Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | inherit kernel-uboot |
| 2 | |
| 3 | python __anonymous () { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 4 | if "uImage" in d.getVar('KERNEL_IMAGETYPES'): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 5 | depends = d.getVar("DEPENDS") |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 6 | depends = "%s u-boot-tools-native" % depends |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | d.setVar("DEPENDS", depends) |
| 8 | |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 9 | # 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 14 | if d.getVar("KEEPUIMAGE") != 'yes': |
| 15 | typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or "" |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 16 | if "uImage" in typeformake.split(): |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 17 | d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('uImage', 'vmlinux')) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 18 | |
| 19 | # Enable building of uImage with mkimage |
| 20 | bb.build.addtask('do_uboot_mkimage', 'do_install', 'do_kernel_link_images', d) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 21 | } |
| 22 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 23 | do_uboot_mkimage[dirs] += "${B}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 24 | do_uboot_mkimage() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 25 | uboot_prep_kimage |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 27 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 32 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 33 | 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 ${B}/arch/${ARCH}/boot/uImage |
| 34 | rm -f linux.bin |
| 35 | } |