| 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(): | 
|  | 17 | typeformake.replace('uImage', 'vmlinux') | 
|  | 18 | d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 19 | } | 
|  | 20 |  | 
|  | 21 | do_uboot_mkimage() { | 
| He Zhe | fe76b1e | 2016-05-25 04:47:16 -0400 | [diff] [blame] | 22 | if echo "${KERNEL_IMAGETYPES}" | grep -wq "uImage"; then | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | if test "x${KEEPUIMAGE}" != "xyes" ; then | 
|  | 24 | uboot_prep_kimage | 
|  | 25 |  | 
|  | 26 | ENTRYPOINT=${UBOOT_ENTRYPOINT} | 
|  | 27 | if test -n "${UBOOT_ENTRYSYMBOL}"; then | 
|  | 28 | ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \ | 
|  | 29 | awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'` | 
|  | 30 | fi | 
|  | 31 |  | 
|  | 32 | 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 | 
|  | 33 | rm -f linux.bin | 
|  | 34 | fi | 
|  | 35 | fi | 
|  | 36 | } | 
|  | 37 |  | 
|  | 38 | addtask uboot_mkimage before do_install after do_compile |