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

来源:互联网 发布:淘宝商家和快递合作 编辑:程序博客网 时间:2024/06/11 19:32
搭建NFS环境并从NFS启动开发板
    编译好ltib后,就可以从中获得我们所需的u-boot、kernel、文件系统了,我们可以把这三部分内容下载(通过freescale提供的Mfgtools工具)到开发板系统就可以跑起来。但是,调试时我们需要频繁的修改内核配置,每次都用这个工具下载就太麻烦,而使用NFS就可以避免这个问题,大大提高开发效率。下面是在Ubuntu12.04 LTS下搭建NFS调试环境的步骤。

1 Ubuntu主机环境设置
    
1.1 安装tftp服务
 (1)Setup tftp server files
apt-get install tftpd tftp openbsd-inetd

(2)Make a tftp directory here(Ex: make /tftpboot as tftp directory )  
mkdir /tftpbootchmod 777 /tftpboot

(3)Open  /etc/inetd.conf  and edit
gedit /etc/inetd.conf 
and add belows:
tftp    dgram        udp        wait        nobody        /usr/sbin/tcpd /usr/sbin/in.tftpd      /tftpboot 

(4)Restart tftp service
sudo /etc/init.d/openbsd-inetd restart 

  1.2 NFS配置
    (1)Install NFS service on host
sudo apt-get install nfs-kernel-server

(2)Create symbolic link to ltib/rootfs
sudo ln -s <ltib instalation folder>/rootfs /tftpboot/rootfs
(3)Setup export:
sudo gedit /etc/exports

 and add as belows:
/tftpboot/rootfs/ *(rw,no_root_squash,no_subtree_check,async)

(4)Restart the NFS server

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


2 Setting Target Linux Image to use NFS
   2.1 配置ltib选项
./ltib -m config

 (1)On first page menu, go to "Target Image Generation -> Options" ,Select the option NFS only and choose linux kernel version、u-boot then exit LTIB configuration to compile with the new configuration.
     (2)LTIB should start new compiling and create a new Linux image on <ltib folder>/rootfs/boot/uImage 
     (3) Copy the created image on <ltib folder>/rootfs/boot/uImage to /tftpboot/uImage

另外,u-boot环境变量也需做相应的配置,下面附上我的u-boot环境变量值做参考:

MX6Solo SABRESD U-Boot > printbootdelay=3baudrate=115200ipaddr=192.168.6.103        //开发板的ipserverip=192.168.6.34        //服务器ipnetmask=255.255.255.0loadaddr=0x10800000rd_loadaddr=(0x10800000 + 0x300000)netdev=eth0ethprime=FEC0uboot=u-boot.binkernel=uImageethaddr=00:0C:0C:A0:02:6Anfsroot=/tftpboot/rootfs          //文件系统bootargs_base=setenv bootargs console=ttymxc0,115200 nosmpbootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcpbootcmd_net=run bootargs_base bootargs_nfs; tftpboot ${loadaddr} ${kernel}; bootmbootargs_mmc=setenv bootargs ${bootargs} ip=dhcp root=/dev/mmcblk0p1 rootwaitbootcmd_mmc=run bootargs_base bootargs_mmc; mmc dev 3; mmc read ${loadaddr} 0x800 0x2000; bootmethact=FEC0bootcmd=run bootcmd_netstdin=serialstdout=serialstderr=serial          //成功的启动参数

以上为nfs开发环境的搭建步骤.


0 0
原创粉丝点击