lakitu-kernel-4_14-4.14.162-r902.ebuild 3.01 KB
Newer Older
chrome-bot's avatar
chrome-bot committed
1 2 3 4
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2

EAPI=5
5 6
CROS_WORKON_COMMIT="deb9682c0b3af17bb9a9f251c01d6a4a4fe63f44"
CROS_WORKON_TREE="43c50128c471e2bf003319d7c1572e4a2b0ace66"
chrome-bot's avatar
chrome-bot committed
7 8 9
CROS_WORKON_PROJECT="chromiumos/third_party/kernel"
CROS_WORKON_LOCALNAME="kernel/v4.14"

chrome-bot's avatar
chrome-bot committed
10
CHROMEOS_KERNEL_CONFIG="${FILESDIR}/base.config"
chrome-bot's avatar
chrome-bot committed
11 12 13 14 15

# This must be inherited *after* EGIT/CROS_WORKON variables defined
inherit cros-workon cros-kernel2 osreleased

STRIP_MASK+=" /usr/src/${P}/build/vmlinux"
chrome-bot's avatar
chrome-bot committed
16
STRIP_MASK+=" *.ko"
chrome-bot's avatar
chrome-bot committed
17 18 19 20

DESCRIPTION="Chromium OS Linux Kernel 4.14"
HOMEPAGE="https://www.chromium.org/chromium-os/chromiumos-design-docs/chromium-os-kernel"
KEYWORDS="*"
chrome-bot's avatar
chrome-bot committed
21
IUSE="module_sign gpu"
chrome-bot's avatar
chrome-bot committed
22

chrome-bot's avatar
chrome-bot committed
23
src_configure() {
chrome-bot's avatar
chrome-bot committed
24 25 26 27 28 29
	if use module_sign ; then
		# Provide a custom key configuration file, because otherwise the kernel
		# would auto-generate one.
		mkdir -p "$(cros-workon_get_build_dir)/certs"
		cp -f "${FILESDIR}/x509.genkey" \
			"$(cros-workon_get_build_dir)/certs/x509.genkey" || die
chrome-bot's avatar
chrome-bot committed
30 31 32 33 34 35
		# Different board use different root key.
		if use gpu ; then
			# The root key belongs to lakitu-gpu board.
			cp -f "${FILESDIR}/lakitu_gpu_root_cert.pem" \
				"$(cros-workon_get_build_dir)/certs/trusted_key.pem" || die
		else
chrome-bot's avatar
chrome-bot committed
36 37
			# The root key belongs to lakitu board.
			cp -f "${FILESDIR}/lakitu_root_cert.pem" \
chrome-bot's avatar
chrome-bot committed
38 39
				"$(cros-workon_get_build_dir)/certs/trusted_key.pem" || die
		fi
chrome-bot's avatar
chrome-bot committed
40
	fi
chrome-bot's avatar
chrome-bot committed
41 42 43
	cros-kernel2_src_configure
}

chrome-bot's avatar
chrome-bot committed
44 45 46 47 48 49 50 51 52 53
tar_kernel_source() {
	# Put kernel source tarball under /opt to avoid it gets
	# masked by INSTALL_MASK.
	local source_dir=opt/google/src
	dodir "${source_dir}"
	pushd "${D}/usr/src/${P}"
	tar --exclude="./build" -czf "${D}/${source_dir}/kernel-src.tar.gz" .
	popd
}

chrome-bot's avatar
chrome-bot committed
54
write_toolchain_env() {
chrome-bot's avatar
chrome-bot committed
55
	# Write the compiler info used for kernel compilation
chrome-bot's avatar
chrome-bot committed
56 57 58
	# in toolchain_env
	local toolchain_env_dir=etc
	# Example for toolchain_env content:
chrome-bot's avatar
chrome-bot committed
59 60 61
	# CC=x86_64-cros-linux-gnu-gcc
	# CXX=x86_64-cros-linux-gnu-g++
	# The file will be deleted after copying data to BUILD_DIR artifact
chrome-bot's avatar
chrome-bot committed
62 63
	echo "CC=${CC}" > "${D}/${toolchain_env_dir}/toolchain_env"
	echo "CXX=${CXX}" >> "${D}/${toolchain_env_dir}/toolchain_env"
chrome-bot's avatar
chrome-bot committed
64 65
}

chrome-bot's avatar
chrome-bot committed
66 67 68 69 70 71
src_install() {
	cros-kernel2_src_install

	# VCSID variable is unconditionally set by the cros-workon eclass, and
	# is in the form of "<ebuild_revision>-<sha1>".
	do_osrelease_field "KERNEL_COMMIT_ID" "${VCSID##*-}"
chrome-bot's avatar
chrome-bot committed
72 73 74 75

	# Install kernel source tarball so it can be exported as an
	# artifact later.
	tar_kernel_source
chrome-bot's avatar
chrome-bot committed
76
	# Install kernel compiler information
chrome-bot's avatar
chrome-bot committed
77
	write_toolchain_env
chrome-bot's avatar
chrome-bot committed
78 79 80
}

# Change the following (commented out) number to the next prime number
chrome-bot's avatar
chrome-bot committed
81
# when you change base.config.  This workaround will force the
chrome-bot's avatar
chrome-bot committed
82 83 84 85 86 87 88
# ChromeOS CQ to uprev sys-kernel/lakitu-kernel-4_14 ebuild and pick up the
# configuration changes.  In absence of this workaround the config changes
# would not be picked up unless there was a code change in kernel source tree.
#
# NOTE: There's nothing magic keeping this number prime but you just need to
# make _any_ change to this file.  ...so why not keep it prime?
#
chrome-bot's avatar
chrome-bot committed
89
# The coolest prime number is: 89