# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. # Distributed under the terms of the GNU General Public License v2 [[ ${EAPI} != "4" ]] && die "Only EAPI=4 is supported" inherit binutils-funcs cros-board toolchain-funcs linux-info HOMEPAGE="http://www.chromium.org/" LICENSE="GPL-2" SLOT="0" DEPEND="sys-apps/debianutils initramfs? ( chromeos-base/chromeos-initramfs ) netboot_ramfs? ( chromeos-base/chromeos-initramfs ) " IUSE="-device_tree -kernel_sources -wireless34 -wifi_testbed_ap" STRIP_MASK="/usr/lib/debug/boot/vmlinux" # Build out-of-tree and incremental by default, but allow an ebuild inheriting # this eclass to explicitly build in-tree. : ${CROS_WORKON_OUTOFTREE_BUILD:=1} : ${CROS_WORKON_INCREMENTAL_BUILD:=1} # Config fragments selected by USE flags # ...fragments will have the following variables substitutions # applied later (needs to be done later since these values # aren't reliable when used in a global context like this): # %ROOT% => ${ROOT} CONFIG_FRAGMENTS=( blkdevram ca0132 cifs fbconsole gdmwimax gobi highmem i2cdev initramfs kgdb kvm netboot_ramfs nfs pcserial qmi realtekpstor samsung_serial systemtap tpm vfat wifi_testbed_ap wireless34 x32 ) blkdevram_desc="ram block device" blkdevram_config=" CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=16384 " ca0132_desc="CA0132 ALSA codec" ca0132_config=" CONFIG_SND_HDA_CODEC_CA0132=y CONFIG_SND_HDA_DSP_LOADER=y " cifs_desc="Samba/CIFS Support" cifs_config=" CONFIG_CIFS=m " fbconsole_desc="framebuffer console" fbconsole_config=" CONFIG_FRAMEBUFFER_CONSOLE=y " gdmwimax_desc="GCT GDM72xx WiMAX support" gdmwimax_config=" CONFIG_WIMAX_GDM72XX=m CONFIG_WIMAX_GDM72XX_USB=y CONFIG_WIMAX_GDM72XX_USB_PM=y " gobi_desc="Qualcomm Gobi modem driver" gobi_config=" CONFIG_USB_NET_GOBI=m " highmem_desc="highmem" highmem_config=" CONFIG_HIGHMEM64G=y " i2cdev_desc="I2C device interface" i2cdev_config=" CONFIG_I2C_CHARDEV=y " kgdb_desc="Enable kgdb" kgdb_config=" CONFIG_KGDB=y CONFIG_KGDB_KDB=y """ tpm_desc="TPM support" tpm_config=" CONFIG_TCG_TPM=y CONFIG_TCG_TIS=y " initramfs_desc="Initramfs for factory install shim and recovery image" initramfs_config=' CONFIG_INITRAMFS_SOURCE="%ROOT%/var/lib/misc/initramfs.cpio.xz" CONFIG_INITRAMFS_COMPRESSION_XZ=y ' netboot_ramfs_desc="Network boot install initramfs" netboot_ramfs_config=' CONFIG_INITRAMFS_SOURCE="%ROOT%/var/lib/misc/netboot_ramfs.cpio.xz" CONFIG_INITRAMFS_COMPRESSION_XZ=y ' vfat_desc="vfat" vfat_config=" CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y CONFIG_FAT_FS=y CONFIG_VFAT_FS=y " kvm_desc="KVM" kvm_config=" CONFIG_HAVE_KVM=y CONFIG_HAVE_KVM_IRQCHIP=y CONFIG_HAVE_KVM_EVENTFD=y CONFIG_KVM_APIC_ARCHITECTURE=y CONFIG_KVM_MMIO=y CONFIG_KVM_ASYNC_PF=y CONFIG_KVM=m CONFIG_KVM_INTEL=m # CONFIG_KVM_AMD is not set # CONFIG_KVM_MMU_AUDIT is not set CONFIG_VIRTIO=m CONFIG_VIRTIO_BLK=m CONFIG_VIRTIO_NET=m CONFIG_VIRTIO_CONSOLE=m CONFIG_VIRTIO_RING=m CONFIG_VIRTIO_PCI=m " nfs_desc="NFS" nfs_config=" CONFIG_USB_NET_AX8817X=y CONFIG_DNOTIFY=y CONFIG_DNS_RESOLVER=y CONFIG_LOCKD=y CONFIG_LOCKD_V4=y CONFIG_NETWORK_FILESYSTEMS=y CONFIG_NFSD=m CONFIG_NFSD_V3=y CONFIG_NFSD_V4=y CONFIG_NFS_COMMON=y CONFIG_NFS_FS=y CONFIG_NFS_USE_KERNEL_DNS=y CONFIG_NFS_V3=y CONFIG_NFS_V4=y CONFIG_ROOT_NFS=y CONFIG_RPCSEC_GSS_KRB5=y CONFIG_SUNRPC=y CONFIG_SUNRPC_GSS=y CONFIG_USB_USBNET=y CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y " pcserial_desc="PC serial" pcserial_config=" CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_PCI=y CONFIG_PARPORT=y CONFIG_PARPORT_PC=y CONFIG_PARPORT_SERIAL=y " qmi_desc="QMI WWAN driver" qmi_config=" CONFIG_USB_NET_QMI_WWAN=m " samsung_serial_desc="Samsung serialport" samsung_serial_config=" CONFIG_SERIAL_SAMSUNG=y CONFIG_SERIAL_SAMSUNG_CONSOLE=y " realtekpstor_desc="Realtek PCI card reader" realtekpstor_config=" CONFIG_RTS_PSTOR=m " systemtap_desc="systemtap support" systemtap_config=" CONFIG_KPROBES=y CONFIG_DEBUG_INFO=y " wifi_testbed_ap_desc="Defer ath9k EEPROM regulatory" wifi_testbed_ap_warning=" Don't use the wifi_testbed_ap flag unless you know what you are doing! An image built with this flag set must never be run outside a sealed RF chamber! " wifi_testbed_ap_config=" CONFIG_ATH_DEFER_EEPROM_REGULATORY=y " x32_desc="x32 ABI support" x32_config=" CONFIG_X86_X32=y " wireless34_desc="Wireless 3.4 stack" wireless34_config=" CONFIG_ATH9K_BTCOEX=m CONFIG_ATH9K_BTCOEX_COMMON=m CONFIG_ATH9K_BTCOEX_HW=m " # Add all config fragments as off by default IUSE="${IUSE} ${CONFIG_FRAGMENTS[@]}" REQUIRED_USE=" initramfs? ( !netboot_ramfs ) netboot_ramfs? ( !initramfs ) initramfs? ( i2cdev tpm ) netboot_ramfs? ( i2cdev tpm ) " # 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}" } # @FUNCTION: kernelrelease # @DESCRIPTION: # Returns the current compiled kernel version. # Note: Only valid after src_configure has finished running. kernelrelease() { kmake -s --no-print-directory kernelrelease } # @FUNCTION: install_kernel_sources # @DESCRIPTION: # Installs the kernel sources into ${D}/usr/src/${P} and fixes symlinks. # The package must have already installed a directory under ${D}/lib/modules. install_kernel_sources() { local version=$(kernelrelease) local dest_modules_dir=lib/modules/${version} local dest_source_dir=usr/src/${P} local dest_build_dir=${dest_source_dir}/build # Fix symlinks in lib/modules ln -sfvT "../../../${dest_build_dir}" \ "${D}/${dest_modules_dir}/build" || die ln -sfvT "../../../${dest_source_dir}" \ "${D}/${dest_modules_dir}/source" || die einfo "Installing kernel source tree" dodir "${dest_source_dir}" local f for f in "${S}"/*; do [[ "$f" == "${S}/build" ]] && continue cp -pPR "${f}" "${D}/${dest_source_dir}" || die "Failed to copy kernel source tree" done dosym "${P}" "/usr/src/linux" einfo "Installing kernel build tree" dodir "${dest_build_dir}" cp -pPR "$(cros-workon_get_build_dir)"/{.config,.version,Makefile,Module.symvers,include} \ "${D}/${dest_build_dir}" || die # Modify Makefile to use the ROOT environment variable if defined. # This path needs to be absolute so that the build directory will # still work if copied elsewhere. sed -i -e "s@${S}@\$(ROOT)/${dest_source_dir}@" \ "${D}/${dest_build_dir}/Makefile" || die } get_build_cfg() { echo "$(cros-workon_get_build_dir)/.config" } 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: