Skip to contentSkip to conversation

Make remote debugging easier

PATCH New unixmania at gmail.com 3 participants 10 messages Oct 1, 2019 – Apr 14, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Make remote debugging easier

From: Carlos Santos <[email protected]>

Patch 1 moves binaries stripping to the rootfs creation instead of in target-finalize. This allows us to find the non-stripped executables under TARGET_DIR, rather than searching inside the build directory.

Patch 2 updates the gdbinit file to set sysroot to TARGET_DIR.

Carlos Santos (2):
Strip binaries in the rootfs creation instead of in target-finalize
toolchain: install gdbinit under TARGET_DIR

 Makefile                                      | 34 -----------------
 docs/manual/quickstart.txt                    |  5 ++-
 docs/manual/using-buildroot-debugger.txt      | 11 ++++--
 fs/common.mk                                  | 37 ++++++++++++++++++-
 toolchain/helpers.mk                          |  4 +-
 .../pkg-toolchain-external.mk                 |  4 +-
 6 files changed, 50 insertions(+), 45 deletions(-)
Signature · 1 line
2.18.1
#1 lore raw

PATCH v2 1/2 Strip binaries in the rootfs creation instead of in target-finalize

From: Carlos Santos <[email protected]>

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.

---
CC: Ciro Santilli <[email protected]>
---
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(-)
Makefile +0 -34
index ecaae13846..57314e5f1d 100644
@@ -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
fs/common.mk +35 -1
index 842ea924a5..caa7825cbb 100644
@@ -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)
Signature · 1 line
2.18.1
#2 lore raw

PATCH v2 1/2 Strip binaries in the rootfs creation instead of in target-finalize

Quoted 6 lines · On Mon, 30 Sep 2019 22:36:53 -0300 unixmania at gmail.com wrote:

From: Carlos Santos <[email protected]>

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.

Quoted 8 lines

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.

I see Arnout reviewed-by this, and while I understand the goal, I am not sure this is the real direction/solution we want for this problem. I believe the real solution we have been talking about for a long time is to install everything in STAGING_DIR (not just libraries). This way, unstripped binaries with debugging symbols with all be in STAGING_DIR.

To me, the change being proposed here makes TARGET_DIR really different from what ends up in the final rootfs image. While we admittely already have a few differences, I personally like to keep the idea of TARGET_DIR being really what's on the target root filesystem, with as few differences as possible.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH v2 1/2 Strip binaries in the rootfs creation instead of in target-finalize

Quoted 25 lines · Thomas Petazzoni
Quoted 6 lines · On Mon, 30 Sep 2019 22:36:53 -0300 unixmania at gmail.com wrote:

From: Carlos Santos <[email protected]>

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.

Quoted 8 lines

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.

I see Arnout reviewed-by this, and while I understand the goal, I am not sure this is the real direction/solution we want for this problem. I believe the real solution we have been talking about for a long time is to install everything in STAGING_DIR (not just libraries). This way, unstripped binaries with debugging symbols with all be in STAGING_DIR.

Quoted 5 lines

To me, the change being proposed here makes TARGET_DIR really different from what ends up in the final rootfs image. While we admittely already have a few differences, I personally like to keep the idea of TARGET_DIR being really what's on the target root filesystem, with as few differences as possible.

We could make it optional, keeping the the current behavior by default.

Signature · 1 line
Carlos Santos <[email protected]>
#4 lore raw

PATCH v2 1/2 Strip binaries in the rootfs creation instead of in target-finalize

In reply to Thomas Petazzoni

Thomas, Carlos, Arnout, All,

On 2019-10-01 08:52 +0200, Thomas Petazzoni spake thusly:

Quoted 15 lines
Quoted 12 lines · On Mon, 30 Sep 2019 22:36:53 -0300 unixmania at gmail.com wrote:

From: Carlos Santos <[email protected]>

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.

Quoted 8 lines
Quoted 2 lines

