Add support for initramfs
cover Add support for initramfs
* Sync with org.openembedded.dev and allow the inclusion of
* lzma and xz compressed images.
Andrea Adami (2):
kernel.bbclass: handle embedding of initramfs images image_types.bbclass: support xz compressed initramfs.cpio and
tarballs
meta/classes/image_types.bbclass | 13 +++++++++++++ meta/classes/kernel.bbclass | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.3.4
PATCH 1/2 kernel.bbclass: handle embedding of initramfs images
* from org.openembedded.dev (oe-classic)
--- meta/classes/kernel.bbclass | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
meta/classes/kernel.bbclass +22 -0
@@ -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-*"
@@ -179,8 +191,18 @@ kernel_do_configure() { cp "${WORKDIR}/defconfig" "${S}/.config" fi 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" + cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$i + fi + done + fi } +kernel_do_configure[depends] += "${INITRAMFS_TASK}" + do_menuconfig() { export DISPLAY='${DISPLAY}' export DBUS_SESSION_BUS_ADDRESS='${DBUS_SESSION_BUS_ADDRESS}'
Signature · 1 line
1.7.3.4
Re: [PATCH 1/2] kernel.bbclass: handle embedding of initramfs images
Ehm,
some cruft slipped in :/
Quoted 16 lines · Andrea Adami
* from org.openembedded.dev (oe-classic)
Signed-off-by Andrea Adami <[email protected]>---
meta/classes/kernel.bbclass | 22 ++++++++++++++++++++++1 files changed, 22 insertions(+), 0 deletions(-)meta/classes/kernel.bbclass +0
-0@@ -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)meta/classes/kernel.bbclass +1
-0+
meta/classes/kernel.bbclass python __anonymous () { · line 25
Quoted 10 lines
meta/classes/kernel.bbclass +8
-0+ 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)
Those bits are extraneous and copied and pasted by mistake.
Quoted 15 lines
}
meta/classes/kernel.bbclass +3
-0+INITRAMFS_IMAGE ?= "" +INITRAMFS_TASK ?= "" +inherit kernel-arch deploy
PACKAGES_DYNAMIC += "kernel-module-*"
meta/classes/kernel.bbclass +0
-0@@ -179,8 +191,18 @@ kernel_do_configure() {cp "${WORKDIR}/defconfig" "${S}/.config" fi
yes '' |oe_runmakeoldconfig
+
+ if [ ! -z "${INITRAMFS_IMAGE}" ]; then
Quoted 1 line
+ for img in cpio.gz cpio.lzo cpio.lzma; do
We'll have to add cpio.xz as bonus too, being there is support for it in image_types.bbclass
Quoted 9 lines
+ if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img"
+ cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$i
+ fi
+ done
+ fi
}meta/classes/kernel.bbclass +2
-0+kernel_do_configure[depends] += "${INITRAMFS_TASK}" +
Quoted 7 lines
do_menuconfig() {
export DISPLAY='${DISPLAY}'
export DBUS_SESSION_BUS_ADDRESS='${DBUS_SESSION_BUS_ADDRESS}' --
1.7.3.4
If you mind, I'll resend a corrected V2 of the patch
Regards
Andrea
Re: [PATCH 1/2] kernel.bbclass: handle embedding of initramfs images
Quoted 11 lines · Andrea Adami
Ehm,
some cruft slipped in :/Quoted 7 lines · Andrea Adami
* from org.openembedded.dev (oe-classic)
Signed-off-by Andrea Adami <[email protected]>--- meta/classes/kernel.bbclass | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
Quoted 11 lines
meta/classes/kernel.bbclass python __anonymous () { · line 19
Quoted 11 lines
meta/classes/kernel.bbclass +3
-0@@ -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:
^^^
Is this ok ?
Quoted 41 lines
meta/classes/kernel.bbclass python __anonymous () { · line 25
Quoted 8 lines
meta/classes/kernel.bbclass +6
-0+ 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)Those bits are extraneous and copied and pasted by mistake.
Quoted 9 lines
meta/classes/kernel.bbclass +3
-0} +INITRAMFS_IMAGE ?= "" +INITRAMFS_TASK ?= "" + inherit kernel-arch deploy
PACKAGES_DYNAMIC+= "kernel-module-*"meta/classes/kernel.bbclass kernel_do_configure() { · line 197
Quoted 7 lines
meta/classes/kernel.bbclass +3
-0@@ -179,8 +191,18 @@ kernel_do_configure() { cp "${WORKDIR}/defconfig" "${S}/.config" fi yes '' | oe_runmake oldconfig + + if [ ! -z "${INITRAMFS_IMAGE}" ]; then + for img in cpio.gz cpio.lzo cpio.lzma; doWe'll have to add cpio.xz as bonus too, being there is support for it in image_types.bbclass
Quoted 7 lines
meta/classes/kernel.bbclass +5
-0+ if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" + cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$i + fi + done + fi }
Quoted 11 lines
Quoted 9 lines
meta/classes/kernel.bbclass +2
-0+kernel_do_configure[depends] += "${INITRAMFS_TASK}" + do_menuconfig() { export DISPLAY='${DISPLAY}'export DBUS_SESSION_BUS_ADDRESS='${DBUS_SESSION_BUS_ADDRESS}'--
1.7.3.4If you mind, I'll resend a corrected V2 of the patch
Please do
Quoted 9 lines
Regards
Andrea
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Re: [PATCH 1/2] kernel.bbclass: handle embedding of initramfs images
Quoted 5 lines · On Friday 08 July 2011 01:53:38 Khem Raj wrote:
Quoted 3 lines
On Fri, Jul 8, 2011 at 1:11 AM, Andrea Adami <[email protected]> > >>
Quoted 2 lines
meta/classes/kernel.bbclass +2
-0+ image = bb.data.getVar('INITRAMFS_IMAGE', d, True) + if image != '' and image is not None:^^^Is this ok ?
Probably "if image:" would be better.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Re: [PATCH 1/2] kernel.bbclass: handle embedding of initramfs images
In reply to Andrea AdamiQuoted 1 line · Andrea Adami
* from org.openembedded.dev (oe-classic)
Hi Andrea,
Please include a descriptive blurb about the patch. When people read through the commit log they need to know what problem this patch addresses and how it intends to go about it. If possible, it should also include the commit id from the source (I suspect that isn't an option here).
Quoted 8 lines
meta/classes/kernel.bbclass +3
-0+INITRAMFS_IMAGE ?= "" +INITRAMFS_TASK ?= "" + inherit kernel-arch deploy PACKAGES_DYNAMIC += "kernel-module-*"@@ -179,8 +191,18 @@ kernel_do_configure() { cp "${WORKDIR}/defconfig" "${S}/.config"
meta/classes/kernel.bbclass kernel_do_configure() { · line 201
Quoted 10 lines
meta/classes/kernel.bbclass +8
-0fi 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" + cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$i + fi + done + fi
Hrm... Why is this part of do_configure? Seems a lot more like a deploy or install step. Also, the cp line has been truncated here.
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
Re: [PATCH 1/2] kernel.bbclass: handle embedding of initramfs images
Op 8 jul. 2011 om 16:38 heeft Darren Hart <[email protected]> het volgende geschreven:
Quoted 27 lines · Andrea Adami
Quoted 1 line
* from org.openembedded.dev (oe-classic)
Hi Andrea,
Please include a descriptive blurb about the patch. When people read through the commit log they need to know what problem this patch addresses and how it intends to go about it. If possible, it should also include the commit id from the source (I suspect that isn't an option here).
Quoted 14 lines
meta/classes/kernel.bbclass +3
-0+INITRAMFS_IMAGE ?= "" +INITRAMFS_TASK ?= "" +inherit kernel-arch deploy
PACKAGES_DYNAMIC+= "kernel-module-*"meta/classes/kernel.bbclass +4
-0@@ -179,8 +191,18 @@ kernel_do_configure() { cp "${WORKDIR}/defconfig" "${S}/.config" fi 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"
Quoted 8 lines
meta/classes/kernel.bbclass kernel_do_configure() { · line 201
Quoted 4 lines
meta/classes/kernel.bbclass +4
-0+ cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$i + fi + done + fiHrm... Why is this part of
do_configure? Seems a lot more like a deploy or install step. Also, the cp line has been truncated here.
the initramfs gets embedded into the kernel, so it needs to happen before do-compile. maybe a seperate task is better
Quoted 10 lines
Signature · 9 lines
-- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel _______________________________________________ Openembedded-core mailing list [email protected] http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Re: [PATCH 1/2] kernel.bbclass: handle embedding of initramfs images
In reply to Darren HartQuoted 12 lines · Darren Hart
Quoted 1 line · Andrea Adami
* from org.openembedded.dev (oe-classic)
Hi Andrea,
Please include a descriptive blurb about the patch. When people read through the commit log they need to know what problem this patch addresses and how it intends to go about it. If possible, it should also include the commit id from the source (I suspect that isn't an option here).
Well, there isn't really much to say: whether you know what an initramfs is or not :)
Seriously, about the history of the patch, there have been so many commits that I could not choose one. See next comment.
Quoted 3 lines
Hrm... Why is this part of
do_configure? Seems a lot more like a deploy or install step.
If you look at the history at
http://cgit.openembedded.org/cgit.cgi/openembedded/log/classes/kernel.bbclass?h=org.openembedded.dev&ofs=50
you'll discover that there was a separate task (72761e4) which has been unified by the author as of commit 3e3f297.
After some rounds of fixes, the code was moved in do_configure with commit id fc03e2b (kernel.bbclass: move initramfs stuff to configure so we can do postprocessing on it with do_configure_append).
Quoted 1 line
Also, the cp line has been truncated here.
The original patch sent by git send.email should be sane.
Quoted 5 lines
--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
Regards
Andrea
Re: [PATCH 1/2] kernel.bbclass: handle embedding of initramfs images
Quoted 13 lines · Andrea Adami
Quoted 12 lines · Darren Hart
Quoted 1 line · Andrea Adami
* from org.openembedded.dev (oe-classic)
Hi Andrea,
Please include a descriptive blurb about the patch. When people read through the commit log they need to know what problem this patch addresses and how it intends to go about it. If possible, it should also include the commit id from the source (I suspect that isn't an option here).
Quoted 5 lines
Well, there isn't really much to say: whether you know what an initramfs is or not :)
Seriously, about the history of the patch, there have been so many commits that I could not choose one. See next comment.
Anyway, you're right. I'm putting together something more descriptive :)
Quoted 4 lines
Quoted 3 lines
Hrm... Why is this part of
do_configure? Seems a lot more like a deploy or install step.
Quoted 9 lines
If you look at the history at
http://cgit.openembedded.org/cgit.cgi/openembedded/log/classes/kernel.bbclass?h=org.openembedded.dev&ofs=50
you'll discover that there was a separate task (72761e4) which has been unified by the author as of commit 3e3f297.After some rounds of fixes, the code was moved in
do_configurewith commit id fc03e2b (kernel.bbclass: move initramfs stuff to configure so we can do postprocessing on it withdo_configure_append).
If there are any further remarks I would keep the code in do_configure for the initial commit.
<cut>
Regards
Andrea
PATCH 2/2 image_types.bbclass: support xz compressed initramfs.cpio and tarballs
In reply to Andrea Adami* from org.openembedded.dev (oe-classic)
--- meta/classes/image_types.bbclass | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
meta/classes/image_types.bbclass +13 -0
@@ -20,6 +20,10 @@ runimagecmd () { ln -s ${IMAGE_NAME}.rootfs.${type} ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${type} } + +XZ_COMPRESSION_LEVEL ?= "-e -9" +XZ_INTEGRITY_CHECK ?= "crc32" + IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD}" IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}"
@@ -55,8 +59,13 @@ IMAGE_CMD_squashfs-lzma = "mksquashfs-lzma ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/$ IMAGE_CMD_tar = "cd ${IMAGE_ROOTFS} && tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar ." IMAGE_CMD_tar.gz = "cd ${IMAGE_ROOTFS} && tar -zcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.gz ." IMAGE_CMD_tar.bz2 = "cd ${IMAGE_ROOTFS} && tar -jcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.bz2 ." +IMAGE_CMD_tar.xz = "cd ${IMAGE_ROOTFS} && tar --xz -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.xz ." IMAGE_CMD_cpio = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)" IMAGE_CMD_cpio.gz = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | gzip -c -9 >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz)" +IMAGE_CMD_cpio.xz = "type cpio >/dev/null; cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | xz -c ${XZ_COMPRESSION_LEVEL} --check=${XZ_INTEGRITY_CHECK} > ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.xz) ${EXTRA_IMAGECMD}" +IMAGE_CMD_cpio.gz.u-boot = "type cpio >/dev/null; cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | gzip -c -9 >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz) ${EXTRA_IMAGECMD}; mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C gzip -n ${IMAGE_NAME} -d ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz.u-boot" +IMAGE_CMD_cpio.lzma = "type cpio >/dev/null; cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | xz --format=lzma -c ${XZ_COMPRESSION_LEVEL} --check=${XZ_INTEGRITY_CHECK} >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.lzma) ${EXTRA_IMAGECMD}" + IMAGE_CMD_ubi () { echo \[ubifs\] > ubinize.cfg echo mode=ubi >> ubinize.cfg
@@ -88,6 +97,10 @@ IMAGE_DEPENDS_ext3.gz = "genext2fs-native e2fsprogs-native" IMAGE_DEPENDS_btrfs = "btrfs-tools-native" IMAGE_DEPENDS_squashfs = "squashfs-tools-native" IMAGE_DEPENDS_squashfs-lzma = "squashfs-lzma-tools-native" +IMAGE_DEPENDS_tar.xz = "tar-native xz-native" +IMAGE_DEPENDS_cpio.gz.u-boot = "u-boot-mkimage-native" +IMAGE_DEPENDS_cpio.lzma = "xz-native" +IMAGE_DEPENDS_cpio.xz = "xz-native" IMAGE_DEPENDS_ubi = "mtd-utils-native" IMAGE_DEPENDS_ubifs = "mtd-utils-native"
Signature · 1 line
1.7.3.4