【问题标题】:yocto disable autostart of systemd services at compile timeyocto 在编译时禁用 systemd 服务的自动启动
【发布时间】:2021-07-31 07:01:41
【问题描述】:

我想在我的嵌入式 linux 目标上启动时禁用 timesyncd.service 的自动启动,该目标运行使用 Yocto 编译的 linux 映像

在我的董事会名称下,我尝试使用以下内容创建 systemd_%.bbappend 文件

/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

}

但我仍然在 /etc/systemd/system 文件夹中看到启动 timesyncd 的软链接

打印 ${D} 显示我

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

build-xxxx/tmp/work/cortex-xxxx-linux-gnueabi/systemd/1_243.2-r0/image/etc 现在为空

所以这意味着当 do_install_append 运行时,文件夹结构是空白的,并且创建软链接的真正配方/创建软链接的流程在不同的配方或不同的功能? 有人可以帮助我吗,我应该如何在 yocto 编译时这样做?

【问题讨论】:

  • 这能回答你的问题吗? Disable a standard systemd service in Yocto build
  • PACKAGECONFIG_remove = "timesyncd" 删除了整个包。我想要该服务,但它不应该在自动启动中出现。所以我想删除 mulit-user.target 中的软链接。我不知道如何使用 SYSTEMD_AUTO_ENABLE_${PN} = "disable" for timesyncd
  • 阅读所有答案。
  • 我都试过了,do_install_append 似乎没有以正确的流程执行..

标签: embedded-linux yocto systemd


【解决方案1】:

想出了如何做到这一点,我们必须更新 systemd.preset 文件以获取 systemd 的默认功能/包。

在文件 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
}

【讨论】:

    猜你喜欢
    • 2020-05-11
    • 2019-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-01
    • 2016-11-10
    • 2018-11-12
    相关资源
    最近更新 更多