ILD

openwrt启用nfs尝试
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2019-11-4 站点:Inside Linux Development

setenv bootargs "root=/dev/nfs nfsroot=192.168.0.100:/work/openwrt/rootfs,vers=3 ip=192.168.0.101:::255.255.255.0::eth1 nfsrootdebug"
setenv bootcmd "tftp 84000000 openwrt-ipq40xx-qcom_ap-dk01.1-c1-fit-uImage.itb && bootm 84000000"

首先开启NFS客户端
<*>   NFS client support
< >     NFS client support for NFS version 2
<*>     NFS client support for NFS version 3
[ ]       NFS client support for the NFSv3 ACL protocol extension
< >     NFS client support for NFS version 4
[ ]     Provide swap over NFS support

然后开启rootfs nfs,需要开启IP_PNP,才能开启ROOT_NFS
CONFIG_IP_PNP
[*]   IP: kernel level autoconfiguration

CONFIG_ROOT_NFS
[*]   Root file system on NFS


注意使用make kernel_menuconfig开启CONFIG_ROOT_NFS后,还不行,openwrt会把它删除,还需要在make menuconfig中开启:

Global build settings → Kernel build options

[*] Compile the kernel with rootfs on NFS

能正常启动,但是启动到netifd时,ip变了,导致nfs断掉:

[    1.354496] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[    3.442784] ess_edma c080000.edma: eth1: GMAC Link is up with phy_speed=1000
[    3.451735] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[    3.482195] IP-Config: Complete:
[    3.482482]      device=eth1, hwaddr=92:98:36:73:3b:10, ipaddr=192.168.0.101, mask=255.255.255.0, gw=255.255.255.255
[    3.484736]      host=192.168.0.101, domain=, nis-domain=(none)
[    3.495546]      bootserver=255.255.255.255, rootserver=192.�[    3.508556] root_dev 255
[    3.508782] Root-NFS: nfsroot=/work/openwrt/rootfs,vers=3
[    3.512046] NFS: nfs mount opts='vers=2,udp,rsize=4096,wsize=4096,vers=3,nolock,addr=192.168.0.100'
[    3.515559] NFS:   parsing nfs mount option 'vers=2'
[    3.524460] NFS:   parsing nfs mount option 'udp'
[    3.529616] NFS:   parsing nfs mount option 'rsize=4096'
[    3.534245] NFS:   parsing nfs mount option 'wsize=4096'
[    3.539603] NFS:   parsing nfs mount option 'vers=3'
[    3.544912] NFS:   parsing nfs mount option 'nolock'
[    3.549843] NFS:   parsing nfs mount option 'addr=192.168.0.100'
[    3.554817] NFS: MNTPATH: '/work/openwrt/rootfs'
[    3.560783] NFS: sending MNT request for 192.168.0.100:/work/openwrt/rootfs
[    3.581350] NFS: received 1 auth flavors
[    3.581379] NFS:   auth flavor[0]: 1
[    3.584448] NFS: MNT request succeeded
[    3.587897] NFS: attempting to use auth flavor 1
[    3.612507] VFS: Mounted root (nfs filesystem) readonly on device 0:10.
[    3.614096] Freeing unused kernel memory: 1024K
[    3.714884] init: Console is alive


Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.