1*4882a593Smuzhiyuninherit kernel-uboot 2*4882a593Smuzhiyun 3*4882a593Smuzhiyunpython __anonymous () { 4*4882a593Smuzhiyun if "uImage" in d.getVar('KERNEL_IMAGETYPES'): 5*4882a593Smuzhiyun depends = d.getVar("DEPENDS") 6*4882a593Smuzhiyun depends = "%s u-boot-tools-native" % depends 7*4882a593Smuzhiyun d.setVar("DEPENDS", depends) 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal 10*4882a593Smuzhiyun # to kernel.bbclass . We override the variable here, since we need 11*4882a593Smuzhiyun # to build uImage using the kernel build system if and only if 12*4882a593Smuzhiyun # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into 13*4882a593Smuzhiyun # the uImage . 14*4882a593Smuzhiyun if d.getVar("KEEPUIMAGE") != 'yes': 15*4882a593Smuzhiyun typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or "" 16*4882a593Smuzhiyun if "uImage" in typeformake.split(): 17*4882a593Smuzhiyun d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('uImage', 'vmlinux')) 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun # Enable building of uImage with mkimage 20*4882a593Smuzhiyun bb.build.addtask('do_uboot_mkimage', 'do_install', 'do_kernel_link_images', d) 21*4882a593Smuzhiyun} 22*4882a593Smuzhiyun 23*4882a593Smuzhiyundo_uboot_mkimage[dirs] += "${B}" 24*4882a593Smuzhiyundo_uboot_mkimage() { 25*4882a593Smuzhiyun uboot_prep_kimage 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun ENTRYPOINT=${UBOOT_ENTRYPOINT} 28*4882a593Smuzhiyun if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then 29*4882a593Smuzhiyun ENTRYPOINT=`${HOST_PREFIX}nm ${B}/vmlinux | \ 30*4882a593Smuzhiyun awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'` 31*4882a593Smuzhiyun fi 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun 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 34*4882a593Smuzhiyun rm -f linux.bin 35*4882a593Smuzhiyun} 36