summaryrefslogtreecommitdiff
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[])
109 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: %8d bytes\n",
113 firmware_size); 113 firmware_size);
114 fprintf(stderr, "[INFO] Packed OF size: %d bytes\n", 114 fprintf(stderr, "[INFO] Packed OF size: %8d bytes\n",
115 of_packedsize); 115 of_packedsize);
116 fprintf(stderr, "[INFO] Bootloader size: %d bytes\n", 116 fprintf(stderr, "[INFO] Bootloader size: %8d bytes\n",
117 (int)bootloader_size); 117 (int)bootloader_size);
118 fprintf(stderr, "[INFO] Packed bootloader size: %d bytes\n", 118 fprintf(stderr, "[INFO] Packed bootloader size: %8d bytes\n",
119 rb_packedsize); 119 rb_packedsize);
120 fprintf(stderr, "[INFO] Dual-boot function size: %d bytes\n", 120 fprintf(stderr, "[INFO] Dual-boot function size: %8d bytes\n",
121 bootloader_sizes[sum.model]); 121 bootloader_sizes[sum.model]);
122 fprintf(stderr, "[INFO] UCL unpack function size: %u bytes\n", 122 fprintf(stderr, "[INFO] UCL unpack function size: %8u bytes\n",
123 (unsigned int)sizeof(nrv2e_d8)); 123 (unsigned int)sizeof(nrv2e_d8));
124 fprintf(stderr, "[INFO] Original firmware version: %8u bytes\n",
125 0x200);
124 126
125 patchable = check_sizes(sum.model, rb_packedsize, bootloader_size, 127 patchable = check_sizes(sum.model, rb_packedsize, bootloader_size,
126 of_packedsize, firmware_size, &totalsize, errstr, sizeof(errstr)); 128 of_packedsize, firmware_size, &totalsize, errstr, sizeof(errstr));
127 129
128 fprintf(stderr, "[INFO] Total size of new image: %d bytes\n", totalsize); 130 fprintf(stderr, "[INFO] Total size of new image: %8d bytes\n", totalsize);
129 131
130 if (!patchable) { 132 if (!patchable) {
131 fprintf(stderr, "%s", errstr); 133 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,
612 int of_packed_size, int of_unpacked_size, int *total_size, 612 int of_packed_size, int of_unpacked_size, int *total_size,
613 char *errstr, int errstrsize) 613 char *errstr, int errstrsize)
614{ 614{
615 /* XXX: we keep the first 0x200 bytes block unmodified, we just replace
616 * the ARM vectors */
615 unsigned int packed_size = bootloader_sizes[model] + sizeof(nrv2e_d8) + 617 unsigned int packed_size = bootloader_sizes[model] + sizeof(nrv2e_d8) +
616 of_packed_size + rb_packed_size; 618 of_packed_size + rb_packed_size + 0x200;
617 619
618 /* how much memory is available */ 620 /* how much memory is available */
619 unsigned int memory_size = model_memory_size(model); 621 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,
632 return 0; \ 634 return 0; \
633 } while(0) 635 } while(0)
634 636
635 /* will packed data fit in the OF file ? 637 /* will packed data fit in the OF file ? */
636 * XXX: we keep the first 0x200 bytes block unmodified, we just replace 638 if(packed_size > of_unpacked_size)
637 * the ARM vectors */
638 if(packed_size + 0x200 > of_unpacked_size)
639 ERROR( 639 ERROR(
640 "[ERR] Packed data (%d bytes) doesn't fit in the firmware " 640 "[ERR] Packed data (%d bytes) doesn't fit in the firmware "
641 "(%d bytes)\n", packed_size, of_unpacked_size 641 "(%d bytes)\n", packed_size, of_unpacked_size