summaryrefslogtreecommitdiff
path: root/rbutil/mkimxboot/mkimxboot.h
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-01-01 21:31:47 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2017-01-02 21:43:10 +0100
commitff946f1f69c325a948e3e73ac21c3880a0ea94d2 (patch)
tree2b3f4c8679f0eadbdd16015245b954258b66f7d5 /rbutil/mkimxboot/mkimxboot.h
parent782d9c0d80f1edc29955dbe7e7f42770f730b597 (diff)
downloadrockbox-ff946f1f69c325a948e3e73ac21c3880a0ea94d2.tar.gz
rockbox-ff946f1f69c325a948e3e73ac21c3880a0ea94d2.zip
imxtools: completely rework patching logic to prepare unpatching
The old code was working but a mess to maintain. The new code is cleaner and always simpler handling of all the different options. Extraction of the OF is no longer a standalone function but just one particular output type. This commit prepares the ground for firmware "unpatching" (aka OF extraction from patched OF). The patching code itself did not change so this commit should still produce the exact same images as before. Change-Id: I3840793d4b78b8435e38c08f558840925085ead1
Diffstat (limited to 'rbutil/mkimxboot/mkimxboot.h')
-rw-r--r--rbutil/mkimxboot/mkimxboot.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/rbutil/mkimxboot/mkimxboot.h b/rbutil/mkimxboot/mkimxboot.h
index 3157bd7daa..59f28a98a0 100644
--- a/rbutil/mkimxboot/mkimxboot.h
+++ b/rbutil/mkimxboot/mkimxboot.h
@@ -29,6 +29,7 @@
29#ifdef __cplusplus 29#ifdef __cplusplus
30extern "C" { 30extern "C" {
31#endif 31#endif
32
32enum imx_error_t 33enum imx_error_t
33{ 34{
34 IMX_SUCCESS = 0, 35 IMX_SUCCESS = 0,
@@ -43,30 +44,31 @@ enum imx_error_t
43 IMX_VARIANT_MISMATCH = -9, 44 IMX_VARIANT_MISMATCH = -9,
44 IMX_WRITE_ERROR = -10, 45 IMX_WRITE_ERROR = -10,
45 IMX_FIRST_SB_ERROR = -11, 46 IMX_FIRST_SB_ERROR = -11,
47 IMX_MODEL_MISMATCH = -12,
46}; 48};
47 49
48enum imx_output_type_t 50enum imx_output_type_t
49{ 51{
50 IMX_DUALBOOT = 0, 52 IMX_DUALBOOT = 0,
51 IMX_RECOVERY = 1, 53 IMX_RECOVERY,
52 IMX_SINGLEBOOT = 2, 54 IMX_SINGLEBOOT,
53 IMX_CHARGE = 3, 55 IMX_CHARGE,
56 IMX_ORIG_FW,
54}; 57};
55 58
56/* Supported models */ 59/* Supported models */
57enum imx_model_t 60enum imx_model_t
58{ 61{
59 MODEL_UNKNOWN = -1, 62 MODEL_UNKNOWN = 0,
60 MODEL_FUZEPLUS = 0, 63 MODEL_FUZEPLUS,
61 MODEL_ZENXFI2, 64 MODEL_ZENXFI2,
62 MODEL_ZENXFI3, 65 MODEL_ZENXFI3,
63 MODEL_ZENXFISTYLE, 66 MODEL_ZENXFISTYLE,
64 MODEL_ZENSTYLE, /* Style 100 and Style 300 */ 67 MODEL_ZENSTYLE, /* Style 100 and Style 300 */
65 MODEL_NWZE370, 68 MODEL_NWZE370,
66 MODEL_NWZE360, 69 MODEL_NWZE360,
67 /* new models go here */ 70 /* Last */
68 71 MODEL_COUNT
69 NUM_MODELS
70}; 72};
71 73
72/* Supported firmware variants */ 74/* Supported firmware variants */
@@ -88,19 +90,22 @@ enum imx_firmware_variant_t
88struct imx_option_t 90struct imx_option_t
89{ 91{
90 bool debug; 92 bool debug;
93 enum imx_model_t model;
91 enum imx_output_type_t output; 94 enum imx_output_type_t output;
92 enum imx_firmware_variant_t fw_variant; 95 enum imx_firmware_variant_t fw_variant;
93 const char *force_version; // set to NULL to ignore 96 const char *force_version; // set to NULL to ignore
94}; 97};
95 98
99/* Print internal information to stdout about device database */
96void dump_imx_dev_info(const char *prefix); 100void dump_imx_dev_info(const char *prefix);
101/* Build a SB image from an input firmware and a bootloader, input firmware
102 * can either be a firmware update or another SB file produced by this tool */
97enum imx_error_t mkimxboot(const char *infile, const char *bootfile, 103enum imx_error_t mkimxboot(const char *infile, const char *bootfile,
98 const char *outfile, struct imx_option_t opt); 104 const char *outfile, struct imx_option_t opt);
99enum imx_error_t extract_firmware(const char *infile, 105/* Compute MD5 sum of an entire file */
100 enum imx_firmware_variant_t fw_variant, const char *outfile);
101enum imx_error_t compute_md5sum(const char *file, uint8_t file_md5sum[16]); 106enum imx_error_t compute_md5sum(const char *file, uint8_t file_md5sum[16]);
102enum imx_error_t compute_soft_md5sum(const char *file, enum imx_model_t model, 107/* Compute "soft" MD5 sum of a SB file */
103 uint8_t soft_md5sum[16]); 108enum imx_error_t compute_soft_md5sum(const char *file, uint8_t soft_md5sum[16]);
104 109
105#ifdef __cplusplus 110#ifdef __cplusplus
106} 111}