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.
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
diff --git a/Makefile b/Makefile
index 902a976..cef149d 100644
--- a/Makefile
+++ b/Makefile
@@ -1583,7 +1583,10 @@
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 $@; false; }
spl/u-boot-splx4.sfp: spl/u-boot-spl.sfp FORCE
$(call if_changed,gensplx4)