[PATCH u-boot-mvebu 25/31] tools: kwbimage: Remove v1 kwbimage SPL padding to CONFIG_SYS_U_BOOT_OFFS bytes

Marek Behún marek.behun at nic.cz
Thu Jul 8 19:30:26 CEST 2021


From: Pali Rohár <pali at kernel.org>

This padding depends on board config file and therere it makes the
mkimage binary tool board specific, which is not correct. One cannot use
mkimage tool built as a result for board A to generate images for board
B, even if both A and B are on the same platform.

This CONFIG_SYS_U_BOOT_OFFS padding was needed when v1 kwbimage contained
SPL code which loaded main U-Boot binary itself, insted of letting
BootROM do it.

Now that SPL code does not load main U-Boot itself and leaves this job to
BootROM, there is no need for this padding anymore. BootROM correctly
locates the second part (main U-Boot binary) in v1 kwbimage, loads it at
correct address as specified in v1 kwbimage header and also jumps to
correct execution address.

Therefore this CONFIG_SYS_U_BOOT_OFFS padding is not needed anymore.

By removing it we also reduce the size of SPL code and therefore also
decrease the final size of v1 kwbimage. This means there is more space
for main U-Boot binary.

Signed-off-by: Pali Rohár <pali at kernel.org>
Reviewed-by: Marek Behún <marek.behun at nic.cz>
---
 tools/kwbimage.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index acd57267f4..656f3f9ae9 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -998,19 +998,6 @@ static size_t image_headersz_v1(int *hasext)
 	}
 #endif
 
-#if defined(CONFIG_SYS_U_BOOT_OFFS)
-	if (headersz > CONFIG_SYS_U_BOOT_OFFS) {
-		fprintf(stderr,
-			"Error: Image header (incl. SPL image) too big!\n");
-		fprintf(stderr, "header=0x%x CONFIG_SYS_U_BOOT_OFFS=0x%x!\n",
-			(int)headersz, CONFIG_SYS_U_BOOT_OFFS);
-		fprintf(stderr, "Increase CONFIG_SYS_U_BOOT_OFFS!\n");
-		return 0;
-	}
-
-	headersz = CONFIG_SYS_U_BOOT_OFFS;
-#endif
-
 	/*
 	 * The payload should be aligned on some reasonable
 	 * boundary
-- 
2.31.1



More information about the U-Boot mailing list