1
0
Fork 0
remarkable-linux/usr
Francisco Blas Izquierdo Riera (klondike) db2aa7fd15 initramfs: allow again choice of the embedded initram compression algorithm
Choosing the appropriate compression option when using an embedded
initramfs can result in significant size differences in the resulting
data.

This is caused by avoiding double compression of the initramfs contents.
For example on my tests, choosing CONFIG_INITRAMFS_COMPRESSION_NONE when
compressing the kernel using XZ) results in up to 500KiB differences
(9MiB to 8.5MiB) in the kernel size as the dictionary will not get
polluted with uncomprensible data and may reuse kernel data too.

Despite embedding an uncompressed initramfs, a user may want to allow
for a compressed extra initramfs to be passed using the rd system, for
example to boot a recovery system.  9ba4bcb645 ("initramfs: read
CONFIG_RD_ variables for initramfs compression") broke that behavior by
making the choice based on CONFIG_RD_* instead of adding
CONFIG_INITRAMFS_COMPRESSION_LZ4.  Saddly, CONFIG_RD_* is also used to
choose the supported RD compression algorithms by the kernel and a user
may want to support more than one.

This patch also reverts commit 3e4e0f0a87 ("initramfs: remove
"compression mode" choice") restoring back the "compression mode" choice
and includes the CONFIG_INITRAMFS_COMPRESSION_LZ4 option which was never
added.

As a result the following options are added or readed affecting the embedded
initramfs compression:
  INITRAMFS_COMPRESSION_NONE Do no compression
  INITRAMFS_COMPRESSION_GZIP Compress using gzip
  INITRAMFS_COMPRESSION_BZIP2 Compress using bzip2
  INITRAMFS_COMPRESSION_LZMA Compress using lzma
  INITRAMFS_COMPRESSION_XZ Compress using xz
  INITRAMFS_COMPRESSION_LZO Compress using lzo
  INITRAMFS_COMPRESSION_LZ4 Compress using lz4

These depend on the corresponding CONFIG_RD_* option being set (except
NONE which has no dependencies).

This patch depends on the previous one (the previous version didn't) to
simplify the way in which the algorithm is chosen and keep backwards
compatibility with the behaviour introduced by 9ba4bcb645
("initramfs: read CONFIG_RD_ variables for initramfs compression").

Link: http://lkml.kernel.org/r/57EAD77B.7090607@klondike.es
Signed-off-by: Francisco Blas Izquierdo Riera (klondike) <klondike@klondike.es>
Cc: P J P <ppandit@redhat.com>
Cc: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-14 16:04:08 -08:00
..
.gitignore gitignore usr/initramfs_data.cpio.bz2 and usr/initramfs_data.cpio.lzma 2009-09-20 12:27:42 +02:00
Kconfig initramfs: allow again choice of the embedded initram compression algorithm 2016-12-14 16:04:08 -08:00
Makefile initramfs: select builtin initram compression algorithm on KConfig instead of Makefile 2016-12-14 16:04:08 -08:00
gen_init_cpio.c gen_init_cpio: avoid NULL pointer dereference and rework env expanding 2013-11-13 12:09:12 +09:00
initramfs_data.S initramfs: Really fix build break on symbol-prefixed archs 2010-12-01 13:13:21 +01:00