[Miscellaneous] JZ2440 mounts NFS network file system

1. Ping the virtual machine, PC, and development board

This time, the PC uses a wireless network card to connect to WIFI for Internet access, and then the PC uses a wired network card to connect to the JZ2440 network port through a network cable. The next step is to make the PC, JZ2440, and virtual machine networks on the same network.

Host: 192.168.1.10
Virtual machine: 192.168.1.108
Development board: 192.168.1.17

1.1 Computer network cable configuration

After connecting the network cable, configure the port number of the network cable. The specific process is as follows:
turn upFind the port of your network cable and set the port number through the properties.

Insert image description here
Insert image description here
Here the network IP address, subnet mask, and gateway are set.

1.2 Configure the virtual machine’s network

Open the virtual network editor, select bridge mode, and connect the PC's wired network card.
Insert image description here
Set the IP address of the virtual machine as follows.
Insert image description here
If the local ping of the computer fails, it means that the local firewall is turned on. Just turn it off. Try
Insert image description here
to ping three networks with each other to see if they can ping successfully. If they can ping successfully, it proves that the adaptation has been completed.

2. Configure the development board to automatically start NFS

Turn on the development board. In the u-boot interface, you can see that the set cmd
Insert image description here
needs to be changed to mount network NFS startup. Set the following command

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

The author's settings are as follows:

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

After the setting is completed, save it. After restarting as follows, NFS will be automatically mounted every time you boot.
Insert image description here

Encountered a problem:
After setting the bridge mode on the virtual machine, restart the virtual machine and the virtual machine cannot access the Internet. You need to reset the bridge network settings automatically (it may be caused by the bridged network cable directly connecting to the development board)

Guess you like

Origin blog.csdn.net/weixin_45281868/article/details/126294407