您的位置:首页 > 其它

E9 搭建 NFS 环境并从 NFS 启动开发板

2014-09-30 11:44 288 查看
从 NFS 启动有很多优点,如果 kernel 部分做了修改,在 BSP 代码中修改编译出 uImage,直接从 NFS 就可以 Download,不用像使用 mfgtool 那样要首先将编译好的 images 再拷贝到 mfgtool 目录下并,重新烧写 u-boot,uImage 和文件系统。除此之外,在目标板上还可以直接读取使用 host 机上的文件和内容。总之,使用 NFS 会节省很多时间,并且也很方便。所以这里就来给大家介绍一下如何从 NFS 启动E9 的LINUX系统,Android系统的方法类似,只需要解压官方给的文件系统替换LINUX的文件系统就OK了。 

 

一、准备工作 

(1)编译 BSP 

在 Ubuntu12.04 上使用编译 出来 u-boot,uImage 。这里需要编译 uImage 从 NFS 启动,具体操作步骤参照本文档 Setting Target Linux Image to use NFS 中的步骤。 

(2)烧写 u-boot 到开发板上 

使用 mfgtool  Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER 将编译好的 u-boot 烧写到MCIMX6Q-SDP 上。

 

二、搭建 NFS 环境 

 

设置主机      

1 在你的ubuntu系统安装nfs服务:

         

 

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

2 make a tftp directory Here we make /opt/tftpboot be a tftp directory. 
# mkdir /opt/tftpboot

# chmod 777 /opt/tftpboot 

 Open /etc/inetd.conf and edit it 

# gedit /etc/inetd.conf 

Add this line: 

tftp    dgram        udp        wait        nobody        /usr/sbin/tcpd /usr/sbin/in.tftpd      /opt/tftpboot   

3- 穿件你的nfs 路径: 

        

$sudo mkdir   /tftpboot/rootfs      //目录随便根据需要修改,但要与exports中保持一致。

          

4 设置exports: 

        

$sudo gedit /etc/exports  

          

增加如下目录: 

        
/tftpboot/rootfs/ *(rw,no_root_squash,no_subtree_check,async)  

重启nfs服务:

#/etc/init.d/nfs-kernel-server start

三、设置 u-boot command  

 

1、将 u-boot 烧写到板子上,根据本文档中部分一、准备工作(2)烧写 u-boot 到开发板上。

然后给板子上电,进入 u-boot。 

2、设置网络 

设置网络 IP,使得 target board 和 host 在路由器的网段中。 

#####    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)

192.168.1.66  //你host的IP

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

192.168.1.52 //板子的IP

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

12:32:43:34:21:43

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

/opt/EmbedSky/root_nfs //此处路径为你的文件系统的路径,根据实际修改 

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.xxx)

192.168.1.66

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

192.168.1.101

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

192.168.1.2

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

3 修改文件系统:

修改解压出来的文件系统的/etc/rcS文件,注销掉里面的net_set二进制文件的执行。

#set_set

4.拷贝编译 出的uImage到/tftpboot/rootfs  

四、从 NFS 启动开发板 

在配置好 u-boot 中的参数后,启动开发板 运行 run bootcmd。 可以看到,通过 NFS 下载 uImage 并启动 kernel 和文件系统: 

然后按“q”退出;

##### 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: q

开始启动系统:

#####    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 ...

Uncompressing Linux... done, booting the kernel.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  E9 imx6 nfs
相关文章推荐