diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-24 10:06:52 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-24 10:06:52 +0000 |
commit | ff6b0425e438add8d12393f90fdbfe93e1fb4746 (patch) | |
tree | b8ac1a3254a8e01051a5d7f2c5c94e61bacd5c02 /rbutil/mkamsboot/main.c | |
parent | eae2464e9a93dc3a8918abcc62348af6c8d9bc9b (diff) | |
download | rockbox-ff6b0425e438add8d12393f90fdbfe93e1fb4746.tar.gz rockbox-ff6b0425e438add8d12393f90fdbfe93e1fb4746.zip |
mkamsboot/rbutil/amsinfo : do not try to detect the model of a given Sansa AMS OF
The field we thought was representative of the model is not, it has
changed in the past for fuzev1 and fuzev2.
For example the value 0x23 is found in 2 old fuzev1 OF versions, and in
the c200v2 OF
The only reliable way to detect the model of a given OF is by using the
built-in list of md5sums.
Modify mkamsboot and rbutilqt to load the rockbox bootloader first, and
then check if the model in the bootloader corresponds to the model of
the known md5sum of the given OF.
That way we can continue to present the user with a list of known OF
versions in case the OF is unknown to mkamsboot
Also explicit the dependency of main.c on mkamsboot.h in case the
prototypes change
Correct the header's description not updated in r21648
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26248 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/mkamsboot/main.c')
-rw-r--r-- | rbutil/mkamsboot/main.c | 24 |
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", |