MTD partitions

From JK2410.org

Jump to: navigation, search

JK2410 所使用的 u-boot 為加入 NAND flash 的支援,由於 upstream u-boot 並未加入此部份,若您要使用 JK2410 上的 NAND flash,請使用 www.jk2410.org 所提供的 u-boot。

將 JK2410 上的 NAND flash 做分割的方式是使用 'mtdparts' 命令:

jollen.org # help mtdparts
mtdparts
   - list partition table
mtdparts delall
   - delete all partitions
mtdparts del part-id
   - delete partition (e.g. part-id = nand0,1)
mtdparts add <mtd-dev> <size>[@<offset>] [<name>] [ro]
   - add partition
mtdparts default
   - reset partition table to defaults

分割 NAND flash 的方式是使用以下二個 u-boot 環境變數:

  • mtdids
  • mtdparts

U-Boot 的 help 說明:

this command uses three environment variables:

'partition' - keeps current partition identifier
partition  := <part-id> <part-id>  := <dev-id>,part_num
'mtdids' - linux kernel mtd device id <-> u-boot device id mapping
mtdids=<idmap>[,<idmap>,...]
<idmap>  := <dev-id>=<mtd-id> <dev-id>  := 'nand'|'nor'<dev-num> <dev-num>  := mtd device number, 0... <mtd-id>  := unique device tag used by linux kernel to find mtd device (mtd->name) 'mtdparts' - partition list
mtdparts=mtdparts=<mtd-def>[;<mtd-def>...]
<mtd-def>  := <mtd-id>:<part-def>[,<part-def>...] <mtd-id>  := unique device tag used by linux kernel to find mtd device (mtd->name) <part-def> := <size>[@<offset>][<name>][<ro-flag>] <size>  := standard linux memsize OR '-' to denote all remaining space <offset>  := partition start offset within the device <name>  := '(' NAME ')' <ro-flag>  := when set to 'ro' makes partition read-only (not used, passed to kernel)

以下是一個範例:

u-boot> setenv mtdids nand0=jk2410-nand
u-boot> setenv mtdparts mtdparts=jk2410-nand:4096k(kernel),-(rootfs)
u-boot> saveenv

分割結果:

jollen.org # mtdparts
device nand0 <jk2410-nand>, # parts = 2 #: name size offset mask_flags 0: kernel 0x00400000 0x00000000 0 1: rootfs 0x03c00000 0x00400000 0
active partition: nand0,0 - (kernel) 0x00400000 @ 0x00000000
defaults: mtdids  : <NULL> mtdparts: <NULL>
Views
個人工具
導航
工具