From 51f03e6a7596d61a9ae9b1aee030112cc6a795ff Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 30 Jun 2016 10:52:19 -0600 Subject: [PATCH] mkimage: Show item lists for all categories Update the error-handling code for -A, -C and -O to show a list of valid options when an invalid one is provided. Signed-off-by: Simon Glass Reported-by: Vinoth Eswaran Reviewed-by: Tom Rini --- tools/mkimage.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/mkimage.c b/tools/mkimage.c index 3cdbb2cfcd..f589a418ee 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -152,8 +152,10 @@ static void process_args(int argc, char **argv) break; case 'A': params.arch = genimg_get_arch_id(optarg); - if (params.arch < 0) + if (params.arch < 0) { + show_valid_options(IH_ARCH); usage("Invalid architecture"); + } break; case 'b': if (add_content(IH_TYPE_FLATDT, optarg)) { @@ -168,8 +170,10 @@ static void process_args(int argc, char **argv) break; case 'C': params.comp = genimg_get_comp_id(optarg); - if (params.comp < 0) + if (params.comp < 0) { + show_valid_options(IH_COMP); usage("Invalid compression type"); + } break; case 'd': params.datafile = optarg; @@ -216,8 +220,10 @@ static void process_args(int argc, char **argv) break; case 'O': params.os = genimg_get_os_id(optarg); - if (params.os < 0) + if (params.os < 0) { + show_valid_options(IH_OS); usage("Invalid operating system"); + } break; case 'p': params.external_offset = strtoull(optarg, &ptr, 16); -- 2.39.5