Search code examples
ethernetu-boot

U-boot ethaddr is not set during the first time bootup of Linux kernel


I have two boards from the different vendor, in which the first one works well other board with Macronix flash memory fails to detect the ethaddrr.

EDIT: My hardware info:

Working Hw:     Micoron 512MB Nor flash, AR; 32-bit 
Not working Hw: Macronix 512 MB(MX29GL256F) NOR Flash, ARM 32 bit.

I checked there is not ethaddr in my env variable. I checked in my working board I have ethaddr variable ethaddr=00:01:02:03:04:54 .

I tried to set the ethaddr/mac-id as 00:01:02:03:04:55 using setenv and saveenv but this doesn't work.

I checked my u-boot config also.

#define CONFIG_NET_MULTI        1

My question is, ethaddr/mac-id is more Hw specific why don't it detects ethddr in certain boards?

This is my error info :

U-Boot 2010.09 (Apr 16 2018 - 10:59:13)
DRAM:  32 MiB
Flash: 32 MiB
In:    serial
Out:   serial
Err:   serial
Net:   macb0
Hit any key to stop autoboot:  0
Checking firmware at 0x100e0000-0x107fffff
  invalid magic 0xffff, ignoring
Checking firmware at 0x10820000-0x10f3ffff
  invalid magic 0xffff, ignoring
highest = 0
No valid firmware in flash, trying to load kernel and ramdisk from server
macb0: PHY present at 0
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
*** ERROR: `ethaddr' not set
macb0: PHY present at 0
macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
Wrong Image Format for bootm command
ERROR: can't get kernel image!

Solution

  • Don't ever set MAC addresses just out of the blue. Kernel is not picking it up because your MAC address has multicast bit set.

    See http://www.denx.de/wiki/bin/view/DULG/EthernetDoesNotWork

    If you want to set a local MAC address you need to make sure it's valid. U-BOOT you can do that by using

    $ make tools/gen_eth_addr
    cc     tools/gen_eth_addr.c   -o tools/gen_eth_addr
    $ tools/gen_eth_addr
    ba:d0:4a:9c:4e:ce
    

    See http://www.denx.de/wiki/bin/view/DULG/WhereCanIGetAValidMACAddress for details.

    Also this is not a kernel programming problem so it really doesn't belong here.