1# 2# Copyright OpenEmbedded Contributors 3# 4# SPDX-License-Identifier: MIT 5# 6 7inherit kernel-uboot 8 9python __anonymous () { 10 if "uImage" in d.getVar('KERNEL_IMAGETYPES'): 11 depends = d.getVar("DEPENDS") 12 depends = "%s u-boot-tools-native" % depends 13 d.setVar("DEPENDS", depends) 14 15 # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal 16 # to kernel.bbclass . We override the variable here, since we need 17 # to build uImage using the kernel build system if and only if 18 # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into 19 # the uImage . 20 if d.getVar("KEEPUIMAGE") != 'yes': 21 typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or "" 22 if "uImage" in typeformake.split(): 23 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('uImage', 'vmlinux')) 24 25 # Enable building of uImage with mkimage 26 bb.build.addtask('do_uboot_mkimage', 'do_install', 'do_kernel_link_images', d) 27} 28 29do_uboot_mkimage[dirs] += "${B}" 30do_uboot_mkimage() { 31 uboot_prep_kimage 32 33 ENTRYPOINT=${UBOOT_ENTRYPOINT} 34 if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then 35 ENTRYPOINT=`${HOST_PREFIX}nm ${B}/vmlinux | \ 36 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'` 37 fi 38 39 uboot-mkimage -A ${UBOOT_ARCH} -O linux -T ${UBOOT_MKIMAGE_KERNEL_TYPE} -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage 40 rm -f linux.bin 41} 42