arm 网络调试内核及文件系统(tftp下载内核,nfs挂载根文件系统)/x86下nfs挂载根文件系统

本文档介绍了如何在ARM和X86平台上通过NFS挂载根文件系统进行调试。主要内容包括在U-Boot中配置NFS参数,设置从TFTP下载内核,内核的NFS支持选项,以及X86环境下NFS挂载的实现方法。在X86环境下,只需修改GRUB配置文件即可实现NFS根文件系统的挂载。

参考资料 : http://www.cnblogs.com/cjjnjust/articles/1754849.html


一、uboot下的网络调试设置参数

1、配置nfs根文件系统参数

setenv bootargs "noinitrd console=ttySAC0,115200 mem=64M init=/linuxrc root=/dev/nfs rw nfsroot=192.168.0.104:/home/smb/uboot_kernel/rootfs_20150417 ip=192.168.0.110:192.168.0.104:192.168.0.1:255.255.255.0"


setenv bootargs "noinitrd console=ttySAC0,115200 mem=64M init=/linuxrc root=/dev/nfs rw nfsroot=192.168.0.104:/home/smb/uboot_kernel/rootfs_20150417,intr,nolock,proto=tcp,nfsvers=3 ip=192.168.0.110:192.168.0.104:192.168.0.1:255.255.255.0:root:eth0:off"

nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
nfsroot=192.168.0.101:/home/smb/uboot_kernel/rootfs_20150417,intr,nolock,proto=tcp,nfsvers=3

nfsaddrs =    <my-ip>   : <serv-ip>   :   <gw-ip> :  <netmask>  :<name>:<dev>:<auto>
  ip     = 192.168.0.240:192.168.1.200:192.168.1.1:255.255.255.0: xlpc : eth0: off


开启host nfs服务

配置NFS服务器
测试是否可用 : mount -t nfs -o nolock 192.168.0.104:/home/smb/uboot_kernel/rootfs_20150417 /mnt


2、配置从tftp下载内核

 setenv bootcmd 'tftp 0x30008000 uImage;bootm 0x30008000'

3、启动内核

run bootcmd


二、内核选项

    File systems  ---> 
        Network File Systems  ---> 
            <*> NFS file system support                        ## 必选
                [*]   Provide NFSv3 client support             ## 可选
            [*] Root file system on NFS                        ## 必选
    Networking  ---> 
        [*] Networking support 
            Networking options  ---> 
                [*]   IP: kernel level autoconfiguration       ## 必选


三、内核挂载nfs根文件系统代码流程

经过分析,内核挂载nfs根文件系统,不依赖于uboot下的网络配置,在内核启动过程中,内核会重新初始化网卡及网络配置,内核挂载nfs根文件系统只需要uboot下的向内核传递的nfs挂载根文件系统的相关参数

4、x86下nfs挂载根文件系统可行性分析

经上面的分析,内核挂载根文件系统,不依赖与uboot下的网络设置,因此,在X86环境下,也不需要BIOS/grub下相关网络能通。经验证,只需需改grub.cfg,即可达到x86下nfs挂载根文件系统的效果

menuentry 'x86 nfs debug'{
linuxefi /bzImage root=/dev/nfs rw nfsroot=10.5.33.253:/home/test/rootfs,intr,nolock,proto=tcp,nfsvers=3 ip=10.5.33.87:10.5.33.253:10.5.33.254:255.255.255.0:root:eth0:off console=ttyS0,115200n81


}





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值