From 65780d06117be92941b3c5404dc31597b6807263 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Sun, 23 Jan 2011 10:58:46 +0100 Subject: [PATCH] kernel bbclass: merge in OE improvements for mkimage, PR and initramfs Signed-off-by: Koen Kooi --- classes/kernel.bbclass | 60 +++++++++++++++++++++++++++++++++++------------ 1 files changed, 44 insertions(+), 16 deletions(-) diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass index 827046e..d94930b 100644 --- a/classes/kernel.bbclass +++ b/classes/kernel.bbclass @@ -14,8 +14,20 @@ python __anonymous () { depends = bb.data.getVar("DEPENDS", d, 1) depends = "%s u-boot-mkimage-native" % depends bb.data.setVar("DEPENDS", depends, d) + + image = bb.data.getVar('INITRAMFS_IMAGE', d, True) + if image != '' and image is not None: + bb.data.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs', d) + + machine_kernel_pr = bb.data.getVar('MACHINE_KERNEL_PR', d, True) + + if machine_kernel_pr: + bb.data.setVar('PR', machine_kernel_pr, d) } +INITRAMFS_IMAGE ?= "" +INITRAMFS_TASK ?= "" + inherit kernel-arch deploy PACKAGES_DYNAMIC += "kernel-module-*" @@ -196,8 +208,17 @@ sysroot_stage_all_append() { kernel_do_configure() { yes '' | oe_runmake oldconfig + if [ ! -z "${INITRAMFS_IMAGE}" ]; then + for img in cpio.gz cpio.lzo cpio.lzma; do + if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then + cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" initramfs.$img + fi + done + fi } +kernel_do_configure[depends] += "${INITRAMFS_TASK}" + do_menuconfig() { export TERMWINDOWTITLE="${PN} Kernel Configuration" export SHELLCMDS="make menuconfig" @@ -476,6 +497,29 @@ do_sizecheck() { addtask sizecheck before do_install after do_compile +do_uboot_mkimage() { + if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then + ENTRYPOINT=${UBOOT_ENTRYPOINT} + if test -n "${UBOOT_ENTRYSYMBOL}"; then + ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \ + awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'` + fi + if test -e arch/${ARCH}/boot/compressed/vmlinux ; then + ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin + 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 + rm -f linux.bin + else + ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin + rm -f linux.bin.gz + gzip -9 linux.bin + 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 + rm -f linux.bin.gz + fi + fi +} + +addtask uboot_mkimage before do_install after do_compile + KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}" # Don't include the DATETIME variable in the sstate package signatures KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" @@ -487,22 +531,6 @@ kernel_do_deploy() { tar -cvzf ${DEPLOYDIR}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib fi - if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then - if test -e arch/${ARCH}/boot/uImage ; then - cp arch/${ARCH}/boot/uImage ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin - elif test -e arch/${ARCH}/boot/compressed/vmlinux ; then - ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin - 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 - rm -f linux.bin - else - ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin - rm -f linux.bin.gz - gzip -9 linux.bin - 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 - rm -f linux.bin.gz - fi - fi - cd ${DEPLOYDIR} rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin -- 1.6.6.1