I see Arnout reviewed-by this, and while I understand the goal, I am not sure this is the real direction/solution we want for this problem. I believe the real solution we have been talking about for a long time is to install everything in STAGING_DIR (not just libraries). This way, unstripped binaries with debugging symbols with all be in STAGING_DIR.

I agree with Thomas here.

The dichotomy between staging/ and target/ has no raison-d'?tre nowadays.

The idea would be to ensure that all packages install in staging/, always. Then, identify packages that have different commands for target/ and staging/ and make them identical. Finally, remove the target install commands, and genreate it as a copy of staging at the beginning of the target-finalize step.

Yes, the real patches will be a bit more gory than the ideal view above. But except for some special snowflakes (qt5, I'm looking at you), it should be fairly straghtforward...

Quoted 5 lines

To me, the change being proposed here makes TARGET_DIR really different from what ends up in the final rootfs image. While we admittely already have a few differences, I personally like to keep the idea of TARGET_DIR being really what's on the target root filesystem, with as few differences as possible.

I beg to slightly disagree here, and with a much more controversial view on the topic: we should just get rid of target/ altogether. The only valid artefacts we generates are the images in images/

But that one is definitely not on the table. ;-)

Regards,
Yann E. MORIN.

Quoted 9 lines

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH v2 1/2 Strip binaries in the rootfs creation instead of in target-finalize

In reply to unixmania at gmail.com

Hello Carlos,

Quoted 22 lines · On Mon, 30 Sep 2019 22:36:53 -0300 unixmania at gmail.com wrote:

From: Carlos Santos <[email protected]>

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.

---
CC: Ciro Santilli <[email protected]>
---
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.

Quoted 4 lines
---
 Makefile     | 34 ----------------------------------
 fs/common.mk | 36 +++++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 35 deletions(-)

There's been feedback from both Yann and me on this patch, and both of us think this is not the approach we want to take. Instead, we'd rather see everything installed to STAGING_DIR as the way of fixing the original issue.

So I've marked both patches as Rejected in patchwork. Of course, if other people disagree with this decision, we can always revisit and rediscuss the matter.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

PATCH v2 1/2 Strip binaries in the rootfs creation instead of in target-finalize

Quoted 33 lines · Thomas Petazzoni

Hello Carlos,

Quoted 22 lines · On Mon, 30 Sep 2019 22:36:53 -0300 unixmania at gmail.com wrote:

From: Carlos Santos <[email protected]>

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.

---
CC: Ciro Santilli <[email protected]>
---
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.

Quoted 4 lines
---
 Makefile     | 34 ----------------------------------
 fs/common.mk | 36 +++++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 35 deletions(-)
Quoted 8 lines

There's been feedback from both Yann and me on this patch, and both of us think this is not the approach we want to take. Instead, we'd rather see everything installed to STAGING_DIR as the way of fixing the original issue.

So I've marked both patches as Rejected in patchwork. Of course, if other people disagree with this decision, we can always revisit and rediscuss the matter.

Just to remind you, the problem was reported two and a half years ago and the situation is still the same. Perfect is the enemy of good and later easily becomes never. Anyway, your project, your rules.

Signature · 1 line
Carlos Santos <[email protected]>
#7 lore raw

PATCH v2 1/2 Strip binaries in the rootfs creation instead of in target-finalize

Hello Carlos,

Quoted 5 lines · On Mon, 13 Apr 2020 20:41:11 -0300 Carlos Santos <[email protected]> wrote:
Quoted 5 lines

There's been feedback from both Yann and me on this patch, and both of us think this is not the approach we want to take. Instead, we'd rather see everything installed to STAGING_DIR as the way of fixing the original issue.

Quoted 7 lines
Quoted 3 lines

So I've marked both patches as Rejected in patchwork. Of course, if other people disagree with this decision, we can always revisit and rediscuss the matter.

Just to remind you, the problem was reported two and a half years ago and the situation is still the same. Perfect is the enemy of good and later easily becomes never. Anyway, your project, your rules.

