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

搭建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 /tftpboot
chmod 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 /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  /rootfs/boot/uImage 
     (3)   Copy the created image on /rootfs/boot/uImage to /tftpboot/uImage

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

MX6Solo SABRESD U-Boot > print
bootdelay=3
baudrate=115200
ipaddr=192.168.6.103        //开发板的ip
serverip=192.168.6.34        //服务器ip
netmask=255.255.255.0
loadaddr=0x10800000
rd_loadaddr=(0x10800000 + 0x300000)
netdev=eth0
ethprime=FEC0
uboot=u-boot.bin
kernel=uImage
ethaddr=00:0C:0C:A0:02:6A
nfsroot=/tftpboot/rootfs          //文件系统
bootargs_base=setenv bootargs console=ttymxc0,115200 nosmp
bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
bootcmd_net=run bootargs_base bootargs_nfs; tftpboot ${loadaddr} ${kernel}; bootm
bootargs_mmc=setenv bootargs ${bootargs} ip=dhcp root=/dev/mmcblk0p1 rootwait
bootcmd_mmc=run bootargs_base bootargs_mmc; mmc dev 3; mmc read ${loadaddr} 0x800 0x2000; bootm
ethact=FEC0
bootcmd=run bootcmd_net
stdin=serial
stdout=serial
stderr=serial          //成功的启动参数

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


你可能感兴趣的:(Linux/android驱动)