uboot通过kernel command line 动态分区 CONFIG_MTD_CMDLINE_PARTS

General informations

The Linux kernel configuration item CONFIG_MTD_CMDLINE_PARTS has multiple definitions:

drivers/mtd/Kconfig

The configuration item CONFIG_MTD_CMDLINE_PARTS:

  • prompt: Command line partition table parsing
  • type: tristate
  • depends on: CONFIG_MTD_PARTITIONS = "y" && CONFIG_MTD = "y"
  • defined in drivers/mtd/Kconfig
  • found in Linux Kernels: from 2.6.0 release still available on 2.6.39 release
  • module created: cmdlinepart
Help text

Allow generic configuration of the MTD partition tables via the kernel command line. Multiple flash resources are supported for hardware where different kinds of flash memory are available.

You will still need the parsing functions to be called by the driver for your particular device. It won't happen automatically. The SA1100 map driver (CONFIG_MTD_SA1100) has an option for this, for example.

The format for the command line is as follows:

mtdparts=<mtddef>[;<mtddef] <mtddef> := <mtd-id>:<partdef>[,<partdef>] <partdef> := <size>[@offset][<name>][ro] <mtd-id> := unique id used in mapping driver/device <size> := standard linux memsize OR "-" to denote all remaining space <name> := (NAME)

Due to the way Linux handles the command line, no spaces are allowed in the partition definition(中间不能有空格), including mtd id's and partition names.

Examples:

1 flash resource (mtd-id "sa1100"), with 1 single writable partition: mtdparts=sa1100:-

Same flash, but 2 named partitions, the first one being read-only: mtdparts=sa1100:256k(ARMboot)ro,-(root)

If unsure, say 'N'.

 

1. uboot $mtdparts 和 linux /dev/mtd* 的联系
比如:
uboot:# setenv mtdparts 'mtdparts=nx_2016:1408k@0k(boot),128k@1408k(env),-(extra);nx_2017:16m(k0),16m(k1),-(nandextra)'
linux:# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00160000 00010000 "boot"
mtd1: 00020000 00010000 "env"
mtd2: 00280000 00010000 "extra"
mtd3: 00400000 00010000 "nx_2016"
mtd4: 04000000 00004000 "nx_2017"
mtd5: 01000000 00004000 "k0"
mtd6: 01000000 00004000 "k1"
mtd7: 02000000 00004000 "nandextra"

 

 

这里有几个问题:

1.<mtd-id> := unique id used in mapping driver/device 这个怎么弄?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值