April 18, 2024

EBAZ4205 Bitcoin miner board - linux -- NAND flash

My boards have a Winbond W29N01HVSINA chip mounted. This is a 1 megabit (128 megabyte) NAND flash memory chip. So, we get sectors from 0 to 0x8000000.

For comparison, the Zedboard has a 256 megabit (32 megabyte) NOR flash chip. Also, the Zedboard has 512M of ram, via a pair of chips (so they get a 32 bit path to memory). The EBAZ has only a single chip and only 256M of ram.

We see this among the boot messages:

9 ofpart partitions found on MTD device pl35x-nand
Creating 9 MTD partitions on "pl35x-nand":
0x000000000000-0x000000300000 : "nand-fsbl-uboot"
0x000000300000-0x000000800000 : "nand-linux"
0x000000800000-0x000000820000 : "nand-device-tree"
0x000000820000-0x000001220000 : "nand-rootfs"
0x000001220000-0x000002220000 : "nand-jffs2"
0x000002220000-0x000002a20000 : "nand-bitstream"
0x000002a20000-0x000006a20000 : "nand-allrootfs"
0x000006a20000-0x000007e00000 : "nand-release"
0x000007e00000-0x000008000000 : "nand-reserve"
And when we login, we can do this:
cd /proc
cat mtd
dev:    size   erasesize  name
mtd0: 00300000 00020000 "nand-fsbl-uboot"
mtd1: 00500000 00020000 "nand-linux"
mtd2: 00020000 00020000 "nand-device-tree"
mtd3: 00a00000 00020000 "nand-rootfs"
mtd4: 01000000 00020000 "nand-jffs2"
mtd5: 00800000 00020000 "nand-bitstream"
mtd6: 04000000 00020000 "nand-allrootfs"
mtd7: 013e0000 00020000 "nand-release"
mtd8: 00200000 00020000 "nand-reserve"
So, flash is divided into 9 "chunks". Maybe we could call them partitions, but I am unsure about using that word at this point. Chunk 6 is the root filesystem, as we can see by:
mount
/dev/root on / type jffs2 (rw,relatime)
So, what is this jffs2? It is a special filesystem created originally for NOR flash devices, but then made to work with NAND flash via the "mtd" device driver. See devices with those names below. It saw general use in OpenWRT.
cd /dev
ls -l root
lrwxrwxrwx    1 root     root             9 Jan  1  1970 root -> mtdblock6

ls -l mtd*
crw-rw----    1 root     root       90,   0 Jan  1  1970 mtd0
crw-rw----    1 root     root       90,   1 Jan  1  1970 mtd0ro
crw-rw----    1 root     root       90,   2 Jan  1  1970 mtd1
crw-rw----    1 root     root       90,   3 Jan  1  1970 mtd1ro
crw-rw----    1 root     root       90,   4 Jan  1  1970 mtd2
crw-rw----    1 root     root       90,   5 Jan  1  1970 mtd2ro
crw-rw----    1 root     root       90,   6 Jan  1  1970 mtd3
crw-rw----    1 root     root       90,   7 Jan  1  1970 mtd3ro
crw-rw----    1 root     root       90,   8 Jan  1  1970 mtd4
crw-rw----    1 root     root       90,   9 Jan  1  1970 mtd4ro
crw-rw----    1 root     root       90,  10 Jan  1  1970 mtd5
crw-rw----    1 root     root       90,  11 Jan  1  1970 mtd5ro
crw-rw----    1 root     root       90,  12 Jan  1  1970 mtd6
crw-rw----    1 root     root       90,  13 Jan  1  1970 mtd6ro
crw-rw----    1 root     root       90,  14 Jan  1  1970 mtd7
crw-rw----    1 root     root       90,  15 Jan  1  1970 mtd7ro
crw-rw----    1 root     root       90,  16 Jan  1  1970 mtd8
crw-rw----    1 root     root       90,  17 Jan  1  1970 mtd8ro
brw-rw----    1 root     root       31,   0 Jan  1  1970 mtdblock0
brw-rw----    1 root     root       31,   1 Jan  1  1970 mtdblock1
brw-rw----    1 root     root       31,   2 Jan  1  1970 mtdblock2
brw-rw----    1 root     root       31,   3 Jan  1  1970 mtdblock3
brw-rw----    1 root     root       31,   4 Jan  1  1970 mtdblock4
brw-rw----    1 root     root       31,   5 Jan  1  1970 mtdblock5
brw-rw----    1 root     root       31,   6 Jan  1  1970 mtdblock6
brw-rw----    1 root     root       31,   7 Jan  1  1970 mtdblock7
brw-rw----    1 root     root       31,   8 Jan  1  1970 mtdblock8
So in /dev we have 3 ways to get at each "chunk". We have a block device, which is naturally what we use to mount the root filesystem. We also have two raw devices, one read-only and one not.
Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]