summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xkernel/scripts/kernel_debug.sh16
-rwxr-xr-xkernel/scripts/package/mkspec2
2 files changed, 17 insertions, 1 deletions
diff --git a/kernel/scripts/kernel_debug.sh b/kernel/scripts/kernel_debug.sh
new file mode 100755
index 000000000..5ccf1af76
--- /dev/null
+++ b/kernel/scripts/kernel_debug.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpdir=$1 #/tmp/kvmfornfv_rpmbuild.1/BUILD/kernel-4.4.50_rt62nfv
+OBJCOPY=objcopy
+if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
+for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do
+ module=lib/modules/$module
+ mkdir -p $(dirname $tmpdir/usr/lib/debug/$module)
+ # only keep debug symbols in the debug file
+ $OBJCOPY --only-keep-debug $tmpdir/$module $tmpdir/usr/lib/debug/$module
+ # strip original module from debug symbols
+ $OBJCOPY --strip-debug $tmpdir/$module
+ # then add a link to those
+ $OBJCOPY --add-gnu-debuglink=$tmpdir/usr/lib/debug/$module $tmpdir/$module
+ done
+fi \ No newline at end of file
diff --git a/kernel/scripts/package/mkspec b/kernel/scripts/package/mkspec
index 0f96d4f8d..401b948ba 100755
--- a/kernel/scripts/package/mkspec
+++ b/kernel/scripts/package/mkspec
@@ -92,7 +92,7 @@ echo "%endif"
echo 'mkdir -p $RPM_BUILD_ROOT'"/lib/firmware/$KERNELRELEASE"
echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= mod-fw= modules_install'
-echo '/opt/kvmfornfv/ci/kernel_debug.sh $RPM_BUILD_ROOT'
+echo '$RPM_SOURCE_DIR/scripts/kernel_debug.sh $RPM_BUILD_ROOT'
echo 'INSTALL_FW_PATH=$RPM_BUILD_ROOT'"/lib/firmware/$KERNELRELEASE"
echo 'make INSTALL_FW_PATH=$INSTALL_FW_PATH' firmware_install
echo "%ifarch ia64"