[Buildroot] [PATCH] linux: strip installed modules

Mike Frysinger vapier at gentoo.org
Tue Nov 16 14:59:20 UTC 2010


The installed kernel modules should have useless build cruft stripped out
of them.  On my system, a default build went from a very unreasonable 30MB
to a normal 3MB (on disk) and from 14MB to 3MB when compressed due to the
info stored in the kernel modules alone.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 linux/linux.mk |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/linux/linux.mk b/linux/linux.mk
index 4a6025c..69cab9f 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -135,6 +135,8 @@ $(LINUX26_DIR)/.stamp_installed: $(LINUX26_DIR)/.stamp_compiled
 	@if [ $(shell grep -c "CONFIG_MODULES=y" $(LINUX26_DIR)/.config) != 0 ] ; then 	\
 		$(TARGET_MAKE_ENV) $(MAKE1) $(LINUX26_MAKE_FLAGS) -C $(@D) 		\
 			INSTALL_MOD_PATH=$(TARGET_DIR) modules_install ;		\
+		find $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION_PROBED) -type f -name "*o" | \
+			xargs -r $(TARGET_CROSS)strip -R .comment -R .note -g --strip-unneeded ; \
 		rm -f $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION_PROBED)/build ;	\
 		rm -f $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION_PROBED)/source ;	\
 	fi
-- 
1.7.3.2



More information about the buildroot mailing list