diff options
author | Heiko Stuebner <heiko.stuebner@theobroma-systems.com> | 2020-06-30 01:05:45 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-07-08 17:21:46 -0400 |
commit | 85ecfd1a128fa0235c34e14eccafb5aa9bf65554 (patch) | |
tree | 768c8fb332e87b3c86ef23d6628d1c72e916f816 /cmd/panic.c | |
parent | ce6515ecee1fa060a7a4e79eafc8db5f86d259a0 (diff) | |
download | u-boot-85ecfd1a128fa0235c34e14eccafb5aa9bf65554.tar.gz u-boot-85ecfd1a128fa0235c34e14eccafb5aa9bf65554.tar.bz2 u-boot-85ecfd1a128fa0235c34e14eccafb5aa9bf65554.zip |
cmd: add a panic command
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 <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'cmd/panic.c')
-rw-r--r-- | cmd/panic.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cmd/panic.c b/cmd/panic.c new file mode 100644 index 0000000000..f13b3f094f --- /dev/null +++ b/cmd/panic.c @@ -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(struct cmd_tbl *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]" +); |