aboutsummaryrefslogtreecommitdiff
path: root/tools/mkimage.c
diff options
context:
space:
mode:
authorNaoki Hayama <naoki.hayama@lineo.co.jp>2020-10-07 11:21:55 +0900
committerTom Rini <trini@konsulko.com>2020-10-22 09:54:52 -0400
commitad5fb9f2e66e605941f78791f552c6bf6e522a9d (patch)
treec15c1c92dc44279c3b3305bbfc933d0309b5326b /tools/mkimage.c
parent02d41b01bd78dc863614c2919375f366abdeff40 (diff)
downloadu-boot-ad5fb9f2e66e605941f78791f552c6bf6e522a9d.zip
u-boot-ad5fb9f2e66e605941f78791f552c6bf6e522a9d.tar.gz
u-boot-ad5fb9f2e66e605941f78791f552c6bf6e522a9d.tar.bz2
mkimage: Skip adding non-existent IDs to a list
In show_valid_options(), this patch introduces checking whether a category has an entry ID. If not, adding it to a list for output is skipped before calling qsort(). This patch will affect all kinds of image header categories (-A, -C, -O and -T flags). Signed-off-by: Naoki Hayama <naoki.hayama@lineo.co.jp> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/mkimage.c')
-rw-r--r--tools/mkimage.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 43078d0..e786082 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -51,8 +51,13 @@ static int show_valid_options(enum ih_category category)
return -ENOMEM;
/* Sort the names in order of short name for easier reading */
- for (item = 0; item < count; item++)
- order[item] = item;
+ for (i = 0, item = 0; i < count; i++, item++) {
+ while (!genimg_cat_has_id(category, item) && i < count) {
+ item++;
+ count--;
+ }
+ order[i] = item;
+ }
cur_category = category;
qsort(order, count, sizeof(int), h_compare_category_name);