Skip to content

Flash memory layout

Sander edited this page May 11, 2017 · 1 revision

The Xiaomi Xiaofang has 16megabyte of Flash memory. The contents of this memory will be retained during reset. This memory is partitioned in the following segments:

  • 0x00000000 through 0x00000FFF 4kb hw-setting [/dev/mtdblock0]
  • 0x00001000 through 0x00001FFF 4kb rootfs-info [/dev/mtdblock0] (is written to by firmware update)
  • 0x00002000 through 0x00002FFF 4kb jffs2-info [/dev/mtdblock0]
  • 0x00003000 through 0x0007DFFF 492kb u-boot [/dev/mtdblock0]
  • 0x0007E000 through 0x0007EFFF 4kb u-env [/dev/mtdblock0]
  • 0x0007F000 through 0x0007FFFF 4kb flash-layout [/dev/mtdblock0]
  • 0x00080000 through 0x000BFFFF 256kb factory [/dev/mtdblock0]
  • 0x000C0000 through 0x003BFFFF 3072kb kernel [/dev/mtdblock1] (is written to by firmware update)
  • 0x003C0000 through 0x00ABFFFF 7168kb rootfs-r [/dev/mtdblock2] (is written to by firmware update)
  • 0x00AC0000 through 0x00EBFFFF 4096kb rescue [/dev/mtdblock3]
  • 0x00EC0000 through 0x00FBFFFF 1024kb rootfs-rw [/dev/mtdblock4]
  • 0x00FC0000 through 0x00FFFFFF 256kb user [/dev/mtdblock5]

When running linux. The above memory segment are mapped to the following devices:

  • /dev/mtdblock0 = 768kb name=snx-spi
  • /dev/mtdblock1 = 3072kb name=kernel
  • /dev/mtdblock2 = 7168kb name=rootfs
  • /dev/mtdblock3 = 4096kb name=rescue
  • /dev/mtdblock4 = 1024kb name=etc
  • /dev/mtdblock5 = 256kb name=userconfig

The names of the mtdblocks are defined on the uboot>printenv>bootargs variable: bootargs=console=ttyS0,115200 root=/dev/mtdblock2 init=/linuxrc mem=64M isp=10M vc=12M vo=0M mtdparts=snx-spi:768k(uboot),3072k(kernel),7168k(rootfs),4096k(rescue),1024k(etc),256k(userconfig) bootcmd=loadkernel 0x00007FFC 0x0;bootm 0x00008000