Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anders Darander <anders.darander@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] Use gdbserver from external toolchain.
Date: Tue, 10 Nov 2009 08:03:22 +0100	[thread overview]
Message-ID: <1257836602-799-1-git-send-email-ad@datarespons.se> (raw)

Allow the user to copy the pre-compiled gdbserver from the external toolchain
to the rootfs.

It is assumed that the external toolchain has been generated with crosstool-NG,
as there is no generic way to find the location of gdbserver.

Signed-off-by: Anders Darander <ad@datarespons.se>
---
 toolchain/external-toolchain/Config.in   |    9 +++++++
 toolchain/external-toolchain/ext-tool.mk |   35 ++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/toolchain/external-toolchain/Config.in b/toolchain/external-toolchain/Config.in
index efc8378..8837f47 100644
--- a/toolchain/external-toolchain/Config.in
+++ b/toolchain/external-toolchain/Config.in
@@ -19,4 +19,13 @@ config BR2_TOOLCHAIN_EXTERNAL_STRIP
         prompt "Strip shared libraries"
 	help
 	  Strip shared libraries copied from the external toolchain.
+
+config BR2_TOOLCHAIN_EXTERNAL_GDBSERVER
+	bool
+	prompt "Install the gdbserver"
+	help
+	  Install the gdbserver from the external toolchain.
+	  It is assumed that the external toolchain has been generated
+	   by crosstool-NG, as there is no generic mechanism available
+	   to find the location of the gdbserver.
 endif
diff --git a/toolchain/external-toolchain/ext-tool.mk b/toolchain/external-toolchain/ext-tool.mk
index 1f5aa19..0fc7ae8 100644
--- a/toolchain/external-toolchain/ext-tool.mk
+++ b/toolchain/external-toolchain/ext-tool.mk
@@ -72,6 +72,37 @@ copy_toolchain_lib_root = \
 	echo -n
 
 #
+# Copy selected files from the toolchain debug-root to the target dir.
+#
+# $1: The sysroot-feature (this is used for the base of the debug-root)
+# $2: The file to be installed
+# $3: Destination folder on the rootfs.
+# $4: strip (y|n), default is to strip
+#
+copy_toolchain_debugroot = \
+	DEBUGROOT_DIR="$(strip $1)"/../debug-root; \
+	FILE="$(strip $2)"; \
+	DST="$(strip $3)"; \
+	STRIP="$(strip $4)"; \
+\
+	if $$($(TARGET_CROSS)cc -v 2>&1 | grep crosstool-NG 2>&1 1>/dev/null) ; then \
+		echo "A Crosstool-NG generated toolchain is detected."; \
+		if test -f $${DEBUGROOT_DIR}/usr/bin/$${FILE}; then \
+			$(INSTALL) -m0755 $${DEBUGROOT_DIR}/usr/bin/$${FILE} $(TARGET_DIR)/$${DST}/$${FILE}; \
+			case "$${STRIP}" in \
+			(+ | n | no) \
+;; \
+			(*) \
+			$(TARGET_CROSS)strip $(TARGET_DIR)/$${DST}/$${FILE}; \
+;; \
+			esac \
+		fi \
+	else \
+		echo "Error: Not a known toolchain!"; \
+		exit 1; \
+	fi
+
+#
 # Copy the full external toolchain sysroot directory to the staging
 # dir
 #
@@ -227,6 +258,10 @@ endif
 	$(Q)for libs in $(EXTERNAL_LIBS); do \
 		$(call copy_toolchain_lib_root,$(SYSROOT_DIR),$$libs,/lib,$(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \
 	done
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GDBSERVER),y)
+	@echo "Copy gdbserver from the external toolchain to target..."
+	$(Q) $(call copy_toolchain_debugroot,$(SYSROOT_DIR),gdbserver,/usr/bin,$(BR2_TOOLCHAIN_EXTERNAL_STRIP))
+endif
 	@echo "Copy external toolchain sysroot to staging..."
 	$(Q)$(call copy_toolchain_sysroot,$(SYSROOT_DIR))
 	@touch $@
-- 
1.6.5.2

             reply	other threads:[~2009-11-10  7:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-10  7:03 Anders Darander [this message]
2009-11-10  7:08 ` [Buildroot] [PATCH] Use gdbserver from external toolchain Anders Darander

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=1257836602-799-1-git-send-email-ad@datarespons.se \
    --to=anders.darander@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