Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] linux: strip installed modules
@ 2010-11-16 14:59 Mike Frysinger
  2010-11-17 20:51 ` Peter Korsgaard
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2010-11-16 14:59 UTC (permalink / raw)
  To: buildroot

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@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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] linux: strip installed modules
  2010-11-16 14:59 [Buildroot] [PATCH] linux: strip installed modules Mike Frysinger
@ 2010-11-17 20:51 ` Peter Korsgaard
  2010-11-17 23:55   ` [Buildroot] [PATCH v2] " Mike Frysinger
  2010-11-18  7:37   ` [Buildroot] [PATCH] " Thomas Petazzoni
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Korsgaard @ 2010-11-17 20:51 UTC (permalink / raw)
  To: buildroot

>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:

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

Thanks. We're moving away from per-package stripping though, so I would
prefer to add it to the toplevel target-finalize step instead though -
E.G. something like

find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | xargs $(STRIPCMD) ..

Care to adjust the patch to do that instead?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2] linux: strip installed modules
  2010-11-17 20:51 ` Peter Korsgaard
@ 2010-11-17 23:55   ` Mike Frysinger
  2010-11-24 21:04     ` Peter Korsgaard
  2010-11-18  7:37   ` [Buildroot] [PATCH] " Thomas Petazzoni
  1 sibling, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2010-11-17 23:55 UTC (permalink / raw)
  To: buildroot

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@gentoo.org>
---
v2
	- move to toplevel finalize target

 Makefile |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index e569a94..0396e37 100644
--- a/Makefile
+++ b/Makefile
@@ -403,6 +403,9 @@ ifneq ($(BR2_HAVE_DOCUMENTATION),y)
 	rm -rf $(TARGET_DIR)/usr/share/gtk-doc
 endif
 	find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true
+	find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
+		xargs -r $(STRIPCMD) -R .comment -R .note -g --strip-unneeded
+
 	mkdir -p $(TARGET_DIR)/etc
 	# Mandatory configuration file and auxilliary cache directory
 	# for recent versions of ldconfig
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] linux: strip installed modules
  2010-11-17 20:51 ` Peter Korsgaard
  2010-11-17 23:55   ` [Buildroot] [PATCH v2] " Mike Frysinger
@ 2010-11-18  7:37   ` Thomas Petazzoni
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2010-11-18  7:37 UTC (permalink / raw)
  To: buildroot

On Wed, 17 Nov 2010 21:51:44 +0100
Peter Korsgaard <jacmet@uclibc.org> wrote:

>  Mike> The installed kernel modules should have useless build cruft stripped out
>  Mike> of them.  On my system, a default build went from a very unreasonable 30MB
>  Mike> to a normal 3MB (on disk) and from 14MB to 3MB when compressed due to the
>  Mike> info stored in the kernel modules alone.
> 
> Thanks. We're moving away from per-package stripping though, so I would
> prefer to add it to the toplevel target-finalize step instead though -

Actually, yes and now. The stripping will go back into per-package, but
inside the package infrastructure instead. This is because we want to
do all the cleanup (documentation, headers, useless .a and .la files)
right after the package installation in order to make the "package
management" stuff work (this is something that Lionel already did in
his experiments of package management). So it will not be inside each
package .mk file as it used to be, but it's still going to be done on a
per-package basis.

> find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | xargs $(STRIPCMD) ..

In this particular case, the stripping is very much kernel-specific, so
I don't see a strong reason of adding this to linux/linux.mk. Except
maybe packages that do compile additional kernel modules, such as
linux-fusion (and more could be added).

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2] linux: strip installed modules
  2010-11-17 23:55   ` [Buildroot] [PATCH v2] " Mike Frysinger
@ 2010-11-24 21:04     ` Peter Korsgaard
  2010-11-24 21:20       ` Mike Frysinger
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2010-11-24 21:04 UTC (permalink / raw)
  To: buildroot

>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:

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

Committed with a small change to not use binutils strip specific options
(we support sstrip as well).

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2] linux: strip installed modules
  2010-11-24 21:04     ` Peter Korsgaard
@ 2010-11-24 21:20       ` Mike Frysinger
  2010-11-24 21:36         ` Peter Korsgaard
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2010-11-24 21:20 UTC (permalink / raw)
  To: buildroot

On Wednesday, November 24, 2010 16:04:40 Peter Korsgaard wrote:
> >>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:
>  Mike> The installed kernel modules should have useless build cruft
>  Mike> stripped out of them.  On my system, a default build went from a
>  Mike> very unreasonable 30MB to a normal 3MB (on disk) and from 14MB to
>  Mike> 3MB when compressed due to the info stored in the kernel modules
>  Mike> alone.
> 
> Committed with a small change to not use binutils strip specific options
> (we support sstrip as well).

so STRIP_STRIP_UNNEEDED should have those flags added to it for the binutils 
case ... i'll send a patch to fix that.  otherwise we're leaving a crap in the 
target fs that only takes up space.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101124/ba504b95/attachment.pgp>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2] linux: strip installed modules
  2010-11-24 21:20       ` Mike Frysinger
@ 2010-11-24 21:36         ` Peter Korsgaard
  2010-11-24 21:47           ` Mike Frysinger
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2010-11-24 21:36 UTC (permalink / raw)
  To: buildroot

>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:

Hi,

 >> Committed with a small change to not use binutils strip specific
 >> options (we support sstrip as well).

 Mike> so STRIP_STRIP_UNNEEDED should have those flags added to it for
 Mike> the binutils case ... i'll send a patch to fix that.  otherwise
 Mike> we're leaving a crap in the target fs that only takes up space.
 Mike> -mike

STRIPCMD already has --remove-section=.comment --remove-section=.note,
what else are you missing?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2] linux: strip installed modules
  2010-11-24 21:36         ` Peter Korsgaard
@ 2010-11-24 21:47           ` Mike Frysinger
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2010-11-24 21:47 UTC (permalink / raw)
  To: buildroot

On Wednesday, November 24, 2010 16:36:25 Peter Korsgaard wrote:
> >>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:
>  >> Committed with a small change to not use binutils strip specific
>  >> options (we support sstrip as well).
> 
>  Mike> so STRIP_STRIP_UNNEEDED should have those flags added to it for
>  Mike> the binutils case ... i'll send a patch to fix that.  otherwise
>  Mike> we're leaving a crap in the target fs that only takes up space.
> 
> STRIPCMD already has --remove-section=.comment --remove-section=.note,
> what else are you missing?

i hadnt noticed that.  guess you can ignore my new patch too.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101124/5a233ead/attachment.pgp>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-11-24 21:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-16 14:59 [Buildroot] [PATCH] linux: strip installed modules Mike Frysinger
2010-11-17 20:51 ` Peter Korsgaard
2010-11-17 23:55   ` [Buildroot] [PATCH v2] " Mike Frysinger
2010-11-24 21:04     ` Peter Korsgaard
2010-11-24 21:20       ` Mike Frysinger
2010-11-24 21:36         ` Peter Korsgaard
2010-11-24 21:47           ` Mike Frysinger
2010-11-18  7:37   ` [Buildroot] [PATCH] " Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox