[PATCH 27/27] defaultenv-2: set bootargs correctly for network boot

Sascha Hauer s.hauer at pengutronix.de
Fri Dec 1 03:22:56 PST 2017


The defaultenv-2 network boot script uses bootargs-ip which
hardcodes eth0 as network device. To make this work with
other nwetork devices use the "ip_route_get" command to determine
the network device used to reach the server.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 defaultenv/defaultenv-2-base/bin/bootargs-ip | 11 -----------
 defaultenv/defaultenv-2-base/boot/net        |  3 ++-
 2 files changed, 2 insertions(+), 12 deletions(-)
 delete mode 100644 defaultenv/defaultenv-2-base/bin/bootargs-ip

diff --git a/defaultenv/defaultenv-2-base/bin/bootargs-ip b/defaultenv/defaultenv-2-base/bin/bootargs-ip
deleted file mode 100644
index 2d4486caf8..0000000000
--- a/defaultenv/defaultenv-2-base/bin/bootargs-ip
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-# pass either static ip or dhcp to kernel based on barebox settings
-
-. /env/network/eth0
-
-if [ $ip = dhcp ]; then
-	global.linux.bootargs.dyn.ip="ip=dhcp"
-else
-	global.linux.bootargs.dyn.ip="ip=$ipaddr:$serverip:$gateway:$netmask::eth0:"
-fi
diff --git a/defaultenv/defaultenv-2-base/boot/net b/defaultenv/defaultenv-2-base/boot/net
index af096410b7..aaa5394f27 100644
--- a/defaultenv/defaultenv-2-base/boot/net
+++ b/defaultenv/defaultenv-2-base/boot/net
@@ -10,7 +10,8 @@ if [ -f "${oftree}" ]; then
 fi
 
 nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
-bootargs-ip
+
+ip_route_get -b ${global.net.server} global.linux.bootargs.dyn.ip
 
 initramfs="${path}/${global.user}-initramfs-${global.hostname}"
 if [ -f "${initramfs}" ]; then
-- 
2.11.0




More information about the barebox mailing list