diff mbox

[RFC] Simplified lzma initramfs compression patches

Message ID 87mwu2lypq.fsf@arh128.prevas.dk
State Accepted
Delegated to: Esben Haabendal
Headers show

Commit Message

Esben Haabendal March 17, 2013, 5:31 p.m. UTC
<christian.braunersorensen@prevas.dk> writes:

> Christian Sørensen (4):
>   crosstool-ng: Patch dmalloc-5.5.2 for powerpc
>   cpio-image: added lzma support
>   kernel: add lzma compression support
>   initramfs-image: add lzma compression support

The 3 lzma compression patches above seems to make things more
complicated than what should be necessary.

What about something like the patch below instead (available in
ramdisk-compression branch at
git://gitorious.org/~esben/oe-lite/esbens-core.git).

It does not add new USE flags, and sticks with the concept of the
ramdisk image being names the same independent of the compression
method, making integration much simpler.

Could those interested (Jacob?) please consider this, and if possible,
test if this is usable instead of the 3 patches submitted by Christian.

/Esben

Comments

Esben Haabendal March 18, 2013, 10:26 a.m. UTC | #1
Jacob Barsøe Kjærgaard <jacob.kjaergaard@prevas.dk> writes:

> On 03/17/2013 06:31 PM, Esben Haabendal wrote:
>> <christian.braunersorensen@prevas.dk> writes:
>>
>>> Christian Sørensen (4):
>>>    crosstool-ng: Patch dmalloc-5.5.2 for powerpc
>>>    cpio-image: added lzma support
>>>    kernel: add lzma compression support
>>>    initramfs-image: add lzma compression support
>> The 3 lzma compression patches above seems to make things more
>> complicated than what should be necessary.
>>
>> What about something like the patch below instead (available in
>> ramdisk-compression branch at
>> git://gitorious.org/~esben/oe-lite/esbens-core.git).
>>
>> It does not add new USE flags, and sticks with the concept of the
>> ramdisk image being names the same independent of the compression
>> method, making integration much simpler.
>>
>> Could those interested (Jacob?) please consider this, and if possible,
>> test if this is usable instead of the 3 patches submitted by
>> Christian.
>
> This looks less complicated (good) and it is tested and found usable (with the
> below change).

Great, I will merge this to master with the change.

/Esben
diff mbox

Patch

diff --git a/classes/cpio-image.oeclass b/classes/cpio-image.oeclass
index 92433cc..c5333f9 100644
--- a/classes/cpio-image.oeclass
+++ b/classes/cpio-image.oeclass
@@ -2,7 +2,7 @@ 
 IMAGE_BASENAME ?= "${MACHINE_ID}-${PN}"
 inherit image image_mdev image_inetd image_crontab image_makedevs image_inittab image_fstab
 
-RECIPE_FLAGS += "ramdisk_image \
+CLASS_FLAGS += "ramdisk_image \
     ramdisk_image_name ramdisk_image_compression"
 DEFAULT_USE_ramdisk_image = "0"
 DEFAULT_USE_ramdisk_image_name = "${IMAGE_BASENAME}"
@@ -27,13 +27,13 @@  cpio_mkimage () {
 	case "${USE_ramdisk_image_compression}" in
 		none) cp ${B}/${IMAGE_BASENAME}.cpio ${B}/image.bin
 			;;
-		bzip2) echo "TODO: ${USE_ramdisk_image_compression}"
+		bzip2) bzip2 ${B}/${IMAGE_BASENAME}.cpio -c > ${B}/image.bin
 			;;
 		gzip) gzip ${B}/${IMAGE_BASENAME}.cpio -c > ${B}/image.bin
 			;;
-		lzma) echo "TODO: ${USE_ramdisk_image_compression}"
+		lzma) lzma ${B}/${IMAGE_BASENAME}.cpio -c > ${B}/image.bin
 			;;
-		lzo) echo "TODO: ${USE_ramdisk_image_compression}"
+		lzo)  lzop ${B}/${IMAGE_BASENAME}.cpio -c > ${B}/image.bin
 			;;
 		*) echo "ERROR: mkimage compression ${USE_ramdisk_image_compression} not supported"
 			;;
diff --git a/classes/kernel.oeclass b/classes/kernel.oeclass
index 9ae662d..904dd05 100644
--- a/classes/kernel.oeclass
+++ b/classes/kernel.oeclass
@@ -39,6 +39,9 @@  KERNEL_INITRAMFS ?= "${MACHINE_SYSROOT}${bootdir}/initramfs.cpio"
 USE_KERNEL_INITRAMFS = "${USE_kernel_initramfs}"
 USE_KERNEL_INITRAMFS[expand] = "3"
 
+CLASS_FLAGS += "ramdisk_image_compression"
+DEFAULT_USE_ramdisk_image_compression = "none"
+
 do_configure_kernel () {
 	if [ "${DEFCONFIG}" = "file" ] ; then
 		cp ${DEFCONFIG_FILE} ${S}/.config
@@ -55,6 +58,13 @@  do_configure_kernel () {
 		echo 'CONFIG_INITRAMFS_SOURCE="${KERNEL_INITRAMFS}"' \
 			>> ${S}/.config
 		yes '' | oe_runmake oldconfig
+	case "${USE_cpio_image_compression}" in
+	lzma)	echo 'CONFIG_RD_LZMA=y' >> ${S}/.config
+		echo 'CONFIG_INITRAMFS_COMPRESSION_LZMA=y' >> ${S}/.config
+		;;
+	*)
+		;;
+	esac
 	fi
 }