diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2017-11-05 18:27:18 +0100 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2017-11-05 18:30:11 +0100 |
commit | ee2eb13b7407841e9c0dbc76d18878b241d3e9f2 (patch) | |
tree | a70084efb7e88c35273ba26e029a5a2d43135e02 | |
parent | 5a3b30d8fd9a4932df04805410444610fa4c7eda (diff) | |
download | rockbox-ee2eb13b7407841e9c0dbc76d18878b241d3e9f2.tar.gz rockbox-ee2eb13b7407841e9c0dbc76d18878b241d3e9f2.zip |
mkimxboot: small fixes and display a human readable error
Change-Id: I9362b62351925aef5b14656635875123942fe7e4
-rw-r--r-- | rbutil/mkimxboot/main.c | 2 | ||||
-rw-r--r-- | rbutil/mkimxboot/mkimxboot.c | 23 | ||||
-rw-r--r-- | rbutil/mkimxboot/mkimxboot.h | 2 |
3 files changed, 25 insertions, 2 deletions
diff --git a/rbutil/mkimxboot/main.c b/rbutil/mkimxboot/main.c index 90f2f20a5f..5b8cceb044 100644 --- a/rbutil/mkimxboot/main.c +++ b/rbutil/mkimxboot/main.c | |||
@@ -284,6 +284,6 @@ int main(int argc, char *argv[]) | |||
284 | opt.force_version = force_version; | 284 | opt.force_version = force_version; |
285 | opt.model = model; | 285 | opt.model = model; |
286 | enum imx_error_t err = mkimxboot(infile, bootfile, outfile, opt); | 286 | enum imx_error_t err = mkimxboot(infile, bootfile, outfile, opt); |
287 | printf("Result: %d\n", err); | 287 | printf("Result: %d (%s)\n", err, imx_error_to_string(err)); |
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
diff --git a/rbutil/mkimxboot/mkimxboot.c b/rbutil/mkimxboot/mkimxboot.c index db18c769fb..369c397d51 100644 --- a/rbutil/mkimxboot/mkimxboot.c +++ b/rbutil/mkimxboot/mkimxboot.c | |||
@@ -233,6 +233,27 @@ static const struct imx_model_desc_t imx_models[] = | |||
233 | #define MAGIC_NORMAL 0xcafebabe | 233 | #define MAGIC_NORMAL 0xcafebabe |
234 | #define MAGIC_CHARGE 0x67726863 /* 'chrg' */ | 234 | #define MAGIC_CHARGE 0x67726863 /* 'chrg' */ |
235 | 235 | ||
236 | const char *imx_error_to_string(enum imx_error_t err) | ||
237 | { | ||
238 | switch(err) | ||
239 | { | ||
240 | case IMX_SUCCESS: return "success"; | ||
241 | case IMX_ERROR: return "error"; | ||
242 | case IMX_OPEN_ERROR: return "open error"; | ||
243 | case IMX_READ_ERROR: return "read error"; | ||
244 | case IMX_NO_MATCH: return "no match"; | ||
245 | case IMX_BOOT_INVALID: return "invalid"; | ||
246 | case IMX_BOOT_MISMATCH: return "mismatch"; | ||
247 | case IMX_BOOT_CHECKSUM_ERROR: return "checksum error"; | ||
248 | case IMX_DONT_KNOW_HOW_TO_PATCH: return "don't know how to patch"; | ||
249 | case IMX_VARIANT_MISMATCH: return "variant mismatch"; | ||
250 | case IMX_WRITE_ERROR: return "write error"; | ||
251 | case IMX_FIRST_SB_ERROR: return "sb error"; | ||
252 | case IMX_MODEL_MISMATCH: return "model mismatch"; | ||
253 | default: return "unknown error"; | ||
254 | } | ||
255 | } | ||
256 | |||
236 | static void add_key_list(struct crypto_key_t **list) | 257 | static void add_key_list(struct crypto_key_t **list) |
237 | { | 258 | { |
238 | while(*list != NULL) | 259 | while(*list != NULL) |
@@ -987,7 +1008,7 @@ static enum imx_error_t make_boot(struct sb_file_t *sb_file, const char *bootfil | |||
987 | /* produce file */ | 1008 | /* produce file */ |
988 | ret = patch_firmware(opt, sb_file, boot_fw); | 1009 | ret = patch_firmware(opt, sb_file, boot_fw); |
989 | rb_fw_free(&boot_fw); | 1010 | rb_fw_free(&boot_fw); |
990 | return IMX_SUCCESS; | 1011 | return ret; |
991 | } | 1012 | } |
992 | 1013 | ||
993 | enum imx_error_t mkimxboot(const char *infile, const char *bootfile, | 1014 | enum imx_error_t mkimxboot(const char *infile, const char *bootfile, |
diff --git a/rbutil/mkimxboot/mkimxboot.h b/rbutil/mkimxboot/mkimxboot.h index 59f28a98a0..6bf0415e9c 100644 --- a/rbutil/mkimxboot/mkimxboot.h +++ b/rbutil/mkimxboot/mkimxboot.h | |||
@@ -106,6 +106,8 @@ enum imx_error_t mkimxboot(const char *infile, const char *bootfile, | |||
106 | enum imx_error_t compute_md5sum(const char *file, uint8_t file_md5sum[16]); | 106 | enum imx_error_t compute_md5sum(const char *file, uint8_t file_md5sum[16]); |
107 | /* Compute "soft" MD5 sum of a SB file */ | 107 | /* Compute "soft" MD5 sum of a SB file */ |
108 | enum imx_error_t compute_soft_md5sum(const char *file, uint8_t soft_md5sum[16]); | 108 | enum imx_error_t compute_soft_md5sum(const char *file, uint8_t soft_md5sum[16]); |
109 | /* Translate error */ | ||
110 | const char *imx_error_to_string(enum imx_error_t err); | ||
109 | 111 | ||
110 | #ifdef __cplusplus | 112 | #ifdef __cplusplus |
111 | } | 113 | } |