[Buildroot] [PATCH] Use gdbserver from external toolchain.
Anders Darander
anders.darander at gmail.com
Tue Nov 10 07:08:20 UTC 2009
Hi all,
I'm resending the patch in the parent mail, this time without the RFC
in the subject.
As there was hardly any comments on the patch version 2 in my previous
mail thread "[RFC PATCH] Use gdbserver from external toolchain", I
hope that this patch can be applied.
As is stated in the help section of the Config.in-part, this patch is
only intended to be used together with an external toolchain built by
crosstool-NG. The path to the gdbserver is derived as a relative path
compared to the sysroot. This is done as there is no API to find
neither the debug-root, nor the gdbserver binary.
Regards,
Anders Darander
On Tue, Nov 10, 2009 at 08:03, Anders Darander
<anders.darander at gmail.com> wrote:
> 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 at 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
>
>
--
Anders Darander
EPO guidelines 1978: "If the contribution to the known art resides
solely in a computer program then the subject matter is not
patentable in whatever manner it may be presented in the claims."
More information about the buildroot
mailing list