Brad Bishop | c644ddf | 2015-10-06 00:17:30 -0400 | [diff] [blame] | 1 | # Essentially kernel-uimage, but for cuImage. |
| 2 | |
| 3 | inherit kernel-uboot |
| 4 | |
| 5 | KBUILD_HAS_CUIMAGE ?= "no" |
| 6 | |
| 7 | python __anonymous () { |
Rick Altherr | 5c3eab6 | 2016-07-08 15:11:38 -0700 | [diff] [blame] | 8 | if "cuImage" in (d.getVar('KERNEL_IMAGETYPES', True) or "").split(): |
Brad Bishop | c644ddf | 2015-10-06 00:17:30 -0400 | [diff] [blame] | 9 | depends = d.getVar("DEPENDS", True) |
| 10 | depends = "%s u-boot-mkimage-native" % depends |
| 11 | d.setVar("DEPENDS", depends) |
| 12 | |
| 13 | # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal |
| 14 | # to kernel.bbclass . We override the variable here, since we need |
| 15 | # to build cuImage using the kernel build system if and only if |
| 16 | # KBUILD_HAS_CUIMAGE == yes. Otherwise, we pack compressed vmlinux into |
| 17 | # the cuImage . |
| 18 | if d.getVar("KBUILD_HAS_CUIMAGE", True) != 'yes': |
Rick Altherr | 5c3eab6 | 2016-07-08 15:11:38 -0700 | [diff] [blame] | 19 | typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or "" |
| 20 | if "cuImage" in typeformake.split(): |
| 21 | typeformake = typeformake.replace('cuImage', 'zImage') |
| 22 | d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", typeformake) |
Brad Bishop | c644ddf | 2015-10-06 00:17:30 -0400 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | do_uboot_mkcimage() { |
| 26 | dt="arch/${ARCH}/boot/dts/${KERNEL_DEVICETREE}" |
| 27 | if ! test -r $dt; then |
| 28 | dt="" |
| 29 | fi |
| 30 | |
Rick Altherr | 5c3eab6 | 2016-07-08 15:11:38 -0700 | [diff] [blame] | 31 | if echo "${KERNEL_IMAGETYPES}" | grep -wq "cuImage" ; then |
Brad Bishop | c644ddf | 2015-10-06 00:17:30 -0400 | [diff] [blame] | 32 | if test "x${KBUILD_HAS_CUIMAGE}" != "xyes" ; then |
| 33 | uboot_prep_kimage |
| 34 | cat linux.bin $dt > linux-dts.bin |
| 35 | ENTRYPOINT=${UBOOT_ENTRYPOINT} |
| 36 | if test -n "${UBOOT_ENTRYSYMBOL}"; then |
| 37 | ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \ |
| 38 | awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'` |
| 39 | fi |
| 40 | |
| 41 | uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux-dts.bin arch/${ARCH}/boot/cuImage |
Brad Bishop | c644ddf | 2015-10-06 00:17:30 -0400 | [diff] [blame] | 42 | fi |
| 43 | fi |
| 44 | } |
| 45 | |
Brad Bishop | c956845 | 2015-11-01 07:57:04 -0600 | [diff] [blame] | 46 | addtask uboot_mkcimage before do_install after do_compile |