cmd: add a panic command
PATCH v2 1/1 cmd: add a panic command
From: Heiko Stuebner <[email protected]>
Even in boot scripts it may be needed to "panic" when all options are exhausted and the device specification specifies hanging instead of resetting the board.
So add a new panic command that just wraps around the core panic call in U-Boot and can take an optional message.
---
changes in v2:
- add blank line before return (Simon)
- fix U-Boot spelling (Simon)
cmd/Makefile | 1 + cmd/panic.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 cmd/panic.c
cmd/Makefile +1 -0
@@ -8,6 +8,7 @@ ifndef CONFIG_SPL_BUILD obj-y += boot.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-y += help.o +obj-y += panic.o obj-y += version.o # command
cmd/panic.c new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH +*/ + +#include <common.h> +#include <command.h> + +static int do_panic (cmd_tbl_t *cmdtp,int flag,int argc, +char *const argv[]) +{ +char *text = (argc <2 ) ?"" : argv[1 ]; + +panic (text); + +return CMD_RET_SUCCESS ; +} + +U_BOOT_CMD ( + panic,2 ,1 , do_panic, +"Panic with optional message" , +"[message]" +);
Signature · 1 line
2.26.2
PATCH v2 1/1 cmd: add a panic command
Quoted 11 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
Even in boot scripts it may be needed to "panic" when all options are exhausted and the device specification specifies hanging instead of resetting the board.
So add a new panic command that just wraps around the core panic call in U-Boot and can take an optional message.
Signed-off-by Heiko Stuebner <[email protected]>Reviewed-by Simon Glass <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/cd164aff/attachment.sig>
PATCH v2 1/1 cmd: add a panic command
In reply to Heiko StuebnerQuoted 6 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
Even in boot scripts it may be needed to "panic" when all options are exhausted and the device specification specifies hanging instead of resetting the board.
Quoted 6 lines
So add a new panic command that just wraps around the core panic call in U-Boot and can take an optional message.
Signed-off-by Heiko Stuebner <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200708/412ad3ce/attachment.sig>