blob: 340503a2d665402ee3d0af162f8ca300e5a5e773 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001inherit kernel-uboot
2
3python __anonymous () {
He Zhefe76b1e2016-05-25 04:47:16 -04004 if "uImage" in (d.getVar('KERNEL_IMAGETYPES', True) or "").split():
Patrick Williamsc124f4f2015-09-15 14:41:29 -05005 depends = d.getVar("DEPENDS", True)
6 depends = "%s u-boot-mkimage-native" % depends
7 d.setVar("DEPENDS", depends)
8
He Zhefe76b1e2016-05-25 04:47:16 -04009 # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
10 # to kernel.bbclass . We override the variable here, since we need
11 # to build uImage using the kernel build system if and only if
12 # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into
13 # the uImage .
14 if d.getVar("KEEPUIMAGE", True) != 'yes':
15 typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or ""
16 if "uImage" in typeformake.split():
Patrick Williamsc0f7c042017-02-23 20:41:17 -060017 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('uImage', 'vmlinux'))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018}
19
20do_uboot_mkimage() {
He Zhefe76b1e2016-05-25 04:47:16 -040021 if echo "${KERNEL_IMAGETYPES}" | grep -wq "uImage"; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022 if test "x${KEEPUIMAGE}" != "xyes" ; then
23 uboot_prep_kimage
24
25 ENTRYPOINT=${UBOOT_ENTRYPOINT}
26 if test -n "${UBOOT_ENTRYSYMBOL}"; then
27 ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
28 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
29 fi
30
31 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
32 rm -f linux.bin
33 fi
34 fi
35}
36
37addtask uboot_mkimage before do_install after do_compile