mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] Documentation: networking: resize reStructuredText table
@ 2023-02-10 22:48 Roland Hieber
  2023-02-10 22:48 ` [PATCH 2/2] defaultenv: boot/net: allow customising NFS port and path Roland Hieber
  0 siblings, 1 reply; 4+ messages in thread
From: Roland Hieber @ 2023-02-10 22:48 UTC (permalink / raw)
  To: barebox; +Cc: Roland Hieber

Make more space for long lines which we'll add in the next commit.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 Documentation/user/networking.rst | 38 +++++++++++++++----------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/Documentation/user/networking.rst b/Documentation/user/networking.rst
index 2306cb6a60d1..6bd16ea8d1bd 100644
--- a/Documentation/user/networking.rst
+++ b/Documentation/user/networking.rst
@@ -38,25 +38,25 @@ Network devices are configured with a set of device specific variables:
 Additionally there are some more variables that are not specific to a
 device:
 
-+------------------------------+--------------+------------------------------------------------+
-| name                         | type         |                                                |
-+==============================+==============+================================================+
-| global.net.gateway           | ipv4 host    | The network gateway used when a host is not in |
-|                              |              | any directly visible subnet. May be set        |
-|                              |              | automatically by DHCP.                         |
-+------------------------------+--------------+------------------------------------------------+
-| global.net.server            | hostname or  | The default server used by the defaultenv boot |
-|                              | ipv4 address | scripts for NFS and TFTP; see                  |
-|                              |              | :ref:`booting_linux_net`.                      |
-|                              |              | If unspecified, may be set by DHCP.            |
-+------------------------------+--------------+------------------------------------------------+
-| global.net.nameserver        | ipv4 address | The DNS server used for resolving host names.  |
-|                              |              | May be set by DHCP.                            |
-+------------------------------+--------------+------------------------------------------------+
-| 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).                         |
-+------------------------------+--------------+------------------------------------------------+
++------------------------------+--------------+-------------------------------------------------------+
+| name                         | type         |                                                       |
++==============================+==============+=======================================================+
+| global.net.gateway           | ipv4 host    | The network gateway used when a host is not in        |
+|                              |              | any directly visible subnet. May be set               |
+|                              |              | automatically by DHCP.                                |
++------------------------------+--------------+-------------------------------------------------------+
+| global.net.server            | hostname or  | The default server used by the defaultenv boot        |
+|                              | ipv4 address | scripts for NFS and TFTP; see                         |
+|                              |              | :ref:`booting_linux_net`.                             |
+|                              |              | If unspecified, may be set by DHCP.                   |
++------------------------------+--------------+-------------------------------------------------------+
+| global.net.nameserver        | ipv4 address | The DNS server used for resolving host names.         |
+|                              |              | May be set by DHCP.                                   |
++------------------------------+--------------+-------------------------------------------------------+
+| 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).                                |
++------------------------------+--------------+-------------------------------------------------------+
 
 The first step for networking is configuring the network device. The network
 device is usually ``eth0``. The current configuration can be viewed with the
-- 
2.30.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] defaultenv: boot/net: allow customising NFS port and path
  2023-02-10 22:48 [PATCH 1/2] Documentation: networking: resize reStructuredText table Roland Hieber
@ 2023-02-10 22:48 ` Roland Hieber
  2023-02-13  7:42   ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Roland Hieber @ 2023-02-10 22:48 UTC (permalink / raw)
  To: barebox; +Cc: Roland Hieber

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@pengutronix.de>
---
 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] defaultenv: boot/net: allow customising NFS port and path
  2023-02-10 22:48 ` [PATCH 2/2] defaultenv: boot/net: allow customising NFS port and path Roland Hieber
@ 2023-02-13  7:42   ` Sascha Hauer
  2023-02-13 11:38     ` Roland Hieber
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2023-02-13  7:42 UTC (permalink / raw)
  To: Roland Hieber; +Cc: barebox

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

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

Sascha

> 
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> ---
>  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 |



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] defaultenv: boot/net: allow customising NFS port and path
  2023-02-13  7:42   ` Sascha Hauer
@ 2023-02-13 11:38     ` Roland Hieber
  0 siblings, 0 replies; 4+ messages in thread
From: Roland Hieber @ 2023-02-13 11:38 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-13 11:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10 22:48 [PATCH 1/2] Documentation: networking: resize reStructuredText table Roland Hieber
2023-02-10 22:48 ` [PATCH 2/2] defaultenv: boot/net: allow customising NFS port and path Roland Hieber
2023-02-13  7:42   ` Sascha Hauer
2023-02-13 11:38     ` Roland Hieber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox