public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:master commit in: doc/, /
Date: Tue,  3 Jan 2017 05:16:35 +0000 (UTC)	[thread overview]
Message-ID: <1483420546.c2525c65b9f3d5849963bab6beb40817d7720218.robbat2@gentoo> (raw)

commit:     c2525c65b9f3d5849963bab6beb40817d7720218
Author:     Robert Trace <bugzilla-gentoo <AT> farcaster <DOT> org>
AuthorDate: Tue Jan  3 05:15:46 2017 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Jan  3 05:15:46 2017 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c2525c65

Strip kernel & modules

Rebased and tweaked to apply since the original patch was ~7 years old.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 doc/genkernel.8.txt  |  7 +++++++
 gen_cmdline.sh       | 13 +++++++++++++
 gen_compile.sh       |  9 +++++++++
 gen_determineargs.sh |  1 +
 gen_funcs.sh         |  6 ++++++
 5 files changed, 36 insertions(+)

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index a2d3c22..ca8eff0 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -384,6 +384,13 @@ OUTPUT SETTINGS
     Directory structure to include in the initramfs, only available
     on >=2.6 kernels
 
+*--strip*=<all|kernel|modules|none>::
+    Strip debug symbols from the installed kernel, modules, all
+    (default) or none.
+
+*--no-strip*::
+    Alias for *--strip=none*.
+
 *--*[*no-*]*firmware*::
     Enable or disables copying of firmware into initramfs.
 

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 0e1e7ef..37d1b5c 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -174,6 +174,11 @@ longusage() {
   echo "				Compress or do not compress the generated initramfs"
   echo "	--compress-initramfs-type=<arg>"
   echo "				Compression type for initramfs (best, xz, lzma, bzip2, gzip, lzop)"
+  echo "	--strip=(all|kernel|modules|none)"
+  echo "				Strip debug symbols from the installed kernel, modules,"
+  echo "				all (default) or none"
+  echo "	--no-strip"
+  echo "				Don't strip installed kernel or modules (alias for --strip=none)"
   echo
   echo "For a detailed list of supported initramfs options and flags; issue:"
   echo "	man 8 genkernel"
@@ -669,6 +674,14 @@ parse_cmdline() {
 			CMD_NICE=0
 			print_info 2 "CMD_NICE: ${CMD_NICE}"
 			;;
+		--strip=*)
+			CMD_STRIP_TYPE=`parse_opt "$*"`
+			print_info 2 "CMD_STRIP_TYPE: ${CMD_STRIP_TYPE}"
+			;;
+		--no-strip)
+			CMD_STRIP_TYPE=none
+			print_info 2 "CMD_STRIP_TYPE: ${CMD_STRIP_TYPE}"
+			;;
 		all)
 			BUILD_KERNEL=1
 			BUILD_MODULES=1

diff --git a/gen_compile.sh b/gen_compile.sh
index 7cc4733..ef72a23 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -306,6 +306,14 @@ compile_modules() {
 	compile_generic modules kernel
 	export UNAME_MACHINE="${ARCH}"
 	[ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH
+	if [ "${CMD_STRIP_TYPE}" == "all" -o "${CMD_STRIP_TYPE}" == "modules" ]
+	then
+		print_info 1 "        >> Installing ${KV} modules (and stripping)"
+		INSTALL_MOD_STRIP=1
+		export INSTALL_MOD_STRIP
+	else
+		print_info 1 "        >> Installing ${KV} modules"
+	fi
 	MAKEOPTS="${MAKEOPTS} -j1" compile_generic "modules_install" kernel
 	print_info 1 "        >> Generating module dependency data..."
 	if [ "${INSTALL_MOD_PATH}" != '' ]
@@ -315,6 +323,7 @@ compile_modules() {
 		depmod -a -e -F "${KERNEL_OUTPUTDIR}"/System.map ${KV}
 	fi
 	unset UNAME_MACHINE
+	unset INSTALL_MOD_STRIP
 }
 
 compile_kernel() {

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 313dbd0..5f77c07 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -142,6 +142,7 @@ determine_real_args() {
 	set_config_with_override BOOL   KEYMAP               CMD_KEYMAP               "yes"
 	set_config_with_override BOOL   DOKEYMAPAUTO         CMD_DOKEYMAPAUTO
 	set_config_with_override STRING BUSYBOX_CONFIG       CMD_BUSYBOX_CONFIG
+	set_config_with_override STRING STRIP_TYPE           CMD_STRIP_TYPE           "all"
 	set_config_with_override BOOL   INSTALL              CMD_INSTALL              "yes"
 	set_config_with_override BOOL   DEBUGCLEANUP         CMD_DEBUGCLEANUP         "yes"
 

diff --git a/gen_funcs.sh b/gen_funcs.sh
index 6234189..0e22a86 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -388,6 +388,12 @@ copy_image_with_preserve() {
 	cp "${newSrceImage}" "${BOOTDIR}/${currDestImage}" ||
 	    gen_die "Could not copy the ${symlinkName} image to ${BOOTDIR}!"
 
+	if [ "${CMD_STRIP_TYPE}" = "all" -o "${CMD_STRIP_TYPE}" = "kernel" ]
+	then
+		print_info 5 "  Stripping ${BOOTDIR}/${currDestImage}"
+		strip --strip-debug "${BOOTDIR}/${currDestImage}" >/dev/null 2>&1
+	fi
+
 	if [ "${SYMLINK}" = '1' ]
 	then
 		print_info 5 "  Make new symlink(s) (from ${BOOTDIR}):"


             reply	other threads:[~2017-01-03  5:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03  5:16 Robin H. Johnson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-01-08  0:40 [gentoo-commits] proj/genkernel:master commit in: doc/, / Robin H. Johnson
2019-03-25  2:08 Thomas Deutschmann
2019-03-28 23:43 Thomas Deutschmann
2019-03-28 23:43 Thomas Deutschmann
2019-03-29  4:13 Thomas Deutschmann
2019-07-15 18:06 Thomas Deutschmann
2019-07-21 16:26 Thomas Deutschmann
2019-07-21 16:26 Thomas Deutschmann
2019-07-21 18:38 Thomas Deutschmann
2020-08-02 22:42 Thomas Deutschmann
2021-07-06 21:27 Thomas Deutschmann
2023-07-05 17:41 Sam James
2023-08-08  5:33 Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1483420546.c2525c65b9f3d5849963bab6beb40817d7720218.robbat2@gentoo \
    --to=robbat2@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox