There's already precedence in global.tftp.windowsize, so global.nfs.port is probably a better name than squeezing it into global.net. This parameter is not yet in any release, so the fallout is fairly limited. While at it, mention it in the documentation. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- Documentation/user/booting-linux.rst | 15 ++++++++++++--- Documentation/user/networking.rst | 23 ++++++++++++++++++++--- fs/nfs.c | 4 ++-- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Documentation/user/booting-linux.rst b/Documentation/user/booting-linux.rst index b49b2c93b1f3..6c8d25a96c1e 100644 --- a/Documentation/user/booting-linux.rst +++ b/Documentation/user/booting-linux.rst @@ -231,9 +231,18 @@ The entry can be listed with the ``-l`` option: When the SD card shows up as ``mmc1`` in barebox, this entry can be booted with ``boot mmc1`` or by setting ``global.boot.default`` to ``mmc1``. -A bootloader spec entry can also reside on an NFS server, in which case an -`RFC 2224 <https://datatracker.ietf.org/doc/html/rfc2224>`__-compatible NFS URI -must be passed to the boot command: +A bootloader spec entry can also reside on an NFS server by pointing the boot +command at the mount point +(here the default :ref:`automount <network_filesystems_automounts>`): + +.. code-block:: sh + + global.user=myself + boot /mnt/nfs + +Alternatively, the bootloader spec support also understands +`RFC 2224 <https://datatracker.ietf.org/doc/html/rfc2224>`__-compatible +NFS URIs, when passed to the :ref:`boot command <command_boot>`: .. code-block:: sh diff --git a/Documentation/user/networking.rst b/Documentation/user/networking.rst index 2306cb6a60d1..0adcff6954dc 100644 --- a/Documentation/user/networking.rst +++ b/Documentation/user/networking.rst @@ -150,9 +150,26 @@ or mount -t nfs 192.168.2.1:/export none /mnt -**NOTE:** The execution of the mount command can often be hidden behind the -:ref:`automount command <command_automount>`, to make mounting transparent to -the user. +.. _network_filesystems_automounts: + +Automounts +^^^^^^^^^^ + +For user convenience, the default ``automount`` init script runs +the :ref:`automount command <command_automount>` to create automounts for +both TFTP and NFS. On first access, an Ethernet interface will be brought +up and file operations will be forwarded to a host specified by global +variables: + +- ``/mnt/tftp``: will use ``$global.net.server`` as TFTP server + +- ``/mnt/nfs``: will use ``$global.net.server`` as NFS server + and ``/home/${global.user}/nfsroot/${global.hostname}`` as nfsroot. + By default, a RPC lookup will be conducted to determine mount and + NFS ports, but these can be overridden together using a user-specified + by means of ``global.nfs.port``. The latter is equivalent to specifying + ``-o port=$global.nfs.port,mountport=$global.nfs.port`` as argument + to the :ref:`mount command <command_mount>`. Network console --------------- diff --git a/fs/nfs.c b/fs/nfs.c index 530d9c6672d8..bc3ab3aa8e87 100644 --- a/fs/nfs.c +++ b/fs/nfs.c @@ -1567,11 +1567,11 @@ static int nfs_init(void) rootnfsopts = xstrdup("v3,tcp"); globalvar_add_simple_string("linux.rootnfsopts", &rootnfsopts); - globalvar_add_simple_int("net.nfsport", &nfsport_default, "%d"); + globalvar_add_simple_int("nfs.port", &nfsport_default, "%d"); return register_fs_driver(&nfs_driver); } coredevice_initcall(nfs_init); -BAREBOX_MAGICVAR(global.net.nfsport, +BAREBOX_MAGICVAR(global.nfs.port, "Sets both NFS -o {port.mountport}= to the specified non-zero value"); -- 2.39.5