[U-Boot] [PATCH] Make nboot skip bad blocks

Hi,
nboot command currently does not skip bad blocks and gives read error when loading image stored over bad block. With patch applied, nboot works as expected:
# nand bad Device 0 bad blocks: 00780000 014a0000 02000000 02cc0000 04aa0000
# boot Loading from NAND 128MiB 3,3V 8-bit, offset 0x2c00000 Image Name: Linux-2.6.22-omap1 Created: 2008-11-20 23:44:32 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1052520 Bytes = 1 MB Load Address: 10008000 Entry Point: 10008000 Skipping bad block 0x02cc0000 Automatic boot of image at addr 0x10400000 ... ...
CHANGELOG * nboot: skip bad block when loading image from NAND
Signed-off-by: Ladislav Michl ladis@linux-mips.org
diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 11f9096..f915fb6 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -511,7 +511,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, printf("\nLoading from %s, offset 0x%lx\n", nand->name, offset);
cnt = nand->writesize; - r = nand_read(nand, offset, &cnt, (u_char *) addr); + r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr); if (r) { puts("** Read error\n"); show_boot_progress (-56); @@ -543,8 +543,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, } show_boot_progress (57);
- /* FIXME: skip bad blocks */ - r = nand_read(nand, offset, &cnt, (u_char *) addr); + r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr); if (r) { puts("** Read error\n"); show_boot_progress (-58);

On Friday 13 March 2009 09:38:19 Ladislav Michl wrote:
nboot command currently does not skip bad blocks and gives read error when loading image stored over bad block. With patch applied, nboot works as expected:
iirc, some people proposed a new command or an option to nboot to get skip behavior (e.g. nboot.jffs2), but i dont see the value in nboot never skipping bad blocks. when would anyone ever want to use a boot command and have bad blocks attempt to be processed ?
i.e. your patch sounds good to me ;) -mike

On Sun, Mar 15, 2009 at 05:59:28PM -0400, Mike Frysinger wrote:
On Friday 13 March 2009 09:38:19 Ladislav Michl wrote:
nboot command currently does not skip bad blocks and gives read error when loading image stored over bad block. With patch applied, nboot works as expected:
iirc, some people proposed a new command or an option to nboot to get skip behavior (e.g. nboot.jffs2), but i dont see the value in nboot never skipping bad blocks. when would anyone ever want to use a boot command and have bad blocks attempt to be processed ?
Ah... Are you reffering to "Loading from NAND using 'nboot' Periodically Fails Where 'nand read' Succeeds" thread? http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/41977/ It seems conclusion was to skip bad blocks by default, but no patch went in. I'm considering it a bug fix and therefore -rc material...
Best regards, ladis

Dear Scott,
In message 20090316151552.GA4330@localhost.localdomain Ladislav Michl wrote:
On Sun, Mar 15, 2009 at 05:59:28PM -0400, Mike Frysinger wrote:
On Friday 13 March 2009 09:38:19 Ladislav Michl wrote:
nboot command currently does not skip bad blocks and gives read error when loading image stored over bad block. With patch applied, nboot works as expected:
iirc, some people proposed a new command or an option to nboot to get skip behavior (e.g. nboot.jffs2), but i dont see the value in nboot never skipping bad blocks. when would anyone ever want to use a boot command and have bad blocks attempt to be processed ?
Ah... Are you reffering to "Loading from NAND using 'nboot' Periodically Fails Where 'nand read' Succeeds" thread? http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/41977/ It seems conclusion was to skip bad blocks by default, but no patch went in. I'm considering it a bug fix and therefore -rc material...
Could you please comment?
Best regards,
Wolfgang Denk

On Mon, Mar 16, 2009 at 04:15:52PM +0100, Ladislav Michl wrote:
On Sun, Mar 15, 2009 at 05:59:28PM -0400, Mike Frysinger wrote:
On Friday 13 March 2009 09:38:19 Ladislav Michl wrote:
nboot command currently does not skip bad blocks and gives read error when loading image stored over bad block. With patch applied, nboot works as expected:
iirc, some people proposed a new command or an option to nboot to get skip behavior (e.g. nboot.jffs2), but i dont see the value in nboot never skipping bad blocks. when would anyone ever want to use a boot command and have bad blocks attempt to be processed ?
Ah... Are you reffering to "Loading from NAND using 'nboot' Periodically Fails Where 'nand read' Succeeds" thread? http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/41977/ It seems conclusion was to skip bad blocks by default, but no patch went in. I'm considering it a bug fix and therefore -rc material...
No, it was worse than that -- I sent a patch to fix it, but the boot portion of it was broken and incomplete. I'll apply this and send another patch to fix another bug.
-Scott
participants (4)
-
Ladislav Michl
-
Mike Frysinger
-
Scott Wood
-
Wolfgang Denk