From c1f8dcbdf7533221e79184b702048018e5ab738c Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Thu, 14 Nov 2013 15:39:20 -0800 Subject: [PATCH 01/12] fix(cros-kernel2.eclass): Move kernel defconfig along side ebuilds This makes it possible to have multiple kernel ebuilds in the tree at once since the defconfig can be versioned along side the ebuilds instead of being global. --- .../coreos-overlay/eclass/cros-kernel2.eclass | 82 ++++++------------- .../files/x86_64_defconfig-3.11.7} | 0 2 files changed, 25 insertions(+), 57 deletions(-) rename sdk_container/src/third_party/coreos-overlay/{eclass/cros-kernel/x86_64_defconfig => sys-kernel/coreos-kernel/files/x86_64_defconfig-3.11.7} (100%) diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/cros-kernel2.eclass b/sdk_container/src/third_party/coreos-overlay/eclass/cros-kernel2.eclass index 14b18d92c7..2cde97ffad 100644 --- a/sdk_container/src/third_party/coreos-overlay/eclass/cros-kernel2.eclass +++ b/sdk_container/src/third_party/coreos-overlay/eclass/cros-kernel2.eclass @@ -21,17 +21,27 @@ STRIP_MASK="/usr/lib/debug/boot/vmlinux" : ${CROS_WORKON_INCREMENTAL_BUILD:=1} -# If an overlay has eclass overrides, but doesn't actually override this -# eclass, we'll have ECLASSDIR pointing to the active overlay's -# eclass/ dir, but this eclass is still in the main chromiumos tree. So -# add a check to locate the cros-kernel/ regardless of what's going on. -ECLASSDIR_LOCAL=${BASH_SOURCE[0]%/*} -defconfig_dir() { - local d="${ECLASSDIR}/cros-kernel" - if [[ ! -d ${d} ]] ; then - d="${ECLASSDIR_LOCAL}/cros-kernel" - fi - echo "${d}" +# Search for an apropriate defconfig in ${FILESDIR}. The config should reflect +# the kernel version but partial matching is allowed if the config is +# applicalbe to multiple ebuilds, such as different -r revisions or stable +# kernel releases. For an amd64 ebuild with version 3.12.4-r2 the order is: +# - x86_64_defconfig-3.12.4-r2 +# - x86_64_defconfig-3.12.4 +# - x86_64_defconfig-3.12 +# - x86_64_defconfig +# The first matching config is used, die otherwise. +find_defconfig() { + local base_path="${FILESDIR}/$(tc-arch-kernel)_defconfig" + local try_suffix try_path + for try_suffix in "-${PVR}" "-${PV}" "-${PV%.*}" ""; do + try_path="${base_path}${try_suffix}" + if [[ -f "${try_path}" ]]; then + echo "${try_path}" + return + fi + done + + die "No defconfig found for $(tc-arch-kernel) and ${PVR} in ${FILESDIR}" } # @FUNCTION: kernelversion @@ -200,8 +210,7 @@ emit_its_script() { } kmake() { - # Allow override of kernel arch. - local kernel_arch=${CHROMEOS_KERNEL_ARCH:-$(tc-arch-kernel)} + local kernel_arch=$(tc-arch-kernel) local cross=${CHOST}- # Hack for using 64-bit kernel with 32-bit user-space @@ -232,57 +241,17 @@ cros-kernel2_src_prepare() { } cros-kernel2_src_configure() { - # Use a single or split kernel config as specified in the board or variant - # make.conf overlay. Default to the arch specific split config if an - # overlay or variant does not set either CHROMEOS_KERNEL_CONFIG or - # CHROMEOS_KERNEL_SPLITCONFIG. CHROMEOS_KERNEL_CONFIG is set relative - # to the root of the kernel source tree. - local config - local cfgarch="$(get_build_arch)" - - if [ -n "${CHROMEOS_KERNEL_CONFIG}" ]; then - config="${S}/${CHROMEOS_KERNEL_CONFIG}" - else - config=${CHROMEOS_KERNEL_SPLITCONFIG:-"chromiumos-${cfgarch}"} - fi + local config="$(find_defconfig)" elog "Using kernel config: ${config}" - - # Keep a handle on the old .config in case it hasn't changed. This way - # we can keep the old timestamp which will avoid regenerating stuff that - # hasn't actually changed. - local temp_config="${T}/old-kernel-config" - if [[ -e $(get_build_cfg) ]] ; then - cp -a "$(get_build_cfg)" "${temp_config}" - else - rm -f "${temp_config}" - fi - - if [ -n "${CHROMEOS_KERNEL_CONFIG}" ]; then - cp -f "${config}" "$(get_build_cfg)" || die - else - if [ -e chromeos/scripts/prepareconfig ] ; then - chromeos/scripts/prepareconfig ${config} \ - "$(get_build_cfg)" || die - else - config="$(defconfig_dir)/${cfgarch}_defconfig" - ewarn "Can't prepareconfig, falling back to default " \ - "${config}" - cp "${config}" "$(get_build_cfg)" || die - fi - fi + cp -f "${config}" "$(get_build_cfg)" || die # copy the cpio initrd to the output build directory so we can tack it # onto the kernel image itself. cp "${ROOT}"/usr/share/bootengine/bootengine.cpio "$(cros-workon_get_build_dir)" || die "copy of dracut cpio failed." - # Use default for any options not explitly set in splitconfig + # Use default for any options not explitly set in defconfig yes "" | kmake oldconfig - - # Restore the old config if it is unchanged. - if cmp -s "$(get_build_cfg)" "${temp_config}" ; then - touch -r "${temp_config}" "$(get_build_cfg)" - fi } # @FUNCTION: get_dtb_name @@ -353,7 +322,6 @@ cros-kernel2_src_compile() { fi local src_dir="$(cros-workon_get_build_dir)/source" - local kernel_arch=${CHROMEOS_KERNEL_ARCH:-$(tc-arch-kernel)} SMATCH_ERROR_FILE="${src_dir}/chromeos/check/smatch_errors.log" if use test && [[ -e "${SMATCH_ERROR_FILE}" ]]; then diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/cros-kernel/x86_64_defconfig b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/files/x86_64_defconfig-3.11.7 similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/eclass/cros-kernel/x86_64_defconfig rename to sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/files/x86_64_defconfig-3.11.7 From 76e8f257ab35922fb70f9129ecdd8838227a3df8 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Thu, 14 Nov 2013 15:48:51 -0800 Subject: [PATCH 02/12] fix(sys-kernel/coreos-kernel): Disable example modules and kgdb. Just a little cleanup, no need for either of these. --- .../files/x86_64_defconfig-3.11.7 | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/files/x86_64_defconfig-3.11.7 b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/files/x86_64_defconfig-3.11.7 index 8a0d1a258e..cc40764449 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/files/x86_64_defconfig-3.11.7 +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/files/x86_64_defconfig-3.11.7 @@ -1761,11 +1761,9 @@ CONFIG_SERIAL_8250_RSA=y # # Non-8250 serial port support # -# CONFIG_SERIAL_KGDB_NMI is not set # CONFIG_SERIAL_MFD_HSU is not set CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_CONSOLE_POLL=y # CONFIG_SERIAL_JSM is not set # CONFIG_SERIAL_SCCNXP is not set # CONFIG_SERIAL_TIMBERDALE is not set @@ -2969,7 +2967,7 @@ CONFIG_STACKTRACE=y # CONFIG_DEBUG_KOBJECT is not set CONFIG_DEBUG_BUGVERBOSE=y # CONFIG_DEBUG_WRITECOUNT is not set -CONFIG_DEBUG_LIST=y +# CONFIG_DEBUG_LIST is not set # CONFIG_DEBUG_SG is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_CREDENTIALS is not set @@ -3043,23 +3041,16 @@ CONFIG_FTRACE_MCOUNT_RECORD=y CONFIG_ATOMIC64_SELFTEST=y # CONFIG_TEST_STRING_HELPERS is not set CONFIG_TEST_KSTRTOX=y -CONFIG_PROVIDE_OHCI1394_DMA_INIT=y -CONFIG_BUILD_DOCSRC=y +# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set +# CONFIG_BUILD_DOCSRC is not set # CONFIG_DMA_API_DEBUG is not set # CONFIG_SAMPLES is not set CONFIG_HAVE_ARCH_KGDB=y -CONFIG_KGDB=y -CONFIG_KGDB_SERIAL_CONSOLE=y -CONFIG_KGDB_TESTS=y -# CONFIG_KGDB_TESTS_ON_BOOT is not set -CONFIG_KGDB_LOW_LEVEL_TRAP=y -CONFIG_KGDB_KDB=y -CONFIG_KDB_KEYBOARD=y -CONFIG_KDB_CONTINUE_CATASTROPHIC=0 +# CONFIG_KGDB is not set CONFIG_STRICT_DEVMEM=y # CONFIG_X86_VERBOSE_BOOTUP is not set CONFIG_EARLY_PRINTK=y -CONFIG_EARLY_PRINTK_DBGP=y +# CONFIG_EARLY_PRINTK_DBGP is not set # CONFIG_X86_PTDUMP is not set CONFIG_DEBUG_RODATA=y CONFIG_DEBUG_RODATA_TEST=y From c1039fbcfa921704cd03fe4b52ed0654262014ce Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Thu, 14 Nov 2013 18:08:39 -0800 Subject: [PATCH 03/12] fix(cros-kernel2.eclass): Remove a massive amount of dead code. We do not currently support or care about things like arm, device trees, smatch, and other things that massively complicate this eclass. Remove them so making further changes is simple. Features can always be added back later. --- .../coreos-overlay/eclass/cros-kernel2.eclass | 315 +----------------- .../coreos-kernel/coreos-kernel-3.11.7.ebuild | 4 +- 2 files changed, 14 insertions(+), 305 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/cros-kernel2.eclass b/sdk_container/src/third_party/coreos-overlay/eclass/cros-kernel2.eclass index 2cde97ffad..8168bf4e1b 100644 --- a/sdk_container/src/third_party/coreos-overlay/eclass/cros-kernel2.eclass +++ b/sdk_container/src/third_party/coreos-overlay/eclass/cros-kernel2.eclass @@ -3,7 +3,7 @@ [[ ${EAPI} != "4" ]] && die "Only EAPI=4 is supported" -inherit binutils-funcs cros-board toolchain-funcs +inherit cros-workon toolchain-funcs HOMEPAGE="http://www.chromium.org/" LICENSE="GPL-2" @@ -12,7 +12,7 @@ SLOT="0" DEPEND="sys-apps/debianutils " -IUSE="-device_tree -kernel_sources" +IUSE="-kernel_sources" STRIP_MASK="/usr/lib/debug/boot/vmlinux" # Build out-of-tree and incremental by default, but allow an ebuild inheriting @@ -91,124 +91,6 @@ install_kernel_sources() { "${D}/${dest_build_dir}/Makefile" || die } -get_build_cfg() { - echo "$(cros-workon_get_build_dir)/.config" -} - -get_boot_kernel() { - if [[ "${PN}" =~ boot ]] ; then - echo "true" - else - echo "false" - fi -} - -get_build_arch() { - if [ "${ARCH}" = "arm" ] ; then - case "${CHROMEOS_KERNEL_SPLITCONFIG}" in - *tegra*) - echo "tegra" - ;; - *exynos*) - echo "exynos5" - ;; - *) - echo "arm" - ;; - esac - else - echo $(tc-arch-kernel) - fi -} - -# @FUNCTION: cros_chkconfig_present -# @USAGE: