URL
https://opencores.org/ocsvn/test_project/test_project/trunk
Subversion Repositories test_project
[/] [test_project/] [trunk/] [linux_sd_driver/] [Documentation/] [nfsroot.txt] - Rev 62
Compare with Previous | Blame | View Log
Mounting the root filesystem via NFS (nfsroot)===============================================Written 1996 by Gero Kuhlmann <gero@gkminix.han.de>Updated 1997 by Martin Mares <mj@atrey.karlin.mff.cuni.cz>Updated 2006 by Nico Schottelius <nico-kernel-nfsroot@schottelius.org>Updated 2006 by Horms <horms@verge.net.au>In order to use a diskless system, such as an X-terminal or printer serverfor example, it is necessary for the root filesystem to be present on anon-disk device. This may be an initramfs (see Documentation/filesystems/ramfs-rootfs-initramfs.txt), a ramdisk (see Documentation/initrd.txt) or afilesystem mounted via NFS. The following text describes on how to use NFSfor the root filesystem. For the rest of this text 'client' means thediskless system, and 'server' means the NFS server.1.) Enabling nfsroot capabilities-----------------------------In order to use nfsroot, NFS client support needs to be selected asbuilt-in during configuration. Once this has been selected, the nfsrootoption will become available, which should also be selected.In the networking options, kernel level autoconfiguration can be selected,along with the types of autoconfiguration to support. Selecting all ofDHCP, BOOTP and RARP is safe.2.) Kernel command line-------------------When the kernel has been loaded by a boot loader (see below) it needs to betold what root fs device to use. And in the case of nfsroot, where to findboth the server and the name of the directory on the server to mount as root.This can be established using the following kernel command line parameters:root=/dev/nfsThis is necessary to enable the pseudo-NFS-device. Note that it's not areal device but just a synonym to tell the kernel to use NFS instead ofa real device.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 differentservers 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 bereplaced by the ASCII-representation of the client'sIP address.<nfs-options> Standard NFS options. All options are separated by commas.The following defaults are used:port = as given by server portmap daemonrsize = 4096wsize = 4096timeo = 7retrans = 3acregmin = 3acregmax = 60acdirmin = 30acdirmax = 60flags = hard, nointr, noposix, cto, acip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>This parameter tells the kernel how to configure IP addresses of devicesand also how to set up the IP routing table. It was originally called`nfsaddrs', but now the boot-time IP configuration works independently ofNFS, so it was renamed to `ip' and the old name remained as an alias forcompatibility reasons.If this parameter is missing from the kernel command line, all fields areassumed to be empty, and the defaults mentioned below apply. In generalthis means that the kernel tries to configure everything usingautoconfiguration.The <autoconf> parameter can appear alone as the value to the `ip'parameter (without all the ':' characters before). If the value is"ip=off" or "ip=none", no autoconfiguration will take place, otherwiseautoconfiguration will take place. The most common way to use thisis "ip=dhcp".<client-ip> IP address of the client.Default: Determined using autoconfiguration.<server-ip> IP address of the NFS server. If RARP is used to determinethe client address and this parameter is NOT empty onlyreplies from the specified server are accepted.Only required for for NFS root. That is autoconfigurationwill not be triggered if it is missing and NFS root is notin 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 unspecifiedthe netmask is derived from the client IP address assumingclassful 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 usingautoconfiguration. This is done by sendingautoconfiguration requests out of all devices,and using the device that received the first reply.<autoconf> Method to use for autoconfiguration. In the case of optionswhich specify multiple autoconfiguration protocols,requests are sent using all protocols, and the first oneto reply is used.Only autoconfiguration protocols that have been compiledinto the kernel will be used, regardless of the value ofthis option.off or none: don't use autoconfiguration(do static IP assignment instead)on or any: use any protocol available in the kernel(default)dhcp: use DHCPbootp: use BOOTPrarp: use RARPboth: use both BOOTP and RARP but not DHCP(old option kept for backwards compatibility)Default: any3.) Boot Loader----------To get the kernel into memory different approaches can be used.They depend on various facilities being available:3.1) Booting from a floppy using syslinuxWhen building kernels, an easy way to create a boot floppy that usessyslinux is to use the zdisk or bzdisk make targets which useand bzimage images respectively. Both targets accept theFDARGS parameter which can be used to set the kernel command line.e.g.make bzdisk FDARGS="root=/dev/nfs"Note that the user running this command will need to haveaccess to the floppy drive device, /dev/fd0For more information on syslinux, including how to create bootdisksfor prebuilt kernels, see http://syslinux.zytor.com/N.B: Previously it was possible to write a kernel directly toa floppy using dd, configure the boot device using rdev, andboot using the resulting floppy. Linux no longer supports thismethod of booting.3.2) Booting from a cdrom using isolinuxWhen building kernels, an easy way to create a bootable cdrom thatuses isolinux is to use the isoimage target which uses a bzimageimage. Like zdisk and bzdisk, this target accepts the FDARGSparameter which can be used to set the kernel command line.e.g.make isoimage FDARGS="root=/dev/nfs"The resulting iso image will be arch/<ARCH>/boot/image.isoThis can be written to a cdrom using a variety of tools includingcdrecord.e.g.cdrecord dev=ATAPI:1,0,0 arch/i386/boot/image.isoFor more information on isolinux, including how to create bootdisksfor prebuilt kernels, see http://syslinux.zytor.com/3.2) Using LILOWhen using LILO all the necessary command line parameters may bespecified using the 'append=' directive in the LILO configurationfile.However, to use the 'root=' directive you also need to createa dummy root device, which may be removed after LILO is run.mknod /dev/boot255 c 0 255For information on configuring LILO, please refer to its documentation.3.3) Using GRUBWhen using GRUB, kernel parameter are simply appended after the kernelspecification: kernel <kernel> <parameters>3.4) Using loadlinloadlin may be used to boot Linux from a DOS command prompt withoutrequiring a local hard disk to mount as root. This has not beenthoroughly tested by the authors of this document, but in generalit should be possible configure the kernel command line similarlyto the configuration of LILO.Please refer to the loadlin documentation for further information.3.5) Using a boot ROMThis is probably the most elegant way of booting a diskless client.With a boot ROM the kernel is loaded using the TFTP protocol. Theauthors of this document are not aware of any no commercial bootROMs that support booting Linux over the network. However, thereare two free implementations of a boot ROM, netboot-nfs andetherboot, both of which are available on sunsite.unc.edu, and bothof which contain everything you need to boot a diskless Linux client.3.6) Using pxelinuxPxelinux may be used to boot linux using the PXE boot loaderwhich is present on many modern network cards.When using pxelinux, the kernel image is specified using"kernel <relative-path-below /tftpboot>". The nfsroot parametersare passed to the kernel by adding them to the "append" line.It is common to use serial console in conjunction with pxeliunx,see Documentation/serial-console.txt for more information.For more information on isolinux, including how to create bootdisksfor prebuilt kernels, see http://syslinux.zytor.com/4.) Credits-------The nfsroot code in the kernel and the RARP support have been writtenby Gero Kuhlmann <gero@gkminix.han.de>.The rest of the IP layer autoconfiguration code has been writtenby Martin Mares <mj@atrey.karlin.mff.cuni.cz>.In order to write the initial version of nfsroot I would like to thankJens-Uwe Mager <jum@anubis.han.de> for his help.
