kernel bbclass: merge in OE improvements for mkimage, PR and initramfs

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
This commit is contained in:
Koen Kooi 2011-01-23 10:58:46 +01:00
parent 04a29595e9
commit 65780d0611

View File

@ -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