mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
mkamsboot: take in account the additional 0x200 block when calculating size
Align sizes of different blocks on mkamsboot output git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27482 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c2273cf5e2
commit
bff5e3d7ab
2 changed files with 14 additions and 12 deletions
|
@ -109,23 +109,25 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
printf("[INFO] Firmware patching has begun !\n\n");
|
printf("[INFO] Firmware patching has begun !\n\n");
|
||||||
|
|
||||||
fprintf(stderr, "[INFO] Original firmware size: %d bytes\n",
|
fprintf(stderr, "[INFO] Original firmware size: %8d bytes\n",
|
||||||
firmware_size);
|
firmware_size);
|
||||||
fprintf(stderr, "[INFO] Packed OF size: %d bytes\n",
|
fprintf(stderr, "[INFO] Packed OF size: %8d bytes\n",
|
||||||
of_packedsize);
|
of_packedsize);
|
||||||
fprintf(stderr, "[INFO] Bootloader size: %d bytes\n",
|
fprintf(stderr, "[INFO] Bootloader size: %8d bytes\n",
|
||||||
(int)bootloader_size);
|
(int)bootloader_size);
|
||||||
fprintf(stderr, "[INFO] Packed bootloader size: %d bytes\n",
|
fprintf(stderr, "[INFO] Packed bootloader size: %8d bytes\n",
|
||||||
rb_packedsize);
|
rb_packedsize);
|
||||||
fprintf(stderr, "[INFO] Dual-boot function size: %d bytes\n",
|
fprintf(stderr, "[INFO] Dual-boot function size: %8d bytes\n",
|
||||||
bootloader_sizes[sum.model]);
|
bootloader_sizes[sum.model]);
|
||||||
fprintf(stderr, "[INFO] UCL unpack function size: %u bytes\n",
|
fprintf(stderr, "[INFO] UCL unpack function size: %8u bytes\n",
|
||||||
(unsigned int)sizeof(nrv2e_d8));
|
(unsigned int)sizeof(nrv2e_d8));
|
||||||
|
fprintf(stderr, "[INFO] Original firmware version: %8u bytes\n",
|
||||||
|
0x200);
|
||||||
|
|
||||||
patchable = check_sizes(sum.model, rb_packedsize, bootloader_size,
|
patchable = check_sizes(sum.model, rb_packedsize, bootloader_size,
|
||||||
of_packedsize, firmware_size, &totalsize, errstr, sizeof(errstr));
|
of_packedsize, firmware_size, &totalsize, errstr, sizeof(errstr));
|
||||||
|
|
||||||
fprintf(stderr, "[INFO] Total size of new image: %d bytes\n", totalsize);
|
fprintf(stderr, "[INFO] Total size of new image: %8d bytes\n", totalsize);
|
||||||
|
|
||||||
if (!patchable) {
|
if (!patchable) {
|
||||||
fprintf(stderr, "%s", errstr);
|
fprintf(stderr, "%s", errstr);
|
||||||
|
|
|
@ -612,8 +612,10 @@ int check_sizes(int model, int rb_packed_size, int rb_unpacked_size,
|
||||||
int of_packed_size, int of_unpacked_size, int *total_size,
|
int of_packed_size, int of_unpacked_size, int *total_size,
|
||||||
char *errstr, int errstrsize)
|
char *errstr, int errstrsize)
|
||||||
{
|
{
|
||||||
|
/* XXX: we keep the first 0x200 bytes block unmodified, we just replace
|
||||||
|
* the ARM vectors */
|
||||||
unsigned int packed_size = bootloader_sizes[model] + sizeof(nrv2e_d8) +
|
unsigned int packed_size = bootloader_sizes[model] + sizeof(nrv2e_d8) +
|
||||||
of_packed_size + rb_packed_size;
|
of_packed_size + rb_packed_size + 0x200;
|
||||||
|
|
||||||
/* how much memory is available */
|
/* how much memory is available */
|
||||||
unsigned int memory_size = model_memory_size(model);
|
unsigned int memory_size = model_memory_size(model);
|
||||||
|
@ -632,10 +634,8 @@ int check_sizes(int model, int rb_packed_size, int rb_unpacked_size,
|
||||||
return 0; \
|
return 0; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/* will packed data fit in the OF file ?
|
/* will packed data fit in the OF file ? */
|
||||||
* XXX: we keep the first 0x200 bytes block unmodified, we just replace
|
if(packed_size > of_unpacked_size)
|
||||||
* the ARM vectors */
|
|
||||||
if(packed_size + 0x200 > of_unpacked_size)
|
|
||||||
ERROR(
|
ERROR(
|
||||||
"[ERR] Packed data (%d bytes) doesn't fit in the firmware "
|
"[ERR] Packed data (%d bytes) doesn't fit in the firmware "
|
||||||
"(%d bytes)\n", packed_size, of_unpacked_size
|
"(%d bytes)\n", packed_size, of_unpacked_size
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue