您的位置:首页 > 运维架构 > Linux

天嵌E9卡片i.mx6q-Linux12.04搭建nfs环境以及从nfs启动开发板

2015-11-26 17:11 302 查看
最近导师丢了一个图像处理的项目,要用嵌入式来实现。于是买了一块天嵌近期推出的E9卡片i.mx6q板子,这款板子算是功能比较全面,基本上要用的驱动都给实现了。刚开始接触嵌入式,之前也没用过Linux系统,一开始入手真是各种不懂。一开始调程序都是在pc机上调好然后在用U盘拷到板子上运行。这样太麻烦了,而且效率太低,真是费力不讨好。于是在网上看了很多nfs环境搭建以及使用nfs启动开发板的资料,折腾了一段时间后终于实现了E9文件系统的挂载,以及通过nfs启动开发板!在这里把自己的操作过程以及理解写下来供有兴趣的同行参考,本人新手,有说的不够正确的地方欢迎各位指正!

准备工作:

安装相关软件工具

$sudo apt-get install nfs-kernel-server tftpd tftp openbsd-inetd

一、tftp环境搭建(ubuntu12.04)

1.创建tftpboot文件夹(该文件夹是用来存放uImage文件的)

# mkdir /opt/tftpboot (我的是用的这个目录,可自选目录)

# chmod 777 /opt/tftpboot

2.打开inetd.conf 文件添加以下内容(#gedit /etc/inetd.conf)

在这个文件最后面添加内容:tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /opt/tftpboot

3.重启tftp服务更新设置

$ /etc/init.d/openbsd-inetd restart

$ in.tftpd -l /opt/tftpboot

二、nfs环境搭建(ubuntu12.04)

1.创建文件夹

$ mkdir /opt/rootfs (我的是这个目录,可自选,这个目录就是挂在E9文件系统的目录,挂载成功后可在E9板子上看到这个目录)

$ chmod 777 /opt/rootfs

2.设置nfs配置文件

$ gedit /etc/exports

在文件后面添加如下内容:

/opt/rootfs *(subtree_check,rw,no_root_squash,async)

3.重启服务使设置生效

$ /etc/init.d/nfs-kernel-server restart

三、手动拷贝一些必要的相关文件

1.把你需要的E9系统(我的是Linux+Qt)的文件系统(rootfsfs.tgz)解压在 /opt/rootfs 目录下

2.修改解压后的文件系统

$ gedit /opt/rootfs/etc/init.d/rcS

打开这个文件后:找到这一行:net_set & (把这一行注销掉)

在前面加个#:

#net_set &

3.拷贝你需要的E9系统的uImage文件到 /opt/tftpboot

四、开发板E9设置

1.启动开发板敲击键盘空格键进入uboot菜单

2、设置网络

设置网络 IP,使得 E9板子 和 PC机 在同一个网段中 (要保证PC机和E9能够互相拼通)

##### Boot for IMX6 Main Menu #####

[1]boot from emmc

[2]boot from sdcard

[3]boot from tftp

[5]download from sdcard

[0]setting boot args

[q]exit to command mode

Enter your selection: 0

##### param setting #####

[1]setting nfs args

[2]setting tftp args

[3]setting display args

[4]setting default boot

[s]save setting

[q]quit

Enter your selection: 1

--------setting nfs args--------

Enter the PC IP address:(xxx.xxx.xxx.xxx)

172.31.101.36 //你的PC机的IP地址(这是我的pc机的ip地址)

Enter the IMX6 IP address:(xxx.xxx.xxx.xxx)

172.31.101.88 //E9板子的IP地址

Enter the IMX6 MAC address:(xx:xx:xx:xx:xx:xx)

10:23:45:67:89AB // 这是我的E9板子的物理地址(使用命令ifconfig 看一下,按实际填写)

Enter NFS directory:(eg: /opt/EmbedSky/root_nfs)

/opt/rootfs //此处为要挂载文件系统的路径,根据实际修改

save setting ? (y/n) :

y

Saving Environment to MMC...

Writing to MMC(3)... done

##### param setting #####

[1]setting nfs args

[2]setting tftp args

[3]setting display args

[4]setting default boot

[s]save setting

[q]quit

Enter your selection: 2

--------setting tftp args--------

Enter the TFTP Server(PC) IP address:(xxx.xxx.xxx.xx

172.31.101.36

Enter the IMX6 IP address:(xxx.xxx.xxx.xxx)

172.31.101.88

Enter the GateWay IP:(xxx.xxx.xxx.xxx)

172.31.101.33 (这是网关,ifconfig看一下你的网关是啥,按实际情况填写)

Enter the bootloader (u-boot or bootimage) image name:

u-boot.bin

Enter the LOGO image name:

Enter the kernel image name:

uImage

Enter the root image name:

save setting ? (y/n) :

y

Saving Environment to MMC...

Writing to MMC(3)... done

配置完成

开始启动系统:

##### Boot for IMX6 Main Menu #####

[1]boot from emmc

[2]boot from sdcard

[3]boot from tftp

[5]download from sdcard

[0]setting boot args

[q]exit to command mode

Enter your selection: 3

PHY indentify @ 0x0 = 0x004dd072

FEC: Link is Up 796d

Using FEC0 device

TFTP from server 192.168.1.66; our IP address is 192.168.1.101

Filename 'uImage'.

Load address: 0x10800000

Loading: #################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

################

done

Bytes transferred = 5070264 (4d5db8 hex)

## Booting kernel from Legacy Image at 10800000 ...

Image Name: Linux-3.0.35

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 5070200 Bytes = 4.8 MB

Load Address: 10008000

Entry Point: 10008000

Verifying Checksum ... OK

Loading Kernel Image ... OK

OK

Starting kernel ...

如果看到这些信息,恭喜你,成功啦!!!!

备注:参考博文链接

1.http://blog.csdn.net/bzw073/article/details/39693993

2.http://blog.csdn.net/zengzhihao/article/details/48575939
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: