[PATCH 1/2] net: add nameserver IPs to kernel-parameter ip=

Christoph Fritz chf.fritz at googlemail.com
Sat Sep 22 06:58:50 EDT 2012


Kernel-parameter "ip=" is used to assign network configuration.
With linux kernel 3.7 it is also possible to set nameserver IPs.

This patch adds two new options (nameserver0 and nameserver1) to
ethernet device parameter. It also updates defaultenv version 1.

Signed-off-by: Christoph Fritz <chf.fritz at googlemail.com>
---
 defaultenv/bin/boot |    4 +++-
 defaultenv/config   |    2 ++
 net/eth.c           |    2 ++
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
index 4e2056e..d5b5844 100644
--- a/defaultenv/bin/boot
+++ b/defaultenv/bin/boot
@@ -61,7 +61,9 @@ if [ x$ip = xdhcp -o ]; then
 elif [ x$ip = xnone ]; then
 	bootargs="$bootargs ip=none"
 else
-	bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0:"
+	bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:"
+	bootargs="$bootargs$eth0.netmask::eth0::"
+	bootargs="$bootargs$eth0.nameserver0:$eth0.nameserver1"
 fi
 
 
diff --git a/defaultenv/config b/defaultenv/config
index 391ba47..6596753 100644
--- a/defaultenv/config
+++ b/defaultenv/config
@@ -18,6 +18,8 @@ global.dhcp.vendor_id=barebox
 #eth0.netmask=a.b.c.d
 #eth0.serverip=a.b.c.d
 #eth0.gateway=a.b.c.d
+#eth0.nameserver0=a.b.c.d
+#eth0.nameserver1=a.b.c.d
 
 # can be either 'tftp', 'nfs', 'nand', 'nor' or 'disk'
 kernel_loc=tftp
diff --git a/net/eth.c b/net/eth.c
index d42a72d..bb8157b 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -229,6 +229,8 @@ int eth_register(struct eth_device *edev)
 	dev_add_param(dev, "gateway", eth_set_ipaddr, NULL, 0);
 	dev_add_param(dev, "netmask", eth_set_ipaddr, NULL, 0);
 	dev_add_param(dev, "serverip", eth_set_ipaddr, NULL, 0);
+	dev_add_param(dev, "nameserver0", eth_set_ipaddr, NULL, 0);
+	dev_add_param(dev, "nameserver1", eth_set_ipaddr, NULL, 0);
 
 	edev->init(edev);
 
-- 
1.7.2.5






More information about the barebox mailing list