^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ===============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Mounting the root filesystem via NFS (nfsroot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ===============================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) :Authors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) Written 1996 by Gero Kuhlmann <gero@gkminix.han.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) Updated 1997 by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Updated 2006 by Nico Schottelius <nico-kernel-nfsroot@schottelius.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) Updated 2006 by Horms <horms@verge.net.au>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) Updated 2018 by Chris Novakovic <chris@chrisn.me.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) In order to use a diskless system, such as an X-terminal or printer server for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) example, it is necessary for the root filesystem to be present on a non-disk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) device. This may be an initramfs (see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) Documentation/filesystems/ramfs-rootfs-initramfs.rst), a ramdisk (see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) Documentation/admin-guide/initrd.rst) or a filesystem mounted via NFS. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) following text describes on how to use NFS for the root filesystem. For the rest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) of this text 'client' means the diskless system, and 'server' means the NFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) server.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) Enabling nfsroot capabilities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) In order to use nfsroot, NFS client support needs to be selected as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) built-in during configuration. Once this has been selected, the nfsroot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) option will become available, which should also be selected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) In the networking options, kernel level autoconfiguration can be selected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) along with the types of autoconfiguration to support. Selecting all of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) DHCP, BOOTP and RARP is safe.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) Kernel command line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ===================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) When the kernel has been loaded by a boot loader (see below) it needs to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) told what root fs device to use. And in the case of nfsroot, where to find
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) both the server and the name of the directory on the server to mount as root.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) This can be established using the following kernel command line parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) root=/dev/nfs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) This is necessary to enable the pseudo-NFS-device. Note that it's not a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) real device but just a synonym to tell the kernel to use NFS instead of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) a real device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) If the `nfsroot' parameter is NOT given on the command line,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) the default ``"/tftpboot/%s"`` will be used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) <server-ip> Specifies the IP address of the NFS server.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) The default address is determined by the ip parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) (see below). This parameter allows the use of different
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) servers for IP autoconfiguration and NFS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) <root-dir> Name of the directory on the server to mount as root.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) If there is a "%s" token in the string, it will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) replaced by the ASCII-representation of the client's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) IP address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) <nfs-options> Standard NFS options. All options are separated by commas.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) The following defaults are used::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) port = as given by server portmap daemon
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) rsize = 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) wsize = 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) timeo = 7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) retrans = 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) acregmin = 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) acregmax = 60
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) acdirmin = 30
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) acdirmax = 60
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) flags = hard, nointr, noposix, cto, ac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>:<ntp0-ip>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) This parameter tells the kernel how to configure IP addresses of devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) and also how to set up the IP routing table. It was originally called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) nfsaddrs, but now the boot-time IP configuration works independently of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) NFS, so it was renamed to ip and the old name remained as an alias for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) compatibility reasons.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) If this parameter is missing from the kernel command line, all fields are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) assumed to be empty, and the defaults mentioned below apply. In general
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) this means that the kernel tries to configure everything using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) autoconfiguration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) The <autoconf> parameter can appear alone as the value to the ip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) parameter (without all the ':' characters before). If the value is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) "ip=off" or "ip=none", no autoconfiguration will take place, otherwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) autoconfiguration will take place. The most common way to use this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) is "ip=dhcp".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) <client-ip> IP address of the client.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) Default: Determined using autoconfiguration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) <server-ip> IP address of the NFS server.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) If RARP is used to determine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) the client address and this parameter is NOT empty only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) replies from the specified server are accepted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) Only required for NFS root. That is autoconfiguration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) will not be triggered if it is missing and NFS root is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) in operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) Value is exported to /proc/net/pnp with the prefix "bootserver "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) (see below).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) Default: Determined using autoconfiguration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) The address of the autoconfiguration server is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) <gw-ip> IP address of a gateway if the server is on a different subnet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) Default: Determined using autoconfiguration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) <netmask> Netmask for local network interface.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) If unspecified the netmask is derived from the client IP address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) assuming classful addressing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) Default: Determined using autoconfiguration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) <hostname> Name of the client.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) If a '.' character is present, anything
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) before the first '.' is used as the client's hostname, and anything
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) after it is used as its NIS domain name. May be supplied by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) autoconfiguration, but its absence will not trigger autoconfiguration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) If specified and DHCP is used, the user-provided hostname (and NIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) domain name, if present) will be carried in the DHCP request; this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) may cause a DNS record to be created or updated for the client.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) Default: Client IP address is used in ASCII notation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) <device> Name of network device to use.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) Default: If the host only has one device, it is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) Otherwise the device is determined using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) autoconfiguration. This is done by sending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) autoconfiguration requests out of all devices,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) and using the device that received the first reply.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) <autoconf> Method to use for autoconfiguration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) In the case of options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) which specify multiple autoconfiguration protocols,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) requests are sent using all protocols, and the first one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) to reply is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) Only autoconfiguration protocols that have been compiled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) into the kernel will be used, regardless of the value of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) this option::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) off or none: don't use autoconfiguration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) (do static IP assignment instead)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) on or any: use any protocol available in the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) (default)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) dhcp: use DHCP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) bootp: use BOOTP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) rarp: use RARP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) both: use both BOOTP and RARP but not DHCP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) (old option kept for backwards compatibility)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) if dhcp is used, the client identifier can be used by following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) format "ip=dhcp,client-id-type,client-id-value"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) Default: any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) <dns0-ip> IP address of primary nameserver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) Value is exported to /proc/net/pnp with the prefix "nameserver "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) (see below).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) Default: None if not using autoconfiguration; determined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) automatically if using autoconfiguration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) <dns1-ip> IP address of secondary nameserver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) See <dns0-ip>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) <ntp0-ip> IP address of a Network Time Protocol (NTP) server.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) Value is exported to /proc/net/ipconfig/ntp_servers, but is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) otherwise unused (see below).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) Default: None if not using autoconfiguration; determined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) automatically if using autoconfiguration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) After configuration (whether manual or automatic) is complete, two files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) are created in the following format; lines are omitted if their respective
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) value is empty following configuration:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) - /proc/net/pnp:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) #PROTO: <DHCP|BOOTP|RARP|MANUAL> (depending on configuration method)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) domain <dns-domain> (if autoconfigured, the DNS domain)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) nameserver <dns0-ip> (primary name server IP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) nameserver <dns1-ip> (secondary name server IP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) nameserver <dns2-ip> (tertiary name server IP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) bootserver <server-ip> (NFS server IP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) - /proc/net/ipconfig/ntp_servers:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) <ntp0-ip> (NTP server IP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) <ntp1-ip> (NTP server IP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) <ntp2-ip> (NTP server IP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) <dns-domain> and <dns2-ip> (in /proc/net/pnp) and <ntp1-ip> and <ntp2-ip>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) (in /proc/net/ipconfig/ntp_servers) are requested during autoconfiguration;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) they cannot be specified as part of the "ip=" kernel command line parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) Because the "domain" and "nameserver" options are recognised by DNS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) resolvers, /etc/resolv.conf is often linked to /proc/net/pnp on systems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) that use an NFS root filesystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) Note that the kernel will not synchronise the system time with any NTP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) servers it discovers; this is the responsibility of a user space process
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) (e.g. an initrd/initramfs script that passes the IP addresses listed in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /proc/net/ipconfig/ntp_servers to an NTP client before mounting the real
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) root filesystem if it is on NFS).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) nfsrootdebug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) This parameter enables debugging messages to appear in the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) log at boot time so that administrators can verify that the correct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) NFS mount options, server address, and root path are passed to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) NFS client.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) rdinit=<executable file>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) To specify which file contains the program that starts system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) initialization, administrators can use this command line parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) The default value of this parameter is "/init". If the specified
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) file exists and the kernel can execute it, root filesystem related
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) kernel command line parameters, including 'nfsroot=', are ignored.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) A description of the process of mounting the root file system can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) found in Documentation/driver-api/early-userspace/early_userspace_support.rst
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) Boot Loader
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) To get the kernel into memory different approaches can be used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) They depend on various facilities being available:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) - Booting from a floppy using syslinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) When building kernels, an easy way to create a boot floppy that uses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) syslinux is to use the zdisk or bzdisk make targets which use zimage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) and bzimage images respectively. Both targets accept the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) FDARGS parameter which can be used to set the kernel command line.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) e.g::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) make bzdisk FDARGS="root=/dev/nfs"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) Note that the user running this command will need to have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) access to the floppy drive device, /dev/fd0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) For more information on syslinux, including how to create bootdisks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) for prebuilt kernels, see https://syslinux.zytor.com/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) Previously it was possible to write a kernel directly to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) a floppy using dd, configure the boot device using rdev, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) boot using the resulting floppy. Linux no longer supports this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) method of booting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) - Booting from a cdrom using isolinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) When building kernels, an easy way to create a bootable cdrom that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) uses isolinux is to use the isoimage target which uses a bzimage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) image. Like zdisk and bzdisk, this target accepts the FDARGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) parameter which can be used to set the kernel command line.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) e.g::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) make isoimage FDARGS="root=/dev/nfs"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) The resulting iso image will be arch/<ARCH>/boot/image.iso
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) This can be written to a cdrom using a variety of tools including
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) cdrecord.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) e.g::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) cdrecord dev=ATAPI:1,0,0 arch/x86/boot/image.iso
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) For more information on isolinux, including how to create bootdisks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) for prebuilt kernels, see https://syslinux.zytor.com/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) - Using LILO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) When using LILO all the necessary command line parameters may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) specified using the 'append=' directive in the LILO configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) However, to use the 'root=' directive you also need to create
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) a dummy root device, which may be removed after LILO is run.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) e.g::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) mknod /dev/boot255 c 0 255
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) For information on configuring LILO, please refer to its documentation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) - Using GRUB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) When using GRUB, kernel parameter are simply appended after the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) specification: kernel <kernel> <parameters>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) - Using loadlin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) loadlin may be used to boot Linux from a DOS command prompt without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) requiring a local hard disk to mount as root. This has not been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) thoroughly tested by the authors of this document, but in general
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) it should be possible configure the kernel command line similarly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) to the configuration of LILO.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) Please refer to the loadlin documentation for further information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) - Using a boot ROM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) This is probably the most elegant way of booting a diskless client.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) With a boot ROM the kernel is loaded using the TFTP protocol. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) authors of this document are not aware of any no commercial boot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) ROMs that support booting Linux over the network. However, there
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) are two free implementations of a boot ROM, netboot-nfs and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) etherboot, both of which are available on sunsite.unc.edu, and both
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) of which contain everything you need to boot a diskless Linux client.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) - Using pxelinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) Pxelinux may be used to boot linux using the PXE boot loader
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) which is present on many modern network cards.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) When using pxelinux, the kernel image is specified using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) "kernel <relative-path-below /tftpboot>". The nfsroot parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) are passed to the kernel by adding them to the "append" line.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) It is common to use serial console in conjunction with pxeliunx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) see Documentation/admin-guide/serial-console.rst for more information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) For more information on isolinux, including how to create bootdisks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) for prebuilt kernels, see https://syslinux.zytor.com/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) Credits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) =======
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) The nfsroot code in the kernel and the RARP support have been written
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) by Gero Kuhlmann <gero@gkminix.han.de>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) The rest of the IP layer autoconfiguration code has been written
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) by Martin Mares <mj@atrey.karlin.mff.cuni.cz>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) In order to write the initial version of nfsroot I would like to thank
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) Jens-Uwe Mager <jum@anubis.han.de> for his help.