Commit 9c32cb7b authored by Alessandro Rubini's avatar Alessandro Rubini

barebox: bugfix: add missing patch for MAC address

When porting forward the patches from v2012.05 to v2014.04, I forgot
this last patch, that allows flash-wrs to set a mac address in the
barebox binary.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent a40b567e
No preview for this file type
From fd575013159dcb486c3f59877edc9c9beec08d7b Mon Sep 17 00:00:00 2001
From: Federico Vaga <federico.vaga@gmail.com>
Date: Tue, 23 Oct 2012 01:44:59 +0200
Subject: [PATCH 7/9] barebox: add MAC addresses to environment
This patch add to default mac addresses to the barebox evironment. The
first MAC address (eth0.ethaddr) is the one to assign to the ethernet
port on board.
The second MAC address (macaddr) is the base for all switch ports
Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
---
common/environment.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/common/environment.c b/common/environment.c
index 9f4e098..9346927 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -384,6 +384,10 @@ int envfs_load(const char *filename, const char *dir, unsigned flags)
int envfd;
int ret = 0;
size_t size;
+#ifdef __BAREBOX__
+ char *mac_addr_1="02:34:56:78:9A:BC";
+ char *mac_addr_2="02:34:56:78:9A:00";
+#endif
envfd = open(filename, O_RDONLY);
if (envfd < 0) {
@@ -420,6 +424,15 @@ int envfs_load(const char *filename, const char *dir, unsigned flags)
goto out;
ret = 0;
+
+#ifdef __BAREBOX__
+ /* When the environment is correctly loaded, set the MAC address */
+ setenv("eth0.ethaddr", mac_addr_1);
+ export("eth0.ethaddr");
+ setenv("macaddr", mac_addr_2);
+ export("macaddr");
+#endif
+
out:
close(envfd);
free(buf);
--
1.7.7.2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment