public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] arm: mach-imx: Makefile: Extend u-boot-nand.imx padding
@ 2023-10-03 21:26 Hiago De Franco
  2023-10-07 12:52 ` Fabio Estevam
  2023-10-16  9:22 ` sbabic
  0 siblings, 2 replies; 3+ messages in thread
From: Hiago De Franco @ 2023-10-03 21:26 UTC (permalink / raw)
  To: Stefano Babic, Fabio Estevam, NXP i.MX U-Boot Team
  Cc: Hiago De Franco, u-boot

From: Hiago De Franco <hiago.franco@toradex.com>

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>
---
 arch/arm/mach-imx/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index aebfa6517b..6904cf3880 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -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)
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: mach-imx: Makefile: Extend u-boot-nand.imx padding
  2023-10-03 21:26 [PATCH] arm: mach-imx: Makefile: Extend u-boot-nand.imx padding Hiago De Franco
@ 2023-10-07 12:52 ` Fabio Estevam
  2023-10-16  9:22 ` sbabic
  1 sibling, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2023-10-07 12:52 UTC (permalink / raw)
  To: Hiago De Franco
  Cc: Stefano Babic, NXP i.MX U-Boot Team, Hiago De Franco, u-boot

On Tue, Oct 3, 2023 at 6:27 PM Hiago De Franco <hiagofranco@gmail.com> wrote:
>
> From: Hiago De Franco <hiago.franco@toradex.com>
>
> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] arm: mach-imx: Makefile: Extend u-boot-nand.imx padding
  2023-10-03 21:26 [PATCH] arm: mach-imx: Makefile: Extend u-boot-nand.imx padding Hiago De Franco
  2023-10-07 12:52 ` Fabio Estevam
@ 2023-10-16  9:22 ` sbabic
  1 sibling, 0 replies; 3+ messages in thread
From: sbabic @ 2023-10-16  9:22 UTC (permalink / raw)
  To: Hiago De Franco, u-boot

> From: Hiago De Franco <hiago.franco@toradex.com>
> 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>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-16  9:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-03 21:26 [PATCH] arm: mach-imx: Makefile: Extend u-boot-nand.imx padding Hiago De Franco
2023-10-07 12:52 ` Fabio Estevam
2023-10-16  9:22 ` sbabic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox