summaryrefslogtreecommitdiff
path: root/rbutil/mkamsboot/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/mkamsboot/main.c')
-rw-r--r--rbutil/mkamsboot/main.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/rbutil/mkamsboot/main.c b/rbutil/mkamsboot/main.c
index 1132334261..a864c2a5c1 100644
--- a/rbutil/mkamsboot/main.c
+++ b/rbutil/mkamsboot/main.c
@@ -59,6 +59,7 @@ int main(int argc, char* argv[])
59 int rb_packedsize; 59 int rb_packedsize;
60 int patchable; 60 int patchable;
61 int totalsize; 61 int totalsize;
62 int model;
62 char errstr[200]; 63 char errstr[200];
63 struct md5sums sum; 64 struct md5sums sum;
64 char md5sum[33]; /* 32 digits + \0 */ 65 char md5sum[33]; /* 32 digits + \0 */
@@ -81,11 +82,21 @@ int main(int argc, char* argv[])
81 bootfile = argv[2]; 82 bootfile = argv[2];
82 outfile = argv[3]; 83 outfile = argv[3];
83 84
85 /* Load bootloader file */
86 rb_packed = load_rockbox_file(bootfile, &model, &bootloader_size,
87 &rb_packedsize, errstr, sizeof(errstr));
88 if (rb_packed == NULL) {
89 fprintf(stderr, "%s", errstr);
90 fprintf(stderr, "[ERR] Could not load %s\n", bootfile);
91 return 1;
92 }
93
84 /* Load original firmware file */ 94 /* Load original firmware file */
85 buf = load_of_file(infile, &len, &sum, 95 buf = load_of_file(infile, model, &len, &sum,
86 &firmware_size, &of_packed, &of_packedsize, errstr, sizeof(errstr)); 96 &firmware_size, &of_packed, &of_packedsize, errstr, sizeof(errstr));
87 97
88 if (buf == NULL) { 98 if (buf == NULL) {
99 free(rb_packed);
89 fprintf(stderr, "%s", errstr); 100 fprintf(stderr, "%s", errstr);
90 fprintf(stderr, "[ERR] Could not load %s\n", infile); 101 fprintf(stderr, "[ERR] Could not load %s\n", infile);
91 return 1; 102 return 1;
@@ -96,17 +107,6 @@ int main(int argc, char* argv[])
96 model_names[sum.model], hw_revisions[sum.model], sum.version); 107 model_names[sum.model], hw_revisions[sum.model], sum.version);
97 108
98 109
99 /* Load bootloader file */
100 rb_packed = load_rockbox_file(bootfile, sum.model, &bootloader_size,
101 &rb_packedsize, errstr, sizeof(errstr));
102 if (rb_packed == NULL) {
103 fprintf(stderr, "%s", errstr);
104 fprintf(stderr, "[ERR] Could not load %s\n", bootfile);
105 free(buf);
106 free(of_packed);
107 return 1;
108 }
109
110 printf("[INFO] Firmware patching has begun !\n\n"); 110 printf("[INFO] Firmware patching has begun !\n\n");
111 111
112 fprintf(stderr, "[INFO] Original firmware size: %d bytes\n", 112 fprintf(stderr, "[INFO] Original firmware size: %d bytes\n",