Skip to contentSkip to conversation

linux: Do not force GZIP initramfs compression

PATCH New Valentine Barshak 4 participants 4 messages Oct 9, 2012 – Jul 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux: Do not force GZIP initramfs compression

Initramfs compression does not make much sense for the architectures that support compressed kernel images because in this case the data would be compressed twice. This will eventually result in a bigger kernel image and time overhead when uncompressing it.
The only reason to use compressed initramfs is to reduce memory usage when the kernel prepares rootfs, and both the unpacked filesystem and initramfs.cpio are present in the memory.

Buildroot attempts to force GZIP compression for initramfs, however it doesn't always work because initramfs compression mode depends on RAM disk compression supported by the kernel. Thus, CONFIG_INITRAMFS_COMPRESSION_GZIP depends on CONFIG_RD_GZIP. If CONFIG_RD_GZIP is not set, setting GZIP initramfs compression will have no effect.

Besides, the kernel also supports other compression methods, like BZIP2, LZMA, XZ and LZO. Forcing the good old GZIP does not really make much sense any more.

This removes initramfs compression settings from Buildroot, so that the default value preset in the kernel config is used, which is CONFIG_INITRAMFS_COMPRESSION_NONE.

If initramfs compression is still needed, it can be set in the kernel config (using make linux-menuconfig)

---
 fs/initramfs/Config.in | 4 ++--
 linux/linux.mk         | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)
fs/initramfs/Config.in +2 -2
index bbc2ab0..b71018e 100644
@@ -9,8 +9,8 @@ config BR2_TARGET_ROOTFS_INITRAMFS
 
 	  A rootfs.cpio file will be generated in the images/ directory.
 	  This is the archive that will be included in the kernel image.
-	  The rootfs in the kernel will always be gzip'ed, regardless
-	  of how buildroot's cpio archive is configured.
+	  The default rootfs compression set in the kernel configuration
+	  is used, regardless of how buildroot's cpio archive is configured.
 
 	  Note that enabling initramfs together with another filesystem
 	  formats doesn't make sense: you would end up having two
linux/linux.mk +1 -3
index c4bdf90..914c09a 100644
@@ -169,9 +169,7 @@ define LINUX_CONFIGURE_CMDS
 		$(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_INITRD,$(@D)/.config)
 		$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_SOURCE,\"$(BINARIES_DIR)/rootfs.cpio\",$(@D)/.config)
 		$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_ROOT_UID,0,$(@D)/.config)
-		$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_ROOT_GID,0,$(@D)/.config)
-		$(call KCONFIG_DISABLE_OPT,CONFIG_INITRAMFS_COMPRESSION_NONE,$(@D)/.config)
-		$(call KCONFIG_ENABLE_OPT,CONFIG_INITRAMFS_COMPRESSION_GZIP,$(@D)/.config))
+		$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_ROOT_GID,0,$(@D)/.config))
 	$(if $(BR2_ROOTFS_DEVICE_CREATION_STATIC),,
 		$(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS,$(@D)/.config)
 		$(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS_MOUNT,$(@D)/.config))
Signature · 1 line
1.7.11.4
#1 lore raw

PATCH 1/1 linux: Do not force GZIP initramfs compression

Quoted 19 lines · Valentine Barshak

Initramfs compression does not make much sense for the architectures that support compressed kernel images because in this case the data would be compressed twice. This will eventually result in a bigger kernel image and time overhead when uncompressing it.
The only reason to use compressed initramfs is to reduce memory usage when the kernel prepares rootfs, and both the unpacked filesystem and initramfs.cpio are present in the memory.

Buildroot attempts to force GZIP compression for initramfs, however it doesn't always work because initramfs compression mode depends on RAM disk compression supported by the kernel. Thus, CONFIG_INITRAMFS_COMPRESSION_GZIP depends on CONFIG_RD_GZIP. If CONFIG_RD_GZIP is not set, setting GZIP initramfs compression will have no effect.

