summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-07-18 17:05:05 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-07-18 17:05:05 +0000
commitbff5e3d7ab853b01f56a83c15b49faed720f2386 (patch)
treed453c5530b7b7b8b3f216406e908c101aa08e830
parentc2273cf5e2bdf0902d6b375155c49326e623669b (diff)
downloadrockbox-bff5e3d7ab853b01f56a83c15b49faed720f2386.tar.gz
rockbox-bff5e3d7ab853b01f56a83c15b49faed720f2386.zip
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
-rw-r--r--rbutil/mkamsboot/main.c16
-rw-r--r--rbutil/mkamsboot/mkamsboot.c10
2 files changed, 14 insertions, 12 deletions
diff --git a/rbutil/mkamsboot/main.c b/rbutil/mkamsboot/main.c
index a864c2a5c1..4f82bbc8c2 100644
--- a/rbutil/mkamsboot/main.c
+++ b/rbutil/mkamsboot/main.c
@@ -109,23 +109,25 @@ int main(int argc, char* argv[])
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);
- fprintf(stderr, "[INFO] Packed OF size: %d bytes\n",
+ fprintf(stderr, "[INFO] Packed OF size: %8d bytes\n",
of_packedsize);
- fprintf(stderr, "[INFO] Bootloader size: %d bytes\n",
+ fprintf(stderr, "[INFO] Bootloader size: %8d bytes\n",
(int)bootloader_size);
- fprintf(stderr, "[INFO] Packed bootloader size: %d bytes\n",
+ fprintf(stderr, "[INFO] Packed bootloader size: %8d bytes\n",
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]);
- 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));
+ fprintf(stderr, "[INFO] Original firmware version: %8u bytes\n",
+ 0x200);
patchable = check_sizes(sum.model, rb_packedsize, bootloader_size,
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) {
fprintf(stderr, "%s", errstr);
diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c
index 74275279a1..1196038b09 100644
--- a/rbutil/mkamsboot/mkamsboot.c
+++ b/rbutil/mkamsboot/mkamsboot.c
@@ -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,
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) +
- of_packed_size + rb_packed_size;
+ of_packed_size + rb_packed_size + 0x200;
/* how much memory is available */
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; \
} while(0)
- /* will packed data fit in the OF file ?
- * XXX: we keep the first 0x200 bytes block unmodified, we just replace
- * the ARM vectors */
- if(packed_size + 0x200 > of_unpacked_size)
+ /* will packed data fit in the OF file ? */
+ if(packed_size > of_unpacked_size)
ERROR(
"[ERR] Packed data (%d bytes) doesn't fit in the firmware "
"(%d bytes)\n", packed_size, of_unpacked_size