blob: 871bee3b884453b2eb3c8810f9a435f216c36c9b [file] [log] [blame]
Brad Bishopc644ddf2015-10-06 00:17:30 -04001# Essentially kernel-uimage, but for cuImage.
2
3inherit kernel-uboot
4
5KBUILD_HAS_CUIMAGE ?= "no"
6
7python __anonymous () {
Rick Altherr5c3eab62016-07-08 15:11:38 -07008 if "cuImage" in (d.getVar('KERNEL_IMAGETYPES', True) or "").split():
Brad Bishopc644ddf2015-10-06 00:17:30 -04009 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 Altherr5c3eab62016-07-08 15:11:38 -070019 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 Bishopc644ddf2015-10-06 00:17:30 -040023}
24
25do_uboot_mkcimage() {
26 dt="arch/${ARCH}/boot/dts/${KERNEL_DEVICETREE}"
27 if ! test -r $dt; then
28 dt=""
29 fi
30
Rick Altherr5c3eab62016-07-08 15:11:38 -070031 if echo "${KERNEL_IMAGETYPES}" | grep -wq "cuImage" ; then
Brad Bishopc644ddf2015-10-06 00:17:30 -040032 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 Bishopc644ddf2015-10-06 00:17:30 -040042 fi
43 fi
44}
45
Brad Bishopc9568452015-11-01 07:57:04 -060046addtask uboot_mkcimage before do_install after do_compile