X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=tools%2Fkwbimage.c;h=9540e7eb84fc40b67b2827869b081e3462ca0577;hb=8ee28251d95e237302c7c44929e59a813e147622;hp=66f459ad6b1c7f2b65eb612349e6a2e647c8238e;hpb=358b8bc204f365be28fed94f23e53e04183a8c7f;p=oweals%2Fu-boot.git diff --git a/tools/kwbimage.c b/tools/kwbimage.c index 66f459ad6b..9540e7eb84 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -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);