diff options
author | Alain Knaff <alain@knaff.lu> | 2009-02-19 16:43:51 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2009-02-19 16:43:51 -0500 |
commit | ab76f3d771590d5c89faa3219559c5d3fc0ce0c2 (patch) | |
tree | 4433427c29c34e8fc1ab7ba50bb381f8f5b2051d | |
parent | ab59d3b70f7a47987f80e153d828363faec643fe (diff) |
bzip2/lzma: make internal initramfs compression configurable
Impact: Avoids silent environment dependency
Make builtin initramfs compression an explicit configurable. The
previous version would pick a compression based on the binaries which
were installed on the system, which could lead to unexpected results.
It is now explicitly configured, and not having the appropriate
binaries installed on the build host is simply an error.
Signed-off-by: Alain Knaff <alain@knaff.lu>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | usr/Kconfig | 62 | ||||
-rw-r--r-- | usr/Makefile | 18 |
2 files changed, 68 insertions, 12 deletions
diff --git a/usr/Kconfig b/usr/Kconfig index a691a8f5898b..43a3a0fe8f29 100644 --- a/usr/Kconfig +++ b/usr/Kconfig | |||
@@ -71,3 +71,65 @@ config RD_LZMA | |||
71 | help | 71 | help |
72 | Support loading of a lzma encoded initial ramdisk or cpio buffer | 72 | Support loading of a lzma encoded initial ramdisk or cpio buffer |
73 | If unsure, say N. | 73 | If unsure, say N. |
74 | |||
75 | choice | ||
76 | prompt "Built-in initramfs compression mode" | ||
77 | help | ||
78 | This setting is only meaningful if the INITRAMFS_SOURCE is | ||
79 | set. It decides by which algorithm the INITRAMFS_SOURCE will | ||
80 | be compressed. | ||
81 | Several compression algorithms are available, which differ | ||
82 | in efficiency, compression and decompression speed. | ||
83 | Compression speed is only relevant when building a kernel. | ||
84 | Decompression speed is relevant at each boot. | ||
85 | |||
86 | If you have any problems with bzip2 or lzma compressed | ||
87 | initramfs, mail me (Alain Knaff) <alain@knaff.lu>. | ||
88 | |||
89 | High compression options are mostly useful for users who | ||
90 | are low on disk space (embedded systems), but for whom ram | ||
91 | size matters less. | ||
92 | |||
93 | If in doubt, select 'gzip' | ||
94 | |||
95 | config INITRAMFS_COMPRESSION_NONE | ||
96 | bool "None" | ||
97 | help | ||
98 | Do not compress the built-in initramfs at all. This may | ||
99 | sound wasteful in space, but, you should be aware that the | ||
100 | built-in initramfs will be compressed at a later stage | ||
101 | anyways along with the rest of the kernel, on those | ||
102 | architectures that support this. | ||
103 | However, not compressing the initramfs may lead to slightly | ||
104 | higher memory consumption during a short time at boot, while | ||
105 | both the cpio image and the unpacked filesystem image will | ||
106 | be present in memory simultaneously | ||
107 | |||
108 | config INITRAMFS_COMPRESSION_GZIP | ||
109 | bool "Gzip" | ||
110 | depends on RD_GZIP | ||
111 | help | ||
112 | The old and tried gzip compression. Its compression ratio is | ||
113 | the poorest among the 3 choices; however its speed (both | ||
114 | compression and decompression) is the fastest. | ||
115 | |||
116 | config INITRAMFS_COMPRESSION_BZIP2 | ||
117 | bool "Bzip2" | ||
118 | depends on RD_BZIP2 | ||
119 | help | ||
120 | Its compression ratio and speed is intermediate. | ||
121 | Decompression speed is slowest among the three. The initramfs | ||
122 | size is about 10% smaller with bzip2, in comparison to gzip. | ||
123 | Bzip2 uses a large amount of memory. For modern kernels you | ||
124 | will need at least 8MB RAM or more for booting. | ||
125 | |||
126 | config INITRAMFS_COMPRESSION_LZMA | ||
127 | bool "LZMA" | ||
128 | depends on RD_LZMA | ||
129 | help | ||
130 | The most recent compression algorithm. | ||
131 | Its ratio is best, decompression speed is between the other | ||
132 | two. Compression is slowest. The initramfs size is about 33% | ||
133 | smaller with LZMA in comparison to gzip. | ||
134 | |||
135 | endchoice | ||
diff --git a/usr/Makefile b/usr/Makefile index 451cdff7dff9..b84894b3929d 100644 --- a/usr/Makefile +++ b/usr/Makefile | |||
@@ -5,24 +5,18 @@ | |||
5 | klibcdirs:; | 5 | klibcdirs:; |
6 | PHONY += klibcdirs | 6 | PHONY += klibcdirs |
7 | 7 | ||
8 | # Find out "preferred" ramdisk compressor. Order of preference is | ||
9 | # 1. bzip2 efficient, and likely to be present | ||
10 | # 2. gzip former default | ||
11 | # 3. lzma | ||
12 | # 4. none | ||
13 | 8 | ||
14 | # None of the above | 9 | # No compression |
15 | suffix_y = | 10 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_NONE) = |
16 | |||
17 | # Lzma, but no gzip nor bzip2 | ||
18 | suffix_$(CONFIG_RD_LZMA) = .lzma | ||
19 | 11 | ||
20 | # Gzip, but no bzip2 | 12 | # Gzip, but no bzip2 |
21 | suffix_$(CONFIG_RD_GZIP) = .gz | 13 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_GZIP) = .gz |
22 | 14 | ||
23 | # Bzip2 | 15 | # Bzip2 |
24 | suffix_$(CONFIG_RD_BZIP2) = .bz2 | 16 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) = .bz2 |
25 | 17 | ||
18 | # Lzma | ||
19 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma | ||
26 | 20 | ||
27 | # Generate builtin.o based on initramfs_data.o | 21 | # Generate builtin.o based on initramfs_data.o |
28 | obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data$(suffix_y).o | 22 | obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data$(suffix_y).o |