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: doc/, /
Date: Tue, 03 Jan 2017 05:16:39
Message-Id: 1483420546.c2525c65b9f3d5849963bab6beb40817d7720218.robbat2@gentoo
1 commit: c2525c65b9f3d5849963bab6beb40817d7720218
2 Author: Robert Trace <bugzilla-gentoo <AT> farcaster <DOT> org>
3 AuthorDate: Tue Jan 3 05:15:46 2017 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 3 05:15:46 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c2525c65
7
8 Strip kernel & modules
9
10 Rebased and tweaked to apply since the original patch was ~7 years old.
11
12 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
13
14 doc/genkernel.8.txt | 7 +++++++
15 gen_cmdline.sh | 13 +++++++++++++
16 gen_compile.sh | 9 +++++++++
17 gen_determineargs.sh | 1 +
18 gen_funcs.sh | 6 ++++++
19 5 files changed, 36 insertions(+)
20
21 diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
22 index a2d3c22..ca8eff0 100644
23 --- a/doc/genkernel.8.txt
24 +++ b/doc/genkernel.8.txt
25 @@ -384,6 +384,13 @@ OUTPUT SETTINGS
26 Directory structure to include in the initramfs, only available
27 on >=2.6 kernels
28
29 +*--strip*=<all|kernel|modules|none>::
30 + Strip debug symbols from the installed kernel, modules, all
31 + (default) or none.
32 +
33 +*--no-strip*::
34 + Alias for *--strip=none*.
35 +
36 *--*[*no-*]*firmware*::
37 Enable or disables copying of firmware into initramfs.
38
39
40 diff --git a/gen_cmdline.sh b/gen_cmdline.sh
41 index 0e1e7ef..37d1b5c 100755
42 --- a/gen_cmdline.sh
43 +++ b/gen_cmdline.sh
44 @@ -174,6 +174,11 @@ longusage() {
45 echo " Compress or do not compress the generated initramfs"
46 echo " --compress-initramfs-type=<arg>"
47 echo " Compression type for initramfs (best, xz, lzma, bzip2, gzip, lzop)"
48 + echo " --strip=(all|kernel|modules|none)"
49 + echo " Strip debug symbols from the installed kernel, modules,"
50 + echo " all (default) or none"
51 + echo " --no-strip"
52 + echo " Don't strip installed kernel or modules (alias for --strip=none)"
53 echo
54 echo "For a detailed list of supported initramfs options and flags; issue:"
55 echo " man 8 genkernel"
56 @@ -669,6 +674,14 @@ parse_cmdline() {
57 CMD_NICE=0
58 print_info 2 "CMD_NICE: ${CMD_NICE}"
59 ;;
60 + --strip=*)
61 + CMD_STRIP_TYPE=`parse_opt "$*"`
62 + print_info 2 "CMD_STRIP_TYPE: ${CMD_STRIP_TYPE}"
63 + ;;
64 + --no-strip)
65 + CMD_STRIP_TYPE=none
66 + print_info 2 "CMD_STRIP_TYPE: ${CMD_STRIP_TYPE}"
67 + ;;
68 all)
69 BUILD_KERNEL=1
70 BUILD_MODULES=1
71
72 diff --git a/gen_compile.sh b/gen_compile.sh
73 index 7cc4733..ef72a23 100755
74 --- a/gen_compile.sh
75 +++ b/gen_compile.sh
76 @@ -306,6 +306,14 @@ compile_modules() {
77 compile_generic modules kernel
78 export UNAME_MACHINE="${ARCH}"
79 [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH
80 + if [ "${CMD_STRIP_TYPE}" == "all" -o "${CMD_STRIP_TYPE}" == "modules" ]
81 + then
82 + print_info 1 " >> Installing ${KV} modules (and stripping)"
83 + INSTALL_MOD_STRIP=1
84 + export INSTALL_MOD_STRIP
85 + else
86 + print_info 1 " >> Installing ${KV} modules"
87 + fi
88 MAKEOPTS="${MAKEOPTS} -j1" compile_generic "modules_install" kernel
89 print_info 1 " >> Generating module dependency data..."
90 if [ "${INSTALL_MOD_PATH}" != '' ]
91 @@ -315,6 +323,7 @@ compile_modules() {
92 depmod -a -e -F "${KERNEL_OUTPUTDIR}"/System.map ${KV}
93 fi
94 unset UNAME_MACHINE
95 + unset INSTALL_MOD_STRIP
96 }
97
98 compile_kernel() {
99
100 diff --git a/gen_determineargs.sh b/gen_determineargs.sh
101 index 313dbd0..5f77c07 100755
102 --- a/gen_determineargs.sh
103 +++ b/gen_determineargs.sh
104 @@ -142,6 +142,7 @@ determine_real_args() {
105 set_config_with_override BOOL KEYMAP CMD_KEYMAP "yes"
106 set_config_with_override BOOL DOKEYMAPAUTO CMD_DOKEYMAPAUTO
107 set_config_with_override STRING BUSYBOX_CONFIG CMD_BUSYBOX_CONFIG
108 + set_config_with_override STRING STRIP_TYPE CMD_STRIP_TYPE "all"
109 set_config_with_override BOOL INSTALL CMD_INSTALL "yes"
110 set_config_with_override BOOL DEBUGCLEANUP CMD_DEBUGCLEANUP "yes"
111
112
113 diff --git a/gen_funcs.sh b/gen_funcs.sh
114 index 6234189..0e22a86 100755
115 --- a/gen_funcs.sh
116 +++ b/gen_funcs.sh
117 @@ -388,6 +388,12 @@ copy_image_with_preserve() {
118 cp "${newSrceImage}" "${BOOTDIR}/${currDestImage}" ||
119 gen_die "Could not copy the ${symlinkName} image to ${BOOTDIR}!"
120
121 + if [ "${CMD_STRIP_TYPE}" = "all" -o "${CMD_STRIP_TYPE}" = "kernel" ]
122 + then
123 + print_info 5 " Stripping ${BOOTDIR}/${currDestImage}"
124 + strip --strip-debug "${BOOTDIR}/${currDestImage}" >/dev/null 2>&1
125 + fi
126 +
127 if [ "${SYMLINK}" = '1' ]
128 then
129 print_info 5 " Make new symlink(s) (from ${BOOTDIR}):"