Besides, the kernel also supports other compression methods, like BZIP2, LZMA, XZ and LZO. Forcing the good old GZIP does not really make much sense any more.

Quoted 8 lines

This removes initramfs compression settings from Buildroot, so that the default value preset in the kernel config is used, which is CONFIG_INITRAMFS_COMPRESSION_NONE.

If initramfs compression is still needed, it can be set in the kernel config (using make linux-menuconfig)

I especially like the extensive commit message!

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH 1/1 linux: Do not force GZIP initramfs compression

Agreed.

2012/10/10 Arnout Vandecappelle <[email protected]>

Quoted 51 lines · Valentine Barshak
Quoted 20 lines

Initramfs compression does not make much sense for the architectures that support compressed kernel images because in this case the data would be compressed twice. This will eventually result in a bigger kernel image and time overhead when uncompressing it.
The only reason to use compressed initramfs is to reduce memory usage when the kernel prepares rootfs, and both the unpacked filesystem and initramfs.cpio are present in the memory.

Buildroot attempts to force GZIP compression for initramfs, however it doesn't always work because initramfs compression mode depends on RAM disk compression supported by the kernel. Thus, CONFIG_INITRAMFS_COMPRESSION_**GZIP depends on CONFIG_RD_GZIP. If CONFIG_RD_GZIP is not set, setting GZIP initramfs compression will have no effect.

Besides, the kernel also supports other compression methods, like BZIP2, LZMA, XZ and LZO. Forcing the good old GZIP does not really make much sense any more.

Quoted 9 lines

This removes initramfs compression settings from Buildroot, so that the default value preset in the kernel config is used, which is CONFIG_INITRAMFS_COMPRESSION_**NONE.

If initramfs compression is still needed, it can be set in the kernel config (using make linux-menuconfig)

I especially like the extensive commit message!

Regards,
Arnout
--

Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR
Leuven
LinkedIn profile: http://www.linkedin.com/in/**arnoutvandecappelle<http://www.linkedin.com/in/arnoutvandecappelle>
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

______________________________**_________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/**mailman/listinfo/buildroot<http://lists.busybox.net/mailman/listinfo/buildroot>

Signature · 5 lines
Best Regards!
Kelvin Cheung
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130708/3008c21c/attachment.html>
#3 lore raw

PATCH 1/1 linux: Do not force GZIP initramfs compression

In reply to Valentine Barshak
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Valentine" == Valentine Barshak <[email protected]> writes:

Valentine> Initramfs compression does not make much sense for the architectures Valentine> that support compressed kernel images because in this case the data Valentine> would be compressed twice. This will eventually result in a bigger Valentine> kernel image and time overhead when uncompressing it. Valentine> The only reason to use compressed initramfs is to reduce memory Valentine> usage when the kernel prepares rootfs, and both the unpacked Valentine> filesystem and initramfs.cpio are present in the memory.

Valentine> Buildroot attempts to force GZIP compression for initramfs, Valentine> however it doesn't always work because initramfs compression mode Valentine> depends on RAM disk compression supported by the kernel. Valentine> Thus, CONFIG_INITRAMFS_COMPRESSION_GZIP depends on CONFIG_RD_GZIP. Valentine> If CONFIG_RD_GZIP is not set, setting GZIP initramfs compression Valentine> will have no effect.

Valentine> Besides, the kernel also supports other compression methods, Valentine> like BZIP2, LZMA, XZ and LZO. Forcing the good old GZIP does not Valentine> really make much sense any more.

Valentine> This removes initramfs compression settings from Buildroot, Valentine> so that the default value preset in the kernel config is used, Valentine> which is CONFIG_INITRAMFS_COMPRESSION_NONE.

Valentine> If initramfs compression is still needed, it can be set Valentine> in the kernel config (using make linux-menuconfig)

Sorry, this somehow seems to have fallen through the cracks - Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard