搭建嵌入式开发环境
一.把boootloader写到SD卡
1、把SD卡插入PC机
2、fdisk -l查看SD卡对应的设备文件
3、卸载SD卡
4、./<path>/write_sd /dev/sdb <path>u-boot-movi.bin
5、把SD卡插入开发板,并切换为SD卡启动方式,上电
二、配置minicom
1、minicom -s
ttyS0 ttyUSB0
115200 8N1
2、退出
ctrl a q
三、uboot命令
1、printenv 查看环境变量
2、setenv 设置环境变量
3、saveenv 保存环境变量
四、配置tftp服务器
1、vim /etc/xinetd.d/tftp
disable = no
2、service xinetd restart
3、关闭防火墙 selinux
4、测试
[u-boot-sd]# tftp 50008000 zImage
[u-boot-sd]# bootm 50008000
此时会出现kernel panic的错误,原因是没有根
五、创建根文件系统nfs
1.[root]# mkdir -p /nfsroot/20121210
2.[root]# chmod 777 /nfsroot/20121210
3.[root]# tar ~/smdk6410_lzy/rootfs/rootfs.tar -C /nfsroot/20121210
4.告诉开发板根在网络上
打开minicom的自动换行功能:
ctrl a w
[u-boot-sd]# set bootargs root=/dev/nfs
nfsroot=192.168.1.254:/nfsroot/20121210 ip=192.168.1.20 console=ttySAC0,115200
[u-boot-sd]# saveenv
[root]# vim /etc/exports
/nfsroot/20121210 *(rw,sync,no_root_squash)
[root]# service nfs restart
5.测试
[u-boot-sd]# tftp 50008000 zImage
[u-boot-sd]# bootm 50008000
如果启动成功,minicom中会出现shell,LCD上会出现图形界面
六、校正触摸屏
[root@uplooking]# rm /etc/pointercal
[root@uplooking]# reboot
[u-boot-sd]# tftp 50008000 zImage
[u-boot-sd]# bootm 5008000
此时就会出现校正界面
作业:
根
1、把uboot烧写到nand
[u-boot-sd]# nand erase
[u-boot-sd]# nand scrub / y
[u-boot-sd]# tftp 50000000 u-boot-nand.bin
内存地址:0x50000000-0x58000000
[u-boot-sd]# nand write 50000000 0 40000
0x00000000-0x00040000 : "Bootloader"
0x00040000-0x00400000 : "Kernel"
0x00400000-0x05400000 : "Rootfs"
0x05400000-0x10000000 : "File System"
关掉电源,切换为nand启动,上电
如果启动成功shell:[u-boot-nand]#
启动后会出现ECC校验错误,解决方法如下:
[u-boot-nand]# set serverip 192.168.1.254
[u-boot-nand]# tftp 50000000 u-boot-nand.bin
[u-boot-nand]# nand erase 0 40000
[u-boot-nand]# nand write 50000000 0 40000
[u-boot-nand]# reset
二、把kernel烧写到nand
[u-boot-nand]# set serverip 192.168.1.254
[u-boot-nand]# saveenv
[u-boot-nand]# tftp 50000000 zImage
[u-boot-nand]# nand erase 40000 300000
[u-boot-nand]# nand write 50000000 40000 300000
测试:
[u-boot-nand]# nand read 50008000 40000 300000
[u-boot-nand]# bootm 50008000
三、把根烧写到nand
挂网络文件系统
[root]# service nfs restart
[u-boot-nand]# set bootargs root=/dev/nfs
nfsroot=192.168.1.254:/nfsroot/20121210 ip=192.168.1.20 console=ttySAC0,115200
[u-boot-nand]# saveenv
[u-boot-nand]# nand read 50008000 40000 300000
[u-boot-nand]# bootm 50008000
启动后如下:
[root@uplooking]#
[root@uplooking]# ls /dev/mtd*
mtdblock0 1 2 3
[root@uplooking]# mount /dev/mtdblock2 /mnt
[root@uplooking]# ls /mnt
lost-found
[root]# cp ~/smdk6410_lzy/rootfs/rootfs.tar /nfsroot/20121210
[root@uplooking]# tar -xvf rootfs.tar -C /mnt
[root@uplooking]# sync
[root@uplooking]# umount /mnt
[root@uplooking]# reboot
[u-boot-nand]# set bootargs root=/dev/mtdblock2 console=ttySAC0,115200
[u-boot-nand]# saveenv
[u-boot-nand]# nand read 50008000 40000 300000
[u-boot-nand]# bootm 50008000
四、设置自动启动
[u-boot-nand]# set bootcmd "nand read 5000800 40000 300000;bootm 50008000"
[u-boot-nand]# saveenv
[u-boot-nand]# reset
作业:
1.总结文档
2.在LCD上画一个正方形mmap
3.参考文档把内核和根文件系统放入SD卡启动
4.参考文档自己做文件系统
原文:http://www.cnblogs.com/cainiaoaixuexi/p/3859698.html