Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3 of 5 v2] build: add option to exclude executables/dirs from being stripped
Date: Thu, 17 Nov 2011 20:41:59 +0100	[thread overview]
Message-ID: <76f1a5eeba5e79cb8413.1321557992@devws108> (raw)
In-Reply-To: <patchbomb.1321557989@devws108>

# HG changeset patch
# User Sven Neumann <s.neumann@raumfeld.com>
# Date 1314025139 -7200
# Node ID 76f1a5eeba5e79cb841338d5317e3c618bf7c93c
# Parent  26239e4561037c19ccfc7ac7ea216d36a6a8e87e
build: add option to exclude executables/dirs from being stripped

Sometimes it may be desirable to keep debug symbols for some binaries and
libraries on the target. This commit introduces the config option
BR2_STRIP_EXCLUDE_FILES, which is interpreted as a list of such binaries
and libraries, and the option BR2_STRIP_EXCLUDE_DIRS, which indicates
directories excluded from stripping entirely.
These exclusions are passed to the find command in the target-finalize step.

Signed-off-by: Sven Neumann <s.neumann@raumfeld.com>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

---
v2: add the possibility to exclude entire directories

 Config.in |  19 +++++++++++++++++++
 Makefile  |   9 +++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/Config.in b/Config.in
--- a/Config.in
+++ b/Config.in
@@ -247,6 +247,25 @@ config BR2_STRIP_none
 	  none    do not strip (only for debugging!)
 endchoice
 
+config BR2_STRIP_EXCLUDE_FILES
+	string "executables that should not be stripped"
+	depends on !BR2_STRIP_none
+	default ""
+	help
+	  You may specify a space-separated list of binaries and libraries
+	  here that should not be stripped on the target.
+
+config BR2_STRIP_EXCLUDE_DIRS
+	string "directories that should be skipped when stripping"
+	depends on !BR2_STRIP_none
+	default ""
+	help
+	  You may specify a space-separated list of directories that should
+	  be skipped when stripping. Binaries and libraries in these
+	  directories will not be touched.
+	  The directories should be specified relative to the target directory,
+	  without leading slash.
+
 choice
 	prompt "gcc optimization level"
 	default BR2_OPTIMIZE_S
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -430,6 +430,12 @@ endif
 erase-fakeroots:
 	rm -f $(BUILD_DIR)/.fakeroot*
 
+STRIP_FIND_CMD=find $(TARGET_DIR)
+ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
+STRIP_FIND_CMD+=\( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
+endif
+STRIP_FIND_CMD+=-type f -perm +111 -not \( $(call findfileclauses,libthread_db*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
+
 target-finalize:
 ifeq ($(BR2_HAVE_DEVFILES),y)
 	( support/scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) )
@@ -454,8 +460,7 @@ endif
 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
 	find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
 endif
-	find $(TARGET_DIR) -type f -perm +111 '!' $(call findfileclauses,libthread_db*.so*) | \
-		xargs $(STRIPCMD) 2>/dev/null || true
+	$(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
 	find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
 		xargs -r $(KSTRIPCMD) || true
 

  parent reply	other threads:[~2011-11-17 19:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17 19:41 [Buildroot] [PATCH 0 of 5 v2] Add find utility functions / exclude files from strip / reduce python Thomas De Schampheleire
2011-11-17 19:41 ` [Buildroot] [PATCH 1 of 5 v2] Makefile.package.in: add utility functions find*clauses and notfirstword Thomas De Schampheleire
2011-11-17 19:50   ` Thomas Petazzoni
2011-11-17 20:19     ` Thomas De Schampheleire
2011-11-18  0:10   ` Arnout Vandecappelle
2011-11-18  9:41     ` Thomas De Schampheleire
2011-11-19  7:13   ` Cam Hutchison
2011-11-21  8:42     ` Thomas De Schampheleire
2011-11-17 19:41 ` [Buildroot] [PATCH 2 of 5 v2] stripping: use findfileclauses utility function Thomas De Schampheleire
2011-11-18  0:06   ` Arnout Vandecappelle
2011-11-18  1:46   ` Cam Hutchison
2011-11-18  6:21     ` Thomas De Schampheleire
2011-11-17 19:41 ` Thomas De Schampheleire [this message]
2011-11-17 19:42 ` [Buildroot] [PATCH 4 of 5 v2] python config: move configuration into menu Thomas De Schampheleire
2011-11-17 19:42 ` [Buildroot] [PATCH 5 of 5 v2] python: allow reduced installation Thomas De Schampheleire
2011-11-17 19:55   ` Thomas Petazzoni
2011-11-18  0:24     ` Arnout Vandecappelle
2011-11-18  7:59     ` Thomas De Schampheleire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76f1a5eeba5e79cb8413.1321557992@devws108 \
    --to=patrickdepinguin+buildroot@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox