[PATCH 3/9] intoduce dmesg to print the barebox output ring buffer
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Thu Dec 13 11:40:04 EST 2012
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
commands/Kconfig | 6 ++++++
common/console.c | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/commands/Kconfig b/commands/Kconfig
index ac9b797..55a9840 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -115,6 +115,12 @@ config CMD_TIME
checking for ctrl-c, so the time command can be used with commands
which are interruptible with ctrl-c.
+config CMD_DMESG
+ bool "dmesg"
+ depends on CONSOLE_FULL
+ help
+ print the barebox output ring buffer
+
config CMD_LINUX_EXEC
bool "linux exec"
depends on LINUX
diff --git a/common/console.c b/common/console.c
index 96e1396..2d2d20a 100644
--- a/common/console.c
+++ b/common/console.c
@@ -434,3 +434,23 @@ int ctrlc (void)
}
EXPORT_SYMBOL(ctrlc);
#endif /* ARCH_HAS_CTRC */
+
+#include <command.h>
+#include <complete.h>
+
+static int do_dmesg(int argc, char *argv[])
+{
+ kfifo_dump_str(console_output_fifo, console_output_dump);
+
+ return 0;
+}
+
+static const __maybe_unused char cmd_dmesg_help[] =
+"print the barebox output ring buffer\n";
+
+BAREBOX_CMD_START(dmesg)
+ .cmd = do_dmesg,
+ .usage = "dmesg",
+ BAREBOX_CMD_HELP(cmd_dmesg_help)
+ BAREBOX_CMD_COMPLETE(empty_complete)
+BAREBOX_CMD_END
--
1.7.10.4
More information about the barebox
mailing list