Hello, I need to start avahi-autoipd with --force-bind option.
I can do it on runtime via:
/usr/sbin/avahi-autoipd --force-bind -D -w eth0
How can I add this rule to the system interface up for eth0 on the yocto building stage?
Thanks in advance for correct answers
My case: yocto Kirkstone release for i.MX8
已解决! 转到解答。
Hi @Anton_K!
Thank you for contacting NXP Support!
To solve this problem you can execute this command as a service at the start of the boot of the board.
After doing this on Yocto try to do the .service following the steps:
1: cd etc/systemd/system
2: create a file .service using vim or nano
3: The file must contain:
[Unit]
Description=” Your Description”
[Service]
ExecStart=/usr/sbin/avahi-autoipd --force-bind -D -w eth0
[Install]
WantedBy=multi-user.target
4: save the file with .service extension
After that, if your commands are executed every time that you turn on your board you can add the service on Yocto.
I found this wiki on how to do that.
https://wiki.koansoftware.com/index.php/Add_a_systemd_service_file_into_a_Yocto_image
Best Regards!
Chavira
Hi @Anton_K!
Thank you for contacting NXP Support!
To solve this problem you can execute this command as a service at the start of the boot of the board.
After doing this on Yocto try to do the .service following the steps:
1: cd etc/systemd/system
2: create a file .service using vim or nano
3: The file must contain:
[Unit]
Description=” Your Description”
[Service]
ExecStart=/usr/sbin/avahi-autoipd --force-bind -D -w eth0
[Install]
WantedBy=multi-user.target
4: save the file with .service extension
After that, if your commands are executed every time that you turn on your board you can add the service on Yocto.
I found this wiki on how to do that.
https://wiki.koansoftware.com/index.php/Add_a_systemd_service_file_into_a_Yocto_image
Best Regards!
Chavira
Hi @Anton_K!
I think is possible but is not automatic.
Probably you can solve this problem using a script or something similar to monitor the ethernet status and send the proper commands according to your necessities.
Best Regards!
Chavira
Totally I have solved this problem by your way. I've extended avahi recipe by avahi-autoipd custom service in meta-distro repository.
diff git a/conf/distro/layer.conf b/conf/distro/layer.conf
...
+IMAGE_INSTALL:append = " avahi-autoipd"
diff --git a/recipes-connectivity/avahi/avahi/avahi-autoipd.service b/recipes-connectivity/avahi/avahi/avahi-autoipd.service
...
+++ b/recipes-connectivity/avahi/avahi/avahi-autoipd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Running avahi-autoipd
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/avahi-autoipd --force-bind eth0
+ExecStop=/usr/sbin/avahi-autoipd -k eth0
+Restart=always
+RestartSec=5
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-connectivity/avahi/avahi_%.bbappend b/recipes-connectivity/avahi/avahi_%.bbappend
...
+++ b/recipes-connectivity/avahi/avahi_%.bbappend
@@ -0,0 +1,14 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += " file://${PN}-autoipd.service "
+
+FILES:avahi-autoipd += " ${systemd_unitdir}/system/${PN}-autoipd.service "
+
+SYSTEMD_PACKAGES += " ${PN}-autoipd"
+SYSTEMD_AUTO_ENABLE:${PN}-autoipd = "enable"
+SYSTEMD_SERVICE:${PN}-autoipd = "${PN}-autoipd.service"
+
+do_install:append() {
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/${PN}-autoipd.service ${D}${systemd_unitdir}/system
+}
And it's successfully worked, @Chavira very thanks for case!