u-boot环境变量的配置
在移植好u-boot之后别忘了我们u-boot的终极目标是为了引导内核并挂载文件系统。
一、首先概述下我移植的uboot所带的一些基本功能:
1. DM9000A网卡,是uboot带网络tftp下载功能
2. nand flash读写功能(nor flash功能暂未移植)
3. 支持yaffs系统的读写功能
4. 命令行下的命令Tab补全功能
5. 串口loadx传送功能
二、 板上一些关于存储空间的大小介绍
=================================================
1. Common storage size
=================================================
0x1000 : 4KB
0x10000 : 64KB
0x100000 : 1MB
0x1000000 : 16MB
0x10000000 : 256MB
0x400000000 : 1GB
0x1000000000 : 4GB
=================================================
2. SDRAM info
=================================================
Memory Size :
64MB
Address Map :
0x3000,0000 ~ 0x3400,0000
Config :
run u-boot.bin : 1 MB[0x33F0,0000 ~ 0x3400,0000]
run tftpboot : 31MB[0x3200,0000 ~ 0x33F0,0000]
run kernel : 32MB[0x3000,0000 ~ 0x3200,0000]
=================================================
3. NOR Flash info
=================================================
Memory Size :
2MB
Address Map : 0x0000,0000 ~ 0x0020,0000
=================================================
4. NAND Flash info
=================================================
Memory Size : 256MB
Address Map : 0x0000,0000 ~ 0x1000,0000
Config : mtdblock0 ~ mtdblock3
bootloader : 256 KB[0x0000,0000 ~ 0x0004,0000]
params : 128 KB[0x0004,0000 ~ 0x0006,0000]
kernel : 2 MB[0x0006,0000 ~ 0x0026,0000]
root : XXX MB[0x0026,0000 ~ 0x1000,0000]
三、 环境变量的配置
/*基本环境变量*/
setenv loadaddr 0x32000000 //指定加载到内存的地址
setenv imageU_name tftpU.img //指定tftp传送uboot时的名字
setenv imageI_name tftpI.img //指定tftp传送Kernel Image时的名字
setenv imageF_name tftpF.img //指定tftp传送rootFs时的名字
setenv serverip 192.168.1.100 //指定tftp服务器IP
setenv ipaddr 192.168.1.200 //指定开发板IP
setenv netmask 255.255.255.0 //指定开发板IP mask
setenv ethaddr 08:00:3e:26:0a:5b //指定开发板MAC地址
/*Nand Flash分区表设置:256K(bootloader),128K(params),2M(kernel),-(root)*/
setenv mtdParts ‘mtdparts=nandflash0:256K@0(bootloader),128K(params),2M(kernel),-(root)‘
/*CMD:将uboot(U)烧录到Nor flash(暂时没有实现Nor flash)*/
setenv bootcmd_WU2Nor‘tftpboot ${loadaddr} ${imageU_name}; Nor erase ; Nor write ; reset;‘
/*CMD:将uboot(U)、uImage(I)、rootFs(F)烧录到Nand flash*/
setenv bootcmd_WU2Nand ‘tftpboot ${loadaddr} ${imageU_name}; nand erase 0x0 0x40000; nand write ${loadaddr} 0x0 0x40000; reset;‘
setenv bootcmd_WI2Nand ‘tftpboot ${loadaddr} ${imageI_name}; nand erase 0x60000 0x200000; nand write ${loadaddr} 0x60000 0x200000; reset;‘
setenv bootcmd_WF2Nand ‘tftpboot ${loadaddr} ${imageF_name}; nand erase 0x260000 0x1000000; nand write ${loadaddr} 0x260000 0x1000000; reset;‘
setenv bootcmd_WYaffs2Nand ‘tftpboot ${loadaddr} ${imageF_name}; nand erase 0x260000 0x1000000; nand write.yaffs ${loadaddr} 0x260000 ${filesize}; reset;‘
/*内核启动参数bootargs设置*/
setenv bootargs ‘noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0‘
/*默认的内核启动命令*/
setenv bootcmd ‘nand read 0x30007FC0 0x60000 0x200000; bootm 0x30007FC0‘