[U-Boot] [PATCH] Add Yaffs2 image writing support.
Li Wenhao
liwenhao.g at gmail.com
Sun Jan 10 18:38:46 CET 2010
Signed-off-by: Li Wenhao <liwenhao.g at gmail.com>
---
common/cmd_nand.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 075a8af..38c6480 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -390,6 +390,27 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
ret = nand->read_oob(nand, off, &ops);
else
ret = nand->write_oob(nand, off, &ops);
+ } else if (!strcmp(s, ".yaffs2") && !read) {
+ mtd_oob_ops_t ops = {
+ .mode = MTD_OOB_AUTO,
+ .len = 2048, /* page size */
+ .ooblen = 64, /* spare size */
+ };
+
+ ulong page = 0;
+ ulong block_size = ops.len + ops.ooblen;
+ while (page * block_size < size) {
+ ops.datbuf = addr + page * block_size;
+ ops.oobbuf = ops.datbuf + ops.len;
+
+ ret = nand->write_oob(nand,
+ off + page * ops.len,
+ &ops);
+
+ if (ret) break;
+
+ page++;
+ }
} else {
printf("Unknown nand command suffix '%s'.\n", s);
return 1;
--
1.6.3.3
More information about the U-Boot
mailing list