These days I got a 9200 new board, board and PC Direct connection, mount NFS root file system OK, when using router (D-link), NFS root file system hook is always a problem:
Nfs:server 192.168.0.114 Not responding Nfs:server 192.168.0.114 not responding Nfs:server OK is always connected at a time, a Will fall, so repeatedly. The feeling is lost when the packet is caused. Set u-boot environment variable: BOOTARGS=ROOT=/DEV/NFS nfsroot=192.168.0.114:/home/rootfs/nfs,rsize=1500,wsize=1
ip=192.168.0.113:192.168.0.114:192.168.0.2:255.255.255.0 console=tty0 ttys0,115200 Mem=64M increased rsize and wsize parameters, Increase the block size (default is 1024), I guess can reduce the probability of losing packets. After the change, sure enough. Cite an article on the web for your own reference:
In the development of Embedded Linux, in the process of kernel porting and root file system, in order to verify the success of kernel porting, the establishment of root file system is feasible, it is necessary to burn their image files to the repeated experiments in flash. Burning so frequently to write Flash is a waste of time, reduces development efficiency, and can cause damage to flash. Therefore, in the process of kernel porting and root file system construction, network guidance is generally adopted. The specific procedures are as follows:
One Boot loader environment variable and kernel parameter setting
My Development Board's boot loader is u-boot, and its environment variables are set as follows:
Uboot> printenv
Bootdelay=3
baudrate=115200
ethaddr=00:12:34:56:78:9a
Ipaddr=192.168.0.9①
Serverip=192.168.0.1②
netmask=255.255.255.0
Rootpath=/home/zht/rfsys③
Stdin=serial
Stdout=serial
Stderr=serial
Bootcmd=tftp 21000000 Uimage;bootm 21000000④
Bootargs=root=/dev/nfs RW Nfsroot=192.168.0.1:/home/zht/rfsys nfsaddrs=192.168.0.48: 192.168.0.1:192.168.0.1:255.255.255.0 console=ttys0,115200 Mem=32m⑤
① Set Target Board IP address
② Set Server IP address
③ set the path of the root file system on the server, note that the path must be set to the NFS directory on the server.
④bootcmd are commands that are executed after the U-boot is started, separated by semicolons.
The TFTP 21000000 uimage indicates that the kernel image was downloaded via TFTP to ram with the address 0x21000000;
BOOTM 21000000 boot Linux operating system
⑤ defines the command-line arguments that U-boot passes to the Linux kernel, which specifies the network file system as the root file system.
The ROOT=/DEV/NFS is not a real device, but a flag that tells the kernel to get the root file system through the network.
Parameter Nfsroot This parameter tells the kernel to use that machine, the directory, and the network File System option as the root file system. The parameters are formatted as follows:
Nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
If no nfsroot parameter is given on the instruction column, the '/tftpboot/%s ' preset is used. Other options are as follows:
<server-ip>-Specifies the Internet address (IP addresses) of the network File System server. If this field is not given, the value determined by the Nfsaddrs variable (see below) is used. One of the purposes of this parameter is to allow different machines to be used as the reverse Address Resolution Protocol (RARP) and the network File System server. Usually you can ignore it (set to blank).
<root-dir>-The directory name on the service side to be mounted as the root. If there is a '%s ' character in the string (token), this will be substituted for the ASCII representation of the client's Internet address.
<nfs-options>-Standard network File system options. All options are separated by commas. If this option field is not given, the following preset values are used:
Port = as given by server Portmap daemon
Rsize = 1024
Wsize = 1024
Timeo = 7
Retrans = 3
Acregmin = 3
Acregmax = 60
Acdirmin = 30
Acdirmax = 60
Flags = hard, NOINTR, Noposix, CTO, AC
Parameter Nfsaddrs the various network interface addresses required for network communication. If this parameter is not given, kernel cores will try to use the reverse Address Resolution Protocol and/or the Startup Protocol (BOOTP) to find these parameters. The format is as follows:
Nfsaddrs=<my-ip>:<serv-ip>:<gw-ip>:<netmask>:<name>:<dev>:<auto>
<my-ip>-The Internet address of the client. If it is not set, this address will be determined by the reverse Address Resolution Protocol or the startup protocol. Which protocol is used depends on the options open when configuring the core and the <auto> parameters. If this parameter is set, the reverse Address Resolution Protocol or the startup protocol is not used.
<serv-ip>-The Internet address of the network File System server. If you use a reverse address Resolution protocol to determine the client address and set this parameter, only the response from the specified service side is accepted. To use a different machine as the reverse address resolution and network File System server, here you specify your reverse address Resolution Protocol server (remain blank) and specify your network file system server in the Nfsroot parameter (see above). If this item is blank, the address of the server that answers the reverse address Resolution Protocol or the startup protocol is used.
<gw-ip> Gateway Internet Address, if the service end is located on a different subnet. If this project is blank, no gateways are used and the server is assumed to be on a local network unless a value is received by the startup protocol.
<netmask>-The network mask for the local network interface. If blank, the network mask is exported by the client's Internet address, unless the value is received by the startup protocol.
<name>-The name of the client. If blank, use the ascii-notation for the client Internet address, or the value received by the startup protocol.
<dev>-The name of the network device to use. If blank, all devices are used to issue a reverse address resolution request, and the initiating protocol request is issued by the device that was first found. The network file system uses a device that receives a reverse address Resolution Protocol or initiates a protocol response. If you have only one device, then you can ignore it.
<auto>--Used as a method of automatic configuration. If it is ' rarp ' or ' BOOTP ', use the indicated protocol. If this value is ' both ' or blank, it is used if both protocols are open when the core is configured. ' None ' means that automatic configuration is not used. In this case you must specify all the necessary values in the preceding field.
This <auto> parameter can be used separately as a Nfsaddrs parameter (there is no ': ' character before), in which case automatic configuration is used. However, you cannot use ' none ' as a value in this case.
Two-kernel configuration requirements
Add kernel support for NFS:
Select Networking options-"Ip:kernel level auloconfiguralion Item
Select the root file system on NFS and NFS file system support under File systems-Network file systems-(must be selected, otherwise the network filesystem hangs up)
Configuration of the three TFTP server
Log on as root and run the Setup command
#setup
Select Systme Services and choose TFTP.
Open the TFTP configuration file/etc/xinetd.d/tftp
Set Server_args to the directory where the kernel image files are located, default to/tftpboot
My kernel image is in the/home/zht/sources/kernel/linux-2.4.27 directory, set as follows:
Cc>service TFTP
{
Disable = no
Socket_type = Dgram
protocol = UDP
Wait = yes
user = root
Server =/USR/SBIN/IN.TFTPD
Server_args =-s/home/zht/sources/kernel/linux-2.4.27
Per_source = 11
CPS = 100 2
Flags = IPV4
}
Restart the PC Linux operating system or run the service xinetd Restart command to start the TFTP server.
Run Netstat-a | grep TFTP can see if the TFTP server is configured successfully.
Configuration of four NFS servers
Log on to the Linux server as root, edit the shared directory profile exports in the/etc directory, specify shared directories and permissions, and so on.
Perform the following command to edit the file/etc/exports:
# Vi/etc/exports
Add the following content to the file:
/home/zht/rfsys 192.168.0.* (Rw,sync,no_root_squash)
After editing, save the exit, and then run the command Exports–rav check that the input is correct.
Added: Allows a computer with an IP address range to access the/home/zht/rfsys directory with read-write access to the 192.168.0.*. /home/work is also known as the server output share directory.
The parameter meanings in parentheses are described as follows:
RW: Read/write permission, read-only permission parameter is ro;
Sync: Data is written to memory and hard drives, or async, where data is temporarily stored in memory and not written to the hard disk immediately.
The NO_ROOT_SQUASH:NFS server shares the user's attributes of the directory and, if the user is root, has root permissions for the shared directory.
Then execute the following command to start the port mapping:
#/etc/rc.d/init.d/portmap Start
Finally, execute the following command to start the NFS service, at which time NFS activates the daemon and then starts listening on client side requests:
#/etc/rc.d/init.d/nfs Start
After the NFS server is started, you will also need to check settings such as the firewall for the Linux server (typically shutting down the firewall service, executing iptables-f), ensuring that the ports used for NFS are not blocked and the hosts that allow traffic, primarily check the Linux server iptables, IPChains options such as the settings, and/etc/hosts.deny,/etc/hosts.allow files.
We first test the loopback server on the Linux server to verify that the shared directory can be accessed. Run the following command on the Linux server:
# mount–t NFS 192.168.0.20:/home/zht/rfsys/mnt
# ls/mnt
command to mount the NFS output share directory of the Linux server to the/MNT directory, so if NFS is working properly, you should be able to see the contents of the/home/work shared directory in the/MNT directory.
V. Copy the kernel image file Uimage to the/tftpboot directory, and the established root file system is copied to the/home/zht/rfsys directory. Then reboot the target board.
Article Source: Flying Connaught Net (
www.firnow.com): http://dev.firnow.com/course/6_system/linux/Linuxjs/2008831/139066_2.html