Why do you have to be so aggressive immediately ? Don't you have in your palette of expression, some intermediate feelings, where you can express concern and possibly frustration, without the agression ? Be constructive instead of aggressive ?

It is deeply annoying that we can never say anything about your patches and the approach you're taking without getting back a missile. This is not how open-source works. We discuss, understand each others concerns, find good trade-offs and make progress.

Have you read our concerns ? As far as I can see, your only reply was to make it optional, which really only makes the whole thing even more complicated.

I would really like to build a more constructive and collaborative work relationship with you. You are always sending very good and valuable contributions of high-quality, but there's a total impossibility of discussing them if we have some fundamental concerns about them. All of us maintainers always fear to reply negatively to one of your contributions, because we know we are going to get back an aggression. This is not how it should work. This is not why we all want to contribute together to the same project.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#8 lore raw

PATCH v2 1/2 Strip binaries in the rootfs creation instead of in target-finalize

ing Tue, Apr 14, 2020 at 2:36 AM Thomas Petazzoni

Quoted 18 lines · <[email protected]> wrote:

Hello Carlos,

Quoted 12 lines · On Mon, 13 Apr 2020 20:41:11 -0300 Carlos Santos <[email protected]> wrote:
Quoted 8 lines

There's been feedback from both Yann and me on this patch, and both of us think this is not the approach we want to take. Instead, we'd rather see everything installed to STAGING_DIR as the way of fixing the original issue.

So I've marked both patches as Rejected in patchwork. Of course, if other people disagree with this decision, we can always revisit and rediscuss the matter.

Just to remind you, the problem was reported two and a half years ago and the situation is still the same. Perfect is the enemy of good and later easily becomes never. Anyway, your project, your rules.

---8<---

Quoted 3 lines

Have you read our concerns ? As far as I can see, your only reply was to make it optional, which really only makes the whole thing even more complicated.

---8<---

I have read the concerns. They sound reasonable but at the same time there was an assumption (or promise) that the problem would vanish once the dichotomy between staging/ and target/ be eliminated. Fair enough, but no ETA was provided and the fact that the problem still exists should be an alert about how difficult the solution is.

So two questions must be answered:

1. Is the problem reported by Ciro Santilli in bug 10386 real? If the answer is "no", there's nothing else to argue about. Otherwise, jump to question 2.

2. Is anybody able to estimate how long it will take to provide a solution?

Signature · 1 line
Carlos Santos <[email protected]>
#9 lore raw

PATCH v2 2/2 toolchain: install gdbinit under TARGET_DIR

In reply to unixmania at gmail.com

From: Carlos Santos <[email protected]>

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.

---
CC: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
CC: Ciro Santilli <[email protected]>

---
 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(-)
docs/manual/quickstart.txt +3 -2
index 74158ae249..d2e48b4540 100644
@@ -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
docs/manual/using-buildroot-debugger.txt +7 -4
index d5293beb53..599f9f77d1 100644
@@ -35,15 +35,18 @@ Then, on the host, you should start the cross gdb using the following
 command line:
 
 ----------------------------
-<buildroot>/output/host/bin/<tuple>-gdb -x <buildroot>/output/staging/usr/share/buildroot/gdbinit foo
+<buildroot>/output/host/bin/<tuple>-gdb -x <buildroot>/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 +<buildroot>/output/staging/usr/share/buildroot/gdbinit+ file will tell the
+----------------------------
+<buildroot>/output/host/bin/<tuple>-gdb -x <buildroot>/output/target/usr/share/buildroot/gdbinit output/target/usr/bib/foo
+----------------------------
+
+The +<buildroot>/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:
fs/common.mk +1 -0
index caa7825cbb..612baffca2 100644
@@ -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)
 
toolchain/helpers.mk +2 -2
index 6a4f7223c8..4ee3ba3e99 100644
@@ -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
toolchain/toolchain-external/pkg-toolchain-external.mk +2 -2
index c00211d59c..613e170855 100644
@@ -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
 
Signature · 1 line
2.18.1