[U-Boot] [PATCH 4/5] cmd_nand: add nand write.ubi command

Ben Gardiner bengardiner at nanometrics.ca
Thu Apr 28 23:47:54 CEST 2011


Add another nand write. variant, ubi. This command will request of
nand_write_skip_bad() that all trailing all-0xff pages will be
dropped from eraseblocks as they are written as-per the
reccommended behaviour of the UBI FAQ.

Signed-off-by: Ben Gardiner <bengardiner at nanometrics.ca>
---
 common/cmd_nand.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 69b2acc..faece07 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -567,7 +567,11 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 		rwsize = size;
 
 		s = strchr(cmd, '.');
-		if (!s || !strcmp(s, ".jffs2") ||
+		if (!strcmp(s, ".ubi")) {
+			ret = nand_write_skip_bad(nand, off, &rwsize,
+						  (u_char *)addr,
+						  WITH_DROP_FFS);
+		} else if (!s || !strcmp(s, ".jffs2") ||
 		    !strcmp(s, ".e") || !strcmp(s, ".i")) {
 			if (read)
 				ret = nand_read_skip_bad(nand, off, &rwsize,
@@ -694,6 +698,11 @@ U_BOOT_CMD(
 	"    write 'size' bytes starting at offset 'off' with yaffs format\n"
 	"    from memory address 'addr', skipping bad blocks.\n"
 #endif
+	"nand write.ubi - addr off|partition size\n"
+	"    write 'size' bytes starting at offset 'off'\n"
+	"    from memory address 'addr', skipping bad blocks and "
+	"dropping any pages at the\n"
+	"    end of eraseblocks that contain only 0xFF\n"
 	"nand erase[.spread] [clean] [off [size]] - erase 'size' bytes "
 	"from offset 'off'\n"
 	"    With '.spread', erase enough for given file size, otherwise,\n"
-- 
1.7.1



More information about the U-Boot mailing list