[PATCH v2 4/4] mkimge: Reject signing-related flags without FIT_SIGNATURE
Joel Stanley
joel at jms.id.au
Tue Dec 8 05:12:16 CET 2020
When CONFIG_FIT_SIGNATURE=n the signing options are not available. If a
user is careful they will notice this when looking at the help output.
If they are not careful they will waste several hours wondering why
their FIT doesn't contain a /signature node, as mkimage will silently
ingore the signing related options.
Make it obvious that the commands don't work by removing them from the
getopt opt_string.
$ mkimage -f machine.its -k keys -K u-boot-pubkey.dtb -r image.fit
mkimage: invalid option -- 'k'
Error: Invalid option
Signed-off-by: Joel Stanley <joel at jms.id.au>
--
v2: Leave padding related options in the CONFIG_FIT_SIGNATURE=y optargs
---
tools/mkimage.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 68d5206cb4fd..f7d3ac40e681 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -142,7 +142,11 @@ static int add_content(int type, const char *fname)
return 0;
}
+#ifdef CONFIG_FIT_SIGNATURE
#define OPT_STRING "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx"
+#else
+#define OPT_STRING "a:A:b:B:C:d:D:e:Ef:i:ln:O:R:qstT:vVx"
+#endif
static void process_args(int argc, char **argv)
{
char *ptr;
@@ -150,8 +154,7 @@ static void process_args(int argc, char **argv)
char *datafile = NULL;
int opt;
- while ((opt = getopt(argc, argv,
- "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx")) != -1) {
+ while ((opt = getopt(argc, argv, OPT_STRING)) != -1) {
switch (opt) {
case 'a':
params.addr = strtoull(optarg, &ptr, 16);
--
2.29.2
More information about the U-Boot
mailing list