当前位置:文档之家› 建立嵌入式linux开发环境实验

建立嵌入式linux开发环境实验

嵌入式linux开发环境的建立
一、创建文件:vi hello.c如下:
二、安装交叉编译器:
arm-linux-gcc-3.4.6-glibc-2.3.6.tar 步骤1、把交叉编译链考贝到任意目录下,并解压:tar zxvf
arm-linux-gcc-3.4.6-glibc-2.3.6.tar –C /
2、把以上路径添加到/etc/profile文件的最后:export
PATH=$PATH:/gcc-3.4.6-glibc-2.3.6/arm-linux/bin
3、输入命令使环境变量立即生效:source /tec/profile
4、测试是否安装成功:arm-linux-gcc–v 如果显示版本号,则安装成功。

5、编译C文件:arm-linux-gcc hello.c–o hello
三、配置tftp服务步骤
1、检查系统有无安装包:用命令:rpm –aq | grep tftp,如有安装包的版本号,说明系统已有相应的安装包;
2、配置服务器,打开文件:vi /etc/xinetd.d/tftp,显示如下桌面service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = yes
}
然后编辑将disable改为no,其他不变
3、重启xinetd服务:service xinetd restart,
停止 xinetd: [ 确定 ]
启动 xinetd: [ 确定 ]
4、输入如下命令:netstat –a | grep tftp,如果出现如下画面
“udp 0 0 *:tftp *:*”则说明tftp服务已经正常运行(输入命令chkconfig --list也能在列表中看到tftp启动字样)。

接下来建立默认的tftp根目录,要跟上面的server_args的路径一样,这里是/tftpboot:
[root@localhost /]# mkdir tftpboot
[root@localhost /]# /etc/rc.d/init.d/xinetd restart(或service xinetd restart)
停止 xinetd: [ 确定 ]
启动 xinetd: [ 确定 ]
[root@localhost /]#
5、把hello拷贝到/tftpboot下
6、用以下命令tftp –r hello –g 192.168.1.12下载IP为192.168.1.12的虚拟机的/tftpboot/目录下的hello文件到实验箱当前目录。

7、在开发板上运行./hello
四、配置NFS
步骤:1、检查有无安装包:rpm –qa | grep nfs_utils,如显示版本号,说明系统已下载了安装包。

2、nfs配置:打开文件vi /etc/exports并在文件中添加/home 192.168.1.*(rw,sync,no_root_squash)
其中/home允许其他计算机访问的目录,192.168.1.*被允许访问该目录的客户端IP地址,rw表示可读可写,sync同步写磁盘(async,表示资料会先暂存于内存当中而非直接写入硬盘),no_root_squash 表示客户端root用户对该目录具备写权限。

3、启动nfs:/etc/init.d/nfs start(重启/etc/initd/nfs restart)或者service nfs start(重启service nfs restart)
4、把hello拷贝到/arm2410cl下
5、挂载:mount –o
nolock,rsize=4096,wsize=4096 192.168.1.12:/arm2410cl /mnt/nfs 如果挂载不上,先在宿主机端执行route del default
6、在开发板上运行:./hello
五、配置smba服务
1、检查有无安装包:rpm –qa | grep samba,如显示版本号,说明系统已下载了安装包。

2、配置(匿名)
Vi /etc/samba/smb.cof
[global]
Security = share(不需密码)
Passdb bachend = tdbsam
[share]
comment = aa备注(可以任何字符)
writable = yes
browseable = yes
available = yes
path = /home/share
public = yes
3、chmod 777 share
4、重启service smb start(使设置生效)
5、关闭防火墙:vi /etc/selinux/config
SELINUY = disabled(重启,使之生效)
6、重启linux系统。

7、设置虚拟机与PC机的IP地址为同一网段。

并ping通。

在PC机端运行\\192.168.1.12进行共享。

8、(非匿名)
Vi /etc/samba/smb.cof
[global]
Security = users
Passdb bachend = tdbsam
[share]
comment = aa备注(可以任何字符) writable = yes
browseable = yes
available = yes
path = /home/share
valid = users = 用户名
3、添加samba密码
Smbpasswd –a 用户名
3、chmod 777 share
4、重启service smb start(使设置生效)
5、关闭防火墙:vi /etc/selinux/config
SELINUY = disabled(重启,使之生效)
6、重启linux系统。

7、设置虚拟机与PC机的IP地址为同一网段。

并ping通。

在PC机端运行\\192.168.1.12并输入用户名及密码进行共享。

相关主题