WIN11系统使用JZ2440挂载NFS
1.虚拟机、PC机、开发板ping通
本次PC电脑是用无线网卡连接WIFI上网,然后PC电脑利用有线网卡通过一条网线与JZ2440网口相连,然后接下来的工作是使PC电脑、JZ2440和虚拟机的网络处于同一段网络。
主机:192.168.1.10
虚拟机:192.168.1.108
开发板:192.168.1.17
1.1电脑网线配置
链接好网线之后配置网线的端口号,具体过程如下:
找到自己网线的端口,通过属性设置端口号
在这里就设置好了网络的IP地址、子网掩码、和网关。
1.2配置虚拟机的网络
打开虚拟网络编辑器,选择桥接模式,连接PC机的有线网卡。
设置虚拟机IP地址,如下
若电脑本地的ping不通是本地开了防火墙,关闭就好
尝试互相ping三个网络,是否能够ping通,若能ping通证明已经适配完成
2.配置开发板自启动NFS
开启开发板,在u-boot界面,可以看到设置的cmd
在这里需要更改成挂载网络NFS启动,设置如下命令
nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
If the `nfsroot' parameter is NOT given on the command line,
the default "/tftpboot/%s" will be used.
<server-ip> Specifies the IP address of the NFS server.
The default address is determined by the `ip' parameter
(see below). This parameter allows the use of different
servers for IP autoconfiguration and NFS.
<root-dir> Name of the directory on the server to mount as root.
If there is a "%s" token in the string, it will be
replaced by the ASCII-representation of the client's
IP address.
<nfs-options> Standard NFS options. All options are separated by commas.
The following defaults are used:
port = as given by server portmap daemon
rsize = 4096
wsize = 4096
timeo = 7
retrans = 3
acregmin = 3
acregmax = 60
acdirmin = 30
acdirmax = 60
flags = hard, nointr, noposix, cto, ac
ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
This parameter tells the kernel how to configure IP addresses of devices
and also how to set up the IP routing table. It was originally called
`nfsaddrs', but now the boot-time IP configuration works independently of
NFS, so it was renamed to `ip' and the old name remained as an alias for
compatibility reasons.
If this parameter is missing from the kernel command line, all fields are
assumed to be empty, and the defaults mentioned below apply. In general
this means that the kernel tries to configure everything using
autoconfiguration.
The <autoconf> parameter can appear alone as the value to the `ip'
parameter (without all the ':' characters before) in which case auto-
configuration is used.
<client-ip> IP address of the client.
Default: Determined using autoconfiguration.
<server-ip> IP address of the NFS server. If RARP is used to determine
the client address and this parameter is NOT empty only
replies from the specified server are accepted.
Only required for for NFS root. That is autoconfiguration
will not be triggered if it is missing and NFS root is not
in operation.
Default: Determined using autoconfiguration.
The address of the autoconfiguration server is used.
<gw-ip> IP address of a gateway if the server is on a different subnet.
Default: Determined using autoconfiguration.
<netmask> Netmask for local network interface. If unspecified
the netmask is derived from the client IP address assuming
classful addressing.
Default: Determined using autoconfiguration.
<hostname> Name of the client. May be supplied by autoconfiguration,
but its absence will not trigger autoconfiguration.
Default: Client IP address is used in ASCII notation.
<device> Name of network device to use.
Default: If the host only has one device, it is used.
Otherwise the device is determined using
autoconfiguration. This is done by sending
autoconfiguration requests out of all devices,
and using the device that received the first reply.
<autoconf> Method to use for autoconfiguration. In the case of options
which specify multiple autoconfiguration protocols,
requests are sent using all protocols, and the first one
to reply is used.
Only autoconfiguration protocols that have been compiled
into the kernel will be used, regardless of the value of
this option.
off or none: don't use autoconfiguration (default)
on or any: use any protocol available in the kernel
dhcp: use DHCP
bootp: use BOOTP
rarp: use RARP
both: use both BOOTP and RARP but not DHCP
(old option kept for backwards compatibility)
Default: any
笔者设置如下:
set bootargs noinitrd root=/dev/nfs nfsroot=192.168.1.108:/work/nfs_root/first_fs ip=192.168.1.17:192.168.1.108:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0,115200
设置完成之后save,如下重启以后每次开机都会自动挂载NFS
遇到问题:
虚拟机设置桥接模式之后,重启虚拟机虚拟机不能上网,需要重新设置桥接网络设置自动(可能是桥接的网线直接链接开发板导致的)