Search code examples
usbyoctoifconfigimx6

How to set i.p for usb0 before imx board boots?


I'd like to automatically set the i.p address of usb port which is configured in cdc mode for my imx6 board.

I have tried manually setting the

I have also written a script to do this after boot. (after we login as root).

Both of them work but I'd like this to happen before the board asks for login prompt.

This was the content of the script

ifconfig usb0 192.168.100.100

placed in /etc/profile.d

I need to first login as root and then I can see the ip of usb0. Is it possible to have usb0's i.p set before login?


Solution

  • So I found a script /etc/rc.local

    It was mentioned that the script does nothing so I guess that means I can modify it as I wish.

    I just added

    ifconfig usb0 192.168.100.100
    

    at the start, and the usb i.p seem's to have set before login.

    This however seems like a dirty solution, If there is a cleaner way please let me know.