Re: [PATCH 2/2] defaultenv: boot/net: allow customising NFS port and path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 13, 2023 at 08:42:11AM +0100, Sascha Hauer wrote:
> On Fri, Feb 10, 2023 at 11:48:31PM +0100, Roland Hieber wrote:
> > 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.
> 
> Does this approach really make you happy with your usecase? The port
> may change with every invocation of 'ptxdist nfsroot'.
> 
> With bootloaderspec it should be possible to do this in barebox:
> 
> boot nfs://host:13049//root

Ah, I didn't know this! This seems more reasonable to me! :-)

> If that works we might convince Michael to print this line suitable for
> copy-paste along with the output of 'ptxdist nfsroot'.

The message is actually printed by unfsd, but I'll see how this could be
done reasonably in PTXdist.

 - Roland

> Sascha
> 
> > 
> > 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
> > 
> > 
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@xxxxxxxxxxxxxx     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux