diff options
author | Lorenzo Miori <memoryS60@gmail.com> | 2013-09-11 22:42:59 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2013-09-11 23:08:37 +0200 |
commit | 5ef1e2dcfa2845d7196223af2e170798f7621df6 (patch) | |
tree | bf33c9260e3fac5f7ee55baf19eafbf03528cac1 /utils | |
parent | 743a6d0a5741bc0d4ef5ccc1c2e59ba8736c711e (diff) | |
download | rockbox-5ef1e2dcfa2845d7196223af2e170798f7621df6.tar.gz rockbox-5ef1e2dcfa2845d7196223af2e170798f7621df6.zip |
ypr0-ypr1 firmware tools fix
fixed a bug concerning bytes padding, since it wasn't correctly
implemented regarding original firmware structure.
This fixes ROM generation especially for ypr1.
Change-Id: I1a40fb4bb8f9d6b005d694246123e314c4d19b49
Reviewed-on: http://gerrit.rockbox.org/616
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/ypr0tools/fwcrypt.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/utils/ypr0tools/fwcrypt.c b/utils/ypr0tools/fwcrypt.c index e99d8872ba..feeff26bdc 100644 --- a/utils/ypr0tools/fwcrypt.c +++ b/utils/ypr0tools/fwcrypt.c | |||
@@ -47,6 +47,15 @@ static void die(int error) | |||
47 | exit(error); | 47 | exit(error); |
48 | } | 48 | } |
49 | 49 | ||
50 | static void pad4byte(char byte, FILE* handle) { | ||
51 | int padding = 4 - ftell(handle) % 4; | ||
52 | if (padding != 4) { | ||
53 | while (padding-- > 0) { | ||
54 | fwrite(&byte, 1, 1, handle); | ||
55 | } | ||
56 | } | ||
57 | } | ||
58 | |||
50 | int main(int argc, char **argv) | 59 | int main(int argc, char **argv) |
51 | { | 60 | { |
52 | FILE* component_handle = NULL; | 61 | FILE* component_handle = NULL; |
@@ -136,6 +145,9 @@ int main(int argc, char **argv) | |||
136 | } | 145 | } |
137 | } | 146 | } |
138 | 147 | ||
148 | /* Padding */ | ||
149 | pad4byte('\n', output_file); | ||
150 | |||
139 | /* write final data to the firmware file */ | 151 | /* write final data to the firmware file */ |
140 | for (int i = 0; i < YPR0_COMPONENTS_COUNT; i++) | 152 | for (int i = 0; i < YPR0_COMPONENTS_COUNT; i++) |
141 | { | 153 | { |
@@ -162,7 +174,7 @@ int main(int argc, char **argv) | |||
162 | } | 174 | } |
163 | /* padding */ | 175 | /* padding */ |
164 | if (i < (YPR0_COMPONENTS_COUNT-1)) | 176 | if (i < (YPR0_COMPONENTS_COUNT-1)) |
165 | fputs("\0\0\0\0", output_file); | 177 | pad4byte('\0', output_file); |
166 | } | 178 | } |
167 | 179 | ||
168 | /* free the big amount of memory and close handles */ | 180 | /* free the big amount of memory and close handles */ |