All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/2] Embedding initramfs images during kernel build.
@ 2011-07-11 22:33 Andrea Adami
  2011-07-11 22:33 ` [PATCH V2 1/2] kernel.bbclass: handle embedding of initramfs images Andrea Adami
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrea Adami @ 2011-07-11 22:33 UTC (permalink / raw)
  To: openembedded-core

* Sync with org.openembedded.dev and allow the inclusion of
* lzma and xz compressed initramfs images.
*
* Provide a convenient way to include an initramfs by setting
* INITRAMFS_IMAGE = "your_initramfs_image.bb"
* and specifying the chosen output format in the initramfs image recipe, e.g.
* IMAGE_FSTYPES = "cpio.gz cpio.lzma"

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 |   11 +++++++++++
 meta/classes/kernel.bbclass      |   16 ++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

-- 
1.7.3.4




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V2 1/2] kernel.bbclass: handle embedding of initramfs images
  2011-07-11 22:33 [PATCH V2 0/2] Embedding initramfs images during kernel build Andrea Adami
@ 2011-07-11 22:33 ` Andrea Adami
  2011-07-11 22:33 ` [PATCH V2 2/2] image_types.bbclass: add support for tar.xz, cpio.xz, cpio.lzma Andrea Adami
  2011-07-12 14:04 ` [PATCH V2 0/2] Embedding initramfs images during kernel build Richard Purdie
  2 siblings, 0 replies; 5+ messages in thread
From: Andrea Adami @ 2011-07-11 22:33 UTC (permalink / raw)
  To: openembedded-core

* "All 2.6 Linux kernels contain a gzipped "cpio" format archive, which is
* extracted into rootfs when the kernel boots up."
* (http://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt)
*
* In some cases it can be useful to take advantage of this ability and embed your
* customized rootfs ("the move to early userspace is necessary because finding
* and mounting the real root device is complex").
*
* Therefore, some code was added and since 2009 OpenEmbedded metadata
* provides a convenient way to include your initramfs by setting
* INITRAMFS_IMAGE = "your_initramfs_image.bb"
* and specifying the chosen output format in the initramfs image recipe, e.g.
* IMAGE_FSTYPES = "cpio.gz cpio.lzma"
*
*
* Patch was imported from the OpenEmbedded git server
* (git://git.openembedded.org/openembedded)
*
* Add satndalone task "builtin_initramfs".
* commit  72761e468bb3e905459f2b81ce1bc4d80419481f
* Signed-off-by:Paul Sokolovsky <pmiscml@gmail.com>
*
* 'Remove usage of non-standard variables (DEPLOY_TO) and random renaming
* of output.'
* commit 456ba7ffd159821e86ad7ad4b66ec7d5790bd054
* Richard Purdie <rpurdie@rpsys.net>
*
* 'Fis typo in do_builtin_initramfs.'
* commit 37f2fe4b801df832e93553a08eff24fec736c7d4
* Signed-off-by:Paul Sokolovsky <pmiscml@gmail.com>
*
* 'comment initramfs stuff till rootfs locking works properly (initramfs
* should be optional as well)'
* commit 2818d8b7be1a0d9a59ad3528091d47517d59328b
* Signed-off-by: Koen Kooi <koen@openembedded.org>
*
* 'get initramfs stuff working
* commit 1642b3e8fc81c666713951fdd4e7ff9a50d1c5a8
* Signed-off-by: Thomas Kunze <thommycheck@gmx.de>
*
* 'Fix INITRAMFS logic to stop breaking builds for people not using it'
* commit dcf3049eb9eedf0838af59969b3f70a43298d3d7
* Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
*
* '-change initramfs-logic'
* commit 3e3f297457138e96e2b652658675796853eb0293
* Signed-off-by: Thomas Kunze <thommycheck@gmx.de>
*
* 'move initramfs stuff to configure so we can do postprocessing
* on it with do_configure_append'
* commit fc03e2be0b4470748a8b7707cea7293303adc424
* Signed-off-by: Koen Kooi <koen@openembedded.org>
*
* 'copy gz, lzo, lzma initramfs cpio images.'
* commit 572abc3fdd1076ca35d8c15d269cc9d862101805
* Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
*
* 'move the kernel size check to linux-kexecboot.inc.'
* commit 45f82a941c77e9d747814fa1e337ba803475d327
* Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
*
* Finally, two refinements as discussed on openembedded-core
* mailing list:
* - replace "if image != '' and image is not None:" with "if image"
* - add cpio.xz support

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 meta/classes/kernel.bbclass |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 943252a..1a71df6 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -7,6 +7,8 @@ DEPENDS += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}depmod virtual/$
 INHIBIT_DEFAULT_DEPS = "1"
 
 KERNEL_IMAGETYPE ?= "zImage"
+INITRAMFS_IMAGE ?= ""
+INITRAMFS_TASK ?= ""
 
 python __anonymous () {
     kerneltype = bb.data.getVar('KERNEL_IMAGETYPE', d, 1) or ''
@@ -14,6 +16,10 @@ 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:
+    	bb.data.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs', d)
 }
 
 inherit kernel-arch deploy
@@ -179,8 +185,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 cpio.xz; 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}'
-- 
1.7.3.4




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH V2 2/2] image_types.bbclass: add support for tar.xz, cpio.xz, cpio.lzma
  2011-07-11 22:33 [PATCH V2 0/2] Embedding initramfs images during kernel build Andrea Adami
  2011-07-11 22:33 ` [PATCH V2 1/2] kernel.bbclass: handle embedding of initramfs images Andrea Adami
@ 2011-07-11 22:33 ` Andrea Adami
  2011-07-12 14:04 ` [PATCH V2 0/2] Embedding initramfs images during kernel build Richard Purdie
  2 siblings, 0 replies; 5+ messages in thread
From: Andrea Adami @ 2011-07-11 22:33 UTC (permalink / raw)
  To: openembedded-core

* Once we add support for building kernel containing initramfs images
* we expect compressed cpio archives.
* Thus, add support for lzma and xz compressors for the initramfs images.
* While there, add support for tar.xz as done in org.openembedded.dev.
*
* Patch was imported from the OpenEmbedded git server
* (git://git.openembedded.org/openembedded)
*
* 'bitbake.conf: add cpio and ext4 .xz support'
* commit 7977d3325a09e2edf4a8a1b02f48085f88f7a631
* Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
*
* 'bitbake.conf: Define tar.xz image types.'
* 1fca8dc50a821f4589fa5e339e6e279dd3c0dafe 
* Signed-off-by: Tom Rini <tom_rini@mentor.com>	
*
* 'bitbake.conf: add XZ_INTEGRITY_CHECK and LZMA_COMPRESSION_LEVEL variables'
* commit 312b42bcf2cc9b11266ba497ade68e8ddabb3007
* Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
*
* 'bitbake.conf: unbreak and improve lzma image compression handling and adapt
* linux-kexecboot.inc'
* commit c382a9ce64bf4291572665652138aa01b2e54306
* Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
* Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 meta/classes/image_types.bbclass |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 8c86227..89a745c 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -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,12 @@ 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.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 +96,9 @@ 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.lzma = "xz-native"
+IMAGE_DEPENDS_cpio.xz = "xz-native"
 IMAGE_DEPENDS_ubi = "mtd-utils-native"
 IMAGE_DEPENDS_ubifs = "mtd-utils-native"
 
-- 
1.7.3.4




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V2 0/2] Embedding initramfs images during kernel build.
  2011-07-11 22:33 [PATCH V2 0/2] Embedding initramfs images during kernel build Andrea Adami
  2011-07-11 22:33 ` [PATCH V2 1/2] kernel.bbclass: handle embedding of initramfs images Andrea Adami
  2011-07-11 22:33 ` [PATCH V2 2/2] image_types.bbclass: add support for tar.xz, cpio.xz, cpio.lzma Andrea Adami
@ 2011-07-12 14:04 ` Richard Purdie
  2011-07-12 17:05   ` Andrea Adami
  2 siblings, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2011-07-12 14:04 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Tue, 2011-07-12 at 00:33 +0200, Andrea Adami wrote:
> * Sync with org.openembedded.dev and allow the inclusion of
> * lzma and xz compressed initramfs images.
> *
> * Provide a convenient way to include an initramfs by setting
> * INITRAMFS_IMAGE = "your_initramfs_image.bb"
> * and specifying the chosen output format in the initramfs image recipe, e.g.
> * IMAGE_FSTYPES = "cpio.gz cpio.lzma"
> 
> Andrea Adami (2):
>   kernel.bbclass: handle embedding of initramfs images
>   image_types.bbclass: support xz compressed initramfs.cpio and
>     tarballs

Merged to master, thanks.

Richard




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2 0/2] Embedding initramfs images during kernel build.
  2011-07-12 14:04 ` [PATCH V2 0/2] Embedding initramfs images during kernel build Richard Purdie
