mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Gavin Schenk <g.schenk@eckelmann.de>
To: barebox@lists.infradead.org
Cc: Gavin Schenk <g.schenk@eckelmann.de>
Subject: [PATCH] Configure network device for nfsboot via nv var
Date: Wed, 8 Nov 2017 16:05:17 +0100	[thread overview]
Message-ID: <20171108150517.130503-1-g.schenk@eckelmann.de> (raw)

When you have a static network environment but more than one network
device on your machine it is necessary to provide the <device> parameter
to the ip parameter at kernel cmd line.

The device name assigned by Linux cannot in general be predicted as it
depends on driver bind order.

This patch introduces a new global variable
"global.linux.nfsroot.device" which when set is feed to the ip=
kernel parameter as device name.

Signed-off-by: Gavin Schenk <g.schenk@eckelmann.de>
---
 net/ifup.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/ifup.c b/net/ifup.c
index 5113d138329a..bdb7cf0e6d0a 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -109,16 +109,19 @@ int ifup(const char *name, unsigned flags)
 		dev_set_param(dev, "linux.bootargs", "ip=dhcp");
 	} else if (!strcmp(ip, "static")) {
 		char *bootarg;
+		const char *env_linux_nfsroot_device = 
+			getenv("global.linux.nfsroot.device");
 		for (i = 0; i < ARRAY_SIZE(vars); i++) {
 			ret = eth_set_param(dev, vars[i]);
 			if (ret)
 				goto out;
 		}
-		bootarg = basprintf("ip=%pI4:%pI4:%pI4:%pI4:::",
+		bootarg = basprintf("ip=%pI4:%pI4:%pI4:%pI4::%s:",
 				&edev->ipaddr,
 				&edev->serverip,
 				&edev->gateway,
-				&edev->netmask);
+				&edev->netmask,
+				env_linux_nfsroot_device ?: "");
 		dev_set_param(dev, "linux.bootargs", bootarg);
 		free(bootarg);
 	} else {
-- 
2.15.0


Eckelmann AG
Vorstand: Dipl.-Ing. Peter Frankenbach (Sprecher) Dipl.-Wi.-Ing. Philipp Eckelmann
Dr.-Ing. Marco Münchhof Dr.-Ing. Frank Uhlemann
Vorsitzender des Aufsichtsrats: Hubertus G. Krossa
Stv. Vorsitzender des Aufsichtsrats: Dr.-Ing. Gerd Eckelmann
Sitz der Gesellschaft: Berliner Str. 161, 65205 Wiesbaden, Amtsgericht Wiesbaden HRB 12636
http://www.eckelmann.de 


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2017-11-08 15:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08 15:05 Gavin Schenk [this message]
2017-11-10  7:00 ` Sascha Hauer
2017-11-16  7:20   ` AW: " Schenk, Gavin
2017-11-17  9:26     ` Uwe Kleine-König
2017-11-17  9:32     ` s.hauer

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=20171108150517.130503-1-g.schenk@eckelmann.de \
    --to=g.schenk@eckelmann.de \
    --cc=barebox@lists.infradead.org \
    /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