[PATCH] tools: mxsboot: pre-fill buffer with 0xff, not 0

Fabio Estevam festevam at gmail.com
Mon Dec 4 02:35:56 CET 2023


Hi Alessandro,

[Adding Marek and Rogan]

On Sun, Dec 3, 2023 at 9:24 PM Alessandro Rubini <rubini at gnudd.com> wrote:
>
> The tool works for me, with imx28 and NAND memory, but the resulting
> blocks are reported as bad, both by u-boot and the kernel.
>
> This makes it impossible to erase from Linux (for an upgrade without
> console access, for example -- u-boot can "nand scrub" but linux can't).
>
> pre-filling with 0xff creates a proper boot loader image, but no
> bad-block marker is there when written to flash.
>
> Signed-off-by: Alessandro Rubini <rubini at gnudd.com>
> ---
>  tools/mxsboot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/mxsboot.c b/tools/mxsboot.c
> index 04d86f87a8..8f4018aa56 100644
> --- a/tools/mxsboot.c
> +++ b/tools/mxsboot.c
> @@ -478,7 +478,7 @@ static int mx28_create_nand_image(int infd, int outfd)
>                 goto err0;
>         }
>
> -       memset(buf, 0, size);
> +       memset(buf, 0xff, size);

This makes sense:

Reviewed-by: Fabio Estevam <festevam at gmail.com>

Thanks


More information about the U-Boot mailing list