I try to add can0 to systemd to auto start at boot time on my imx8 board. But I couldnt with these configurations :
$tree recipes-core/
----------------------------------------
recipes-core/
└── systemd
├── systemd-machine-units
│ ├── 10-eth0.network
│ ├── 10-eth1.network
│ ├── 90-dhcp-default.network
│ ├── can0.service
│ └── can1.service
└── systemd-machine-units_1.0.bbappend
2 directories, 6 files
$ cat systemd-machine-units_1.0.bbappend
-------------------------------------------------------------
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
# all our boards have at least one native network port
SRC_URI = " \
file://10-eth0.network \
file://90-dhcp-default.network \
file://10-eth1.network \
file://can0.service \
file://can1.service \
"
SYSTEMD_SERVICE_${PN} = "can0.service can1.service"
do_install_append() {
install -d ${D}${systemd_unitdir}/network/
install -m 0644 "${WORKDIR}/10-eth0.network" ${D}${systemd_unitdir}/network/
install -m 0644 "${WORKDIR}/90-dhcp-default.network" ${D}${systemd_unitdir}/network/
install -m 0644 "${WORKDIR}/10-eth1.network" ${D}${systemd_unitdir}/network/
install -d ${D}${systemd_system_unitdir}/
install -m 0644 "${WORKDIR}/can0.service" ${D}${systemd_system_unitdir}/
install -m 0644 "${WORKDIR}/can1.service" ${D}${systemd_system_unitdir}/
}
FILES_${PN} = "\
${systemd_system_unitdir} \
${systemd_unitdir}/network/ \
"
$cat can0.service
--------------------------------------------------------------------------------
# For 2.0B legacy mode, arbitration bit rate (bitrate) and
# payload bit rate (dbitrate) have the same value - not higher than 1Mbps.
# CAN frames are limited to max 8 bytes in this case
# if target does not support FD, fg settings are not accepted by ip link set
[Unit]
Description=can0 interface setup
[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/sbin/ip link set can0 up type can bitrate 500000
ExecStop=/sbin/ip link set can0 down
[Install]
WantedBy=basic.target
search can0.service on target roots but not found :
$cd lib/systemd/ && find -name "*can*"
--------------------------------------------
./system/wpa_supplicant.service
./system/[email protected]
./system/[email protected]
./system/[email protected]
Also I try to add systemd_%.bbappend with these file : (Also systemd tree different with under code. can0.service is under the files folder near to service_%.bbappend file)
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://can0.service"
SYSTEMD_SERVICE_${PN} = "can0.service can1.service"
FILES_${PN} += "{sysconfdir}/systemd/system/* "
do_install_append() {
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/*.service ${D}${systemd_unitdir}/system/
}
can0.service created by above systemd_%.bbappend but not auto start at boot time. Just can0.service seems at /lib/systemd/system folder at target.
What is my mistake? Can somebody help me?
journalctl -u can0say? - Oleksandr Kravchuksystemctl status cat0- Oleksandr Kravchuk