[PATCH] board: amlogic: vim3: ethernet mac fixed from serial

Artem Lapkin email2tema at gmail.com
Fri Jan 8 06:43:23 CET 2021


Fixed randomly generated ethernet mac address!

Used meson_generate_serial_ethaddr for generate mac address from
board serial number, if ethaddr variable not defined.

Signed-off-by: Artem Lapkin <art at khadas.com>
---
 board/amlogic/vim3/vim3.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/board/amlogic/vim3/vim3.c b/board/amlogic/vim3/vim3.c
index 09ef39ff30..0315eaf569 100644
--- a/board/amlogic/vim3/vim3.c
+++ b/board/amlogic/vim3/vim3.c
@@ -133,5 +133,14 @@ int misc_init_r(void)
 {
 	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
 
+	u8 mac_addr[6];
+	if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
+		meson_generate_serial_ethaddr();
+		eth_env_get_enetaddr("ethaddr", mac_addr);
+		printf("[i] serial eth mac %02X:%02X:%02X:%02X:%02X:%02X\n",
+			mac_addr[0],mac_addr[1],mac_addr[2],
+			mac_addr[3],mac_addr[4],mac_addr[5]);
+	}
+
 	return 0;
 }
-- 
2.25.1



More information about the U-Boot mailing list