Yocto network configuration using command line

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Yocto network configuration using command line

3,980 次查看
amrit_soni
Contributor I

I am using standard Yocto build from BSP 4.14.98 for imx8m mini. Our device is headless. After yocto boots on our device, I am able to access the device using ssh, device comes up with dhcp enabled, assigned IP address and works fine.

Before we ship the device, it must be configured for a known static ip address, subnet mask, gateway and dns. Our customers will have the option of using the device with the shipped ip address or change the network settings to their own.

I tried ifconfig command to change ip address, but upon reboot it went back to dhcp.

1. What is the best way to change ip address and mask etc., and save them?

2. My customers or I need to be able to do (1) above using my application without going to ssh. Is there any API (similar to Windows network adapter), I could use to change IP settings from my application?

Do I need to rebuild Yocto with any additional Install options?

Thank you.

Amrit Soni

0 项奖励
回复
2 回复数

3,964 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

 

To disable DHCP, please remove it(ip=dhcp) in uboot command line;

To use a static IP, you can use ifconfig command such as:

ifconfig eth0 10.192.242.117

To change MAC address, you can use below command in commandline:

fec.macaddr=0x00,0x10,0x20,0x30,0x40,0x88

 

As for MAC address it can be permanently changed by burning e-fuse.
Alternatively you can add the command like this

ifconfig eth0 hw ether 00:04:9f:00:e9:bb

into init script of the system to overwrite the value.

Regards

0 项奖励
回复

3,953 次查看
amrit_soni
Contributor I

Thank you for your reply.

But our device is headless and boots directly into Yocto with our application.. U-Boot is not an option for our customers to change any settings, We have to find a way to do it using command line in ssh or using network setup API.

Best regards,

Amrit Soni

0 项奖励
回复