Message ID | 6e6b8df328c43801e847c9445db81298e80b643b.1498757828.git.baruch@tkos.co.il |
---|---|
State | Accepted |
Commit | 79aa33cdb3d2a158c5ccb35173cbd2ab084d8e9c |
Delegated to: | Tom Rini |
Headers | show |
On 29 June 2017 at 11:37, Baruch Siach <baruch@tkos.co.il> wrote: > Since commit 5b9d44df2307f (mkimage: Display a better list of available image > types) mkimage usage text suggest to "use -T to see a list of available image > types". Unfortunately, commit 02221f29deb8 (mkimage: Convert to use getopt()) > broke that feature, because getopt() fails when -T has no option argument. > > Add a pseudo image type name 'list' that lists all image types. Update the > usage text accordingly. > > Cc: Simon Glass <sjg@chromium.org> > Signed-off-by: Baruch Siach <baruch@tkos.co.il> > --- > v2: Use 'list' pseudo type instead of getopt() optional argument > --- > tools/mkimage.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Thu, Jun 29, 2017 at 08:37:08PM +0300, Baruch Siach wrote: > Since commit 5b9d44df2307f (mkimage: Display a better list of available image > types) mkimage usage text suggest to "use -T to see a list of available image > types". Unfortunately, commit 02221f29deb8 (mkimage: Convert to use getopt()) > broke that feature, because getopt() fails when -T has no option argument. > > Add a pseudo image type name 'list' that lists all image types. Update the > usage text accordingly. > > Cc: Simon Glass <sjg@chromium.org> > Signed-off-by: Baruch Siach <baruch@tkos.co.il> Applied to u-boot/master, thanks!
diff --git a/tools/mkimage.c b/tools/mkimage.c index d982bc5665f1..28ff35e670a3 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -113,7 +113,7 @@ static void usage(const char *msg) #endif fprintf(stderr, " %s -V ==> print version information and exit\n", params.cmdname); - fprintf(stderr, "Use -T to see a list of available image types\n"); + fprintf(stderr, "Use '-T list' to see a list of available image types\n"); exit(EXIT_FAILURE); } @@ -260,6 +260,10 @@ static void process_args(int argc, char **argv) params.skipcpy = 1; break; case 'T': + if (strcmp(optarg, "list") == 0) { + show_valid_options(IH_TYPE); + exit(EXIT_SUCCESS); + } type = genimg_get_type_id(optarg); if (type < 0) { show_valid_options(IH_TYPE);
Since commit 5b9d44df2307f (mkimage: Display a better list of available image types) mkimage usage text suggest to "use -T to see a list of available image types". Unfortunately, commit 02221f29deb8 (mkimage: Convert to use getopt()) broke that feature, because getopt() fails when -T has no option argument. Add a pseudo image type name 'list' that lists all image types. Update the usage text accordingly. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Baruch Siach <baruch@tkos.co.il> --- v2: Use 'list' pseudo type instead of getopt() optional argument --- tools/mkimage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)