Reputation: 26
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?
Upvotes: 0
Views: 359
Reputation: 2300
I would create a meta-custom/recipes-core/systemd-conf/files/06-usb0.network
file:
[Match]
Name=usb0
[Network]
Address=192.168.100.100/24
With meta-custom/recipes-core/systemd-conf/systemd-conf_%.bbappend
recipe:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://06-usb0.network"
do_install_append() {
install -d ${D}${sysconfdir}/systemd/network
install -m 0644 ${WORKDIR}/06-usb0.network ${D}${sysconfdir}/systemd/network
}
FILES_${PN} += "${sysconfdir}/systemd/network/06-usb0.network"
Note: if you don't use latest Yocto release, it should be systemd-conf.bbappend
instead of systemd-conf_%.bbappend
Upvotes: 1
Reputation: 26
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.
Upvotes: 0