Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | inherit kernel-uboot |
| 2 | |
| 3 | python __anonymous () { |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 4 | if "uImage" in (d.getVar('KERNEL_IMAGETYPES', True) or "").split(): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 5 | depends = d.getVar("DEPENDS", True) |
| 6 | depends = "%s u-boot-mkimage-native" % depends |
| 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 . |
| 14 | if d.getVar("KEEPUIMAGE", True) != 'yes': |
| 15 | typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or "" |
| 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')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | do_uboot_mkimage() { |
He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 21 | if echo "${KERNEL_IMAGETYPES}" | grep -wq "uImage"; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | 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 | |
| 37 | addtask uboot_mkimage before do_install after do_compile |