aboutsummaryrefslogtreecommitdiffstats
path: root/include/kernel-build.mk
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-08-08 14:22:04 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-08-08 14:22:04 +0000
commitbb5a40c64b7c4f4848509fa0a6625055fc9e66cc (patch)
treed02b9ad490e5885181ac20e22325bbce49d3f4bc /include/kernel-build.mk
parent253c9fcf7d948fb8763defe612cf53ee860744f3 (diff)
downloadupstream-bb5a40c64b7c4f4848509fa0a6625055fc9e66cc.tar.gz
upstream-bb5a40c64b7c4f4848509fa0a6625055fc9e66cc.tar.bz2
upstream-bb5a40c64b7c4f4848509fa0a6625055fc9e66cc.zip
add an optional config option for stripping all unnecessary symbol exports from the kernel image
SVN-Revision: 17181
Diffstat (limited to 'include/kernel-build.mk')
-rw-r--r--include/kernel-build.mk24
1 files changed, 23 insertions, 1 deletions
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index d48f8b9f53..e3e446ba58 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -54,6 +54,28 @@ define BuildKernel
$(Kernel/Prepare)
touch $$@
+ $(KERNEL_BUILD_DIR)/symtab.txt: FORCE
+ find $(LINUX_DIR) $(STAGING_DIR_ROOT)/lib/modules -name \*.ko | \
+ xargs $(TARGET_CROSS)nm | \
+ awk '$$$$1 == "U" { print $$$$2 } ' | \
+ sort -u > $$@
+
+ $(KERNEL_BUILD_DIR)/symtab.h: $(KERNEL_BUILD_DIR)/symtab.txt
+ ( \
+ echo '#define SYMTAB_KEEP \'; \
+ cat $(KERNEL_BUILD_DIR)/symtab.txt | \
+ awk '{print "*(__ksymtab." $$$$1 ") \\" }'; \
+ echo; \
+ echo '#define SYMTAB_KEEP_GPL \'; \
+ cat $(KERNEL_BUILD_DIR)/symtab.txt | \
+ awk '{print "*(__ksymtab_gpl." $$$$1 ") \\" }'; \
+ echo; \
+ echo '#define SYMTAB_KEEP_STR \'; \
+ cat $(KERNEL_BUILD_DIR)/symtab.txt | \
+ awk '{print "*(__ksymtab_strings." $$$$1 ") \\" }'; \
+ echo; \
+ ) > $$@
+
$(STAMP_CONFIGURED): $(STAMP_PREPARED) $(LINUX_CONFIG) $(GENERIC_LINUX_CONFIG) $(TOPDIR)/.config
$(Kernel/Configure)
touch $$@
@@ -62,7 +84,7 @@ define BuildKernel
$(Kernel/CompileModules)
touch $$@
- $(LINUX_DIR)/.image: $(STAMP_CONFIGURED) FORCE
+ $(LINUX_DIR)/.image: $(STAMP_CONFIGURED) $(if $(CONFIG_STRIP_KERNEL_EXPORTS),$(KERNEL_BUILD_DIR)/symtab.h) FORCE
$(Kernel/CompileImage)
touch $$@