blob: a61f39fb57d05eda8aebcc69bccd83079b02c917 [file] [log] [blame]
Doug Andersonf291dba2012-01-19 14:26:10 -08001# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2# Distributed under the terms of the GNU General Public License v2
3
4[[ ${EAPI} != "4" ]] && die "Only EAPI=4 is supported"
5
6inherit binutils-funcs cros-board toolchain-funcs
7
8HOMEPAGE="http://www.chromium.org/"
9LICENSE="GPL-2"
10SLOT="0"
11
12DEPEND="sys-apps/debianutils
Doug Andersonf291dba2012-01-19 14:26:10 -080013 initramfs? ( chromeos-base/chromeos-initramfs )
14"
15
16IUSE="-device_tree -kernel_sources"
17STRIP_MASK="/usr/lib/debug/boot/vmlinux"
Jonathan Kliegman8e557902012-05-08 15:46:40 -040018CROS_WORKON_OUTOFTREE_BUILD=1
Mike Frysinger833d5f72012-08-07 18:11:59 -040019CROS_WORKON_INCREMENTAL_BUILD=1
Doug Andersonf291dba2012-01-19 14:26:10 -080020
21# Config fragments selected by USE flags
Doug Anderson010887c2012-02-04 22:42:54 -080022# ...fragments will have the following variables substitutions
23# applied later (needs to be done later since these values
24# aren't reliable when used in a global context like this):
25# %ROOT% => ${ROOT}
Doug Andersonf291dba2012-01-19 14:26:10 -080026
27CONFIG_FRAGMENTS=(
28 blkdevram
Dylan Reidf0666ff2012-07-01 21:42:38 -070029 ca0132
Micah Catlin0dc2b972012-08-01 17:44:24 -070030 cifs
Mike Frysinger1bddd682012-10-05 14:52:25 -040031 debug
Doug Andersonf291dba2012-01-19 14:26:10 -080032 fbconsole
Ben Chane0654d22012-05-12 00:09:53 -070033 gdmwimax
Ben Chana179ebb2012-10-11 01:02:35 -070034 gobi
Doug Andersonf291dba2012-01-19 14:26:10 -080035 highmem
36 initramfs
Ronald G. Minnich6d888d42012-02-16 13:45:58 -080037 kvm
Doug Andersonf291dba2012-01-19 14:26:10 -080038 nfs
39 pcserial
Ben Chana179ebb2012-10-11 01:02:35 -070040 qmi
Olof Johansson08268b0c2012-08-01 00:12:00 -070041 samsung_serial
Dave Parker9fb68c92012-05-04 10:34:00 -070042 realtekpstor
Doug Andersonf291dba2012-01-19 14:26:10 -080043 systemtap
Vic Yang7cc29a92012-05-18 14:12:10 +080044 vfat
Doug Andersonf291dba2012-01-19 14:26:10 -080045)
46
47blkdevram_desc="ram block device"
48blkdevram_config="
49CONFIG_BLK_DEV_RAM=y
50CONFIG_BLK_DEV_RAM_COUNT=16
51CONFIG_BLK_DEV_RAM_SIZE=16384
52"
53
Dylan Reidf0666ff2012-07-01 21:42:38 -070054ca0132_desc="CA0132 ALSA codec"
55ca0132_config="
56CONFIG_SND_HDA_CODEC_CA0132=y
Chih-Chung Chang2306b492012-09-04 19:52:18 +080057CONFIG_SND_HDA_DSP_LOADER=y
Dylan Reidf0666ff2012-07-01 21:42:38 -070058"
59
Micah Catlin0dc2b972012-08-01 17:44:24 -070060cifs_desc="Samba/CIFS Support"
61cifs_config="
62CONFIG_CIFS=m
63"
64
Mike Frysinger1bddd682012-10-05 14:52:25 -040065debug_desc="debug settings"
66debug_config="
67CONFIG_DEBUG_INFO=y
68"
69
Doug Andersonf291dba2012-01-19 14:26:10 -080070fbconsole_desc="framebuffer console"
71fbconsole_config="
72CONFIG_FRAMEBUFFER_CONSOLE=y
73"
74
Ben Chane0654d22012-05-12 00:09:53 -070075gdmwimax_desc="GCT GDM72xx WiMAX support"
76gdmwimax_config="
77CONFIG_WIMAX_GDM72XX=m
Ben Chane0654d22012-05-12 00:09:53 -070078CONFIG_WIMAX_GDM72XX_USB=y
79CONFIG_WIMAX_GDM72XX_USB_PM=y
80"
81
Ben Chana179ebb2012-10-11 01:02:35 -070082gobi_desc="Qualcomm Gobi modem driver"
83gobi_config="
84CONFIG_USB_NET_GOBI=m
85"
86
Doug Andersonf291dba2012-01-19 14:26:10 -080087highmem_desc="highmem"
88highmem_config="
89CONFIG_HIGHMEM64G=y
90"
91
92# We want to avoid copying modules into the initramfs so we need
93# to enable the functionality required for the initramfs here.
94# NOTES:
95# - TPM support to ensure proper locking.
Hung-Te Lin0c826292012-08-17 11:38:42 +080096# - I2C-DEV support to make /dev/i2c-* available, for all devices having
97# components on I2C bus and will be used during recovery / factory install
98# stage. Ex: Ethernet, EC, ... etc.
Vic Yang7cc29a92012-05-18 14:12:10 +080099# - We need VFAT FS support for EFI System Partition updates, but it is not
100# included here. We need to set USE="initramfs vfat" for recovery and factory
101# install.
Doug Andersonf291dba2012-01-19 14:26:10 -0800102initramfs_desc="initramfs"
103initramfs_config="
Olof Johansson2290f062012-03-12 11:54:45 -0700104CONFIG_INITRAMFS_SOURCE=\"%ROOT%/var/lib/misc/initramfs.cpio.xz\"
Doug Andersonf291dba2012-01-19 14:26:10 -0800105CONFIG_TCG_TPM=y
106CONFIG_TCG_TIS=y
Hung-Te Lin0c826292012-08-17 11:38:42 +0800107CONFIG_I2C_CHARDEV=y
Vic Yang7cc29a92012-05-18 14:12:10 +0800108"
109
110vfat_desc="vfat"
111vfat_config="
Doug Andersonf291dba2012-01-19 14:26:10 -0800112CONFIG_NLS_CODEPAGE_437=y
113CONFIG_NLS_ISO8859_1=y
114CONFIG_FAT_FS=y
115CONFIG_VFAT_FS=y
116"
117
Ronald G. Minnich6d888d42012-02-16 13:45:58 -0800118kvm_desc="KVM"
119kvm_config="
120CONFIG_HAVE_KVM=y
121CONFIG_HAVE_KVM_IRQCHIP=y
122CONFIG_HAVE_KVM_EVENTFD=y
123CONFIG_KVM_APIC_ARCHITECTURE=y
124CONFIG_KVM_MMIO=y
125CONFIG_KVM_ASYNC_PF=y
126CONFIG_KVM=m
127CONFIG_KVM_INTEL=m
128# CONFIG_KVM_AMD is not set
129# CONFIG_KVM_MMU_AUDIT is not set
130CONFIG_VIRTIO=m
131CONFIG_VIRTIO_BLK=m
132CONFIG_VIRTIO_NET=m
133CONFIG_VIRTIO_CONSOLE=m
134CONFIG_VIRTIO_RING=m
135CONFIG_VIRTIO_PCI=m
136"
137
Doug Andersonf291dba2012-01-19 14:26:10 -0800138nfs_desc="NFS"
139nfs_config="
140CONFIG_USB_NET_AX8817X=y
141CONFIG_DNOTIFY=y
142CONFIG_DNS_RESOLVER=y
143CONFIG_LOCKD=y
144CONFIG_LOCKD_V4=y
145CONFIG_NETWORK_FILESYSTEMS=y
146CONFIG_NFSD=m
147CONFIG_NFSD_V3=y
148CONFIG_NFSD_V4=y
149CONFIG_NFS_COMMON=y
150CONFIG_NFS_FS=y
151CONFIG_NFS_USE_KERNEL_DNS=y
152CONFIG_NFS_V3=y
153CONFIG_NFS_V4=y
154CONFIG_ROOT_NFS=y
155CONFIG_RPCSEC_GSS_KRB5=y
156CONFIG_SUNRPC=y
157CONFIG_SUNRPC_GSS=y
158CONFIG_USB_USBNET=y
159CONFIG_IP_PNP=y
160CONFIG_IP_PNP_DHCP=y
161"
162
163pcserial_desc="PC serial"
164pcserial_config="
165CONFIG_SERIAL_8250=y
166CONFIG_SERIAL_8250_CONSOLE=y
167CONFIG_SERIAL_8250_PCI=y
168CONFIG_PARPORT=y
169CONFIG_PARPORT_PC=y
170CONFIG_PARPORT_SERIAL=y
171"
172
Ben Chana179ebb2012-10-11 01:02:35 -0700173qmi_desc="QMI WWAN driver"
174qmi_config="
175CONFIG_USB_NET_QMI_WWAN=m
176"
177
Olof Johansson08268b0c2012-08-01 00:12:00 -0700178samsung_serial_desc="Samsung serialport"
179samsung_serial_config="
180CONFIG_SERIAL_SAMSUNG=y
181CONFIG_SERIAL_SAMSUNG_CONSOLE=y
182"
183
Dave Parker9fb68c92012-05-04 10:34:00 -0700184realtekpstor_desc="Realtek PCI card reader"
185realtekpstor_config="
186CONFIG_RTS_PSTOR=m
187"
188
Doug Andersonf291dba2012-01-19 14:26:10 -0800189systemtap_desc="systemtap support"
190systemtap_config="
191CONFIG_KPROBES=y
192CONFIG_DEBUG_INFO=y
193"
194
195# Add all config fragments as off by default
196IUSE="${IUSE} ${CONFIG_FRAGMENTS[@]}"
197
Olof Johanssoncd9c9fe2012-06-27 20:58:10 -0700198# If an overlay has eclass overrides, but doesn't actually override this
199# eclass, we'll have ECLASSDIR pointing to the active overlay's
200# eclass/ dir, but this eclass is still in the main chromiumos tree. So
201# add a check to locate the cros-kernel/ regardless of what's going on.
202ECLASSDIR_LOCAL=${BASH_SOURCE[0]%/*}
203defconfig_dir() {
204 local d="${ECLASSDIR}/cros-kernel"
205 if [[ ! -d ${d} ]] ; then
206 d="${ECLASSDIR_LOCAL}/cros-kernel"
207 fi
208 echo "${d}"
209}
210
Doug Andersonf291dba2012-01-19 14:26:10 -0800211# @FUNCTION: install_kernel_sources
212# @DESCRIPTION:
213# Installs the kernel sources into ${D}/usr/src/${P} and fixes symlinks.
214# The package must have already installed a directory under ${D}/lib/modules.
215install_kernel_sources() {
216 local version=$(ls "${D}"/lib/modules)
217 local dest_modules_dir=lib/modules/${version}
218 local dest_source_dir=usr/src/${P}
219 local dest_build_dir=${dest_source_dir}/build
220
221 # Fix symlinks in lib/modules
222 ln -sfvT "../../../${dest_build_dir}" \
223 "${D}/${dest_modules_dir}/build" || die
224 ln -sfvT "../../../${dest_source_dir}" \
225 "${D}/${dest_modules_dir}/source" || die
226
227 einfo "Installing kernel source tree"
228 dodir "${dest_source_dir}"
229 local f
230 for f in "${S}"/*; do
231 [[ "$f" == "${S}/build" ]] && continue
232 cp -pPR "${f}" "${D}/${dest_source_dir}" ||
233 die "Failed to copy kernel source tree"
234 done
235
236 dosym "${P}" "/usr/src/linux"
237
238 einfo "Installing kernel build tree"
239 dodir "${dest_build_dir}"
Mike Frysinger833d5f72012-08-07 18:11:59 -0400240 cp -pPR "$(cros-workon_get_build_dir)"/{.config,.version,Makefile,Module.symvers,include} \
Doug Andersonf291dba2012-01-19 14:26:10 -0800241 "${D}/${dest_build_dir}" || die
242
243 # Modify Makefile to use the ROOT environment variable if defined.
244 # This path needs to be absolute so that the build directory will
245 # still work if copied elsewhere.
246 sed -i -e "s@${S}@\$(ROOT)/${dest_source_dir}@" \
247 "${D}/${dest_build_dir}/Makefile" || die
248}
249
Doug Andersonf291dba2012-01-19 14:26:10 -0800250get_build_cfg() {
Mike Frysinger833d5f72012-08-07 18:11:59 -0400251 echo "$(cros-workon_get_build_dir)/.config"
Doug Andersonf291dba2012-01-19 14:26:10 -0800252}
253
Olof Johanssoncd9c9fe2012-06-27 20:58:10 -0700254get_build_arch() {
255 if [ "${ARCH}" = "arm" ] ; then
256 case "${CHROMEOS_KERNEL_SPLITCONFIG}" in
257 *tegra*)
258 echo "tegra"
259 ;;
260 *exynos*)
261 echo "exynos5"
262 ;;
263 *)
264 echo "arm"
265 ;;
266 esac
267 else
268 echo $(tc-arch-kernel)
269 fi
270}
271
Mike Frysinger3f4eaee2012-07-24 17:47:28 -0400272cros-kernel2_pkg_setup() {
Mike Frysinger833d5f72012-08-07 18:11:59 -0400273 cros-workon_pkg_setup
Mike Frysinger3f4eaee2012-07-24 17:47:28 -0400274}
275
Olof Johanssonb62cf892012-04-27 14:50:24 -0700276# @FUNCTION: emit_its_script
277# @USAGE: <output file> <device trees>
278# @DESCRIPTION:
279# Emits the its script used to build the u-boot fitImage kernel binary
280# that contains the kernel as well as device trees used when booting
281# it.
282
283emit_its_script() {
284 local iter=1
285 local its_out=${1}
286 shift
287 cat > "${its_out}" <<-EOF || die
288 /dts-v1/;
289
290 / {
291 description = "Chrome OS kernel image with one or more FDT blobs";
292 #address-cells = <1>;
293
294 images {
295 kernel@1 {
296 data = /incbin/("${boot_dir}/zImage");
297 type = "$(get_kernel_type)";
298 arch = "arm";
299 os = "linux";
300 compression = "none";
301 load = <$(get_load_addr)>;
302 entry = <$(get_load_addr)>;
303 };
304 EOF
305
306 local dtb
307 for dtb in "$@" ; do
308 cat >> "${its_out}" <<-EOF || die
309 fdt@${iter} {
310 description = "$(basename ${dtb})";
311 data = /incbin/("${boot_dir}/${dtb}");
312 type = "flat_dt";
313 arch = "arm";
314 compression = "none";
315 hash@1 {
316 algo = "sha1";
317 };
318 };
319 EOF
320 ((++iter))
321 done
322
323 cat <<-EOF >>"${its_script}"
324 };
325 configurations {
326 default = "conf@1";
327 EOF
328
329 local i
330 for i in $(seq 1 $((iter-1))) ; do
331 cat >> "${its_out}" <<-EOF || die
332 conf@${i} {
333 kernel = "kernel@1";
334 fdt = "fdt@${i}";
335 };
336 EOF
337 done
338
339 echo " };" >> "${its_out}"
340 echo "};" >> "${its_out}"
341}
342
Doug Andersonf291dba2012-01-19 14:26:10 -0800343kmake() {
344 # Allow override of kernel arch.
345 local kernel_arch=${CHROMEOS_KERNEL_ARCH:-$(tc-arch-kernel)}
346
347 local cross=${CHOST}-
348 # Hack for using 64-bit kernel with 32-bit user-space
349 if [ "${ARCH}" = "x86" -a "${kernel_arch}" = "x86_64" ]; then
Sonny Rao5ebd89f2012-08-05 20:31:23 -0700350 cross=x86_64-cros-linux-gnu-
Doug Andersonf291dba2012-01-19 14:26:10 -0800351 else
352 # TODO(raymes): Force GNU ld over gold. There are still some
353 # gold issues to iron out. See: 13209.
354 tc-export LD CC CXX
355
356 set -- \
357 LD="$(get_binutils_path_ld)/ld" \
358 CC="${CC} -B$(get_binutils_path_ld)" \
359 CXX="${CXX} -B$(get_binutils_path_ld)" \
360 "$@"
361 fi
362
Mike Frysingera8ef3cd2012-11-01 18:42:18 -0400363 cw_emake \
Doug Andersonf291dba2012-01-19 14:26:10 -0800364 ARCH=${kernel_arch} \
365 LDFLAGS="$(raw-ldflags)" \
366 CROSS_COMPILE="${cross}" \
Mike Frysinger833d5f72012-08-07 18:11:59 -0400367 O="$(cros-workon_get_build_dir)" \
Doug Andersonf291dba2012-01-19 14:26:10 -0800368 "$@"
369}
370
371cros-kernel2_src_configure() {
Doug Andersonf291dba2012-01-19 14:26:10 -0800372 # Use a single or split kernel config as specified in the board or variant
373 # make.conf overlay. Default to the arch specific split config if an
374 # overlay or variant does not set either CHROMEOS_KERNEL_CONFIG or
375 # CHROMEOS_KERNEL_SPLITCONFIG. CHROMEOS_KERNEL_CONFIG is set relative
376 # to the root of the kernel source tree.
377 local config
Olof Johanssoncd9c9fe2012-06-27 20:58:10 -0700378 local cfgarch="$(get_build_arch)"
379
Doug Andersonf291dba2012-01-19 14:26:10 -0800380 if [ -n "${CHROMEOS_KERNEL_CONFIG}" ]; then
381 config="${S}/${CHROMEOS_KERNEL_CONFIG}"
382 else
Olof Johanssoncd9c9fe2012-06-27 20:58:10 -0700383 config=${CHROMEOS_KERNEL_SPLITCONFIG:-"chromiumos-${cfgarch}"}
Doug Andersonf291dba2012-01-19 14:26:10 -0800384 fi
385
386 elog "Using kernel config: ${config}"
387
Mike Frysinger3f4eaee2012-07-24 17:47:28 -0400388 # Keep a handle on the old .config in case it hasn't changed. This way
389 # we can keep the old timestamp which will avoid regenerating stuff that
390 # hasn't actually changed.
391 local temp_config="${T}/old-kernel-config"
392 if [[ -e $(get_build_cfg) ]] ; then
393 cp -a "$(get_build_cfg)" "${temp_config}"
394 else
395 rm -f "${temp_config}"
396 fi
397
Doug Andersonf291dba2012-01-19 14:26:10 -0800398 if [ -n "${CHROMEOS_KERNEL_CONFIG}" ]; then
399 cp -f "${config}" "$(get_build_cfg)" || die
400 else
Olof Johanssoncd9c9fe2012-06-27 20:58:10 -0700401 if [ -e chromeos/scripts/prepareconfig ] ; then
402 chromeos/scripts/prepareconfig ${config} \
403 "$(get_build_cfg)" || die
404 else
405 config="$(defconfig_dir)/${cfgarch}_defconfig"
406 ewarn "Can't prepareconfig, falling back to default " \
407 "${config}"
408 cp "${config}" "$(get_build_cfg)" || die
409 fi
Doug Andersonf291dba2012-01-19 14:26:10 -0800410 fi
411
412 local fragment
413 for fragment in ${CONFIG_FRAGMENTS[@]}; do
414 use ${fragment} || continue
415
416 local msg="${fragment}_desc"
417 local config="${fragment}_config"
418 elog " - adding ${!msg} config"
Doug Anderson010887c2012-02-04 22:42:54 -0800419
420 echo "${!config}" | \
421 sed -e "s|%ROOT%|${ROOT}|g" \
422 >> "$(get_build_cfg)" || die
Doug Andersonf291dba2012-01-19 14:26:10 -0800423 done
424
425 # Use default for any options not explitly set in splitconfig
426 yes "" | kmake oldconfig
Mike Frysinger3f4eaee2012-07-24 17:47:28 -0400427
428 # Restore the old config if it is unchanged.
429 if cmp -s "$(get_build_cfg)" "${temp_config}" ; then
430 touch -r "${temp_config}" "$(get_build_cfg)"
431 fi
Doug Andersonf291dba2012-01-19 14:26:10 -0800432}
433
Olof Johanssonb62cf892012-04-27 14:50:24 -0700434get_dtb_name() {
Doug Andersonf291dba2012-01-19 14:26:10 -0800435 local board_with_variant=$(get_current_board_with_variant)
436
437 # Do a simple mapping for device trees whose names don't match
438 # the board_with_variant format; default to just the
439 # board_with_variant format.
440 case "${board_with_variant}" in
441 (tegra2_dev-board)
Olof Johanssonb62cf892012-04-27 14:50:24 -0700442 echo tegra-harmony.dtb
Doug Andersonf291dba2012-01-19 14:26:10 -0800443 ;;
444 (tegra2_seaboard)
Olof Johanssonb62cf892012-04-27 14:50:24 -0700445 echo tegra-seaboard.dtb
Doug Andersonf291dba2012-01-19 14:26:10 -0800446 ;;
Olof Johanssonb62cf892012-04-27 14:50:24 -0700447 tegra*)
448 echo ${board_with_variant}.dtb
Olof Johanssonbeaf4722012-04-16 16:57:36 -0700449 ;;
Doug Andersonf291dba2012-01-19 14:26:10 -0800450 *)
Olof Johanssonb62cf892012-04-27 14:50:24 -0700451 local f
Mike Frysinger833d5f72012-08-07 18:11:59 -0400452 for f in $(cros-workon_get_build_dir)/arch/arm/boot/*.dtb ; do
Olof Johanssonb62cf892012-04-27 14:50:24 -0700453 basename ${f}
454 done
Doug Andersonf291dba2012-01-19 14:26:10 -0800455 ;;
456 esac
457}
458
Olof Johanssonbeaf4722012-04-16 16:57:36 -0700459# All current tegra boards ship with an u-boot that won't allow
460# use of kernel_noload. Because of this, keep using the traditional
461# kernel type for those. This means kernel_type kernel and regular
462# load and entry point addresses.
463
464get_kernel_type() {
465 case "$(get_current_board_with_variant)" in
466 tegra*)
467 echo kernel
468 ;;
469 *)
470 echo kernel_noload
471 ;;
472 esac
473}
474
475get_load_addr() {
476 case "$(get_current_board_with_variant)" in
477 tegra*)
478 echo 0x03000000
479 ;;
480 *)
481 echo 0
482 ;;
483 esac
484}
485
Doug Andersonf291dba2012-01-19 14:26:10 -0800486cros-kernel2_src_compile() {
487 local build_targets= # use make default target
488 if use arm; then
489 build_targets="uImage modules"
490 fi
491
492 kmake -k ${build_targets}
493
494 if use device_tree; then
Olof Johanssonb62cf892012-04-27 14:50:24 -0700495 kmake -k dtbs
Doug Andersonf291dba2012-01-19 14:26:10 -0800496 fi
497}
498
499cros-kernel2_src_install() {
500 dodir /boot
501 kmake INSTALL_PATH="${D}/boot" install
502 kmake INSTALL_MOD_PATH="${D}" modules_install
503 kmake INSTALL_MOD_PATH="${D}" firmware_install
504
505 local version=$(ls "${D}"/lib/modules)
506 if use arm; then
Mike Frysinger833d5f72012-08-07 18:11:59 -0400507 local boot_dir="$(cros-workon_get_build_dir)/arch/${ARCH}/boot"
Doug Andersonf291dba2012-01-19 14:26:10 -0800508 local kernel_bin="${D}/boot/vmlinuz-${version}"
509 local zimage_bin="${D}/boot/zImage-${version}"
Doug Andersonf291dba2012-01-19 14:26:10 -0800510 if use device_tree; then
Mike Frysinger833d5f72012-08-07 18:11:59 -0400511 local its_script="$(cros-workon_get_build_dir)/its_script"
Olof Johanssonb62cf892012-04-27 14:50:24 -0700512 emit_its_script "${its_script}" $(get_dtb_name)
Doug Andersonf291dba2012-01-19 14:26:10 -0800513 mkimage -f "${its_script}" "${kernel_bin}" || die
514 else
515 cp -a "${boot_dir}/uImage" "${kernel_bin}" || die
516 fi
517 cp -a "${boot_dir}/zImage" "${zimage_bin}" || die
518
519 # TODO(vbendeb): remove the below .uimg link creation code
520 # after the build scripts have been modified to use the base
521 # image name.
522 cd $(dirname "${kernel_bin}")
523 ln -sf $(basename "${kernel_bin}") vmlinux.uimg || die
524 ln -sf $(basename "${zimage_bin}") zImage || die
525 fi
526 if [ ! -e "${D}/boot/vmlinuz" ]; then
527 ln -sf "vmlinuz-${version}" "${D}/boot/vmlinuz" || die
528 fi
529
Vic Yang40fff212012-05-14 10:43:11 +0800530 # Check the size of kernel image and issue warning when image size is near
531 # the limit.
532 local kernel_image_size=$(stat -c '%s' -L "${D}"/boot/vmlinuz)
533 einfo "Kernel image size is ${kernel_image_size} bytes."
Olof Johanssoncbbe8872012-07-30 08:43:31 -0700534 if [[ ${kernel_image_size} -gt $((8 * 1024 * 1024)) ]]; then
535 die "Kernel image is larger than 8 MB."
536 elif [[ ${kernel_image_size} -gt $((7 * 1024 * 1024)) ]]; then
537 ewarn "Kernel image is larger than 7 MB. Limit is 8 MB."
Vic Yang40fff212012-05-14 10:43:11 +0800538 fi
539
Doug Andersonf291dba2012-01-19 14:26:10 -0800540 # Install uncompressed kernel for debugging purposes.
541 insinto /usr/lib/debug/boot
Mike Frysinger833d5f72012-08-07 18:11:59 -0400542 doins "$(cros-workon_get_build_dir)/vmlinux"
Doug Andersonf291dba2012-01-19 14:26:10 -0800543
544 if use kernel_sources; then
545 install_kernel_sources
546 fi
547}
548
Mike Frysinger3f4eaee2012-07-24 17:47:28 -0400549EXPORT_FUNCTIONS pkg_setup src_configure src_compile src_install