0001-kernel-bbclass-merge-in-OE-improvements-for-mkimage-.patch 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. From 65780d06117be92941b3c5404dc31597b6807263 Mon Sep 17 00:00:00 2001
  2. From: Koen Kooi <koen@dominion.thruhere.net>
  3. Date: Sun, 23 Jan 2011 10:58:46 +0100
  4. Subject: [PATCH] kernel bbclass: merge in OE improvements for mkimage, PR and initramfs
  5. Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
  6. ---
  7. classes/kernel.bbclass | 60 +++++++++++++++++++++++++++++++++++------------
  8. 1 files changed, 44 insertions(+), 16 deletions(-)
  9. diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass
  10. index 827046e..d94930b 100644
  11. --- a/classes/kernel.bbclass
  12. +++ b/classes/kernel.bbclass
  13. @@ -14,8 +14,20 @@ python __anonymous () {
  14. depends = bb.data.getVar("DEPENDS", d, 1)
  15. depends = "%s u-boot-mkimage-native" % depends
  16. bb.data.setVar("DEPENDS", depends, d)
  17. +
  18. + image = bb.data.getVar('INITRAMFS_IMAGE', d, True)
  19. + if image != '' and image is not None:
  20. + bb.data.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs', d)
  21. +
  22. + machine_kernel_pr = bb.data.getVar('MACHINE_KERNEL_PR', d, True)
  23. +
  24. + if machine_kernel_pr:
  25. + bb.data.setVar('PR', machine_kernel_pr, d)
  26. }
  27. +INITRAMFS_IMAGE ?= ""
  28. +INITRAMFS_TASK ?= ""
  29. +
  30. inherit kernel-arch deploy
  31. PACKAGES_DYNAMIC += "kernel-module-*"
  32. @@ -196,8 +208,17 @@ sysroot_stage_all_append() {
  33. kernel_do_configure() {
  34. yes '' | oe_runmake oldconfig
  35. + if [ ! -z "${INITRAMFS_IMAGE}" ]; then
  36. + for img in cpio.gz cpio.lzo cpio.lzma; do
  37. + if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then
  38. + cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" initramfs.$img
  39. + fi
  40. + done
  41. + fi
  42. }
  43. +kernel_do_configure[depends] += "${INITRAMFS_TASK}"
  44. +
  45. do_menuconfig() {
  46. export TERMWINDOWTITLE="${PN} Kernel Configuration"
  47. export SHELLCMDS="make menuconfig"
  48. @@ -476,6 +497,29 @@ do_sizecheck() {
  49. addtask sizecheck before do_install after do_compile
  50. +do_uboot_mkimage() {
  51. + if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
  52. + ENTRYPOINT=${UBOOT_ENTRYPOINT}
  53. + if test -n "${UBOOT_ENTRYSYMBOL}"; then
  54. + ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
  55. + awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
  56. + fi
  57. + if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
  58. + ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
  59. + uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
  60. + rm -f linux.bin
  61. + else
  62. + ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
  63. + rm -f linux.bin.gz
  64. + gzip -9 linux.bin
  65. + uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
  66. + rm -f linux.bin.gz
  67. + fi
  68. + fi
  69. +}
  70. +
  71. +addtask uboot_mkimage before do_install after do_compile
  72. +
  73. KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
  74. # Don't include the DATETIME variable in the sstate package signatures
  75. KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
  76. @@ -487,22 +531,6 @@ kernel_do_deploy() {
  77. tar -cvzf ${DEPLOYDIR}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib
  78. fi
  79. - if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
  80. - if test -e arch/${ARCH}/boot/uImage ; then
  81. - cp arch/${ARCH}/boot/uImage ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
  82. - elif test -e arch/${ARCH}/boot/compressed/vmlinux ; then
  83. - ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
  84. - uboot-mkimage -A ${ARCH} -O linux -T kernel -C none -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
  85. - rm -f linux.bin
  86. - else
  87. - ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
  88. - rm -f linux.bin.gz
  89. - gzip -9 linux.bin
  90. - uboot-mkimage -A ${ARCH} -O linux -T kernel -C gzip -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
  91. - rm -f linux.bin.gz
  92. - fi
  93. - fi
  94. -
  95. cd ${DEPLOYDIR}
  96. rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin
  97. ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin
  98. --
  99. 1.6.6.1