AnsweredAssumed Answered

How to access nand or emmc storage from linux

Question asked by mrigendra chaubey on Oct 13, 2018
Latest reply on Oct 23, 2018 by jimmychan

I have a i.mx6 based board running using buildroot and linux.

 

I am trying to access nand and emmc storages from sd card's rootfs but the underlying subsystem and commands are not very clear to me.


This board have two storages nand and emmc. The nand has full rootfs and bootimage on itself.

Booting from SD card gives below log.
From the boot logs I can see the nand and emmc partition getting detected

[ 3.440294] 5 ofpart partitions found on MTD device gpmi-nand
[ 3.446084] Creating 5 MTD partitions on "gpmi-nand":
[ 3.451148] 0x000000000000-0x000000200000 : "boot"
[ 3.456431] 0x000000200000-0x000000500000 : "scratch"
[ 3.461632] 0x000000500000-0x000000b00000 : "kernel"
[ 3.467091] 0x000000b00000-0x000001100000 : "recovery"
[ 3.472521] 0x000001100000-0x000010000000 : "rootfs"
[ 3.481312] gpmi-nand 112000.gpmi-nand: driver registered.

and emmc

[ 4.318175] mmcblk0: p1 p2

I can see the devices for nand are registered and shown in `/dev/mtd*` but not mounted.
Now I am using `nand and mmc-utils` provided by buildroot.
I am trying to write some data on nand like this

nandwrite -b 1 -n /dev/mtd0 -p /test.txt

error log

https:/pastebin.com/raw/FZdk2hUT

 

Tried flash erase command, 

 

flash_erase /dev/mtd0

flash_erase: error!: no start erase block specified
flash_erase: error!: no erase block count specified
flash_erase: error!: Try `--help' for more information

Can anyone tell the correct way/steps to be followed in case of nand, sd interaction. I followed this thread

https://unix.stackexchange.com/questions/99476/how-can-i-flash-erase-mtd0

Similarly I am not able to flash, or do anything with emmc.

mmc status get /dev/mmcblk0
SEND_STATUS response: 0x00000900

This looks ok, but how to really write or erase mmc? There are many commands associated with mmc , and not know which should I use,

https://manpages.debian.org/unstable/mmc-utils/mmc.1.en.html

 

What are the prerequisites for this?

Any hint or direction would be helpful.

Outcomes