u-boot移植5:添加自动补全和默认分区表

1. uboot中的添加默认的分区表:

diff --git a/include/configs/lip2440.h b/include/configs/lip2440.h
index 1b98fac..ef1a4ee 100644
--- a/include/configs/lip2440.h
+++ b/include/configs/lip2440.h
@@ -89,6 +89,7 @@

 #define CONFIG_SYS_HUSH_PARSER
 #define CONFIG_CMDLINE_EDITING
+#define CONFIG_AUTO_COMPLETE    /* a tab to complete */

 /* autoboot */
 #define CONFIG_BOOTDELAY       5
@@ -192,6 +193,12 @@
 #define CONFIG_YAFFS2
 #define CONFIG_RBTREE

+#define MTDIDS_DEFAULT "nand0=nandflash0"
+#define MTDPARTS_DEFAULT "mtdparts=nandflash0:512k@0(uboot)," \
+                         "512k(uboot-env)," \
+                         "4M(kernel)," \
+                         "-(root)"
+
 /* additions for new relocation code, must be added to all boards */
 #define CONFIG_SYS_SDRAM_BASE  PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_SDRAM_BASE + 0x1000 - \

2. 修改的解释:

nand0=nandflash0 :
    将nand0 命名为 nandflash0
MTDIDS_DEFAULT 对应 uboot 参数中的 mtdids
MTDPARTS_DEFAULT 对应 uboot 参数中的 mtdparts

对于mtdparts 中参数的解释如下:
    mtdparts=mtd-id:<size1>@<offset1>(<name1>),<size2>@<offset2>(<name2>)
    需要注意的几点:
  1. mtd-id 必须要跟你当前平台的flash的mtd-id一致,不然整个mtdparts会失效 怎样获取到当前平台的flash的mtd-id?在bootargs参数列表中,可以指定当前flash的mtd-id,指定 mtdid s:nand0=gen_nand.1,前面的nand0则表示第一个flash 
  2. size在设置的时候可以为实际的size(xxM,xxk,xx),也可以为'-'这表示剩余的所有空间。相关信息可以查看drivers/mtd/cmdlinepart.c中的注释找到相关描述。

3. uboot重新启动:

LIP2440 # mtdparts    (或者 mtd)
mtdparts variable not set, see 'help mtdparts'
no partitions defined

defaults:
mtdids  : nand0=nandflash0
mtdparts: mtdparts=nandflash0: 512k@0(uboot),512k(uboot-env),4M(kernel),-(root)
LIP2440 #  mtdparts default
LIP2440 # mtd

device nand0 <nandflash0>, # parts = 4
 #: name                size            offset          mask_flags
 0: uboot               0x00080000      0x00000000      0
 1: uboot-env           0x00080000      0x00080000      0
 2: kernel              0x00400000      0x00100000      0
 3: root                0x0fb00000      0x00500000      0

active partition: nand0,0 - (uboot) 0x00080000 @ 0x00000000

defaults:
mtdids  : nand0=nandflash0
mtdparts: mtdparts=nandflash0: 512k@0(uboot),512k(uboot-env),4M(kernel),-(root)
LIP2440 # 

4. uboot 参数中添加分区表:

如果将 uboot 使用默认的分区表,需要:
  1. 将 mtdparts default 加到 bootargs 参数中去
  2. 在 uboot 命令行中: set mtdparts $default    并保存
  3. 在 uboot 命令行中: set mtdparts nandflash0:512k@0(uboot),512k(uboot-env),4M(kernel),-(root)   并保存

5. uboot 中的分区和 linux 分区的区别:

一般要设置成相同,但如果不同,是不影响系统启动的,
当内核启动之后,分区是使用内核中设置的分区。
在uboot中的分区可以用在 nand erase.part [分区的助记符(比如 root)]

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值