]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - tools/kwbimage.c
avr32: delete non generic board mimc200
[karo-tx-uboot.git] / tools / kwbimage.c
index 66f459ad6b1c7f2b65eb612349e6a2e647c8238e..9540e7eb84fc40b67b2827869b081e3462ca0577 100644 (file)
@@ -498,6 +498,7 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
                binhdrsz = sizeof(struct opt_hdr_v1) +
                        (binarye->binary.nargs + 1) * sizeof(unsigned int) +
                        s.st_size;
+               binhdrsz = ALIGN_SUP(binhdrsz, 32);
                hdr->headersz_lsb = binhdrsz & 0xFFFF;
                hdr->headersz_msb = (binhdrsz & 0xFFFF0000) >> 16;
 
@@ -868,6 +869,16 @@ static int kwbimage_generate(struct image_tool_params *params,
                        sizeof(struct ext_hdr_v0);
        } else {
                alloc_len = image_headersz_v1(params, NULL);
+#if defined(CONFIG_SYS_SPI_U_BOOT_OFFS)
+               if (alloc_len > CONFIG_SYS_SPI_U_BOOT_OFFS) {
+                       fprintf(stderr, "Error: Image header (incl. SPL image) too big!\n");
+                       fprintf(stderr, "header=0x%x CONFIG_SYS_SPI_U_BOOT_OFFS=0x%x!\n",
+                               alloc_len, CONFIG_SYS_SPI_U_BOOT_OFFS);
+                       fprintf(stderr, "Increase CONFIG_SYS_SPI_U_BOOT_OFFS!\n");
+               } else {
+                       alloc_len = CONFIG_SYS_SPI_U_BOOT_OFFS;
+               }
+#endif
        }
 
        hdr = malloc(alloc_len);