Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: /, arch/parisc64/, arch/x86/, doc/, arch/alpha/, arch/arm/, arch/sparc64/, ...
Date: Sat, 28 Jan 2012 20:23:15
Message-Id: 73520cb6b2e2479bf230d114d0dcb90f6ccd100c.robbat2@gentoo
1 commit: 73520cb6b2e2479bf230d114d0dcb90f6ccd100c
2 Author: Richard Yao <ryao <AT> cs <DOT> stonybrook <DOT> edu>
3 AuthorDate: Sat Jan 28 01:08:58 2012 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 28 20:17:00 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=73520cb6
7
8 Implement --[no-]compress-initramfs option to complement --[no-]integrated-initramfs
9
10 When using an integrated initramfs (including in kernel during build),
11 it's better NOT to compress the initramfs, as the kernel build process
12 will then be re-compressing it. This can provide space savings on disk
13 as well as potential time & memory savings (one less decompress pass is
14 needed before the kernel can use the initramfs).
15
16 This functionality was previously available in the undocumented
17 COMPRESS_INITRD variable.
18
19 Code-by: Richard Yao <ryao <AT> cs.stonybrook.edu>
20 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
21 (commit message rewritten).
22
23 ---
24 arch/alpha/config.sh | 4 ++--
25 arch/arm/config.sh | 4 ++--
26 arch/ia64/config.sh | 4 ++--
27 arch/mips/config.sh | 2 +-
28 arch/parisc/config.sh | 4 ++--
29 arch/parisc64/config.sh | 4 ++--
30 arch/ppc/config.sh | 4 ++--
31 arch/ppc64/config.sh | 4 ++--
32 arch/sparc/config.sh | 3 ++-
33 arch/sparc64/config.sh | 3 ++-
34 arch/um/config.sh | 3 ++-
35 arch/x86/config.sh | 4 ++--
36 arch/x86_64/config.sh | 4 ++--
37 doc/genkernel.8.txt | 3 +++
38 gen_cmdline.sh | 6 ++++++
39 gen_determineargs.sh | 1 +
40 gen_initramfs.sh | 16 ++++++++++++----
41 genkernel.conf | 4 ++++
42 18 files changed, 51 insertions(+), 26 deletions(-)
43
44 diff --git a/arch/alpha/config.sh b/arch/alpha/config.sh
45 index 44494f1..2692f23 100755
46 --- a/arch/alpha/config.sh
47 +++ b/arch/alpha/config.sh
48 @@ -6,12 +6,12 @@ KERNEL_MAKE_DIRECTIVE="boot"
49 KERNEL_MAKE_DIRECTIVE_2=""
50 KERNEL_BINARY="arch/alpha/boot/vmlinux.gz"
51
52 -COMPRESS_INITRD=yes
53 -
54 #
55 # Arch-specific defaults that can be overridden in the config file or on the
56 # command line.
57 #
58 +DEFAULT_COMPRESS_INITRD=yes
59 +
60 DEFAULT_MAKEOPTS="-j2"
61
62 DEFAULT_KERNEL_MAKE=make
63
64 diff --git a/arch/arm/config.sh b/arch/arm/config.sh
65 index 52ec777..7ce427e 100755
66 --- a/arch/arm/config.sh
67 +++ b/arch/arm/config.sh
68 @@ -6,12 +6,12 @@ KERNEL_MAKE_DIRECTIVE=""
69 KERNEL_MAKE_DIRECTIVE_2=""
70 KERNEL_BINARY="arch/arm/boot/zImage"
71
72 -COMPRESS_INITRD=yes
73 -
74 #
75 # Arch-specific defaults that can be overridden in the config file or on the
76 # command line.
77 #
78 +DEFAULT_COMPRESS_INITRD=yes
79 +
80 DEFAULT_MAKEOPTS="-j2"
81
82 DEFAULT_KERNEL_MAKE=make
83
84 diff --git a/arch/ia64/config.sh b/arch/ia64/config.sh
85 index 38f1bc1..9b61bce 100755
86 --- a/arch/ia64/config.sh
87 +++ b/arch/ia64/config.sh
88 @@ -6,12 +6,12 @@ KERNEL_MAKE_DIRECTIVE=""
89 KERNEL_MAKE_DIRECTIVE_2=""
90 KERNEL_BINARY="vmlinux.gz"
91
92 -COMPRESS_INITRD=yes
93 -
94 #
95 # Arch-specific defaults that can be overridden in the config file or on the
96 # command line.
97 #
98 +DEFAULT_COMPRESS_INITRD=yes
99 +
100 DEFAULT_MAKEOPTS="-j2"
101
102 DEFAULT_KERNEL_MAKE=make
103
104 diff --git a/arch/mips/config.sh b/arch/mips/config.sh
105 index 9d49c09..939fb96 100755
106 --- a/arch/mips/config.sh
107 +++ b/arch/mips/config.sh
108 @@ -7,7 +7,6 @@ KERNEL_MAKE_DIRECTIVE_2=""
109 KERNEL_BINARY="./vmlinux"
110
111 # Initrd/Initramfs Options
112 -COMPRESS_INITRD="yes"
113 USECOLOR="yes"
114 NOINITRDMODULES="yes"
115 BUSYBOX=1
116 @@ -22,6 +21,7 @@ CMD_INSTALL=0
117 # Arch-specific defaults that can be overridden in the config file or on the
118 # command line.
119 #
120 +DEFAULT_COMPRESS_INITRD="yes"
121 DEFAULT_KERNEL_MAKE=make
122 DEFAULT_UTILS_MAKE=make
123 DEFAULT_UTILS_CC=gcc
124
125 diff --git a/arch/parisc/config.sh b/arch/parisc/config.sh
126 index 3e2049f..c31b316 100755
127 --- a/arch/parisc/config.sh
128 +++ b/arch/parisc/config.sh
129 @@ -6,12 +6,12 @@ KERNEL_MAKE_DIRECTIVE="vmlinux"
130 KERNEL_MAKE_DIRECTIVE_2=""
131 KERNEL_BINARY="vmlinux"
132
133 -COMPRESS_INITRD=yes
134 -
135 #
136 # Arch-specific defaults that can be overridden in the config file or on the
137 # command line.
138 #
139 +DEFAULT_COMPRESS_INITRD=yes
140 +
141 DEFAULT_MAKEOPTS="-j2"
142
143 DEFAULT_KERNEL_MAKE=make
144
145 diff --git a/arch/parisc64/config.sh b/arch/parisc64/config.sh
146 index 3e2049f..c31b316 100755
147 --- a/arch/parisc64/config.sh
148 +++ b/arch/parisc64/config.sh
149 @@ -6,12 +6,12 @@ KERNEL_MAKE_DIRECTIVE="vmlinux"
150 KERNEL_MAKE_DIRECTIVE_2=""
151 KERNEL_BINARY="vmlinux"
152
153 -COMPRESS_INITRD=yes
154 -
155 #
156 # Arch-specific defaults that can be overridden in the config file or on the
157 # command line.
158 #
159 +DEFAULT_COMPRESS_INITRD=yes
160 +
161 DEFAULT_MAKEOPTS="-j2"
162
163 DEFAULT_KERNEL_MAKE=make
164
165 diff --git a/arch/ppc/config.sh b/arch/ppc/config.sh
166 index e86e926..e661c5a 100755
167 --- a/arch/ppc/config.sh
168 +++ b/arch/ppc/config.sh
169 @@ -5,12 +5,12 @@
170 KERNEL_MAKE_DIRECTIVE="vmlinux"
171 KERNEL_BINARY="vmlinux"
172
173 -COMPRESS_INITRD=yes
174 -
175 #
176 # Arch-specific defaults that can be overridden in the config file or on the
177 # command line.
178 #
179 +DEFAULT_COMPRESS_INITRD=yes
180 +
181 DEFAULT_MAKEOPTS="-j2"
182
183 DEFAULT_KERNEL_MAKE=make
184
185 diff --git a/arch/ppc64/config.sh b/arch/ppc64/config.sh
186 index e86e926..e661c5a 100755
187 --- a/arch/ppc64/config.sh
188 +++ b/arch/ppc64/config.sh
189 @@ -5,12 +5,12 @@
190 KERNEL_MAKE_DIRECTIVE="vmlinux"
191 KERNEL_BINARY="vmlinux"
192
193 -COMPRESS_INITRD=yes
194 -
195 #
196 # Arch-specific defaults that can be overridden in the config file or on the
197 # command line.
198 #
199 +DEFAULT_COMPRESS_INITRD=yes
200 +
201 DEFAULT_MAKEOPTS="-j2"
202
203 DEFAULT_KERNEL_MAKE=make
204
205 diff --git a/arch/sparc/config.sh b/arch/sparc/config.sh
206 index 34cec73..3d62347 100755
207 --- a/arch/sparc/config.sh
208 +++ b/arch/sparc/config.sh
209 @@ -6,13 +6,14 @@ KERNEL_MAKE_DIRECTIVE="vmlinux"
210 KERNEL_MAKE_DIRECTIVE_2=""
211 KERNEL_BINARY="vmlinux"
212
213 -COMPRESS_INITRD=yes
214 USECOLOR="no"
215
216 #
217 # Arch-specific defaults that can be overridden in the config file or on the
218 # command line.
219 #
220 +DEFAULT_COMPRESS_INITRD=yes
221 +
222 DEFAULT_MAKEOPTS="-j1"
223
224 DEFAULT_KERNEL_MAKE=make
225
226 diff --git a/arch/sparc64/config.sh b/arch/sparc64/config.sh
227 index d1e37d5..563ebd9 100755
228 --- a/arch/sparc64/config.sh
229 +++ b/arch/sparc64/config.sh
230 @@ -6,13 +6,14 @@ KERNEL_MAKE_DIRECTIVE="vmlinux"
231 KERNEL_MAKE_DIRECTIVE_2="image"
232 KERNEL_BINARY="arch/sparc64/boot/image arch/sparc/boot/image"
233
234 -COMPRESS_INITRD=yes
235 USECOLOR="no"
236
237 #
238 # Arch-specific defaults that can be overridden in the config file or on the
239 # command line.
240 #
241 +DEFAULT_COMPRESS_INITRD=yes
242 +
243 DEFAULT_MAKEOPTS="-j2"
244
245 DEFAULT_KERNEL_MAKE=make
246
247 diff --git a/arch/um/config.sh b/arch/um/config.sh
248 index 070602e..7955a85 100755
249 --- a/arch/um/config.sh
250 +++ b/arch/um/config.sh
251 @@ -6,13 +6,14 @@ KERNEL_MAKE_DIRECTIVE="linux"
252 KERNEL_MAKE_DIRECTIVE_2=""
253 KERNEL_BINARY="linux"
254
255 -COMPRESS_INITRD=yes
256 ARCH_HAVENOPREPARE=yes
257
258 #
259 # Arch-specific defaults that can be overridden in the config file or on the
260 # command line.
261 #
262 +DEFAULT_COMPRESS_INITRD=yes
263 +
264 DEFAULT_MAKEOPTS="-j2"
265
266 DEFAULT_KERNEL_MAKE="make ARCH=um"
267
268 diff --git a/arch/x86/config.sh b/arch/x86/config.sh
269 index 7f339ea..6f14cef 100755
270 --- a/arch/x86/config.sh
271 +++ b/arch/x86/config.sh
272 @@ -6,12 +6,12 @@ KERNEL_MAKE_DIRECTIVE="bzImage"
273 KERNEL_MAKE_DIRECTIVE_2=""
274 KERNEL_BINARY="arch/i386/boot/bzImage"
275
276 -COMPRESS_INITRD=yes
277 -
278 #
279 # Arch-specific defaults that can be overridden in the config file or on the
280 # command line.
281 #
282 +DEFAULT_COMPRESS_INITRD=yes
283 +
284 DEFAULT_MAKEOPTS="-j2"
285
286 DEFAULT_KERNEL_MAKE=make
287
288 diff --git a/arch/x86_64/config.sh b/arch/x86_64/config.sh
289 index 8e692e8..0a903e1 100755
290 --- a/arch/x86_64/config.sh
291 +++ b/arch/x86_64/config.sh
292 @@ -6,12 +6,12 @@ KERNEL_MAKE_DIRECTIVE="bzImage"
293 KERNEL_MAKE_DIRECTIVE_2=""
294 KERNEL_BINARY="arch/x86_64/boot/bzImage"
295
296 -COMPRESS_INITRD=yes
297 -
298 #
299 # Arch-specific defaults that can be overridden in the config file or on the
300 # command line.
301 #
302 +DEFAULT_COMPRESS_INITRD=yes
303 +
304 DEFAULT_MAKEOPTS="-j2"
305
306 DEFAULT_KERNEL_MAKE=make
307
308 diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
309 index 703f8e1..1e02fb7 100644
310 --- a/doc/genkernel.8.txt
311 +++ b/doc/genkernel.8.txt
312 @@ -361,6 +361,9 @@ OUTPUT SETTINGS
313 Builds or does not build the generated initramfs into the kernel instead
314 of keeping it as a separate file.
315
316 +*--*[*no-*]*compress-initramfs*::
317 + Compresses or does not compress the generated initramfs.
318 +
319
320 RAMDISK OPTIONS
321 ---------------
322
323 diff --git a/gen_cmdline.sh b/gen_cmdline.sh
324 index a89636c..4c04f94 100755
325 --- a/gen_cmdline.sh
326 +++ b/gen_cmdline.sh
327 @@ -149,6 +149,8 @@ longusage() {
328 echo " --integrated-initramfs, --no-integrated-initramfs"
329 echo " Include/exclude the generated initramfs in the kernel"
330 echo " instead of keeping it as a separate file"
331 + echo " --compress-initramfs, --no-compress-initramfs"
332 + echo " Compress or do not compress the generated initramfs"
333 }
334
335 usage() {
336 @@ -529,6 +531,10 @@ parse_cmdline() {
337 CMD_INTEGRATED_INITRAMFS=`parse_optbool "$*"`
338 print_info 2 "CMD_INTEGRATED_INITRAMFS=${CMD_INTEGRATED_INITRAMFS}"
339 ;;
340 + --compress-initramfs|--no-compress-initramfs)
341 + CMD_COMPRESS_INITRD=`parse_optbool "$*"`
342 + print_info 2 "CMD_COMPRESS_INITRD=${CMD_COMPRESS_INITRD}"
343 + ;;
344 --config=*)
345 print_info 2 "CMD_GK_CONFIG: `parse_opt "$*"`"
346 ;;
347
348 diff --git a/gen_determineargs.sh b/gen_determineargs.sh
349 index 66f7ee1..b12efca 100755
350 --- a/gen_determineargs.sh
351 +++ b/gen_determineargs.sh
352 @@ -75,6 +75,7 @@ determine_real_args() {
353 set_config_with_override BOOL KERNEL_SOURCES CMD_KERNEL_SOURCES "yes"
354 set_config_with_override STRING KNAME CMD_KERNNAME "genkernel"
355
356 + set_config_with_override STRING COMPRESS_INITRD CMD_COMPRESS_INITRD "$DEFAULT_COMPRESS_INITRD"
357 set_config_with_override STRING MAKEOPTS CMD_MAKEOPTS "$DEFAULT_MAKEOPTS"
358 set_config_with_override STRING KERNEL_MAKE CMD_KERNEL_MAKE "$DEFAULT_KERNEL_MAKE"
359 set_config_with_override STRING UTILS_MAKE CMD_UTILS_MAKE "$DEFAULT_UTILS_MAKE"
360
361 diff --git a/gen_initramfs.sh b/gen_initramfs.sh
362 index cfcfe97..32a1b1e 100755
363 --- a/gen_initramfs.sh
364 +++ b/gen_initramfs.sh
365 @@ -631,6 +631,7 @@ append_data() {
366 }
367
368 create_initramfs() {
369 + local compress_ext=""
370 print_info 1 "initramfs: >> Initializing..."
371
372 # Create empty cpio
373 @@ -673,16 +674,23 @@ create_initramfs() {
374 append_data 'overlay'
375 fi
376
377 - gzip -9 "${CPIO}"
378 - mv -f "${CPIO}.gz" "${CPIO}"
379 + # Implement support for disabling compression
380 + if isTrue "${COMPRESS_INITRD}"
381 + then
382 + compress_ext=".gz"
383 + print_info 1 " >> Compressing cpio data..."
384 + gzip -9 "${CPIO}" || gen_die "Compression failed"
385 + mv -f "${CPIO}.gz" "${CPIO}" || gen_die "Rename failed"
386 + fi
387 +
388
389 if isTrue "${INTEGRATED_INITRAMFS}"
390 then
391 # cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/usr/initramfs_data.cpio.gz
392 - mv ${TMPDIR}/initramfs-${KV} ${TMPDIR}/initramfs-${KV}.cpio.gz
393 + mv ${TMPDIR}/initramfs-${KV} ${TMPDIR}/initramfs-${KV}.cpio${compress_ext}
394 # sed -i "s|^.*CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio.gz\"|" ${KERNEL_DIR}/.config
395 sed -i '/^.*CONFIG_INITRAMFS_SOURCE=.*$/d' ${KERNEL_DIR}/.config
396 - echo -e "CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio.gz\"\nCONFIG_INITRAMFS_ROOT_UID=0\nCONFIG_INITRAMFS_ROOT_GID=0" >> ${KERNEL_DIR}/.config
397 + echo -e "CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio${compress_ext}\"\nCONFIG_INITRAMFS_ROOT_UID=0\nCONFIG_INITRAMFS_ROOT_GID=0" >> ${KERNEL_DIR}/.config
398 fi
399
400 if isTrue "${CMD_INSTALL}"
401
402 diff --git a/genkernel.conf b/genkernel.conf
403 index b39a952..7032ac7 100644
404 --- a/genkernel.conf
405 +++ b/genkernel.conf
406 @@ -317,6 +317,10 @@ GPG_BINCACHE="%%CACHE%%/gnupg-${GPG_VER}-%%ARCH%%.bz2"
407 #INTEGRATED_INITRAMFS="1"
408
409
410 +# Compress generated initramfs
411 +#COMPRESS_INITRD="yes"
412 +
413 +
414 # Create a self-contained env in the initramfs
415 #NETBOOT="1"