bootm: fdt: Use panic() instead of hang() when presented with a bad image
PATCH 1/1 bootm: fdt: Use panic() instead of hang() when presented with a bad image
When the image which bootm is given can't be booted, call panic with the error message rather than printf/hang so that we can recover from broken images via a bootcount mechanism. If hang on failure is still required then CONFIG_PANIC_HANG can still be enabled.
---
arch/arm/lib/bootm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/lib/bootm.c +2 -4
@@ -230,8 +230,7 @@ static void boot_prep_linux(bootm_headers_t *images)#ifdef CONFIG_OF_LIBFDT debug ("using: FDT\n" );if (image_setup_linux (images)) { -printf ("FDT creation failed! hanging..." ); -hang (); +panic ("FDT creation failed!\n" ); }#endif }else if (BOOTM_ENABLE_TAGS ) {
@@ -264,8 +263,7 @@ static void boot_prep_linux(bootm_headers_t *images)setup_board_tags (¶ms);setup_end_tag (gd->bd); }else { -printf ("FDT and ATAGS support not compiled in - hanging\n" ); -hang (); +panic ("FDT and ATAGS support not compiled in\n" ); } }
Signature · 1 line
2.17.1
PATCH 1/1 bootm: fdt: Use panic() instead of hang() when presented with a bad image
Quoted 4 lines · Alex Kiernan
When the image which bootm is given can't be booted, call panic with the error message rather than printf/hang so that we can recover from broken images via a bootcount mechanism. If hang on failure is still required then
CONFIG_PANIC_HANGcan still be enabled.
This sounds plausible to me, but I think you'll want to send this patch To/Cc someone who owns that file. At least Tom Rini (now CC'd hence quoting the entire patch for context).
Quoted 29 lines
Signed-off-by Alex Kiernan <[email protected]>---
arch/arm/lib/bootm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)arch/arm/lib/bootm.c +2
-4@@ -230,8 +230,7 @@ static void boot_prep_linux(bootm_headers_t *images)#ifdef CONFIG_OF_LIBFDT debug ("using: FDT\n" );if (image_setup_linux (images)) { -printf ("FDT creation failed! hanging..." ); -hang (); +panic ("FDT creation failed!\n" ); }#endif }else if (BOOTM_ENABLE_TAGS ) {@@ -264,8 +263,7 @@ static void boot_prep_linux(bootm_headers_t *images)setup_board_tags (¶ms);setup_end_tag (gd->bd); }else { -printf ("FDT and ATAGS support not compiled in - hanging\n" ); -hang (); +panic ("FDT and ATAGS support not compiled in\n" ); } }
PATCH 1/1 bootm: fdt: Use panic() instead of hang() when presented with a bad image
In reply to Alex KiernanDear Alex,
Quoted 4 lines · In message <[email protected]> you wrote:
When the image which bootm is given can't be booted, call panic with the error message rather than printf/hang so that we can recover from broken images via a bootcount mechanism. If hang on failure is still required then
CONFIG_PANIC_HANGcan still be enabled.
I wonder if the failing of the FDT creation is a reason to panic / reboot at all? The point of no return is architecture dependent - for example, on Power architecture it is usuallywhen the kernel image gests decompressed/written to RAM, as then the exception vectors get overwritten, so no return to U-Boot is possible.
But the FDT is always (I think ?) just written to an area of RAM that is not critical for the execution of U-Boot itself - so when this fails, why can we not simply return to U-Boot with an eroor indication?
I feel we should use panic/hang only as a last resort, when no other recovery is possible?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Have you lived in this village all your life?" "No, not yet."
PATCH 1/1 bootm: fdt: Use panic() instead of hang() when presented with a bad image
Quoted 15 lines · Wolfgang Denk
Dear Alex,
Quoted 4 lines · In message <[email protected]> you wrote:
When the image which bootm is given can't be booted, call panic with the error message rather than printf/hang so that we can recover from broken images via a bootcount mechanism. If hang on failure is still required then
CONFIG_PANIC_HANGcan still be enabled.I wonder if the failing of the FDT creation is a reason to panic / reboot at all? The point of no return is architecture dependent - for example, on Power architecture it is usuallywhen the kernel image gests decompressed/written to RAM, as then the exception vectors get overwritten, so no return to U-Boot is possible.
Quoted 8 lines
But the FDT is always (I think ?) just written to an area of RAM that is not critical for the execution of U-Boot itself - so when this fails, why can we not simply return to U-Boot with an eroor indication?
I feel we should use panic/hang only as a last resort, when no other recovery is possible?
Thinking it through, that sounds reasonable to me... the reason I ended up looking at this code was because I deployed a broken FIT image, then got stuck here. But if bootm had returned with a failure I could have done useful recovery actions without needing a reboot.
Signature · 1 line
Alex Kiernan