tools: mxsboot: pre-fill buffer with 0xff, not 0
PATCH 1/1 tools: mxsboot: pre-fill buffer with 0xff, not 0
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.
--- tools/mxsboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/mxsboot.c +1 -1
@@ -478,7 +478,7 @@ static int mx28_create_nand_image(int infd, int outfd) goto err0; } -memset (buf,0 , size); +memset (buf,0xff , size); fcb =mx28_nand_get_fcb (MAX_BOOTSTREAM_SIZE );if (!fcb) {
Signature · 1 line
2.30.2
Hi Alessandro,
[Adding Marek and Rogan]
Quoted 20 lines · Alessandro Rubini
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
0xffcreates a proper boot loader image, but no bad-block marker is there when written to flash.Signed-off-by Alessandro Rubini <[email protected]>--- tools/mxsboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/mxsboot.c +0
-0
tools/mxsboot.c static int mx28_create_nand_image(int infd, int outfd) · line 481
Quoted 5 lines
tools/mxsboot.c +1
-1@@ -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:
Thanks
Quoted 16 lines · Fabio Estevam
Hi Alessandro,
[Adding Marek and Rogan]
Quoted 11 lines · Alessandro Rubini
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
0xffcreates a proper boot loader image, but no bad-block marker is there when written to flash.Signed-off-by Alessandro Rubini <[email protected]>
Isn't there some kobs-ng or whatever tool it was to properly initialize the NAND on MXS ?
Hello.
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
pre-filling with
0xffcreates a proper boot loader image, but no bad-block marker is there when written to flash.Isn't there some kobs-ng or whatever tool it was to properly initialize the NAND on MXS ?
I didn't know. I used what u-boot offers, which works for me without vendor tools -- and dare I say I trust u-boot tools more than vendor tools?.
The default environment even has the rule to reflash from any u-boot.nand you manage to put into RAM. The only issue is that u-boot.nand, as created, marks good blocks as bad by prefilling with zeores.
thanks
/alessandro
Quoted 8 lines · Alessandro Rubini
Hello.
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
pre-filling with
0xffcreates a proper boot loader image, but no bad-block marker is there when written to flash.Isn't there some kobs-ng or whatever tool it was to properly initialize the NAND on MXS ?
Quoted 8 lines
I didn't know. I used what u-boot offers, which works for me without vendor tools -- and dare I say I trust u-boot tools more than vendor tools?.
The default environment even has the rule to reflash from any u-boot.nand you manage to put into RAM. The only issue is that u-boot.nand, as created, marks good blocks as bad by prefilling with zeores.
But what about the bad block markers , do they get erased when you write this U-Boot image into the NAND ?
I think the vendor tool somehow dealt with it (but it might have depended on some weird stuff in GPMI NAND), I don't think I ever used that tool myself.
Quoted 2 lines
But what about the bad block markers , do they get erased when you write this U-Boot image into the NAND ?
The image includes OOB data, because the rom-mandated map is different from normal standards. If OOB is zeroed, blocks appear as bad (correctly!).
By memsetting to 0xff, before filling data structures and checksums, we get a binary that written with "nand write.raw" works properly (the rom is happy with the format and boots) but doesn't mark blocks as bad.
[actually, only the first half-a-meg is with-oob, the trailing part is not, and the image is partly written with "nand write.raw" and partly with "nand write". Hairy things based on hairy vendor choices in hw/rom]
But tools/mxsboot works fine, and saved my day (or more).
thanks
/alessandro
Marek Vasut
Reviewed-byQuoted 9 lines · Alessandro Rubini
Quoted 2 lines
But what about the bad block markers , do they get erased when you write this U-Boot image into the NAND ?
The image includes OOB data, because the rom-mandated map is different from normal standards. If OOB is zeroed, blocks appear as bad (correctly!).
By memsetting to
0xff, before filling data structures and checksums, we get a binary that written with "nand write.raw" works properly (the rom is happy with the format and boots) but doesn't mark blocks as bad.
Clearly my recollection of the MXS is not what it once was.
Thanks !
Fabio Estevam
reviewerQuoted 11 lines · Alessandro Rubini
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
0xffcreates a proper boot loader image, but no bad-block marker is there when written to flash.Signed-off-by Alessandro Rubini <[email protected]>
Applied to u-boot-imx next, thanks