2022. 2. 15. 11:49

i.mx8 yocto linux 에서 MAC 주소를 설정하는 방법 1 (uboot)

워낙 간단한 것이라서 설명할 것도 없겠지만, h/w적으로 MAC rom 이 없거나, u-boot에서 MAC을 설정해 놓지 않으면,

보통 kernel에서 random 하게 MAC 주소를 만들어서 ethernet device를 구동하게 된다.

이렇게 되면, DHCP를 할 때, 매번 IP 주소가 변경되어, 여간 불편한 것이 아니다.

 

이를 피하려면, u-boot 에 MAC 주소를 설정하면 된다. 설정 방법은,

u-boot> setenv ethaddr "nn:nn:nn:nn:nn:nn"

u-boot> saveenv

이렇게 ethaddr를 설정하면, 커널에서 uboot 의 ethaddr 을 읽어서 ethernet device를 구동한다.

커널에서는 임의의 명령으로 다시 변경할 수도 있다.

간단한 것인데도, 찾으려면 수고스러움이 있어서 정리해서 올린다.

 

혹시 다른 사항이 필요하면, 여기를 보는 것도 좋겠다. (kernel 구성 관련)

https://community.nxp.com/t5/i-MX-Processors/How-to-disable-random-MAC-address-generation-in-Kernel/td-p/802685

 

How to disable random MAC address generation in Kernel

Hi, We want to disable random MAC address generation for Ethernet in i.MX6 BSP in our release build so that IEEE allotted MAC number is programmed without fail during product manufacturing. Usually MAC address is programmed in U-boot environment variable "

community.nxp.com