There are use cases where the port and mount path of the NFS root need to be changed from the default values, e.g. with the userspace NFS daemon used by 'ptxdist nfsroot', which tells you: Mount rootfs with nfsroot=/root,v3,tcp,port=13049,mountport=13049 (The port number can vary of course, depending on how many users on your devel server have already started unfsd at the same time.) Support such use cases by introducing two new variables for the port number and the mount path, which get inserted into the kernel command line. Use the old default mount path as fallback when the new variable is not set. Signed-off-by: Roland Hieber <rhi@xxxxxxxxxxxxxx> --- Documentation/user/networking.rst | 10 ++++++++++ defaultenv/defaultenv-2-base/boot/net | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Documentation/user/networking.rst b/Documentation/user/networking.rst index 6bd16ea8d1bd..e95957c0a26a 100644 --- a/Documentation/user/networking.rst +++ b/Documentation/user/networking.rst @@ -53,6 +53,16 @@ device: | global.net.nameserver | ipv4 address | The DNS server used for resolving host names. | | | | May be set by DHCP. | +------------------------------+--------------+-------------------------------------------------------+ +| global.net.nfspath | string | If set, determines the mount path of the root | +| | | file system on the NFS server. | +| | | If not set, the default value | +| | | ``/home/${global.user}/nfsroot/${global.hostname}`` | +| | | is used. | ++------------------------------+--------------+-------------------------------------------------------+ +| global.net.nfsport | short | If set, determines the port of the NFS server | +| | | (the ``mountport`` and ``port`` arguments of the | +| | | ``nfsroot`` parameter in the kernel command line). | ++------------------------------+--------------+-------------------------------------------------------+ | global.net.ifup_force_detect | boolean | Set to true if your network device is not | | | | detected automatically during start (i.e. for | | | | USB network adapters). | diff --git a/defaultenv/defaultenv-2-base/boot/net b/defaultenv/defaultenv-2-base/boot/net index e79432eb277c..236955ef6fed 100644 --- a/defaultenv/defaultenv-2-base/boot/net +++ b/defaultenv/defaultenv-2-base/boot/net @@ -22,7 +22,16 @@ initramfs="${path}/${global.user}-initramfs-${global.hostname}" if [ -f "${initramfs}" ]; then global.bootm.initrd="$initramfs" else - nfsroot="${nfsserver}:/home/${global.user}/nfsroot/${global.hostname}" + if [ -z "${global.net.nfspath}" ]; then + nfsroot="${nfsserver}:/home/${global.user}/nfsroot/${global.hostname}" + else + nfsroot="${nfsserver}:${global.net.nfspath}" + fi + + if [ -n "${global.net.nfsport}" ]; then + nfsroot="${nfsroot},port=${global.net.nfsport},mountport=${global.net.nfsport}" + fi + ip_route_get -b ${global.net.server} global.linux.bootargs.dyn.ip global.linux.bootargs.dyn.root="root=/dev/nfs nfsroot=$nfsroot,v3,tcp" fi -- 2.30.2