summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/kernel-uimage.bbclass48
-rw-r--r--meta/classes/kernel.bbclass62
2 files changed, 65 insertions, 45 deletions
diff --git a/meta/classes/kernel-uimage.bbclass b/meta/classes/kernel-uimage.bbclass
new file mode 100644
index 0000000000..8a3efc6835
--- /dev/null
+++ b/meta/classes/kernel-uimage.bbclass
@@ -0,0 +1,48 @@
1python __anonymous () {
2 kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
3 if kerneltype == 'uImage':
4 depends = d.getVar("DEPENDS", True)
5 depends = "%s u-boot-mkimage-native" % depends
6 d.setVar("DEPENDS", depends)
7}
8
9uboot_prep_kimage() {
10 if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
11 vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
12 linux_suffix=""
13 linux_comp="none"
14 else
15 vmlinux_path="vmlinux"
16 linux_suffix=".gz"
17 linux_comp="gzip"
18 fi
19
20 ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin
21
22 if [ "${linux_comp}" != "none" ] ; then
23 rm -f linux.bin
24 gzip -9 linux.bin
25 mv -f "linux.bin${linux_suffix}" linux.bin
26 fi
27
28 echo "${linux_comp}"
29}
30
31do_uboot_mkimage() {
32 if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
33 if test "x${KEEPUIMAGE}" != "xyes" ; then
34 uboot_prep_kimage
35
36 ENTRYPOINT=${UBOOT_ENTRYPOINT}
37 if test -n "${UBOOT_ENTRYSYMBOL}"; then
38 ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
39 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
40 fi
41
42 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
43 rm -f linux.bin
44 fi
45 fi
46}
47
48addtask uboot_mkimage before do_install after do_compile
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