From 85ecfd1a128fa0235c34e14eccafb5aa9bf65554 Mon Sep 17 00:00:00 2001 From: Heiko Stuebner Date: Tue, 30 Jun 2020 01:05:45 +0200 Subject: 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 Reviewed-by: Simon Glass Reviewed-by: Tom Rini --- cmd/panic.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cmd/panic.c (limited to 'cmd/panic.c') diff --git a/cmd/panic.c b/cmd/panic.c new file mode 100644 index 00000000000..f13b3f094fa --- /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 +#include + +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]" +); -- cgit v1.2.3