Currently, show_valid_options() shows "Unknown ***" lines.
For example:

        $ ./tools/mkimage -A hoge
        Invalid architecture, supported are:
                Unknown architecture  Unknown architecture
                Unknown architecture  Unknown architecture
                alpha            Alpha
                arc              ARC
                arm              ARM
                arm64            AArch64
                ...

It's because include/image.h must keep obsolete IDs for
backward compatibility (see comit ff87b0810753), and
show_valid_options() tries to find entry IDs which don't exist
in a category table defined in common/image.c
(in this case, uimage_arch[]).

To fix this problem, this patchset introduces checking whether
a category table has an entry ID. If an entry ID doesn't exist,
adding it to a list for output is skipped before calling qsort().
The output will be:

        $ ./tools/mkimage -A hoge
        Invalid architecture, supported are:
                alpha            Alpha
                arc              ARC
                arm              ARM
                arm64            AArch64
                ...

This patchset will affect all kinds of image header categories
(-A, -C, -O and -T flags).


Naoki Hayama (3):
  image: Add a function to modify category information
  mkimage: Skip adding non-existent IDs to a list
  cosmetic: image: Fix comments and the order of definitions

 common/image.c  | 38 ++++++++++++++++++++++++++++----------
 include/image.h | 10 ++++++++++
 tools/mkimage.c |  9 +++++++--
 3 files changed, 45 insertions(+), 12 deletions(-)

-- 
2.17.1

Reply via email to