From patchwork Thu Jun 29 17:37:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 782816 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3wzZQd2QgNz9sNS for ; Fri, 30 Jun 2017 21:42:49 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1F984C21D88; Fri, 30 Jun 2017 11:42:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 9F7FEC21CC4; Fri, 30 Jun 2017 11:41:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4A4ACC21DAA; Thu, 29 Jun 2017 17:38:22 +0000 (UTC) Received: from mx.tkos.co.il (guitar.tcltek.co.il [192.115.133.116]) by lists.denx.de (Postfix) with ESMTPS id 5D9B4C21D5B for ; Thu, 29 Jun 2017 17:38:18 +0000 (UTC) Received: from tarshish.tkos.co.il (unknown [10.0.8.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx.tkos.co.il (Postfix) with ESMTPSA id 267B74402D3; Thu, 29 Jun 2017 20:37:57 +0300 (IDT) From: Baruch Siach To: u-boot@lists.denx.de, Tom Rini Date: Thu, 29 Jun 2017 20:37:08 +0300 Message-Id: <6e6b8df328c43801e847c9445db81298e80b643b.1498757828.git.baruch@tkos.co.il> X-Mailer: git-send-email 2.11.0 X-Mailman-Approved-At: Fri, 30 Jun 2017 11:41:30 +0000 Cc: Baruch Siach Subject: [U-Boot] [PATCH v2] mkimage: fix display of image types list X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 Signed-off-by: Baruch Siach Reviewed-by: Simon Glass --- v2: Use 'list' pseudo type instead of getopt() optional argument --- tools/mkimage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);