diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-08-07 06:15:16 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-08-07 06:15:16 +0200 |
commit | 5b7b7ee5d943c6b58d9b7f974167d0105ca1b787 (patch) | |
tree | 5b01a8a5d8fa8f91f56547761df026adce9dabeb /commands | |
parent | f1ee4e8b73a356278056666da8d0c6b5aa53088d (diff) | |
parent | 07f93f54521c212558eb09adc812d97dffda443b (diff) | |
download | barebox-5b7b7ee5d943c6b58d9b7f974167d0105ca1b787.tar.gz barebox-5b7b7ee5d943c6b58d9b7f974167d0105ca1b787.tar.xz |
Merge branch 'for-next/metadata'
Conflicts:
arch/arm/dts/Makefile
common/Makefile
lib/Makefile
Diffstat (limited to 'commands')
-rw-r--r-- | commands/Kconfig | 9 | ||||
-rw-r--r-- | commands/Makefile | 1 | ||||
-rw-r--r-- | commands/barebox-update.c | 1 | ||||
-rw-r--r-- | commands/cp.c | 1 | ||||
-rw-r--r-- | commands/crc.c | 1 | ||||
-rw-r--r-- | commands/edit.c | 1 | ||||
-rw-r--r-- | commands/exec.c | 1 | ||||
-rw-r--r-- | commands/imd.c | 60 | ||||
-rw-r--r-- | commands/insmod.c | 1 | ||||
-rw-r--r-- | commands/linux16.c | 1 | ||||
-rw-r--r-- | commands/of_dump.c | 1 | ||||
-rw-r--r-- | commands/oftree.c | 1 | ||||
-rw-r--r-- | commands/readf.c | 1 | ||||
-rw-r--r-- | commands/tftp.c | 1 | ||||
-rw-r--r-- | commands/ubiformat.c | 1 | ||||
-rw-r--r-- | commands/uimage.c | 1 |
16 files changed, 83 insertions, 0 deletions
diff --git a/commands/Kconfig b/commands/Kconfig index b03f74a82b..71cd1ee99e 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -148,6 +148,15 @@ config CMD_IOMEM Show information about iomem/ioport usage. Pendant to 'cat /proc/iomem' and 'cat /proc/ioports' under Linux. +config CMD_IMD + tristate + prompt "imd" + select IMD + help + barebox images can have metadata in them which contains information + like the barebox version and the build time. Say yes here to get the + imd command which can extract that information from images. + config CMD_MEMINFO tristate prompt "meminfo" diff --git a/commands/Makefile b/commands/Makefile index d42aca5c0c..44741360e2 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -100,3 +100,4 @@ obj-$(CONFIG_CMD_MENUTREE) += menutree.o obj-$(CONFIG_CMD_2048) += 2048.o obj-$(CONFIG_CMD_REGULATOR) += regulator.o obj-$(CONFIG_CMD_LSPCI) += lspci.o +obj-$(CONFIG_CMD_IMD) += imd.o diff --git a/commands/barebox-update.c b/commands/barebox-update.c index a24dc3ef4d..92e0efab6a 100644 --- a/commands/barebox-update.c +++ b/commands/barebox-update.c @@ -17,6 +17,7 @@ */ #include <common.h> #include <command.h> +#include <libfile.h> #include <getopt.h> #include <malloc.h> #include <errno.h> diff --git a/commands/cp.c b/commands/cp.c index 1a5675405e..af7a3d4dc0 100644 --- a/commands/cp.c +++ b/commands/cp.c @@ -26,6 +26,7 @@ #include <malloc.h> #include <libgen.h> #include <getopt.h> +#include <libfile.h> /** * @param[in] argc Argument count from command line diff --git a/commands/crc.c b/commands/crc.c index 7c2936c23c..9b6a3e2a4b 100644 --- a/commands/crc.c +++ b/commands/crc.c @@ -22,6 +22,7 @@ #include <fs.h> #include <getopt.h> #include <malloc.h> +#include <libfile.h> #include <environment.h> static int crc_from_file(const char* file, ulong *crc) diff --git a/commands/edit.c b/commands/edit.c index 98af583574..b28e2b92a1 100644 --- a/commands/edit.c +++ b/commands/edit.c @@ -21,6 +21,7 @@ #include <fs.h> #include <linux/ctype.h> #include <fcntl.h> +#include <libfile.h> #include <readkey.h> #include <errno.h> #include <xfuncs.h> diff --git a/commands/exec.c b/commands/exec.c index 635f65eeb2..7c8934f137 100644 --- a/commands/exec.c +++ b/commands/exec.c @@ -23,6 +23,7 @@ #include <fcntl.h> #include <linux/stat.h> #include <errno.h> +#include <libfile.h> #include <malloc.h> #include <xfuncs.h> diff --git a/commands/imd.c b/commands/imd.c new file mode 100644 index 0000000000..f1a22cef96 --- /dev/null +++ b/commands/imd.c @@ -0,0 +1,60 @@ +/* + * (C) Copyright 2014 Sascha Hauer, Pengutronix + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <common.h> +#include <command.h> +#include <complete.h> +#include <environment.h> +#include <image-metadata.h> + +int imd_command_setenv(const char *variable_name, const char *value) +{ + return setenv(variable_name, value); +} + +static int do_imd(int argc, char *argv[]) +{ + int ret; + + ret = imd_command(argc, argv); + + if (ret == -ENOSYS) + return COMMAND_ERROR_USAGE; + + return ret; +} + +BAREBOX_CMD_HELP_START(imd) +BAREBOX_CMD_HELP_TEXT("extract metadata from barebox binary") +BAREBOX_CMD_HELP_TEXT("") +BAREBOX_CMD_HELP_TEXT("Options:") +BAREBOX_CMD_HELP_OPT ("-t <type>", "only show information of <type>") +BAREBOX_CMD_HELP_OPT ("-n <no>", "for tags with multiple strings only show string <no>") +BAREBOX_CMD_HELP_OPT ("-s VARNAME", "set variable VARNAME instead of showing information") +BAREBOX_CMD_HELP_TEXT("") +BAREBOX_CMD_HELP_TEXT("Without options all information available is printed. Valid types are:") +BAREBOX_CMD_HELP_TEXT("release, build, model, of_compatible") +BAREBOX_CMD_HELP_END + +BAREBOX_CMD_START(imd) + .cmd = do_imd, + BAREBOX_CMD_DESC("extract metadata from barebox binary") + BAREBOX_CMD_OPTS("[nst] FILE") + BAREBOX_CMD_GROUP(CMD_GRP_INFO) + BAREBOX_CMD_HELP(cmd_imd_help) +BAREBOX_CMD_END diff --git a/commands/insmod.c b/commands/insmod.c index 176437ee70..735dde0222 100644 --- a/commands/insmod.c +++ b/commands/insmod.c @@ -3,6 +3,7 @@ #include <module.h> #include <errno.h> #include <fs.h> +#include <libfile.h> #include <malloc.h> static int do_insmod(int argc, char *argv[]) diff --git a/commands/linux16.c b/commands/linux16.c index 594efc7dc2..bb678bdb83 100644 --- a/commands/linux16.c +++ b/commands/linux16.c @@ -24,6 +24,7 @@ #include <environment.h> #include <fs.h> #include <errno.h> +#include <libfile.h> #include <getopt.h> #include <malloc.h> #include <boot.h> diff --git a/commands/of_dump.c b/commands/of_dump.c index cafde07b7c..315dbbae8c 100644 --- a/commands/of_dump.c +++ b/commands/of_dump.c @@ -18,6 +18,7 @@ */ #include <common.h> +#include <libfile.h> #include <fdt.h> #include <of.h> #include <command.h> diff --git a/commands/oftree.c b/commands/oftree.c index 49976bc02a..8a47c0be58 100644 --- a/commands/oftree.c +++ b/commands/oftree.c @@ -26,6 +26,7 @@ #include <common.h> #include <environment.h> #include <fdt.h> +#include <libfile.h> #include <of.h> #include <command.h> #include <fs.h> diff --git a/commands/readf.c b/commands/readf.c index c8cc574f35..8dd5a2b55a 100644 --- a/commands/readf.c +++ b/commands/readf.c @@ -1,6 +1,7 @@ #include <common.h> #include <command.h> #include <fs.h> +#include <libfile.h> #include <malloc.h> #include <linux/stat.h> #include <linux/ctype.h> diff --git a/commands/tftp.c b/commands/tftp.c index 62b9424cf3..8a3b541382 100644 --- a/commands/tftp.c +++ b/commands/tftp.c @@ -24,6 +24,7 @@ #include <fs.h> #include <net.h> #include <libbb.h> +#include <libfile.h> #define TFTP_MOUNT_PATH "/.tftp_tmp_path" diff --git a/commands/ubiformat.c b/commands/ubiformat.c index 443d645a5a..df0b801da9 100644 --- a/commands/ubiformat.c +++ b/commands/ubiformat.c @@ -40,6 +40,7 @@ #include <malloc.h> #include <ioctl.h> #include <libbb.h> +#include <libfile.h> #include <linux/mtd/mtd.h> #include <linux/kernel.h> #include <linux/stat.h> diff --git a/commands/uimage.c b/commands/uimage.c index 33523d7e5c..7c2dca41ec 100644 --- a/commands/uimage.c +++ b/commands/uimage.c @@ -7,6 +7,7 @@ #include <malloc.h> #include <errno.h> #include <getopt.h> +#include <libfile.h> static int uimage_fd; |