AnsweredAssumed Answered

The eth0 address of the yocto system is not fixed

Question asked by fu qiang on Sep 25, 2019

Now when I am doing yocto system development on imx6, I find that the MAC address of Eth0 will be changed after reboot, and I need to set it to fixed so that the IP address is fixed.

 

It is found in the code that a MAC address is randomly assigned in step 5. Is there any way to fix the MAC address or have any ideas, such as reading the CPU model to set the MAC address?

/*
* 5) random mac address
*/
if (!is_valid_ether_addr(iap)) {
/* Report it and use a random ethernet address instead */
netdev_err(ndev, "Invalid MAC address: %pM\n", iap);
eth_hw_addr_random(ndev);
netdev_info(ndev, "Using random MAC address: %pM\n",
ndev->dev_addr);
return;
}

Any ideas or Suggestions, thank you

Outcomes