aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/kernel-defaults.mk3
-rw-r--r--rules.mk3
-rwxr-xr-xscripts/strip-kmod.sh5
3 files changed, 8 insertions, 3 deletions
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 24d26308b1..d37787a44b 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -11,7 +11,8 @@ KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
ARCH="$(LINUX_KARCH)" \
KBUILD_HAVE_NLS=no \
CONFIG_SHELL="$(BASH)" \
- $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
+ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
+ $(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID))
ifdef CONFIG_STRIP_KERNEL_EXPORTS
KERNEL_MAKEOPTS += \
diff --git a/rules.mk b/rules.mk
index 819bea5f5a..7710fb4d9d 100644
--- a/rules.mk
+++ b/rules.mk
@@ -273,8 +273,9 @@ else
STRIP:=$(STAGING_DIR_HOST)/bin/sstrip
endif
endif
- RSTRIP:= \
+ RSTRIP= \
export CROSS="$(TARGET_CROSS)" \
+ $(if $(PKG_BUILD_ID),KEEP_BUILD_ID=1) \
$(if $(CONFIG_KERNEL_KALLSYMS),NO_RENAME=1) \
$(if $(CONFIG_KERNEL_PROFILING),KEEP_SYMBOLS=1); \
NM="$(TARGET_CROSS)nm" \
diff --git a/scripts/strip-kmod.sh b/scripts/strip-kmod.sh
index 13e6b58007..e3f13bee47 100755
--- a/scripts/strip-kmod.sh
+++ b/scripts/strip-kmod.sh
@@ -18,11 +18,14 @@ else
ARGS="-x -G __this_module --strip-unneeded"
fi
+if [ -z "$KEEP_BUILD_ID" ]; then
+ ARGS="$ARGS -R .note.gnu.build-id"
+fi
+
${CROSS}objcopy \
-R .comment \
-R .pdr \
-R .mdebug.abi32 \
- -R .note.gnu.build-id \
-R .gnu.attributes \
-R .reginfo \
$ARGS \