一、nand分区信息
nand一般划分成如下几个区域:bootlader-》params-》kernel-》root
uboot/include/configs/mini2440.h
#define MTDPARTS_DEFAULT "mtdparts=nandflash0:250k@0(bootloader)," \ "128K(params)," \ "5m(kernel)," \ "-(root)"以上,对应的nand布局为:
name 大小 在nand上的起始地址
bootloader 0x00040000 0x00000000
params 0x00020000 0x00040000
kernel 0x00200000 0x00060000
root 0xfda00000 0x00260000
二、启动kernel部分
文件系统为ramdisk类型,且已经在内存中:
bootargs = ‘initrd=0x32000000,0xa00000 root=/dev/ram0 console=ttySAC0 mem=64M init=/linuxrc’
文件系统为ramdisk类型,且在flash中:
bootargs = ‘mem=32M console=ttyS0,115200 root=/dev/ram rw init=/linuxrc’
文件系统为jffs2类型,且在flash中:
bootargs = ‘mem=32M console=ttyS0,115200 noinitrd root=/dev/mtdblock2 rw rootfstype=jffs2 init=/linuxrc’
文件系统为nfs类型:
bootargs = ‘noinitrd mem=64M console=ttySAC0 root=/dev/nfs nfsroot=192.168.0.3:/nfs ip=192.168.0.5’
bootcmd = nand read.jffs2 0x30007FC0 kernel;bootm 0x30007FC0
1.nand read.jffs2 0x30007FC0 kernel
//上述代码等价于:nand read.jffs2 0x30007FC0 0x00060000 0x00200000
//从nand的kernel分区读出内核放置0x30007FC0处
2.bootm 0x30007FC0
说明:uImage的头部CRC为64个字节;所以,内核"zImage"正好位于0x30008000处。
三、启动代码情景分析
1.执行bootcmd环境变量定义的命令
uboot/common/main.c
...... s = getenv ("bootcmd"); ...... run_command (s, 0); ......
2.执行bootargs环境变量定义的命令
uboot/lib_arm/bootm.c
...... char *commandline = getenv ("bootargs"); ...... setup_commandline_tag (bd, commandline); ......