/src/barebox/commands/imd.c
Line | Count | Source |
1 | | // SPDX-License-Identifier: GPL-2.0-or-later |
2 | | // SPDX-FileCopyrightText: © 2014 Sascha Hauer, Pengutronix |
3 | | |
4 | | #include <common.h> |
5 | | #include <command.h> |
6 | | #include <complete.h> |
7 | | #include <environment.h> |
8 | | #include <image-metadata.h> |
9 | | |
10 | | int imd_command_setenv(const char *variable_name, const char *value) |
11 | 0 | { |
12 | 0 | return setenv(variable_name, value); |
13 | 0 | } |
14 | | |
15 | | static int do_imd(int argc, char *argv[]) |
16 | 0 | { |
17 | 0 | int ret; |
18 | |
|
19 | 0 | ret = imd_command(argc, argv); |
20 | |
|
21 | 0 | if (ret == -ENOSYS) |
22 | 0 | return COMMAND_ERROR_USAGE; |
23 | | |
24 | 0 | return ret; |
25 | 0 | } |
26 | | |
27 | | BAREBOX_CMD_HELP_START(imd) |
28 | | BAREBOX_CMD_HELP_TEXT("extract metadata from barebox binary") |
29 | | BAREBOX_CMD_HELP_TEXT("") |
30 | | BAREBOX_CMD_HELP_TEXT("Options:") |
31 | | BAREBOX_CMD_HELP_OPT ("-t <type>", "only show information of <type>") |
32 | | BAREBOX_CMD_HELP_OPT ("-n <no>", "for tags with multiple strings only show string <no>") |
33 | | BAREBOX_CMD_HELP_OPT ("-s VARNAME", "set variable VARNAME instead of showing information") |
34 | | BAREBOX_CMD_HELP_OPT ("-v", "Be verbose") |
35 | | BAREBOX_CMD_HELP_OPT ("-V", "Verify checksum of FILE") |
36 | | BAREBOX_CMD_HELP_OPT ("-c", "Create checksum for FILE and write it to the crc32 tag.") |
37 | | BAREBOX_CMD_HELP_TEXT("") |
38 | | BAREBOX_CMD_HELP_TEXT("Without options all information available is printed. Valid types are:") |
39 | | BAREBOX_CMD_HELP_TEXT("release, build, model, of_compatible") |
40 | | BAREBOX_CMD_HELP_END |
41 | | |
42 | | BAREBOX_CMD_START(imd) |
43 | | .cmd = do_imd, |
44 | | BAREBOX_CMD_DESC("extract metadata from barebox binary") |
45 | | BAREBOX_CMD_OPTS("[nst] FILE") |
46 | | BAREBOX_CMD_GROUP(CMD_GRP_INFO) |
47 | | BAREBOX_CMD_HELP(cmd_imd_help) |
48 | | BAREBOX_CMD_END |