Sample Header Ad - 728x90

How to write data to raw NAND FLASH through /dev/mtd0 in Linux?

1 vote
1 answer
5641 views
I am working on an embedded Linux system (5.10.24), where there is a NAND FLASH as storage. The NAND FLASH is partitioned into 4 parts, part 0 is used for u-boot, part 1 is used for kernel, part 2 is used as UBIFS, part 3 is another UBIFS partition. So when Linux boots up, it shows there are /dev/mtd0, /dev/mtd1, /dev/mtd2, /dev/mtd3. Now I can read data of u-boot from /dev/mtd0 (raw FLASH, no filesystem) through POSIX-C file operations. Then I want to saved some data to NAND FLASH partition 0 by writing to /dev/mtd0. All the file reading/writing operations are done well, no error reported. But when I reboot system back to u-boot, it complains that there are lots of errors like spi nand read oob error ,ret= -74 , oob addr e0000, ooboffs 0, ooblen 64. It seemed that NAND OOB has something wrong, why does this error happen and how to write data to raw NAND FLASH through /dev/mtd interface?
Asked by wangt13 (631 rep)
Apr 20, 2023, 02:16 PM
Last activity: Apr 20, 2023, 02:42 PM