From patchwork Fri Jun 22 05:34:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 166501 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 5F2BAB6EF1 for ; Fri, 22 Jun 2012 15:36:11 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id ED40B32018; Fri, 22 Jun 2012 05:36:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QxufXxVt1Pzb; Fri, 22 Jun 2012 05:36:03 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id CAFA431F5D; Fri, 22 Jun 2012 05:35:57 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id B33E38F753 for ; Fri, 22 Jun 2012 05:35:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A30128C967 for ; Fri, 22 Jun 2012 05:35:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L22DLhVuhTS4 for ; Fri, 22 Jun 2012 05:35:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ey0-f171.google.com (mail-ey0-f171.google.com [209.85.215.171]) by whitealder.osuosl.org (Postfix) with ESMTPS id C9D848C9BA for ; Fri, 22 Jun 2012 05:35:48 +0000 (UTC) Received: by eaaa12 with SMTP id a12so803992eaa.16 for ; Thu, 21 Jun 2012 22:35:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:content-transfer-encoding:subject :x-mercurial-node:message-id:in-reply-to:references:user-agent:date :from:to:cc; bh=CMpIemsoA9RJnTVPNfniktNI9yzd7DBK+LWTnn4/GwU=; b=wBM3207bVlYJi1aB0Rw52JhB6swlRWW3UA4a9id+aV/WPk4hMEYygxSdFw0LziWl/9 nJe0qJYt7YKmDU1f6xf8huhCjek+rnSLwtwQKCirZR567MV/QuEkMQZiB8LjkT1QwA60 d4APzQs9KofyQk1j3O7zmvb3BHVvO8TgoT3pZJOZkCCE7IR3wYTaITQ/0Pj6FYu4R5tf gIAXwvVvi87EDA41f8Q7LxeWjlseOjJu/GIBUGWEJ7MZbaO2wcVGw1FIlo+atv5VsJLI E8s3H+xnFs1Lw0AfK7MQ2LnIvRCdDfRz2bBtogf7kWWcZLycPagjij3hyCtyMxIwU2DC xutg== Received: by 10.14.97.137 with SMTP id t9mr172428eef.73.1340343346815; Thu, 21 Jun 2012 22:35:46 -0700 (PDT) Received: from [127.0.1.1] (d54C62EEB.access.telenet.be. [84.198.46.235]) by mx.google.com with ESMTPS id c42sm109210990eeb.2.2012.06.21.22.35.45 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Jun 2012 22:35:45 -0700 (PDT) MIME-Version: 1.0 X-Mercurial-Node: 953c32c4b68dd49651ef2660e4a34600dafeabf5 Message-Id: <953c32c4b68dd49651ef.1340343290@beantl019720> In-Reply-To: References: User-Agent: Mercurial-patchbomb/2.0.2 Date: Fri, 22 Jun 2012 07:34:50 +0200 From: Thomas De Schampheleire To: buildroot@busybox.net, jacmet@sunsite.dk Subject: [Buildroot] [PATCH 2 of 2 v5-resend2] build: add option to exclude executables/dirs from being stripped X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net 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 Signed-off-by: Thomas De Schampheleire Acked-by: Arnout Vandecappelle (Essensium/Mind) --- v5: line up with latest git v4: whitespace changes v3: merge with redundant patch 'stripping: use findfileclauses utility function' v2: add the possibility to exclude entire directories Config.in | 19 +++++++++++++++++++ Makefile | 10 ++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Config.in b/Config.in --- a/Config.in +++ b/Config.in @@ -283,6 +283,25 @@ config BR2_STRIP_none filesystem. 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 @@ -386,6 +386,13 @@ endif $(TARGET_DIR): $(BUILD_DIR)/.root +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 +STRIP_FIND_CMD += -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) ) @@ -410,8 +417,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 '!' -name '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