1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-08-31 08:12:06 +02:00

Revert "env: net: Move eth_parse_enetaddr() to net.c/h"

The reverted patch causes linking error with disabled CONFIG_NET:

  cmd/built-in.o: In function `eth_env_get_enetaddr':
  u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to `eth_parse_enetaddr'

Function setup_environment() in board/sunxi/board.c calls
eth_env_set_enetaddr() to setup stable mac address for ethernet interfaces.

This needs to be implemented and succeed even if net is disabled in u-boot,
as it ensures Linux will not generate random MAC addresses, and picks the
ones provided by u-boot via DT. See fdt_fixup_ethernet().

This feature is independent of the whole network stack and network drivers
in u-boot.

This revert fixes the linking error.

Signed-off-by: Ondrej Jirman <megous@megous.com>
This commit is contained in:
Ondrej Jirman
2019-09-12 18:56:02 +02:00
parent 5ba8b12543
commit 5d5db652e3
4 changed files with 23 additions and 23 deletions

View File

@@ -358,6 +358,18 @@ ulong env_get_hex(const char *varname, ulong default_val)
return value;
}
void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
{
char *end;
int i;
for (i = 0; i < 6; ++i) {
enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
if (addr)
addr = (*end) ? end + 1 : end;
}
}
int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
{
eth_parse_enetaddr(env_get(name), enetaddr);

View File

@@ -332,4 +332,15 @@ int env_get_char(int index);
*/
void env_reloc(void);
/**
* eth_parse_enetaddr() - Parse a MAC address
*
* Convert a string MAC address
*
* @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 2-digit
* hex value
* @enetaddr: Place to put MAC address (6 bytes)
*/
void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
#endif

View File

@@ -875,15 +875,4 @@ int update_tftp(ulong addr, char *interface, char *devstring);
/**********************************************************************/
/**
* eth_parse_enetaddr() - Parse a MAC address
*
* Convert a string MAC address
*
* @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 2-digit
* hex value
* @enetaddr: Place to put MAC address (6 bytes)
*/
void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
#endif /* __NET_H__ */

View File

@@ -1628,15 +1628,3 @@ ushort env_get_vlan(char *var)
{
return string_to_vlan(env_get(var));
}
void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
{
char *end;
int i;
for (i = 0; i < 6; ++i) {
enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
if (addr)
addr = (*end) ? end + 1 : end;
}
}