summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <pmiscml@gmail.com>2008-02-15 15:43:42 +0000
committerPaul Sokolovsky <pmiscml@gmail.com>2008-02-15 15:43:42 +0000
commit07e7c1fcd70ab0a124aaee53deacb49a9f388975 (patch)
treee1ca74ae76ab3c8fba297405ca100c1f23b9ba4c
parent72761e468bb3e905459f2b81ce1bc4d80419481f (diff)
kernel-initramfs: A recipe to build a kernel with linked in initramfs.
* First builds ${KERNEL_INITRAMFS} in cpio.gz format, then stuffs it into kernel as specified by virtual/kernel, deploys to deploy dir, and packages kernel-image (the package would overrite previously built kernel-image package w/o initramfs, so caveat). * kernel-image packaing actually requires PKGPV/PKGPR support, to be RFCed.
-rw-r--r--packages/initrdscripts/kernel-initramfs_1.0.bb48
1 files changed, 48 insertions, 0 deletions
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}"