1.构建交叉开发环境
工具链压缩包:fsl-linaro-toolchain.tar.gz
将压缩包进行解压
sudo mkdir –p /opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-mutilib-2011.12/
sudo tar xvf fsl-linaro-toolchain.tar.gz –C/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-mutilib-2011.12/
解压后,交叉编译工具链的位置为:
/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-mutilib-2011.12/fsl-linaro-toolchain
将交叉编译工具bin目录添加到系统PATH环境变量中
vim .bashrc
export PATH=$PATH: /opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-mutilib-2011.12/fsl-linaro-toolchain/bin

编写一个hello.c,放到虚拟机中,运行arm-none-linux-gnueabi-gcc hello.c –o hello编译
2.搭建NFS服务器
输入”su root”命令切换到root用户
输入”apt-get update”命令更新
输入”apt-get install nfs-kernel-server”命令安装Ubuntu NFS服务
安装过程会提示是否继续安装,选择是

用vi命令打开、etc/exports

最后一行添加/home/topeet/minLinux/ 192.168.1.136*(rw,sync,no_root_squash),如图,此处为要共享的目录,192.168.1.136为i.MX6开发板的IP,即允许开发板共享PC机的目录。

重启portmap服务,输入/etc/init.d/portmap restart命令

重启nfs服务,输入”/etc/init.d/nfs-kernel-server restart”命令

可以先挂载到本地目录,并使用df命令查看是否挂载成功

3.虚拟机设置
虚拟机的网络设置为“桥接模式”

完成之后在Ubuntu终端用”ifconfig”命令查看,如果未更新则重启Ubuntu。
之后进行虚拟机、PC、i.MX6板互ping,没有问题就可以进行下一步。
4.将i.MX6板通过网线与PC直连,设定IP使之与PC在同一网段,然后进行远程mount操作
“mount –t nfs 192.168.1.138:/home/topeet/minLinux /mnt/nfs –o nolock”
查看i.MX6板/mnt/nfs目录,此时就与虚拟机/home/topeet/minLinux目录共享了
把编译好的hello程序复制到虚拟机/home/topeet/minLinux目录下,刷新i.MX6板/mnt/nfs目录,就可找到hello程序,输入”./hello”即可运行。