blob: 2e661ea916537bbca7cc3e8594ced50a57ef8045 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001inherit kernel-uboot
2
3python __anonymous () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08004 if "uImage" in d.getVar('KERNEL_IMAGETYPES'):
Brad Bishop6e60e8b2018-02-01 10:27:11 -05005 depends = d.getVar("DEPENDS")
Brad Bishop19323692019-04-05 15:28:33 -04006 depends = "%s u-boot-tools-native" % depends
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007 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 .
Brad Bishop6e60e8b2018-02-01 10:27:11 -050014 if d.getVar("KEEPUIMAGE") != 'yes':
15 typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
He Zhefe76b1e2016-05-25 04:47:16 -040016 if "uImage" in typeformake.split():
Patrick Williamsc0f7c042017-02-23 20:41:17 -060017 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('uImage', 'vmlinux'))
Brad Bishop6e60e8b2018-02-01 10:27:11 -050018
19 # Enable building of uImage with mkimage
20 bb.build.addtask('do_uboot_mkimage', 'do_install', 'do_kernel_link_images', d)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021}
22
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023do_uboot_mkimage[dirs] += "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024do_uboot_mkimage() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025 uboot_prep_kimage
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027 ENTRYPOINT=${UBOOT_ENTRYPOINT}
28 if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
29 ENTRYPOINT=`${HOST_PREFIX}nm ${B}/vmlinux | \
30 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032
Andrew Geissler615f2f12022-07-15 14:00:58 -050033 uboot-mkimage -A ${UBOOT_ARCH} -O linux -T ${UBOOT_MKIMAGE_KERNEL_TYPE} -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034 rm -f linux.bin
35}