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..5931c6ecef 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,17 +3,20 @@ [[ ${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" SLOT="0" DEPEND="sys-apps/debianutils + sys-devel/bc + sys-kernel/bootengine " -IUSE="-device_tree -kernel_sources" -STRIP_MASK="/usr/lib/debug/boot/vmlinux" +IUSE="-source" +RESTRICT="binchecks" +STRIP_MASK="/usr/lib/debug/lib/modules/*/vmlinux" # Build out-of-tree and incremental by default, but allow an ebuild inheriting # this eclass to explicitly build in-tree. @@ -21,17 +24,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 @@ -81,142 +94,33 @@ 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: