From d09cda05efff1fa0a3ed60231758b5dca742c2d5 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 27 Jun 2024 20:13:02 +0200 Subject: [PATCH 1/2] build: extend GLUON_DEBUG with values 0, 1 and 2 Debugging binaries in images that are built with sstrip is extremely annoying, as not even objdump will work on them. Switching from sstrip to standard strip increases the ath79 image size (for some usual Archer C7 v2 configuration I used for testing) by ~70KiB, or 1.3% of the rootfs size (~1% of the total image size), which is rarely worth the decreased debuggability. Extend GLUON_DEBUG to not only distinguish 0 and 1, such that: - 0 uses sstrip same as before - 1 switches to regular strip; this is the new default - 2 includes all debug info, like GLUON_DEBUG=1 did before --- Makefile | 2 +- docs/user/getting_started.rst | 13 +++++++++++-- targets/generic | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5fa37a4322..afdbc4c8a7 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ GLUON_SITE_VERSION ?= $(shell scripts/getversion.sh '$(GLUON_SITEDIR)') GLUON_MULTIDOMAIN ?= 0 GLUON_AUTOREMOVE ?= 0 -GLUON_DEBUG ?= 0 +GLUON_DEBUG ?= 1 GLUON_MINIFY ?= 1 # Can be overridden via environment/command line/... to use the Gluon diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst index daa7f53714..332ffc9917 100644 --- a/docs/user/getting_started.rst +++ b/docs/user/getting_started.rst @@ -255,8 +255,17 @@ GLUON_AUTOREMOVE as it significantly increases incremental build times. GLUON_DEBUG - Setting ``GLUON_DEBUG=1`` will provide firmware images including debugging symbols usable with GDB or - similar tools. Requires a device or target with at least 16 MB of flash space, e.g. `x86-64`. Unset by default. + The following values are supported: + + - ``0``: Remove symbol tables and debug information as well as most section and other + information not strictly necessary for execution using ``sstrip``. This saves a small amount + of flash space over the default ``strip`` command (roughly 70kiB for ath79), but makes any + kind of binary analysis much more difficult, as common tools like objdump and gdb can't + handle such files at all. + - ``1``: Remove symbol tables and debug information from binaries using the standard ``strip`` + command. This is the default. + - ``2``: Include debugging symbols usable with GDB or similar tools in all binaries of the image. + Requires a device or target with at least 16 MB of flash space, e.g. ``x86-64``. GLUON_MINIFY Setting ``GLUON_MINIFY=0`` will omit the minification of scripts during the build process. By diff --git a/targets/generic b/targets/generic index 80beb7ee92..125375e30b 100644 --- a/targets/generic +++ b/targets/generic @@ -84,13 +84,16 @@ config('GLUON_MULTIDOMAIN', istrue(env.GLUON_MULTIDOMAIN)) config('AUTOREMOVE', istrue(env.GLUON_AUTOREMOVE)) -if istrue(env.GLUON_DEBUG) then +if (tonumber(env.GLUON_DEBUG) or 0) > 1 then config('DEBUG', true) config('NO_STRIP', true) config('USE_STRIP', false) config('USE_SSTRIP', false) try_config('TARGET_ROOTFS_PARTSIZE', 500) +elseif istrue(env.GLUON_DEBUG) then + config('USE_STRIP', true) + config('USE_SSTRIP', false) end config('GLUON_MINIFY', istrue(env.GLUON_MINIFY)) From 0f0cbaa5ea45e68c2243b5bccb9d21da3818d7f0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 27 Jun 2024 20:26:11 +0200 Subject: [PATCH 2/2] docs: user/getting_started: fix monospace markup Unlike Markdown, RST uses double backticks for monospace text; single backticks result in italic text. Use monospace for commands like the surrounding paragraphs. --- docs/user/getting_started.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst index 332ffc9917..d6927c67a6 100644 --- a/docs/user/getting_started.rst +++ b/docs/user/getting_started.rst @@ -239,7 +239,7 @@ GLUON_RELEASE GLUON_SITE_VERSION Version of the site configuration. This string is displayed in the config mode - and `gluon-info`. If unset, Gluon generates a version string using `git describe` + and ``gluon-info``. If unset, Gluon generates a version string using ``git describe`` on the site folder. GLUON_TARGET