[PATCH v2 3/3] defaultenv-2: automount: use ifup -a1 for NFS/TFTP automounts

Ahmad Fatoum a.fatoum at pengutronix.de
Sun Jan 29 23:20:57 PST 2023


The ifup -a in the automounts has too big a scope: The remote server is
specified at mount time, so we could stop bringing up interfaces once
$global.net.server becomes resolvable. For the common case, where
$global.net.server is initially empty and then set via DHCP, ifup
provides the new -1 option to early-exit once $global.net.server was set.

For setups where one, but not all, Ethernet interfaces have a cable
attached, this normally reduces ifup -a time from 10s to 1s.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
  - new patch
---
 Documentation/user/automount.rst            | 2 +-
 defaultenv/defaultenv-2-base/boot/net       | 2 +-
 defaultenv/defaultenv-2-base/init/automount | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/user/automount.rst b/Documentation/user/automount.rst
index 1fdeffc66336..b41b41ef021d 100644
--- a/Documentation/user/automount.rst
+++ b/Documentation/user/automount.rst
@@ -15,7 +15,7 @@ TFTP server, the following is required:
 .. code-block:: sh
 
   mkdir -p /mnt/tftp
-  automount /mnt/tftp 'ifup -a && mount -t tftp $global.net.server /mnt/tftp'
+  automount /mnt/tftp 'ifup -a1 && mount -t tftp $global.net.server /mnt/tftp'
 
 This creates an automountpoint on ``/mnt/tftp``. Whenever this directory is accessed,
 the command ``ifup eth0 && mount -t tftp $eth0.serverip /mnt/tftp`` is executed.
diff --git a/defaultenv/defaultenv-2-base/boot/net b/defaultenv/defaultenv-2-base/boot/net
index e79432eb277c..98286ff5e050 100644
--- a/defaultenv/defaultenv-2-base/boot/net
+++ b/defaultenv/defaultenv-2-base/boot/net
@@ -3,7 +3,7 @@
 path="/mnt/tftp"
 
 # global.net.server and global.hostname may be set by DHCP, so trigger it first
-ifup -a
+ifup -a1
 
 global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
 
diff --git a/defaultenv/defaultenv-2-base/init/automount b/defaultenv/defaultenv-2-base/init/automount
index 0996cea04df7..39e823489793 100644
--- a/defaultenv/defaultenv-2-base/init/automount
+++ b/defaultenv/defaultenv-2-base/init/automount
@@ -3,12 +3,12 @@
 # automount tftp server
 
 mkdir -p /mnt/tftp
-automount /mnt/tftp 'ifup -a && mount -t tftp $global.net.server /mnt/tftp'
+automount /mnt/tftp 'ifup -a1 && mount -t tftp $global.net.server /mnt/tftp'
 
 # automount nfs server's nfsroot
 
 mkdir -p /mnt/nfs
-automount /mnt/nfs 'ifup -a && mount -t nfs ${global.net.server}:/home/${global.user}/nfsroot/${global.hostname} /mnt/nfs'
+automount /mnt/nfs 'ifup -a1 && mount -t nfs ${global.net.server}:/home/${global.user}/nfsroot/${global.hostname} /mnt/nfs'
 
 
 # FAT on usb disk example
-- 
2.30.2




More information about the barebox mailing list