From patchwork Tue May 8 19:26:18 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: 157817 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 AC48AB6FA4 for ; Wed, 9 May 2012 05:27:16 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C734432039; Tue, 8 May 2012 19:27:15 +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 3vn9Xw60ZZgu; Tue, 8 May 2012 19:27:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 5617A32244; Tue, 8 May 2012 19:27:06 +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 525448F753 for ; Tue, 8 May 2012 19:27:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 41D268F0B6 for ; Tue, 8 May 2012 19:27:02 +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 AFXRhF02hBuS for ; Tue, 8 May 2012 19:27:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by whitealder.osuosl.org (Postfix) with ESMTPS id 7F9478F0BD for ; Tue, 8 May 2012 19:27:00 +0000 (UTC) Received: by mail-ee0-f43.google.com with SMTP id c14so345606eek.16 for ; Tue, 08 May 2012 12:27:00 -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=zJ1CVcusjCU1X8s2x7cjLOGFJgQwWacIhggWz5HDWKI=; b=mVgFyX6H+WoP2A3PeXEqzC8N8DhciQzMDOvWcxbq6fzFpmN+P2DK4JsBOpRZYD7C2T y6S56otVaNicPevE0BrPKGpEfDfeL93VvRmxwOjRKXjOXi6xhwPBIIFkgh63vB9tn2w2 bl5xlpFrvlgdcQIeiVLqWHKBw1fnVkOdQcaaCQfeT2DUln0W0RpzPEGzcGDT9/S+TAq7 zTXGPKw5QkALekRLaU8xfv4iMtcwM871AEjjRURzKPEbunATulJl0mbGo0MFi1BKx3BR 818ISRvnZbhNwBYZSH9yZ3FWgsOf7IiPZEyQBdyk4nOGs1aFztwsa+5IG5tXbA56p3X9 eU7Q== Received: by 10.213.121.130 with SMTP id h2mr36128ebr.122.1336505220186; Tue, 08 May 2012 12:27:00 -0700 (PDT) Received: from [127.0.1.1] (d54C62A5A.access.telenet.be. [84.198.42.90]) by mx.google.com with ESMTPS id p57sm1028965eei.8.2012.05.08.12.26.58 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 May 2012 12:26:58 -0700 (PDT) MIME-Version: 1.0 X-Mercurial-Node: b776ce3b621179f0713ffca67eb745f6ddd02f27 Message-Id: In-Reply-To: References: User-Agent: Mercurial-patchbomb/1.9.1 Date: Tue, 08 May 2012 21:26:18 +0200 From: Thomas De Schampheleire To: buildroot@busybox.net Subject: [Buildroot] [PATCH 2 of 2 v5] 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 @@ -276,6 +276,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 @@ -376,6 +376,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) ) @@ -400,8 +407,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