forked from len0rd/rockbox
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>
This commit is contained in:
parent
743a6d0a57
commit
5ef1e2dcfa
1 changed files with 13 additions and 1 deletions
|
@ -47,6 +47,15 @@ static void die(int error)
|
||||||
exit(error);
|
exit(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pad4byte(char byte, FILE* handle) {
|
||||||
|
int padding = 4 - ftell(handle) % 4;
|
||||||
|
if (padding != 4) {
|
||||||
|
while (padding-- > 0) {
|
||||||
|
fwrite(&byte, 1, 1, handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
FILE* component_handle = NULL;
|
FILE* component_handle = NULL;
|
||||||
|
@ -136,6 +145,9 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Padding */
|
||||||
|
pad4byte('\n', output_file);
|
||||||
|
|
||||||
/* write final data to the firmware file */
|
/* write final data to the firmware file */
|
||||||
for (int i = 0; i < YPR0_COMPONENTS_COUNT; i++)
|
for (int i = 0; i < YPR0_COMPONENTS_COUNT; i++)
|
||||||
{
|
{
|
||||||
|
@ -162,7 +174,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
/* padding */
|
/* padding */
|
||||||
if (i < (YPR0_COMPONENTS_COUNT-1))
|
if (i < (YPR0_COMPONENTS_COUNT-1))
|
||||||
fputs("\0\0\0\0", output_file);
|
pad4byte('\0', output_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free the big amount of memory and close handles */
|
/* free the big amount of memory and close handles */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue