]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Save server's MAC address in environment
authorRobin Getz <rgetz@blackfin.uclinux.org>
Tue, 21 Jul 2009 16:15:28 +0000 (12:15 -0400)
committerBen Warren <biggerbadderben@gmail.com>
Thu, 23 Jul 2009 06:17:01 +0000 (23:17 -0700)
Linux's netconsole works much better when you can pass it the MAC address of
the server. (otherwise it just uses broadcast, which everyone else on my
network complains about :)

This sets the env var "serveraddr" (to match ethaddr), so that you can pass
it to linux with whatever bootargs you want to....

addnetconsole=set bootargs $(bootargs) netconsole=@$(ipaddr)/eth0,@$(serverip)/$(serveraddr)

Signed-of-by: Robin Getz <rgetz@blackfin.uclinux.org>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
README
net/net.c

diff --git a/README b/README
index 4c74cb79347ada1cb1c0906d5894cbfd0f5a465b..90714727cde2d714643b2ac11d246bf41ec74627 100644 (file)
--- a/README
+++ b/README
@@ -1184,6 +1184,11 @@ The following options need to be configured:
                Defines a default value for the IP address of a TFTP
                server to contact when using the "tftboot" command.
 
+               CONFIG_KEEP_SERVERADDR
+
+               Keeps the server's MAC address, in the env 'serveraddr'
+               for passing to bootargs (like Linux's netconsole option)
+
 - Multicast TFTP Mode:
                CONFIG_MCAST_TFTP
 
index 7ce947db3003b4d9de05e7f749983655f371150c..641c37cb8f3b898bf756d48b006914f2c1f1b774 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -1287,6 +1287,15 @@ NetReceive(volatile uchar * inpkt, int len)
                        /* are we waiting for a reply */
                        if (!NetArpWaitPacketIP || !NetArpWaitPacketMAC)
                                break;
+
+#ifdef CONFIG_KEEP_SERVERADDR
+                       if (NetServerIP == NetArpWaitPacketIP) {
+                               char buf[20];
+                               sprintf(buf, "%pM", arp->ar_data);
+                               setenv("serveraddr", buf);
+                       }
+#endif
+
 #ifdef ET_DEBUG
                        printf("Got ARP REPLY, set server/gtwy eth addr (%pM)\n",
                                arp->ar_data);