本文主要是介绍用uboot烧写内核到smart210,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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 Smart210CPU: S5PC110@1000MHzBoard: Smart210
DRAM: 512 MiB
WARNING: Caches not enabledPWM Moudle Initialized.
NAND: 512 MiB
MMC: SAMSUNG SD/MMC: 0, SAMSUNG SD/MMC: 1
In: serial
Out: serial
Err: serial
Net: dm9000Hit 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
第一个参数0为地址,50000为大小
擦除完后写入
[Smart210]# nand erase 0 50000NAND erase: device 0 offset 0x0, size 0x50000
offset = 800, writesize = 0
Erasing at 0x40000 -- 100% complete.
OK
[Smart210]# nand write 20000000 0 50000NAND 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 500000NAND 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 13dfd540NAND 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
关机,重启开发板,
这篇关于用uboot烧写内核到smart210的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!