From 020a30be0d9a3b56a98c4e4094d13d3b4e3bd4eb Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sat, 26 Nov 2011 21:33:59 +0100 Subject: add magicvar command The magicvar command gives an overview about all environment variables with a special meaning. Signed-off-by: Sascha Hauer --- commands/Kconfig | 14 ++++++++++++++ commands/Makefile | 1 + commands/magicvar.c | 20 ++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 commands/magicvar.c (limited to 'commands') diff --git a/commands/Kconfig b/commands/Kconfig index 18ab840916..78b9d2a0e6 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -383,6 +383,20 @@ config CMD_HELP default y prompt "help" +config CMD_MAGICVAR + tristate + prompt "magicvar" + help + barebox has some shell variables with special meanings. This + command shows the available magic variables. + +config CMD_MAGICVAR_HELP + bool + prompt "display description" + depends on CMD_MAGICVAR + help + Also display a description to the magic variables + config CMD_DEVINFO tristate default y diff --git a/commands/Makefile b/commands/Makefile index 5c519169c3..9b3a349bd2 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -58,3 +58,4 @@ obj-$(CONFIG_CMD_LED_TRIGGER) += trigger.o obj-$(CONFIG_CMD_USB) += usb.o obj-$(CONFIG_CMD_TIME) += time.o obj-$(CONFIG_CMD_OFTREE) += oftree.o +obj-$(CONFIG_CMD_MAGICVAR) += magicvar.o diff --git a/commands/magicvar.c b/commands/magicvar.c new file mode 100644 index 0000000000..31606d2afa --- /dev/null +++ b/commands/magicvar.c @@ -0,0 +1,20 @@ +#include +#include +#include + +static int do_magicvar(struct command *cmdtp, int argc, char *argv[]) +{ + struct magicvar *m; + + for (m = &__barebox_magicvar_start; + m != &__barebox_magicvar_end; + m++) + printf("%-32s %s\n", m->name, m->description); + + return 0; +} + +BAREBOX_CMD_START(magicvar) + .cmd = do_magicvar, + .usage = "List information about magic variables", +BAREBOX_CMD_END -- cgit v1.2.3 From f84fb129c703a682e37ba05f1ba2ea2b567a14d8 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 27 Nov 2011 13:02:48 +0100 Subject: bootm: Add bootargs magicvar Signed-off-by: Sascha Hauer --- commands/bootm.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'commands') diff --git a/commands/bootm.c b/commands/bootm.c index f11138afba..ada790ee97 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -42,6 +42,7 @@ #include #include #include +#include #include /* @@ -367,6 +368,8 @@ BAREBOX_CMD_START(bootm) BAREBOX_CMD_HELP(cmd_bootm_help) BAREBOX_CMD_END +BAREBOX_MAGICVAR(bootargs, "Linux Kernel parameters"); + /** * @page bootm_command -- cgit v1.2.3