Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH V1] core: add kconfig option to archive an un-stripped filesystem
@ 2023-07-28 23:18 Colin Foster
  2023-07-29  7:49 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Colin Foster @ 2023-07-28 23:18 UTC (permalink / raw)
  To: buildroot

It is reasonable to expect that deployed systems don't contain debugging
symbols. At the very least, it will bloat image size unnecessarily.

There might also be scenarios where a previously released image might
generate core dumps, or require attaching a debugger to a process
well after the filesystem image has been made.

These two goals contradict each other, and is addressed here.

Just before stripping target binaries, allow the option to tar the
target filesystem for archiving. This will create a single image -
rootfs_syms.tgz - with un-stripped target binaries, and allow post-build
debugging and core dump analysis. The final image will be unaffected.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
---
 Config.in | 10 ++++++++++
 Makefile  |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/Config.in b/Config.in
index 0d7641633c..a6343f6336 100644
--- a/Config.in
+++ b/Config.in
@@ -443,6 +443,16 @@ config BR2_STRIP_strip
 	  on the target are needed for native debugging, but not when
 	  remote debugging is used.
 
+config BR2_TAR_UNSTRIPPED_FILESYSTEM
+    bool "create filesystem image with unstripped binaries"
+    default n
+    depends on BR2_STRIP_strip
+    help
+      Create an image of the filesystem prior to the 'strip' command.
+      This will allow binaries with debugging symbols to be archived,
+      and should aid in remote debugging and core dump analysis while
+      not taking up space on the target filesystem.
+
 config BR2_STRIP_EXCLUDE_FILES
 	string "executables that should not be stripped"
 	default ""
diff --git a/Makefile b/Makefile
index 09b2066f05..9a5165c24e 100644
--- a/Makefile
+++ b/Makefile
@@ -746,6 +746,9 @@ endif
 	rmdir $(TARGET_DIR)/usr/share 2>/dev/null || true
 ifneq ($(BR2_ENABLE_DEBUG):$(BR2_STRIP_strip),y:)
 	rm -rf $(TARGET_DIR)/lib/debug $(TARGET_DIR)/usr/lib/debug
+endif
+ifeq ($(BR2_TAR_UNSTRIPPED_FILESYSTEM),y)
+	tar -czvf $(BINARIES_DIR)/rootfs_syms.tgz -C $(TARGET_DIR) .
 endif
 	$(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
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-29 20:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28 23:18 [Buildroot] [PATCH V1] core: add kconfig option to archive an un-stripped filesystem Colin Foster
2023-07-29  7:49 ` Thomas Petazzoni via buildroot
2023-07-29 20:43   ` Colin Foster
2023-07-29 20:59     ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox