summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel.bbclass
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2015-05-14 14:31:09 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-26 10:57:51 +0100
commit7f131b88631223df342148e54811a2b125b73819 (patch)
tree4c74f566762727e29282ae8048b4aa9aeff97ceb /meta/classes/kernel.bbclass
parent12f983b66ac00525745d7ad0fb11cba77c431fad (diff)
downloadpoky-7f131b88631223df342148e54811a2b125b73819.tar.gz
kernel: Pull uImage generation into separate class
Pull the uImage image format generation from kernel.bbclass into a separate kernel-uimage.bbclass. Introduce new KERNEL_CLASSES variable, which allows registration of additional classes which implement new kernel image types. The default value of is to register kernel-uimage to preserve the original behavior. (From OE-Core rev: 086536ac84fcc9350802c09166f600becd52a1f8) Signed-off-by: Marek Vasut <marex@denx.de> Cc: Richard Purdie <richard.purdie@linuxfoundation.org> Cc: Koen Kooi <koen@dominion.thruhere.net> Cc: Paul Eggleton <paul.eggleton@linux.intel.com> Cc: Ross Burton <ross.burton@intel.com> Cc: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/kernel.bbclass')
-rw-r--r--meta/classes/kernel.bbclass62
1 files changed, 17 insertions, 45 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index ba4bc607b0..76d03dc4a7 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -20,10 +20,6 @@ python __anonymous () {
20 import re 20 import re
21 21
22 kerneltype = d.getVar('KERNEL_IMAGETYPE', True) 22 kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
23 if kerneltype == 'uImage':
24 depends = d.getVar("DEPENDS", True)
25 depends = "%s u-boot-mkimage-native" % depends
26 d.setVar("DEPENDS", depends)
27 23
28 d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", re.sub(r'\.gz$', '', kerneltype)) 24 d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", re.sub(r'\.gz$', '', kerneltype))
29 25
@@ -40,6 +36,23 @@ python __anonymous () {
40 d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}') 36 d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
41} 37}
42 38
39# Here we pull in all various kernel image types which we support.
40#
41# In case you're wondering why kernel.bbclass inherits the other image
42# types instead of the other way around, the reason for that is to
43# maintain compatibility with various currently existing meta-layers.
44# By pulling in the various kernel image types here, we retain the
45# original behavior of kernel.bbclass, so no meta-layers should get
46# broken.
47#
48# KERNEL_CLASSES by default pulls in kernel-uimage.bbclass, since this
49# used to be the default behavior when only uImage was supported. This
50# variable can be appended by users who implement support for new kernel
51# image types.
52
53KERNEL_CLASSES ?= " kernel-uimage "
54inherit ${KERNEL_CLASSES}
55
43# Old style kernels may set ${S} = ${WORKDIR}/git for example 56# Old style kernels may set ${S} = ${WORKDIR}/git for example
44# We need to move these over to STAGING_KERNEL_DIR. We can't just 57# We need to move these over to STAGING_KERNEL_DIR. We can't just
45# create the symlink in advance as the git fetcher can't cope with 58# create the symlink in advance as the git fetcher can't cope with
@@ -437,47 +450,6 @@ MODULE_TARBALL_BASE_NAME ?= "${MODULE_IMAGE_BASE_NAME}.tgz"
437MODULE_TARBALL_SYMLINK_NAME ?= "modules-${MACHINE}.tgz" 450MODULE_TARBALL_SYMLINK_NAME ?= "modules-${MACHINE}.tgz"
438MODULE_TARBALL_DEPLOY ?= "1" 451MODULE_TARBALL_DEPLOY ?= "1"
439 452
440uboot_prep_kimage() {
441 if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
442 vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
443 linux_suffix=""
444 linux_comp="none"
445 else
446 vmlinux_path="vmlinux"
447 linux_suffix=".gz"
448 linux_comp="gzip"
449 fi
450
451 ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin
452
453 if [ "${linux_comp}" != "none" ] ; then
454 rm -f linux.bin
455 gzip -9 linux.bin
456 mv -f "linux.bin${linux_suffix}" linux.bin
457 fi
458
459 echo "${linux_comp}"
460}
461
462do_uboot_mkimage() {
463 if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
464 if test "x${KEEPUIMAGE}" != "xyes" ; then
465 uboot_prep_kimage
466
467 ENTRYPOINT=${UBOOT_ENTRYPOINT}
468 if test -n "${UBOOT_ENTRYSYMBOL}"; then
469 ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
470 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
471 fi
472
473 uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
474 rm -f linux.bin
475 fi
476 fi
477}
478
479addtask uboot_mkimage before do_install after do_compile
480
481kernel_do_deploy() { 453kernel_do_deploy() {
482 install -m 0644 ${KERNEL_OUTPUT} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin 454 install -m 0644 ${KERNEL_OUTPUT} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
483 if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then 455 if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then