Skip to contentSkip to conversation

configs: socfpga: Add CONFIG_SPL_PAD_TO

PATCH New Ley Foon Tan 1 participant 2 messages Jan 6, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 configs: socfpga: Add CONFIG_SPL_PAD_TO

Add CONFIG_SPL_PAD_TO for Gen5 and Arria 10. CONFIG_SPL_PAD_TO is set to size of OCRAM.

This is preparation for image padding change in socfpgaimage.

---
 include/configs/socfpga_common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/socfpga_common.h +2 -0
index 3d71759da4b4..62b327cd6e52 100644
@@ -22,8 +22,10 @@
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 #define CONFIG_SYS_INIT_RAM_ADDR	0xFFFF0000
 #define CONFIG_SYS_INIT_RAM_SIZE	SOCFPGA_PHYS_OCRAM_SIZE
+#define CONFIG_SPL_PAD_TO		0x10000
 #elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
 #define CONFIG_SYS_INIT_RAM_ADDR	0xFFE00000
+#define CONFIG_SPL_PAD_TO		0x40000
 /* SPL memory allocation configuration, this is for FAT implementation */
 #ifndef CONFIG_SYS_SPL_MALLOC_SIZE
 #define CONFIG_SYS_SPL_MALLOC_SIZE	0x10000
Signature · 1 line
2.19.0
#1 lore raw

PATCH 2/2 tools: socfpgaimage: update padding flow

The existing socfpgaimage always pads the image to the maximum size of OCRAM size. This will break in the encryption flow where it expects the image to be un-padded. The encryption tool will do the encryption for the whole image and append the signature key at end of the image. The signature key will append to beyond the size of OCRAM if the image is padded with the maximum size before encryption.

Move the padding step from socfpgaimage to Makefile and pads with objcopy command.

socfpgaimage will pad the image with 16 bytes aligned (including CRC word), this is a requirement in encryption flow.

---
 Makefile             |  5 ++++-
 tools/socfpgaimage.c | 41 ++++++++++++++++++++++++++++-------------
 2 files changed, 32 insertions(+), 14 deletions(-)
Makefile +4 -1
index 679e4a603a28..e7ff15d419c4 100644
@@ -1583,7 +1583,10 @@ u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE
 
 ifneq ($(CONFIG_ARCH_SOCFPGA),)
 quiet_cmd_gensplx4 = GENSPLX4 $@
-cmd_gensplx4 = cat	spl/u-boot-spl.sfp spl/u-boot-spl.sfp	\
+cmd_gensplx4 = $(OBJCOPY) -I binary -O binary --gap-fill=0x0		\
+			--pad-to=$(CONFIG_SPL_PAD_TO)			\
+			spl/u-boot-spl.sfp spl/u-boot-spl.sfp &&        \
+		cat	spl/u-boot-spl.sfp spl/u-boot-spl.sfp		\
 			spl/u-boot-spl.sfp spl/u-boot-spl.sfp > $@ || rm -f $@
 spl/u-boot-splx4.sfp: spl/u-boot-spl.sfp FORCE
 	$(call if_changed,gensplx4)
tools/socfpgaimage.c +28 -13

109 lines not on this page · raw message

Signature · 1 line
2.19.0