summaryrefslogtreecommitdiffstats
path: root/source/k/kernel-modules.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'source/k/kernel-modules.SlackBuild')
-rwxr-xr-xsource/k/kernel-modules.SlackBuild21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/k/kernel-modules.SlackBuild b/source/k/kernel-modules.SlackBuild
index 8d0d48c4d..fa3cd1639 100755
--- a/source/k/kernel-modules.SlackBuild
+++ b/source/k/kernel-modules.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2018, 2020 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2018, 2020, 2022 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -37,6 +37,17 @@ KERNEL_NAME=${KERNEL_NAME:-}
KERNEL_SOURCE=${KERNEL_SOURCE:-/usr/src/linux}
KERNEL_CONFIG=${KERNEL_CONFIG:-/usr/src/linux/.config}
BUILD=${BUILD:-1}
+
+# The CONFIG_DEBUG_INFO_BTF_MODULES option adds a huge amount of debugging
+# data to the modules which we don't actually need. We'll strip debugging
+# information from kernel modules by default. If you are building a debug
+# kernel and wish to retain this data, export the variable below set to "0".
+STRIP_DEBUG=${STRIP_DEBUG:-1}
+
+# Let's export the variable with the name needed by the kernel's Makefiles,
+# just for good measure.
+export INSTALL_MOD_STRIP=$STRIP_DEBUG
+
if [ ! -r "${KERNEL_CONFIG}" ]; then
echo "Error: the KERNEL_CONFIG environment variable needs to be set to the"
echo ".config file to be used to build these modules. Example:"
@@ -108,14 +119,14 @@ fi
echo "Building kernel modules..."
make $NUMJOBS modules || exit 1
echo "Installing kernel modules to $PKG..."
- make INSTALL_MOD_PATH=$PKG modules_install || exit 1
- # Fix build and source symlinks if they are pointing into /tmp:
+ make INSTALL_MOD_PATH=$PKG INSTALL_MOD_STRIP=$STRIP_DEBUG modules_install || exit 1
+ # Fix build and source symlinks if they are pointing into $TMP:
( cd $PKG/lib/modules/${VERSION}${LOCALVERSION}
for symlink in build source ; do
target=$(readlink $symlink)
- if echo $target | grep -q "^/tmp/package-kernel-source/" ; then
+ if echo $target | grep -q "^$TMP/package-kernel-source/" ; then
rm -f $symlink
- ln -sf $(echo $target | sed "s|/tmp/package-kernel-source/|/|g") $symlink
+ ln -sf $(echo $target | sed "s|$TMP/package-kernel-source/|/|g") $symlink
fi
done
)