kernel-uimage.bbclass 1.4 KB

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