summaryrefslogtreecommitdiff
path: root/rbutil/mkamsboot/mkamsboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/mkamsboot/mkamsboot.c')
-rw-r--r--rbutil/mkamsboot/mkamsboot.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c
index cfa9e37746..e4b6e09782 100644
--- a/rbutil/mkamsboot/mkamsboot.c
+++ b/rbutil/mkamsboot/mkamsboot.c
@@ -89,6 +89,7 @@ execution to the uncompressed firmware.
89#include "uclimg.h" 89#include "uclimg.h"
90#include "bootimg_clip.h" 90#include "bootimg_clip.h"
91#include "bootimg_e200v2.h" 91#include "bootimg_e200v2.h"
92#include "bootimg_m200v2.h"
92 93
93/* Win32 compatibility */ 94/* Win32 compatibility */
94#ifndef O_BINARY 95#ifndef O_BINARY
@@ -126,7 +127,7 @@ static const unsigned char* bootloaders[] =
126 bootimg_clip, 127 bootimg_clip,
127 NULL, 128 NULL,
128 bootimg_e200v2, 129 bootimg_e200v2,
129 NULL, 130 bootimg_m200v2,
130 NULL 131 NULL
131}; 132};
132 133
@@ -136,7 +137,7 @@ static const int bootloader_sizes[] =
136 sizeof(bootimg_clip), 137 sizeof(bootimg_clip),
137 0, 138 0,
138 sizeof(bootimg_e200v2), 139 sizeof(bootimg_e200v2),
139 0, 140 sizeof(bootimg_m200v2),
140 0 141 0
141}; 142};
142 143
@@ -373,6 +374,7 @@ int main(int argc, char* argv[])
373 int fw_version; 374 int fw_version;
374 int totalsize; 375 int totalsize;
375 unsigned char* p; 376 unsigned char* p;
377 uint32_t checksum;
376 378
377 fprintf(stderr,"mkamsboot v" VERSION " - (C) Dave Chapman and Rafaël Carré 2008\n"); 379 fprintf(stderr,"mkamsboot v" VERSION " - (C) Dave Chapman and Rafaël Carré 2008\n");
378 fprintf(stderr,"This is free software; see the source for copying conditions. There is NO\n"); 380 fprintf(stderr,"This is free software; see the source for copying conditions. There is NO\n");
@@ -395,9 +397,10 @@ int main(int argc, char* argv[])
395 return 1; 397 return 1;
396 } 398 }
397 399
398 /* TODO: Do some more sanity checks on the OF image */ 400 /* TODO: Do some more sanity checks on the OF image. Some images (like m200v2) dont have a checksum at the end, only padding (0xdeadbeef). */
401 checksum = get_uint32le(buf + len - 4);
402 if (checksum != 0xefbeadde && checksum != calc_checksum(buf, len - 4)) {
399 403
400 if (get_uint32le(buf + len - 4) != calc_checksum(buf, len - 4)) {
401 fprintf(stderr,"[ERR] Whole file checksum failed - %s\n",infile); 404 fprintf(stderr,"[ERR] Whole file checksum failed - %s\n",infile);
402 return 1; 405 return 1;
403 } 406 }
@@ -420,7 +423,6 @@ int main(int argc, char* argv[])
420 if (bootloaders[model] == NULL) { 423 if (bootloaders[model] == NULL) {
421 fprintf(stderr,"[ERR] Unsupported model - \"%s\"\n",model_names[model]); 424 fprintf(stderr,"[ERR] Unsupported model - \"%s\"\n",model_names[model]);
422 free(buf); 425 free(buf);
423 free(rb_unpacked);
424 return 1; 426 return 1;
425 } 427 }
426 428