mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/3] ARM: start: print debugging info when CONFIG_DEBUG_INITCALLS
@ 2022-12-12 16:42 Ahmad Fatoum
  2022-12-12 16:42 ` [PATCH v2 2/3] RISC-V: " Ahmad Fatoum
  2022-12-12 16:42 ` [PATCH v2 3/3] pbl: define DEBUG globally when CONFIG_INITCALL_DEBUG=y Ahmad Fatoum
  0 siblings, 2 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2022-12-12 16:42 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

CONFIG_INITCALL_DEBUG can be very useful to debug early barebox hangs,
but it doesn't help when the hang happens just before. In this case,
enable the early barebox proper debug messages.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - reworded commit message after changes to now 3rd commit
---
 arch/arm/cpu/start.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index f9b617aa855a..be303514c23d 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -3,6 +3,10 @@
 
 #define pr_fmt(fmt) "start.c: " fmt
 
+#ifdef CONFIG_DEBUG_INITCALLS
+#define DEBUG
+#endif
+
 #include <common.h>
 #include <init.h>
 #include <linux/sizes.h>
-- 
2.30.2




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

* [PATCH v2 2/3] RISC-V: start: print debugging info when CONFIG_DEBUG_INITCALLS
  2022-12-12 16:42 [PATCH v2 1/3] ARM: start: print debugging info when CONFIG_DEBUG_INITCALLS Ahmad Fatoum
@ 2022-12-12 16:42 ` Ahmad Fatoum
  2022-12-12 16:42 ` [PATCH v2 3/3] pbl: define DEBUG globally when CONFIG_INITCALL_DEBUG=y Ahmad Fatoum
  1 sibling, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2022-12-12 16:42 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

CONFIG_INITCALL_DEBUG can be very useful to debug early barebox hangs,
but it doesn't help when the hang happens just before. In this case,
enable the early barebox proper debug messages.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - new patch
---
 arch/riscv/boot/start.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/riscv/boot/start.c b/arch/riscv/boot/start.c
index 27d9066243f9..92991d0f6a84 100644
--- a/arch/riscv/boot/start.c
+++ b/arch/riscv/boot/start.c
@@ -3,6 +3,10 @@
 
 #define pr_fmt(fmt) "start.c: " fmt
 
+#ifdef CONFIG_DEBUG_INITCALLS
+#define DEBUG
+#endif
+
 #include <common.h>
 #include <init.h>
 #include <linux/sizes.h>
-- 
2.30.2




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

* [PATCH v2 3/3] pbl: define DEBUG globally when CONFIG_INITCALL_DEBUG=y
  2022-12-12 16:42 [PATCH v2 1/3] ARM: start: print debugging info when CONFIG_DEBUG_INITCALLS Ahmad Fatoum
  2022-12-12 16:42 ` [PATCH v2 2/3] RISC-V: " Ahmad Fatoum
@ 2022-12-12 16:42 ` Ahmad Fatoum
  2022-12-14 10:25   ` Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2022-12-12 16:42 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

CONFIG_INITCALL_DEBUG=y is a very useful tool for debugging barebox
hangs, but it's not so useful if the hang happens very early.
Define a new CONFIG_PBL_DEBUG symbol that will define DEBUG globally
in PBL to get more insight into boot hangs.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - changed into separate config option instead of piggy backing
    CONFIG_DEBUG_INITCALLS (Sascha)
---
 common/Kconfig       | 9 +++++++++
 scripts/Makefile.lib | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/common/Kconfig b/common/Kconfig
index 19cd79311016..46675dfe2ea7 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1566,6 +1566,15 @@ config DEBUG_INITCALLS
 	help
 	  If enabled this will print initcall traces.
 
+config DEBUG_PBL
+	bool "Print PBL debugging information"
+	depends on PBL_CONSOLE || DEBUG_LL
+	help
+	  If enabled this will enable all debug prints in the prebootloader.
+	  For this to work, a console needs to be configured in the
+	  board-specific entry point and configured for either DEBUG_LL
+	  or PBL_CONSOLE.
+
 config DEBUG_PROBES
 	bool "Trace driver probes/removes"
 	help
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 85d18f07a2b6..6e0d92cf756d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -156,6 +156,10 @@ _c_flags       += $(if $(patsubst n%,, \
 PBL_CPPFLAGS   += $(call cc-option,-fno-sanitize=all)
 endif
 
+ifeq ($(CONFIG_DEBUG_PBL),y)
+PBL_CPPFLAGS   += -DDEBUG
+endif
+
 # If building barebox in a separate objtree expand all occurrences
 # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
 
-- 
2.30.2




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

* Re: [PATCH v2 3/3] pbl: define DEBUG globally when CONFIG_INITCALL_DEBUG=y
  2022-12-12 16:42 ` [PATCH v2 3/3] pbl: define DEBUG globally when CONFIG_INITCALL_DEBUG=y Ahmad Fatoum
@ 2022-12-14 10:25   ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2022-12-14 10:25 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Dec 12, 2022 at 05:42:12PM +0100, Ahmad Fatoum wrote:
> CONFIG_INITCALL_DEBUG=y is a very useful tool for debugging barebox
> hangs, but it's not so useful if the hang happens very early.
> Define a new CONFIG_PBL_DEBUG symbol that will define DEBUG globally
> in PBL to get more insight into boot hangs.

s/CONFIG_PBL_DEBUG/CONFIG_DEBUG_PBL/

Fixed that and adjusted to subject to the updated patch while applying.

Sascha

> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> v1 -> v2:
>   - changed into separate config option instead of piggy backing
>     CONFIG_DEBUG_INITCALLS (Sascha)
> ---
>  common/Kconfig       | 9 +++++++++
>  scripts/Makefile.lib | 4 ++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/common/Kconfig b/common/Kconfig
> index 19cd79311016..46675dfe2ea7 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -1566,6 +1566,15 @@ config DEBUG_INITCALLS
>  	help
>  	  If enabled this will print initcall traces.
>  
> +config DEBUG_PBL
> +	bool "Print PBL debugging information"
> +	depends on PBL_CONSOLE || DEBUG_LL
> +	help
> +	  If enabled this will enable all debug prints in the prebootloader.
> +	  For this to work, a console needs to be configured in the
> +	  board-specific entry point and configured for either DEBUG_LL
> +	  or PBL_CONSOLE.
> +
>  config DEBUG_PROBES
>  	bool "Trace driver probes/removes"
>  	help
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 85d18f07a2b6..6e0d92cf756d 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -156,6 +156,10 @@ _c_flags       += $(if $(patsubst n%,, \
>  PBL_CPPFLAGS   += $(call cc-option,-fno-sanitize=all)
>  endif
>  
> +ifeq ($(CONFIG_DEBUG_PBL),y)
> +PBL_CPPFLAGS   += -DDEBUG
> +endif
> +
>  # If building barebox in a separate objtree expand all occurrences
>  # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
>  
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2022-12-14 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 16:42 [PATCH v2 1/3] ARM: start: print debugging info when CONFIG_DEBUG_INITCALLS Ahmad Fatoum
2022-12-12 16:42 ` [PATCH v2 2/3] RISC-V: " Ahmad Fatoum
2022-12-12 16:42 ` [PATCH v2 3/3] pbl: define DEBUG globally when CONFIG_INITCALL_DEBUG=y Ahmad Fatoum
2022-12-14 10:25   ` Sascha Hauer

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