@ 2011-07-12 17:05   ` Andrea Adami
  0 siblings, 0 replies; 5+ messages in thread
From: Andrea Adami @ 2011-07-12 17:05 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

For some reasons one line has been horribly truncated:

cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$i
^

below the correct line:

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


Sorry

Andrea



On Tue, Jul 12, 2011 at 4:04 PM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Tue, 2011-07-12 at 00:33 +0200, Andrea Adami wrote:
>> * Sync with org.openembedded.dev and allow the inclusion of
>> * lzma and xz compressed initramfs images.
>> *
>> * Provide a convenient way to include an initramfs by setting
>> * INITRAMFS_IMAGE = "your_initramfs_image.bb"
>> * and specifying the chosen output format in the initramfs image recipe, e.g.
>> * IMAGE_FSTYPES = "cpio.gz cpio.lzma"
>>
>> Andrea Adami (2):
>>   kernel.bbclass: handle embedding of initramfs images
>>   image_types.bbclass: support xz compressed initramfs.cpio and
>>     tarballs
>
> Merged to master, thanks.
>
> Richard
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-12 17:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-11 22:33 [PATCH V2 0/2] Embedding initramfs images during kernel build Andrea Adami
2011-07-11 22:33 ` [PATCH V2 1/2] kernel.bbclass: handle embedding of initramfs images Andrea Adami
2011-07-11 22:33 ` [PATCH V2 2/2] image_types.bbclass: add support for tar.xz, cpio.xz, cpio.lzma Andrea Adami
2011-07-12 14:04 ` [PATCH V2 0/2] Embedding initramfs images during kernel build Richard Purdie
2011-07-12 17:05   ` Andrea Adami

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.