From: Sascha Hauer <sha@pengutronix.de>
To: Roland Hieber <rhi@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] defaultenv: boot/net: allow customising NFS port and path
Date: Mon, 13 Feb 2023 08:42:11 +0100 [thread overview]
Message-ID: <20230213074211.GD10447@pengutronix.de> (raw)
In-Reply-To: <20230210224831.2597135-2-rhi@pengutronix.de>
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 |
next prev parent reply other threads:[~2023-02-13 7:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2023-02-13 11:38 ` Roland Hieber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230213074211.GD10447@pengutronix.de \
--to=sha@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=rhi@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox