]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mach-imx: Makefile: Extend u-boot-nand.imx padding
authorHiago De Franco <hiago.franco@toradex.com>
Tue, 3 Oct 2023 21:26:54 +0000 (18:26 -0300)
committerStefano Babic <sbabic@denx.de>
Mon, 16 Oct 2023 06:46:01 +0000 (08:46 +0200)
Extend the padding process of u-boot-nand.imx target by adding 10k bytes
of zeros to the end of the binary using the 'dd' command.

The existing padding method did not generate a functional binary,
as discussed in more detail in this thread [1]. Instead, we adopt the
end-padding calculation method documented in 'board/doc/colibri_imx7.rst'
as a reference, which is relevant for iMX7 with NAND storage.

Adding 10k bytes of zeros provides an approximate value that makes the
proper padding for these NAND devices.

[1] https://lore.kernel.org/all/CAC4tdFUqffQzRQFv5AGe_xtbFy1agr2SEpn_FzEdexhwjdryyw@mail.gmail.com/

Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
arch/arm/mach-imx/Makefile

index aebfa6517bd2a24c3c1191bf82e94c778c233491..6904cf38802ac3e950e5fb41f36a7fee6f824b61 100644 (file)
@@ -142,7 +142,9 @@ u-boot.imx: u-boot.bin u-boot.cfgout $(PLUGIN).bin FORCE
        $(call if_changed,mkimage)
 
 quiet_cmd_u-boot-nand_imx = GEN     $@
-cmd_u-boot-nand_imx = (dd bs=1024 count=1 if=/dev/zero 2>/dev/null) | cat - $< > $@
+cmd_u-boot-nand_imx = (dd bs=1024 count=1 if=/dev/zero 2>/dev/null) | cat - $< > $@.zero-padded ; \
+                     (dd bs=10k count=1 if=/dev/zero 2>/dev/null) | cat $@.zero-padded - > $@ ; \
+                     rm -f $@.zero-padded
 
 u-boot-nand.imx: u-boot.imx FORCE
        $(call if_changed,u-boot-nand_imx)