用uboot烧写内核到smart210

本文详细介绍了如何在Ubuntu系统下将U-Boot烧录到SD卡,并通过SD卡启动开发板的过程,包括环境配置、设备操作、内核与文件系统烧录步骤及系统启动机制。

1,写uboot到sd卡,因为smart210可以从sd卡启动,所以在ubuntu系统下把uboot烧到sd卡中

在ubuntu终端下输入命令:dd iflag=dsync oflag=dsync if=smart210-uboot.bin of=/dev/sdc seek=1

/dev/sdc为SD卡设备名,写完后

2.启动UBOOT:从sd卡启动开发板,进入uboot

U-Boot 2011.06 (Dec 26 2013 - 12:15:22) for Smart210

CPU:    S5PC110@1000MHz

Board:   Smart210
DRAM:  512 MiB
WARNING: Caches not enabled

PWM Moudle Initialized.
NAND:  512 MiB
MMC:   SAMSUNG SD/MMC: 0, SAMSUNG SD/MMC: 1
In:    serial
Out:   serial
Err:   serial
Net:   dm9000

 
Hit any key to stop autoboot:  0 
[Smart210]#
查看环境变量参数

[Smart210]# printenv
baudrate=115200
bootargs=noinitrd root=/dev/mtdblock4 rootfstype=yaffs2 rw console=ttySAC0,115200 init=/linuxrc
bootcmd=nand read 20000000 600000 500000 ; bootm 20000000
ethact=dm9000
ethaddr=00:40:5c:26:0a:5b
fileaddr=20000000
filesize=3EAB0
gaewayip=192.168.18.7
gatewayip=192.168.18.7
ipaddr=192.168.1.5
netmask=255.255.255.0
serverip=192.168.1.2
stderr=serial
stdin=serial
stdout=serial
3.烧写uboot到nand flash

首先确保tftp服务可用,,在ubuntu系统下安装tftp服务器,成功安装后,设置开发板uboot 环境变量ip,,我这里,ubuntu的ip号为192.168.1.3

所以我要设置uboot的serverip 为192.168.1.3

setenv serverip 192.168.1.3

网络设置完成后就可以开始用tftp下载文件了,,这时还要确保ubuntu系统下tftp服务的目录下有我们所需要的uboot.内核,文件系统等

[Smart210]# setenv serverip 192.168.1.3
[Smart210]# tftp 20000000 uboot.bin    
dm9000 i/o: 0x88001000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 00:40:5c:26:0a:5b
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.3; our IP address is 192.168.1.5
Filename 'uboot.bin'.
Load address: 0x20000000
Loading: T ###################################################
done
Bytes transferred = 256688 (3eab0 hex)
这里把tftp服务端的uboot.bin下载到了开发板ram地址为20000000处

然后准备从20000000地址的RAM处写到nand flash中,先擦除nand flash

nand  erase  0  50000

第一个参数0为地址,50000为大小
擦除完后写入

[Smart210]# nand erase 0 50000

NAND erase: device 0 offset 0x0, size 0x50000
offset = 800, writesize = 0 
Erasing at 0x40000 -- 100% complete.
OK
[Smart210]# nand write 20000000 0 50000

NAND write: device 0 offset 0x0, size 0x50000
Writing at 0x40000 -- 100% is complete. 327680 bytes written: OK
4.烧写内核到nand flash

烧写内核时不能随便烧,得看内核中nand flash的分区地址

我的内核分区为,一般友善的210板子好像都这么分的


0x0000000c0000-0x000000100000 : "misc"
0x000000100000-0x000000600000 : "recovery"
0x000000600000-0x000000b00000 : "kernel"
0x000000b00000-0x000000e00000 : "ramdisk"
0x000000e00000-0x000020000000 : "system"
 

看到内核的地址范围为0x000000600000-0x000000b00000 : "kernel"

然后tftp下载内核uImage到ram20000000,擦除nand flash 放内核的区域,写入nand flash

[Smart210]# tftp 20000000 uImage
[Smart210]# nand erase 600000 500000 
Smart210]# nand write 20000000 600000 500000

NAND write: device 0 offset 0x600000, size 0x500000
Writing at 0xae0000 -- 100% is complete. 5242880 bytes written: OK

5.烧写文件系统到nand flash

文件系统地址区域为0x000000e00000-0x000020000000 : "system"

tftp 20000000 rootfs.img

下载成功后看到    

################################
done
Bytes transferred = 333436224 (13dfd540 hex)
转化成16进制大小为0x13dfd540
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,</span>

先擦除nand flash 放文件系统的区

[Smart210]# nand erase e00000 1f200000
NAND erase: device 0 offset 0xe00000, size 0x1f200000
offset = 800, writesize = e00000 
Erasing at 0x1ffe0000 -- 100% complete.
OK
写文件系统到nand flash

 nand write.yaffs 20000000 e00000 13dfd540

最后一个参数为文件系统的实际大小,因为yaffs文件系统的存储有特殊格式,所以最后这个地址不能随便乱设,所以设为了文件系统的实际大小

,烧写过程时间比较长

[Smart210]# nand write.yaffs 20000000 e00000 13dfd540

NAND write: device 0 offset 0xe00000, size 0x13dfd540
Writing at 0x14240000 -- 100% is complete. 323332096 bytes written: OK
6.启动系统

查看uboot环境变量中的bootcmd

bootcmd=nand read 20000000 600000 500000 ; bootm 20000000
这个参数的意思是,系统启动时从600000地址处读取500000大小的文件到RAM20000000地址处,然后启动

,,,保存环境变量到nand flash

[Smart210]# save
Saving Environment to NAND...
Erasing Nand...
offset = 800, writesize = 100000 
Erasing at 0x100000 -- 100% complete.
Writing to Nand... done
关机,重启开发板,




评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值