日期:2014-05-16  浏览次数:20390 次

MPC8313ERDB从NAND FLASH中启动系统

MPC8313ERDB从NAND FLASH中启动系统

mpc8313erdb的linux系统,存放于Nor Flash中,而Nor Flash只有8M,最近在root目录里面加了一点东西,结果Ramdisk的尺寸暴涨啊,一下子超过了4MB(Nor Flash中划分给Ramdisk的空间就只是4M),还好板子上还有32M的NAND Flash,而且原生态的,系统中也没有使用,所以在这里的思路就是这样:把uImage,Ramdisk,dtb文件都写到NAND Flash中,在uboot启动的时候,再读到内存里面,然后从内存启动。

目前我的NAND Flash空间的划分:

NAND Flash空间 使用目标 空间大小 加载到内存的位置
0~1MB NAND UBOOT 1MB  
2MB~6MB uImage 4MB 0x200000
6MB~7MB dtb 1MB 0x800000
7MB~15MB ramdisk 8MB 0x1000000

因为没有USB TAG,所以使用NAND版的uboot以防不测,,,原来在nand的uboot所占的空间j512k的,不懂它的参数保存在哪里的,所以就从2MB的地方开始。

介绍一下uboot下nand的命令:

nand erase [开始地址] [长度]                   // 擦除一片flash
nand write [内存地址] [nand开始地址] [长度]     // 把内存中的数据写到nand flash中
nand read  [内存地址] [nand开始地址] [长度]      // 把nand flash中的数据写到内存中


启动板子进入uboot命令行模式,设置好tftp服务器地址,开始干活~

uImage烧写:

nand erase 0x200000 0x400000
tftp 0x200000 uImage
nand write 0x200000 0x200000 0x400000

dtb:

nand erase 0x600000 0x100000
tftp 0x800000 mpc8313erdb.dtb
nand write 0x800000 0x600000 0x100000

rootfs.ext2.gz.uboot:

nand erase 0x700000 0x800000
tftp 0x1000000 rootfs.ext2.gz.uboot
nand write 0x1000000 0x700000 0x800000

然后修改启动命令:

set bootcmd "nand read 0x200000 0x200000 0x400000;nand read 0x800000 0x600000 0x100000;nand read 0x1000000 0x700000 0x800000;bootm 0x200000 0x1000000 0x800000"
save