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