From patchwork Tue Oct 1 01:36:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1169675 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="M3fQVvpn"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46j22S62Mqz9sDB for ; Tue, 1 Oct 2019 11:37:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CFC8C87B40; Tue, 1 Oct 2019 01:37:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6MIsvAgzEGl7; Tue, 1 Oct 2019 01:37:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id A1A3B85FFD; Tue, 1 Oct 2019 01:37:30 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 3F9661BF20D for ; Tue, 1 Oct 2019 01:37:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3CDF185FA7 for ; Tue, 1 Oct 2019 01:37:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i4cAeDKcuCII for ; Tue, 1 Oct 2019 01:37:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 6ACD583659 for ; Tue, 1 Oct 2019 01:37:11 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id u40so19576017qth.11 for ; Mon, 30 Sep 2019 18:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vHvbPx4Tw39oJYpJuxDM5AhIw87zJL7ow3iejMtxjEE=; b=M3fQVvpnlcjpmqLRx9J134/C11kD81kNgNqZGJsxrbDi7DrCyp/pWAmzFqhaO37/2X W4FA5Nla+KkOu40OsK57KJ4w+p6ElLv3ayNFhRmdaHFFy8sYvPlfh5WvOWAHfP694pf6 APQSPoVzXYpEPH1RPzLy9zPkvaJIbOyBT2CWbuuvMDpE+N1APGQb1O+uD6/2u72OqGAZ c2cNijL+pPgGla4N1zYAlDxBHA+oZ7CKUt1TxyxA+b09YRlWfUD/Gms+7fsvrziRZ3N5 MfhJ2AWb8EfQ93gwuhdRxqyIi7dWOcRfrPbyXlAYvGsGDNTv5PF3/7mJ/ObMpCAcqD9j AjxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vHvbPx4Tw39oJYpJuxDM5AhIw87zJL7ow3iejMtxjEE=; b=n/6wGZsogkde2SxAz54dGylwasFrG4YbY2b+qMFdZdVEG1UF3hfo+AmPuNS5iRd+9b ly2UPLtqDhQZnP9XEmNH9ex+Z8Oxvqs9AWE9gRfuqaOkAyj58E32DkSyJWjMHI60wJ0j VG9S6FjlZ81YCXBi+pHdeNCyBiI+NFjz/0Oj9cDMa7ZKB4enqf3Jbe1mM8mg9kLy/syR xbq3Wv+vhx6kPUJhE/yuYXDWjmvIJa8r8BGSoyXw2/H7SlrEi1UoTEgPsQDU4DG2VYLD Ho2CTkYNbOYWCJ/4fbeU2LGmP0GpVVoMx2GzSlG1DLdonuN5V9/NIvVRkCpInDLXChbg kTXA== X-Gm-Message-State: APjAAAUQ6Ki5yiSSMILahY3g5byR2OECIr30wRFKrFbVEKZosZTAAq60 jWnfiTaNwK+bUJIZ1IGBHUJDK5wSSd0= X-Google-Smtp-Source: APXvYqx4YkwRb19rp5HFDfgyg4r002dJ6UMzujdBHcNl1rZY+2+T3owa5LQ4XdqXSidnhnstEVcAqg== X-Received: by 2002:ac8:3644:: with SMTP id n4mr27232837qtb.92.1569893830237; Mon, 30 Sep 2019 18:37:10 -0700 (PDT) Received: from casantos.remote.csb (177.204.230.110.dynamic.adsl.gvt.net.br. [177.204.230.110]) by smtp.gmail.com with ESMTPSA id t73sm6824587qke.113.2019.09.30.18.37.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2019 18:37:09 -0700 (PDT) From: unixmania@gmail.com To: buildroot@buildroot.org Date: Mon, 30 Sep 2019 22:36:53 -0300 Message-Id: <20191001013654.22298-2-unixmania@gmail.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20191001013654.22298-1-unixmania@gmail.com> References: <20191001013654.22298-1-unixmania@gmail.com> Subject: [Buildroot] [PATCH v2 1/2] Strip binaries in the rootfs creation instead of in target-finalize X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Santos , Ciro Santilli , Thomas De Schampheleire , Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Carlos Santos Since commit 118534fe54 the root filesystem image is generated from a temporary copy of TARGET_DIR, so we can strip the binaries in the copy, only. This allows us to easily find the non-stripped executables to debug with gdbserver, as they are at the same relative path in TARGET_DIR as in the target device, rather than searching inside the build directory. Fixes: https://bugs.busybox.net/show_bug.cgi?id=10386 Signed-off-by: Carlos Santos Reviewed-by: Arnout Vandecappelle (Essensium/Mind) --- CC: Ciro Santilli --- Changes v1->v2: - Strip before running the fakeroot script, as suggested by Arnout Vandecappelle - Change commit message accordingly. Removed paragraph about setting sysroot to TARGET_DIR in gdb, which is done in the next commit. --- Makefile | 34 ---------------------------------- fs/common.mk | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index ecaae13846..57314e5f1d 100644 --- a/Makefile +++ b/Makefile @@ -614,38 +614,6 @@ RSYNC_VCS_EXCLUSIONS = \ --exclude .svn --exclude .git --exclude .hg --exclude .bzr \ --exclude CVS -# When stripping, obey to BR2_STRIP_EXCLUDE_DIRS and -# BR2_STRIP_EXCLUDE_FILES -STRIP_FIND_COMMON_CMD = \ - find $(TARGET_DIR) \ - $(if $(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)), \ - \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) \ - -prune -o \ - ) \ - $(if $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES)), \ - -not \( $(call findfileclauses,$(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) ) - -# Regular stripping for everything, except libpthread, ld-*.so and -# kernel modules: -# - libpthread.so: a non-stripped libpthread shared library is needed for -# proper debugging of pthread programs using gdb. -# - ld.so: a non-stripped dynamic linker library is needed for valgrind -# - kernel modules (*.ko): do not function properly when stripped like normal -# applications and libraries. Normally kernel modules are already excluded -# by the executable permission check, so the explicit exclusion is only -# done for kernel modules with incorrect permissions. -STRIP_FIND_CMD = \ - $(STRIP_FIND_COMMON_CMD) \ - -type f \( -perm /111 -o -name '*.so*' \) \ - -not \( $(call findfileclauses,libpthread*.so* ld-*.so* *.ko) \) \ - -print0 - -# Special stripping (only debugging symbols) for libpthread and ld-*.so. -STRIP_FIND_SPECIAL_LIBS_CMD = \ - $(STRIP_FIND_COMMON_CMD) \ - \( -name 'ld-*.so*' -o -name 'libpthread*.so*' \) \ - -print0 - ifeq ($(BR2_ECLIPSE_REGISTER),y) define TOOLCHAIN_ECLIPSE_REGISTER ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` \ @@ -761,8 +729,6 @@ endif rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc rm -rf $(TARGET_DIR)/usr/share/gtk-doc rmdir $(TARGET_DIR)/usr/share 2>/dev/null || true - $(STRIP_FIND_CMD) | xargs -0 $(STRIPCMD) 2>/dev/null || true - $(STRIP_FIND_SPECIAL_LIBS_CMD) | xargs -0 -r $(STRIPCMD) $(STRIP_STRIP_DEBUG) 2>/dev/null || true test -f $(TARGET_DIR)/etc/ld.so.conf && \ { echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true diff --git a/fs/common.mk b/fs/common.mk index 842ea924a5..caa7825cbb 100644 --- a/fs/common.mk +++ b/fs/common.mk @@ -61,6 +61,38 @@ ROOTFS_COMMON_FINAL_RECURSIVE_DEPENDENCIES = $(sort \ ) \ $(ROOTFS_COMMON_FINAL_RECURSIVE_DEPENDENCIES__X)) +# When stripping, obey to BR2_STRIP_EXCLUDE_DIRS and +# BR2_STRIP_EXCLUDE_FILES +STRIP_FIND_COMMON_CMD = \ + find $(TARGET_DIR) \ + $(if $(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)), \ + \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) \ + -prune -o \ + ) \ + $(if $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES)), \ + -not \( $(call findfileclauses,$(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) ) + +# Regular stripping for everything, except libpthread, ld-*.so and +# kernel modules: +# - libpthread.so: a non-stripped libpthread shared library is needed for +# proper debugging of pthread programs using gdb. +# - ld.so: a non-stripped dynamic linker library is needed for valgrind +# - kernel modules (*.ko): do not function properly when stripped like normal +# applications and libraries. Normally kernel modules are already excluded +# by the executable permission check, so the explicit exclusion is only +# done for kernel modules with incorrect permissions. +STRIP_FIND_CMD = \ + $(STRIP_FIND_COMMON_CMD) \ + -type f \( -perm /111 -o -name '*.so*' \) \ + -not \( $(call findfileclauses,libpthread*.so* ld-*.so* *.ko) \) \ + -print0 + +# Special stripping (only debugging symbols) for libpthread and ld-*.so. +STRIP_FIND_SPECIAL_LIBS_CMD = \ + $(STRIP_FIND_COMMON_CMD) \ + \( -name 'ld-*.so*' -o -name 'libpthread*.so*' \) \ + -print0 + .PHONY: rootfs-common rootfs-common: $(ROOTFS_COMMON_DEPENDENCIES) target-finalize @$(call MESSAGE,"Generating root filesystems common tables") @@ -157,9 +189,11 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES) $$(BASE_TARGET_DIR)/ \ $$(TARGET_DIR) + $$(STRIP_FIND_CMD) | xargs -0 $$(STRIPCMD) 2>/dev/null || true + $$(STRIP_FIND_SPECIAL_LIBS_CMD) | xargs -0 -r $$(STRIPCMD) $$(STRIP_STRIP_DEBUG) 2>/dev/null || true + echo '#!/bin/sh' > $$(FAKEROOT_SCRIPT) echo "set -e" >> $$(FAKEROOT_SCRIPT) - echo "chown -h -R 0:0 $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT) PATH=$$(BR_PATH) $$(TOPDIR)/support/scripts/mkusers $$(ROOTFS_FULL_USERS_TABLE) $$(TARGET_DIR) >> $$(FAKEROOT_SCRIPT) echo "$$(HOST_DIR)/bin/makedevs -d $$(ROOTFS_FULL_DEVICES_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT) From patchwork Tue Oct 1 01:36:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1169678 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lWUjezVz"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46j22b5swkz9sDB for ; Tue, 1 Oct 2019 11:37:43 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 2830421551; Tue, 1 Oct 2019 01:37:41 +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 NYDH0VpHqWB8; Tue, 1 Oct 2019 01:37:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 7D76D21574; Tue, 1 Oct 2019 01:37:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 42FFC1BF20D for ; Tue, 1 Oct 2019 01:37:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 965E485A2E for ; Tue, 1 Oct 2019 01:37:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Xp+UCK3LFIVz for ; Tue, 1 Oct 2019 01:37:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by hemlock.osuosl.org (Postfix) with ESMTPS id 315FA859C0 for ; Tue, 1 Oct 2019 01:37:15 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id 201so9649392qkd.13 for ; Mon, 30 Sep 2019 18:37:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b6Y5MSp/m3lvSHw07Ja2kEAMwFn1b8vbbj9xdeeIOgg=; b=lWUjezVz/4t0lyBvK7X7sNGbOE5CjXV2NAesRQq0hh7skWm3cT82CG7OPPivf9LR9E x4rjPLvFku3c1/YVgu17kUfRzA8qKN84vdWeEiWHMLINi7X5uvewdMZLUln0miT8fFYw XX114K/8bOzLLHFcI/yKA/8BrR0x6foaYByGnyzaqbEmwfdFndRCZOVciEuJNeMtlYbQ +6IQBq2bN426KRi6jMnharYLneHYnnLJa0FV/2vNc0JBTKVONSLMILqPD6LIVb7rlj/T obeksWMIBSKvwM/Gf14HAvDXp1Aq/UrpUoTdW/ICkTN4AlwCMgbaItbCUJ0Ut/GfGTe4 24oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b6Y5MSp/m3lvSHw07Ja2kEAMwFn1b8vbbj9xdeeIOgg=; b=WnDtnY1d/bBR5swrn2lXPnF7bd/79F2RpCXNrluRwly5xu5TLhwh9sE+DDRLkylmtG k+6hpFQrhwiK6OW78mdgZfQ5ii52F6Kv8dNtyus/TuQvgnmWQEgfkjCyQsO9b6nj+Mrc Q9ZZGfoVj3CUP58iAlw/2rol9+L25HuBWEHsvLqugdY5QTWYllqHkc4t+HXC2n5DAWIE 29aTjLuXycB0jZjHwS17glFbw157R4/CyEZr++pxGGYusw4k9XpRpP6sqp6GIVXX9gqz QNajVteAEKRMD6egH2GpLMPVHb2HUfo3qmZUR23DV7OygW3tsyrggUgZHv/zFCP6zvvu tBOw== X-Gm-Message-State: APjAAAUPXdfW6cApeJ+s4cxNkg3jZizKijqG9T/07p7z2BoyvnJLCnTZ CMwZYQNhacyBPpNuQcgC1df0uNaMDdM= X-Google-Smtp-Source: APXvYqw3v2j/rR06uaUFxBLp5hBS9XoEudqT5p/wH2oSixeDf6hKYZ9qsrMg5P04ulOaH63EucdspQ== X-Received: by 2002:a37:7ac1:: with SMTP id v184mr3499912qkc.129.1569893833989; Mon, 30 Sep 2019 18:37:13 -0700 (PDT) Received: from casantos.remote.csb (177.204.230.110.dynamic.adsl.gvt.net.br. [177.204.230.110]) by smtp.gmail.com with ESMTPSA id t73sm6824587qke.113.2019.09.30.18.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2019 18:37:13 -0700 (PDT) From: unixmania@gmail.com To: buildroot@buildroot.org Date: Mon, 30 Sep 2019 22:36:54 -0300 Message-Id: <20191001013654.22298-3-unixmania@gmail.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20191001013654.22298-1-unixmania@gmail.com> References: <20191001013654.22298-1-unixmania@gmail.com> Subject: [Buildroot] [PATCH v2 2/2] toolchain: install gdbinit under TARGET_DIR X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Santos , Ciro Santilli , Thomas De Schampheleire , Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Carlos Santos Now that binaries are stripped only in the root filesystem we can use TARGET_DIR as sysroot in gdb, instead of STAGING dir. Install gdbinit at target/usr/share/buildroot but exclude it from the root filesystem since it's required only at the host side. Update the documentation accordingly. Signed-off-by: Carlos Santos --- CC: Arnout Vandecappelle (Essensium/Mind) CC: Ciro Santilli --- docs/manual/quickstart.txt | 5 +++-- docs/manual/using-buildroot-debugger.txt | 11 +++++++---- fs/common.mk | 1 + toolchain/helpers.mk | 4 ++-- .../toolchain-external/pkg-toolchain-external.mk | 4 ++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/manual/quickstart.txt b/docs/manual/quickstart.txt index 74158ae249..d2e48b4540 100644 --- a/docs/manual/quickstart.txt +++ b/docs/manual/quickstart.txt @@ -108,8 +108,9 @@ This directory contains several subdirectories: use the tarball image generated in +images/+ and extract it as root. Compared to +staging/+, +target/+ contains only the files and libraries needed to run the selected target applications: the - development files (headers, etc.) are not present, the binaries are - stripped. + development files (headers, etc.) are not present. The binaries are stripped + in the generation of the root filesystem but are left unstripped in + +target/+. * +host/+ contains the installation of tools compiled for the host that are needed for the proper execution of Buildroot, including the diff --git a/docs/manual/using-buildroot-debugger.txt b/docs/manual/using-buildroot-debugger.txt index d5293beb53..599f9f77d1 100644 --- a/docs/manual/using-buildroot-debugger.txt +++ b/docs/manual/using-buildroot-debugger.txt @@ -35,15 +35,18 @@ Then, on the host, you should start the cross gdb using the following command line: ---------------------------- -/output/host/bin/-gdb -x /output/staging/usr/share/buildroot/gdbinit foo +/output/host/bin/-gdb -x /output/target/usr/share/buildroot/gdbinit foo ---------------------------- Of course, +foo+ must be available in the current directory, built with debugging symbols. Typically you start this command from the -directory where +foo+ is built (and not from +output/target/+ as the -binaries in that directory are stripped). +directory where +foo+ is built or from from +output/target/+, as in -The +/output/staging/usr/share/buildroot/gdbinit+ file will tell the +---------------------------- +/output/host/bin/-gdb -x /output/target/usr/share/buildroot/gdbinit output/target/usr/bib/foo +---------------------------- + +The +/output/target/usr/share/buildroot/gdbinit+ file will tell the cross gdb where to find the libraries of the target. Finally, to connect to the target from the cross gdb: diff --git a/fs/common.mk b/fs/common.mk index caa7825cbb..612baffca2 100644 --- a/fs/common.mk +++ b/fs/common.mk @@ -186,6 +186,7 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES) mkdir -p $$(ROOTFS_$(2)_DIR) rsync -auH \ --exclude=/$$(notdir $$(TARGET_DIR_WARNING_FILE)) \ + --exclude=/usr/share/buildroot \ $$(BASE_TARGET_DIR)/ \ $$(TARGET_DIR) diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 6a4f7223c8..4ee3ba3e99 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -458,8 +458,8 @@ check_toolchain_ssp = \ # Generate gdbinit file for use with Buildroot # gen_gdbinit_file = \ - mkdir -p $(STAGING_DIR)/usr/share/buildroot/ ; \ - echo "set sysroot $(STAGING_DIR)" > $(STAGING_DIR)/usr/share/buildroot/gdbinit + mkdir -p $(TARGET_DIR)/usr/share/buildroot/ ; \ + echo "set sysroot $(TARGET_DIR)" > $(TARGET_DIR)/usr/share/buildroot/gdbinit # Given a path, determine the relative prefix (../) needed to return to the # root level. Note that the last component is treated as a file component; use a diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk index c00211d59c..613e170855 100644 --- a/toolchain/toolchain-external/pkg-toolchain-external.mk +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk @@ -469,7 +469,7 @@ endef # # Generate gdbinit file for use with Buildroot # -define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT +define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBINIT $(Q)if test -f $(TARGET_CROSS)gdb ; then \ $(call MESSAGE,"Installing gdbinit"); \ $(gen_gdbinit_file); \ @@ -569,7 +569,6 @@ define $(2)_INSTALL_STAGING_CMDS $$(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK) $$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS) $$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER) - $$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT) endef # Even though we're installing things in both the staging, the host @@ -579,6 +578,7 @@ define $(2)_INSTALL_TARGET_CMDS $$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK) $$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS) $$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER) + $$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBINIT) $$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO) endef