Skip to content

Commit 1bf49dd

Browse files
P J Ptorvalds
authored andcommitted
./Makefile: export initial ramdisk compression config option
Make menuconfig allows one to choose compression format of an initial ramdisk image. But this choice does not result in duly compressed ramdisk image. Because - $ make install - does not pass on the selected compression choice to the dracut(8) tool, which creates the initramfs file. dracut(8) generates the image with the default compression, ie. gzip(1). This patch exports the selected compression option to a sub-shell environment, so that it could be used by dracut(8) tool to generate appropriately compressed initramfs images. There isn't a straightforward way to pass on options to dracut(8) via positional parameters. Because it is indirectly invoked at the end of a $ make install sequence. # make install -> arch/$arch/boot/Makefile -> arch/$arch/boot/install.sh -> /sbing/installkernel ... -> /sbin/new-kernel-pkg ... -> /sbin/dracut ... Signed-off-by: P J P <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 69f0554 commit 1bf49dd

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,22 @@ mod_strip_cmd = true
720720
endif # INSTALL_MOD_STRIP
721721
export mod_strip_cmd
722722

723+
# Select initial ramdisk compression format, default is gzip(1).
724+
# This shall be used by the dracut(8) tool while creating an initramfs image.
725+
#
726+
INITRD_COMPRESS=gzip
727+
ifeq ($(CONFIG_RD_BZIP2), y)
728+
INITRD_COMPRESS=bzip2
729+
else ifeq ($(CONFIG_RD_LZMA), y)
730+
INITRD_COMPRESS=lzma
731+
else ifeq ($(CONFIG_RD_XZ), y)
732+
INITRD_COMPRESS=xz
733+
else ifeq ($(CONFIG_RD_LZO), y)
734+
INITRD_COMPRESS=lzo
735+
else ifeq ($(CONFIG_RD_LZ4), y)
736+
INITRD_COMPRESS=lz4
737+
endif
738+
export INITRD_COMPRESS
723739

724740
ifdef CONFIG_MODULE_SIG_ALL
725741
MODSECKEY = ./signing_key.priv

init/do_mounts_rd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ static int __init crd_load(int in_fd, int out_fd, decompress_fn deco);
5757
* cramfs
5858
* squashfs
5959
* gzip
60+
* bzip2
61+
* lzma
62+
* xz
63+
* lzo
64+
* lz4
6065
*/
6166
static int __init
6267
identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)

0 commit comments

Comments
 (0)