overlay/sys-kernel/genkernel/files/3.4.11/cmd_strip_v2.patch
2010-11-03 21:16:48 +00:00

102 lines
3.4 KiB
Diff

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 20380ac..cec496e 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -133,6 +133,11 @@ longusage() {
echo " --integrated-initramfs"
echo " Build the generated initramfs into the kernel instead of"
echo " keeping it as a separate file"
+ 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)"
}
usage() {
@@ -536,6 +541,14 @@ parse_cmdline() {
--config=*)
print_info 2 "CMD_GK_CONFIG: `parse_opt "$*"`"
;;
+ --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 d87d2f4..e7c3d41 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -284,7 +284,16 @@ 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
compile_generic "modules_install" kernel
+ unset INSTALL_MOD_STRIP
unset UNAME_MACHINE
}
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index ed84798..7fb8a66 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -119,6 +119,7 @@ determine_real_args() {
set_config_with_override 1 KEYMAP CMD_KEYMAP "yes"
set_config_with_override 1 DOKEYMAPAUTO CMD_DOKEYMAPAUTO
set_config_with_override 2 BUSYBOX_CONFIG CMD_BUSYBOX_CONFIG
+ set_config_with_override 1 STRIP_TYPE CMD_STRIP_TYPE "all"
BOOTDIR=`arch_replace "${BOOTDIR}"`
BOOTDIR=${BOOTDIR%/} # Remove any trailing slash
diff --git a/gen_funcs.sh b/gen_funcs.sh
index 07a7f5f..010f5bd 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -393,7 +393,13 @@ copy_image_with_preserve() {
print_info 5 " Copying ${symlinkName}: ${newSrceImage}"
print_info 5 " to ${BOOTDIR}/${currDestImage}"
cp "${newSrceImage}" "${BOOTDIR}/${currDestImage}" ||
- gen_die "Could not copy the ${symlinkName} image to ${BOOTDIR}!"
+ 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}" -eq '1' ]
then
diff --git a/genkernel.8 b/genkernel.8
index 4dba331..2c498a8 100644
--- a/genkernel.8
+++ b/genkernel.8
@@ -243,6 +243,13 @@ against a kernel source tree.
\fB\-\-initramfs\-overlay=\fR<dir>
Directory structure to include in the initramfs,
only available on 2.6 kernels
+.TP
+\fB\-\-strip=\fR<all|kernel|modules|none>
+Strip debug symbols from the installed kernel, modules, all (default)
+or none.
+.TP
+\fB\-\-no\-\fBstrip
+Alias for \fB\-\-strip=none\fR
.SH RAMDISK OPTIONS
The following options can be passed as kernel parameters from the
bootloader, which the ramdisk scripts would recognize.