diff options
author | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2008-02-15 17:28:09 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2008-02-15 17:28:09 +0000 |
commit | c774a4e441deac27ee040a701926f0324cc5cd19 (patch) | |
tree | 8dd7dd2ab499de64302c96767a03b65ae08d0c9a | |
parent | 5cc9834638b028694beef90531848a91c60138f5 (diff) | |
parent | e8d74197f050420390f7c01bf74c0d1c72716a39 (diff) |
merge of '0693b64dbb432d884ac6897aaa6c97de6bc99af3'
and '706ca8a56360cf090b26c74d6dc02843def49575'
-rw-r--r-- | classes/kernel.bbclass | 21 | ||||
-rw-r--r-- | packages/initrdscripts/kernel-initramfs_1.0.bb | 48 |
2 files changed, 69 insertions, 0 deletions
diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass index 047a3ec047..28e04ea204 100644 --- a/classes/kernel.bbclass +++ b/classes/kernel.bbclass @@ -11,6 +11,10 @@ PACKAGES_DYNAMIC += "kernel-image-*" export OS = "${TARGET_OS}" export CROSS_COMPILE = "${TARGET_PREFIX}" KERNEL_IMAGETYPE ?= "zImage" +# Base filename under which users see built kernel (i.e. deploy name) +KERNEL_IMAGE_BASE_NAME = "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}" +# Symlink basename pointing to the most recently built kernel for a machine +KERNEL_IMAGE_SYMLINK_NAME = "${KERNEL_IMAGETYPE}-${MACHINE}" KERNEL_PRIORITY = "${@bb.data.getVar('PV',d,1).split('-')[0].split('.')[-1]}" @@ -30,6 +34,7 @@ HOST_LD_KERNEL_ARCH ?= "${TARGET_LD_KERNEL_ARCH}" KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc${KERNEL_CCSUFFIX} ${HOST_CC_KERNEL_ARCH}" KERNEL_LD = "${LD}${KERNEL_LDSUFFIX} ${HOST_LD_KERNEL_ARCH}" +# Where built kernel lies in the kernel tree KERNEL_OUTPUT = "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}" KERNEL_IMAGEDEST = "boot" @@ -60,6 +65,22 @@ kernel_do_compile() { fi } +do_builtin_initramfs() { + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE + cp "${INITRAMFS_LOC}" usr/initramfs_data.cpio.gz + oe_runmake ${KERNEL_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" + install -d ${DEPLOY_DIR_IMAGE} + mv ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.no-initramfs.bin + install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin + # Make sure to kill injected initramfs, in case someone will do "-c compile -f" + rm usr/initramfs_data.cpio.gz + + [ -n "${DEPLOY_TO}" ] && install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_TO} +} +addtask builtin_initramfs after do_compile +# As it accepts external parameter(s), better make it unstamped +do_builtin_initramfs[nostamp] = "1" + kernel_do_stage() { ASMDIR=`readlink include/asm` diff --git a/packages/initrdscripts/kernel-initramfs_1.0.bb b/packages/initrdscripts/kernel-initramfs_1.0.bb new file mode 100644 index 0000000000..be1c067ba2 --- /dev/null +++ b/packages/initrdscripts/kernel-initramfs_1.0.bb @@ -0,0 +1,48 @@ +DESCRIPTION = "A kernel with internal initramfs" +PR = "r1" + +#inherit kernel +KERNEL_IMAGETYPE ?= "zImage" + +# Name of initramfs recipe to build and put result into kernel +KERNEL_INITRAMFS ?= "initramfs-image" + +do_compile() { + cd ${TOPDIR}; DISTRO=${USERDISTRO} MACHINE=${MACHINE} ANGSTROM_MODE=uclibc IMAGE_FSTYPES=cpio.gz DEPLOY_TO=${WORKDIR}/initramfs.bin bitbake ${KERNEL_INITRAMFS} -c deploy_to + cd ${TOPDIR}; DISTRO=${USERDISTRO} MACHINE=${MACHINE} INITRAMFS_LOC=${WORKDIR}/initramfs.bin DEPLOY_TO=${WORKDIR}/\${KERNEL_IMAGE_BASE_NAME} bitbake virtual/kernel -c builtin_initramfs +} + +do_install() { + install -d ${D}/boot/ + install -m 644 ${WORKDIR}/${KERNEL_IMAGETYPE}* ${D}/boot/${KERNEL_IMAGETYPE}-${@get_pv(d)} +} + +def get_version(d): + import bb + import os + dest = bb.data.getVar("WORKDIR", d, 1) + try: + files = os.listdir(dest) + files = filter(lambda f:f.startswith("zImage-"), files) + ver = files[0][len("zImage-"):] + return ver + except: + return "dum-m-y" + +def get_pv(d): + ver = get_version(d) + verc = ver.split("-") + return verc[0] + "-" + verc[1] + +def get_pr(d): + ver = get_version(d) + verc = ver.split("-") + return verc[2] + +PACKAGES = "kernel-image" +FILES_kernel-image = "/boot/*" +PKG_kernel-image = "kernel-image-${@get_pv(d)}" +PKGPV_kernel-image = "${@get_pv(d)}" +PKGPR_kernel-image = "${@get_pr(d)}" + +PACKAGE_ARCH = "${MACHINE_ARCH}" |