diff options
Diffstat (limited to 'classes/kernel.bbclass')
| -rw-r--r-- | classes/kernel.bbclass | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass index 827046e7b1..d94930b7be 100644 --- a/classes/kernel.bbclass +++ b/classes/kernel.bbclass | |||
| @@ -14,8 +14,20 @@ python __anonymous () { | |||
| 14 | depends = bb.data.getVar("DEPENDS", d, 1) | 14 | depends = bb.data.getVar("DEPENDS", d, 1) |
| 15 | depends = "%s u-boot-mkimage-native" % depends | 15 | depends = "%s u-boot-mkimage-native" % depends |
| 16 | bb.data.setVar("DEPENDS", depends, d) | 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) | ||
| 17 | } | 26 | } |
| 18 | 27 | ||
| 28 | INITRAMFS_IMAGE ?= "" | ||
| 29 | INITRAMFS_TASK ?= "" | ||
| 30 | |||
| 19 | inherit kernel-arch deploy | 31 | inherit kernel-arch deploy |
| 20 | 32 | ||
| 21 | PACKAGES_DYNAMIC += "kernel-module-*" | 33 | PACKAGES_DYNAMIC += "kernel-module-*" |
| @@ -196,8 +208,17 @@ sysroot_stage_all_append() { | |||
| 196 | 208 | ||
| 197 | kernel_do_configure() { | 209 | kernel_do_configure() { |
| 198 | yes '' | oe_runmake oldconfig | 210 | yes '' | oe_runmake oldconfig |
| 211 | if [ ! -z "${INITRAMFS_IMAGE}" ]; then | ||
| 212 | for img in cpio.gz cpio.lzo cpio.lzma; do | ||
| 213 | if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then | ||
| 214 | cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" initramfs.$img | ||
| 215 | fi | ||
| 216 | done | ||
| 217 | fi | ||
| 199 | } | 218 | } |
| 200 | 219 | ||
| 220 | kernel_do_configure[depends] += "${INITRAMFS_TASK}" | ||
| 221 | |||
| 201 | do_menuconfig() { | 222 | do_menuconfig() { |
| 202 | export TERMWINDOWTITLE="${PN} Kernel Configuration" | 223 | export TERMWINDOWTITLE="${PN} Kernel Configuration" |
| 203 | export SHELLCMDS="make menuconfig" | 224 | export SHELLCMDS="make menuconfig" |
| @@ -476,6 +497,29 @@ do_sizecheck() { | |||
| 476 | 497 | ||
| 477 | addtask sizecheck before do_install after do_compile | 498 | addtask sizecheck before do_install after do_compile |
| 478 | 499 | ||
| 500 | do_uboot_mkimage() { | ||
| 501 | if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then | ||
| 502 | ENTRYPOINT=${UBOOT_ENTRYPOINT} | ||
| 503 | if test -n "${UBOOT_ENTRYSYMBOL}"; then | ||
| 504 | ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \ | ||
| 505 | awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'` | ||
| 506 | fi | ||
| 507 | if test -e arch/${ARCH}/boot/compressed/vmlinux ; then | ||
| 508 | ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin | ||
| 509 | 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 | ||
| 510 | rm -f linux.bin | ||
| 511 | else | ||
| 512 | ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin | ||
| 513 | rm -f linux.bin.gz | ||
| 514 | gzip -9 linux.bin | ||
| 515 | 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 | ||
| 516 | rm -f linux.bin.gz | ||
| 517 | fi | ||
| 518 | fi | ||
| 519 | } | ||
| 520 | |||
| 521 | addtask uboot_mkimage before do_install after do_compile | ||
| 522 | |||
| 479 | KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}" | 523 | KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}" |
| 480 | # Don't include the DATETIME variable in the sstate package signatures | 524 | # Don't include the DATETIME variable in the sstate package signatures |
| 481 | KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" | 525 | KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" |
| @@ -487,22 +531,6 @@ kernel_do_deploy() { | |||
| 487 | tar -cvzf ${DEPLOYDIR}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib | 531 | tar -cvzf ${DEPLOYDIR}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib |
| 488 | fi | 532 | fi |
| 489 | 533 | ||
| 490 | if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then | ||
| 491 | if test -e arch/${ARCH}/boot/uImage ; then | ||
| 492 | cp arch/${ARCH}/boot/uImage ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin | ||
| 493 | elif test -e arch/${ARCH}/boot/compressed/vmlinux ; then | ||
| 494 | ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin | ||
| 495 | 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 | ||
| 496 | rm -f linux.bin | ||
| 497 | else | ||
| 498 | ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin | ||
| 499 | rm -f linux.bin.gz | ||
| 500 | gzip -9 linux.bin | ||
| 501 | 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 | ||
| 502 | rm -f linux.bin.gz | ||
| 503 | fi | ||
| 504 | fi | ||
| 505 | |||
| 506 | cd ${DEPLOYDIR} | 534 | cd ${DEPLOYDIR} |
| 507 | rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin | 535 | rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin |
| 508 | ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin | 536 | ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin |
