[PATCH] net: ifup: pass hostname and linuxdevname to linux with DHCP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Barebox always uses the hostname in the DHCP request. To configure
kernel networking, use the long ip= syntax for DHCP and set the hostname
as well. This way, Barebox and Linux use the same hostname in the DHCP
request.
Also set the device if linuxdevname is configured. This is already done
for static configurations. Do the same for DHCP.

Signed-off-by: Michael Olbrich <m.olbrich@xxxxxxxxxxxxxx>
---
 net/ifup.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ifup.c b/net/ifup.c
index 1870f7401714..18ab1363c748 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -159,8 +159,8 @@ out:
 
 static void set_linux_bootarg(struct eth_device *edev)
 {
+	char *bootarg;
 	if (edev->global_mode == ETH_MODE_STATIC) {
-		char *bootarg;
 		IPaddr_t serverip;
 		IPaddr_t gateway;
 
@@ -176,7 +176,11 @@ static void set_linux_bootarg(struct eth_device *edev)
 		dev_set_param(&edev->dev, "linux.bootargs", bootarg);
 		free(bootarg);
 	} else if (edev->global_mode == ETH_MODE_DHCP) {
-		dev_set_param(&edev->dev, "linux.bootargs", "ip=dhcp");
+		bootarg = basprintf("ip=::::%s:%s:dhcp",
+				barebox_get_hostname(),
+				edev->linuxdevname ? edev->linuxdevname : "");
+		dev_set_param(&edev->dev, "linux.bootargs", bootarg);
+		free(bootarg);
 	}
 }
 
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux