DJM
DJM

Reputation: 624

yocto disable autostart of systemd services at compile time

i want to disable auto starting for the timesyncd.service at boot up on my embedded linux target running linux image compile with Yocto

under my board name, i tried creating systemd_%.bbappend file with content at

/meta-xxxx/recipes-core/systemd/systemd_%.bbappend

inherit systemd
do_install_append() {

        echo "djm";
        #rm -fr ${D}${sysconfdir}/systemd/system/dbus-org.freedesktop.resolve1.service
        #rm -fr ${D}${sysconfdir}/systemd/system/multi-user.target.wants/systemd-resolved.service

        #rm -fr ${D}${sysconfdir}/systemd/system/dbus-org.freedesktop.timesync1.service
        #rm -fr ${D}${sysconfdir}/systemd/system/sysinit.target.wants/systemd-timesyncd.service
        echo "djm-2";
        echo "D=  "  ${D};
        echo "syscondfdir= " ${sysconfdir};
        ls -l  ${D}${sysconfdir}/systemd/system/
 #      exit 1

}

but i still see the soft link to start the timesyncd in the /etc/systemd/system folder

printing the ${D} shows me

build-xxxx/tmp/work/cortex-xxxx-linux-gnueabi/systemd/1_243.2-r0/image

the build-xxxx/tmp/work/cortex-xxxx-linux-gnueabi/systemd/1_243.2-r0/image/etc is blank now

so it means that when the do_install_append is run , the folder structure is blank and the real recipe which creates/ the flow at which the soft link is create is at different recipe or different function ? can someone help me in, how i should be doing this at compile time in yocto ?

Upvotes: 2

Views: 2986

Answers (1)

DJM
DJM

Reputation: 624

figured out how to do this, we have to update the systemd.preset file for the feature/packages coming default with the systemd.

in file meta-xxx/recipes-core/systemd/systemd_%.bbappend

do_configure_append() {

#disabling autostart of systemd-timesyncd
    sed -i -e "s/enable systemd-timesyncd.service/disable systemd-timesyncd.service/g" ${S}/presets/90-systemd.preset

#disabling autostart of systemd-resolved
    sed -i -e "s/enable systemd-resolved.service/disable systemd-resolved.service/g" ${S}/presets/90-systemd.preset
}

Upvotes: 3

Related Questions