From d1c07785fd68def6aa2251a15eed99f2e9c8071f Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Mon, 23 Sep 2019 10:18:44 +0800 Subject: imx8: Add support to get container image set size To avoid hardcoded offset when adding u-boot.cnt to flash.bin, we use flexible offset which is calculated based on the size of the container image generated int the first stage. And pad u-boot.cnt at 1KB alignment. So add code to get the offset when SPL loading u-boot.cnt. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- arch/arm/mach-imx/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'arch/arm/mach-imx/Makefile') diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 17b241ae99..87fd69706d 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -169,9 +169,16 @@ u-boot.cnt: MKIMAGEOUTPUT = u-boot.cnt.log ifeq ($(CONFIG_SPL_LOAD_IMX_CONTAINER), y) u-boot.cnt: u-boot.bin container.cfg FORCE $(call if_changed,mkimage) -endif flash.bin: spl/u-boot-spl.bin FORCE $(call if_changed,mkimage) + @flashbin_size=`wc -c flash.bin | awk '{print $$1}'`; \ + pad_cnt=$$(((flashbin_size + 0x400 - 1) / 0x400)); \ + echo "append u-boot.cnt at $$pad_cnt KB"; \ + dd if=u-boot.cnt of=flash.bin bs=1K seek=$$pad_cnt; +else +flash.bin: spl/u-boot-spl.bin FORCE + $(call if_changed,mkimage) +endif endif else -- cgit