Skip to content

RAW Nand Flash

RAW Nand Flash

https://www.j-michel.org/blog/2014/05/27/from-nand-chip-to-files
https://user.eng.umd.edu/~blj/CS-590.26/micron-tn2919.pdf

Adjacent Data and Spare Areas

512 Bytes of Data Area
16 Bytes of Spare Area
______________________
512 Bytes of Data Area
16 Bytes of Spare Area
______________________
512 Bytes of Data Area
16 Bytes of Spare Area
______________________
512 Bytes of Data Area
16 Bytes of Spare Area

Separate Data and Spare Areas

512 Bytes of Data Area
512 Bytes of Data Area
512 Bytes of Data Area
512 Bytes of Data Area
16 Bytes of Spare Area
16 Bytes of Spare Area
16 Bytes of Spare Area
16 Bytes of Spare Area

Dumping data

Nand-dump-tool

./Nand-dump-tool.py -i full-dump.bin --layout=guess -I adda1095 -o main-dump.bin
[*] Using given ID code
ID code                          : adda1095
Manufacturer                     : Hynix
Device                           : NAND 256MiB 3,3V 8-bit
Die/Package                      : 1
Cell type                        : 2 Level Cell
Simultaneously programmed paged  : 2
Interleave between multiple chips: False
Write cache                      : False
Page size                        : 2048 bytes (2 K)
Spare area size                  : 16 bytes / 512 byte
Block size                       : 131072 bytes (128 K)
Organization                     : X16
Serial access time               : 25 ns
OOB size                         : 64 bytes

[*] Guessing NAND layout using hamming distance...
[*] Guessed layout is: separate

[*] Start dumping...
[*] Finished
        Total: 276824064 bytes (264.00 MB)
        Data : 268435456 bytes (256.00 MB)
        OOB  : 8388608 bytes (8.00 MB)

UBI/UBIFS

Do strings on the dump and see if the strings "UBI" or "UBIFS" exist. If so then this is a compressed file system.

Mounting a Flash module from a dump

modprobe nandism first_id_byte=0xad second_id_byte=0xda third_id_byte=0x10 fourth_id_byte=0x95 
dd if=main-dump.bin of=/dev/mtd0
modprobe ubi
modprobe ubifs
ubiattach --mtdn=0

If you run in to the error below then run the updated command

UBI error: validate_ec_hdr: bad VID header offset 2048, expected 512

New Mount Command:

ubiattach --mtdn=0 --vid-hdr-offset=2048