]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - tools/kwbimage.c
kwbimage: Make the Makefile pass in CONFIG_SYS_SPI_U_BOOT_OFFS
[karo-tx-uboot.git] / tools / kwbimage.c
index 66f459ad6b1c7f2b65eb612349e6a2e647c8238e..de5c80847e3f8d2ee4c8a9aeda595d0c3b1adb56 100644 (file)
@@ -868,6 +868,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);