From: Ley Foon Tan <ley.foon....@intel.com>

HSD #1508690657-2: 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....@intel.com>
Signed-off-by: Jit Loon Lim <jit.loon....@intel.com>
---
 Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index ff25f92974..04914a8bec 100644
--- a/Makefile
+++ b/Makefile
@@ -1606,8 +1606,14 @@ spl/u-boot-splx4.sfp: spl/u-boot-spl.sfp FORCE
        $(call if_changed,gensplx4)
 
 quiet_cmd_socboot = SOCBOOT $@
-cmd_socboot = cat      spl/u-boot-splx4.sfp u-boot.img > $@ || { rm -f $@; 
false; }
-u-boot-with-spl.sfp: spl/u-boot-splx4.sfp u-boot.img FORCE
+cmd_socboot = $(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 > spl/u-boot-splx4.sfp ;     \
+             cat       spl/u-boot-splx4.sfp u-boot.img > $@ || rm -f $@
+u-boot-with-spl.sfp: spl/u-boot-spl.sfp u-boot.img FORCE
        $(call if_changed,socboot)
 
 quiet_cmd_gensplpadx4 = GENSPLPADX4 $@
-- 
2.26.2

Reply via email to