diff options
author | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2017-04-16 19:37:51 +0200 |
---|---|---|
committer | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2017-05-09 12:41:40 +0200 |
commit | 543dc58518279b815afc512d44f48ffccc59ee63 (patch) | |
tree | 6ffa279e484671d4a5a1d59236b053c1a5dfcdf0 | |
parent | 83725491470720830afe8ae54e1795ea5b4c3afc (diff) |
rockchip: mkimage: play nice with dumpimage
Dumpimage (it invoked with "-T rkspi" or "-T rksd") would not work due
to check_params failing. These changes ensure that we can both be called
with an empty imagename.
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | tools/rkcommon.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/rkcommon.c b/tools/rkcommon.c index ba83120484..f634a01028 100644 --- a/tools/rkcommon.c +++ b/tools/rkcommon.c @@ -85,6 +85,9 @@ static struct spl_info *rkcommon_get_spl_info(char *imagename) { int i; + if (!imagename) + return NULL; + for (i = 0; i < ARRAY_SIZE(spl_infos); i++) if (!strncmp(imagename, spl_infos[i].imagename, 6)) return spl_infos + i; @@ -97,17 +100,24 @@ int rkcommon_check_params(struct image_tool_params *params) int i; if (rkcommon_get_spl_info(params->imagename) != NULL) - return 0; + return EXIT_SUCCESS; + + /* + * If this is a operation (list or extract), the don't require + * imagename to be set. + */ + if (params->lflag || params->iflag) + return EXIT_SUCCESS; fprintf(stderr, "ERROR: imagename (%s) is not supported!\n", - strlen(params->imagename) > 0 ? params->imagename : "NULL"); + params->imagename ? params->imagename : "NULL"); fprintf(stderr, "Available imagename:"); for (i = 0; i < ARRAY_SIZE(spl_infos); i++) fprintf(stderr, "\t%s", spl_infos[i].imagename); fprintf(stderr, "\n"); - return -1; + return EXIT_FAILURE; } const char *rkcommon_get_spl_hdr(struct image_tool_params *params) |