| # |
| # Copyright 2024 Google LLC |
| # |
| # This program is free software; you can redistribute it and/or |
| # modify it under the terms of the GNU General Public License |
| # version 2 as published by the Free Software Foundation. |
| # |
| # This program is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| # GNU General Public License for more details. |
| # |
| |
| EAPI=7 |
| |
| CROS_WORKON_COMMIT="8304a87e8eefd1d44dc3bf6c8475aa92eaa1b7a6" |
| CROS_WORKON_TREE="e7f6e3c8a267f90e37eb926a788384d6a7a53ebb" |
| CROS_WORKON_REPO="https://cos.googlesource.com" |
| CROS_WORKON_PROJECT="third_party/kernel" |
| CROS_WORKON_LOCALNAME="kernel/v6.6" |
| |
| # This must be inherited *after* EGIT/CROS_WORKON variables defined |
| inherit cros-workon cros-kernel2 |
| |
| # Copied verbatim from the lakitu-kernel ebuild. |
| cos_kernel_config_arch() { |
| case ${ARCH} in |
| amd64) echo "x86";; |
| arm64) echo "arm64";; |
| *) die "Unknown architecture: ${ARCH}";; |
| esac |
| } |
| |
| STRIP_MASK+=" /usr/src/${P}/build/vmlinux" |
| STRIP_MASK+=" *.ko" |
| |
| DESCRIPTION="A dump capture kernel for kdump functionality" |
| HOMEPAGE="https://cloud.google.com/container-optimized-os" |
| KEYWORDS="*" |
| |
| # shellcheck disable=SC2154 |
| CHROMEOS_KERNEL_CONFIG="arch/$(cos_kernel_config_arch)/configs/lakitu_dump_defconfig" |
| |
| src_prepare() { |
| default |
| # This has the same behavior as cos-kernel_src_prepare. |
| cros_allow_gnu_build_tools |
| cros-kernel2_src_prepare |
| } |
| |
| # Use stripped-down version of cros-kernel2 configure routine |
| # to avoid dragging in all fragments enabled by USE flags. |
| src_configure() { |
| # Combination of two lines from cros-kernel2_src_configure |
| local config="${CHROMEOS_KERNEL_CONFIG}" |
| |
| # All lines below taken verbatim from cros-kernel2_src_configure |
| local build_cfg="$(get_build_cfg)" |
| elog "Using kernel config: ${config}" |
| cp -f "${config}" "${build_cfg}" || die |
| |
| local old_defconfig="$(cros-workon_get_build_dir)/cros-old-defconfig" |
| kmake olddefconfig |
| cp -a "${build_cfg}" "${old_defconfig}" || die |
| } |
| |
| src_install() { |
| dodir /boot/kdump |
| kmake INSTALL_PATH="${D}/boot/kdump" INSTALL_MOD_PATH="${D}" \ |
| INSTALL_MOD_STRIP=1 install |
| local version |
| version=$(kmake -s --no-print-directory kernelrelease) |
| ln -sf "vmlinuz-${version}" "${D}/boot/kdump/vmlinuz" || die |
| |
| # We also strips the symbol table /boot/kdump/System.map-* at: |
| # overlay-lakitu/scripts/board_specific_setup.sh |
| } |