(小白嵌入式)基于S5pv210的arm初级驱动开发之环境安装(一)

一.安装环境需要准备的资源:
linux-3.0.8.tar.bz2 liunx内核代码
rootfs_fs210.tgz 文件系统
toolchain-4.5.1-farsight.tar.bz2 交叉编译工具
zImage308 内核镜像
还需要在Ubuntu上配置好Samba、nfs、tftp服务。

二.安装步骤
1)将linux内核镜像zImage308拷贝到 /tftpboot
2)将根文件系统rootfs_fs210.tgz拷贝到 /opt ,并解压 sudo tar -xvf rootfs_fs210.tgz
3)配置nfs:
1》打开配置文件
sudo vim /etc/exports
2》在文件的末尾添加下面一行:
/opt/rootfs *(subtree_check,rw,no_root_squash,async)
3》重启nfs服务
sudo /etc/init.d/nfs-kernel-server restart
sudo exportfs -a
//-a 全部mount或umount文件/etc/exports中的内容
4)配置uboot参数:(在开发板中进行,使用putty串口登录开发板)
重启开发板:
FS210 # set ipaddr 192.168.7.7 //设置开发板IP----uboot
FS210 # set gatewayip 192.168.7.1
FS210 # set netmask 255.255.255.0
FS210 # set serverip 192.168.7.5 //设置服务器IP-----ubuntu
FS210 # set bootcmd tftp 0x40008000 zImage308 ; bootm 0x40008000
解释:
tftp 0x40008000 zImage308 //让tftp从ubuntu中下载内核镜像:zImage308 存放到开发板的内存:0x40008000
bootm 0x40008000 //从0x40008000执行内核的镜像文件
FS210 # set bootargs root=/dev/nfs nfsroot=192.168.7.5:/opt/rootfs init=/linuxrc console=ttySAC0,115200 ip=192.168.7.7
解释:
root=/dev/nfs nfsroot=192.168.7.5:/opt/rootfs //让内核挂载IP为192.168.7.5的主机上的网络文件系统
init=/linuxrc ///让内核执行祖先进程
console=ttySAC0,115200 //设置串口
ip=192.168.7.7 //给开发板的linux系统设置IP
FS210 # sa //保存设置
Saving Environment to SMDK bootable device…
Erasing Nand…
Writing to Nand…
Saved enviroment variables
5)重启开发板,结果如下:
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
dm9000 dm9000: eth0: link down
IP-Config: Guessing netmask 255.255.255.0
dm9000 dm9000: eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
IP-Config: Complete:
device=eth0, addr=192.168.7.7, mask=255.255.255.0, gw=255.255.255.255,
host=192.168.7.7, domain=, nis-domain=(none),
bootserver=255.255.255.255, rootserver=192.168.7.5, rootpath=
VFS: Mounted root (nfs filesystem) on device 0:11.
Freeing init memory: 136K
=_ fs start
=@_@ fs end
//出现笑脸表示配置成功
Please press Enter to activate this console.
[root@farsight /]# ls
bin etc lib opt sbin usr
dev hello_arm linuxrc proc sys
drv_module home mnt root tmp
[root@farsight /]#
6)配置交叉编译器
1》将交叉编译器(toolchain-4.5.1-farsight.tar.bz2)拷贝到: /opt ,并解压
tar -xvf toolchain-4.5.1-farsight.tar.bz2

				2》配置交叉编译器
					1) 打开配置文件:
						 sudo vim /etc/environment
						 
					2) 添加:/opt/toolchain-4.5.1-farsight/bin  到path中
						PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/toolchain-4.5.1-farsight/bin"
						
					3) 使之生效
						source /etc/environment

		7)测试:
				1》编写一个c程序: hello.c
					#include <stdio.h>
			
					int main(void)
					{
						printf("hello farsight!\n");
						return 0;
					}
			
				2》交叉编译:hello.c 
					arm-none-linux-gnueabi-gcc -o hello hello.c
					
				3》将编译生成的可执行文件,拷贝到开发板中运行:
					 cp hello /opt/rootfs
					 
				4》在开发板中运行:
					[root@farsight /]# ./hello
					hello farsight!
					[root@farsight /]#
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值