在 Yocto 构建中禁用标准 systemd 服务 [英] Disable a standard systemd service in Yocto build
问题描述
我需要启动我自己的systemd
服务,我们称之为custom.service
.我知道如何编写一个在启动时添加和启用它的方法:
I need to start my own systemd
service, let's call it custom.service
. I know how to write a recipe for it to be added and enabled on boot:
SYSTEMD_SERVICE_${PN} = "custom.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"
但是,它与默认的 systemd
服务之一 - systemd-timesyncd.service
冲突.
However, it conflicts with one of the default systemd
services - systemd-timesyncd.service
.
即使 systemd_XX.bb
实际启用它,是否有一个很好的首选方法来禁用我的 bitbake 文件中的默认 systemd
服务?
Is there a nice preferred way to disable that default systemd
service in my bitbake file even though the systemd_XX.bb
actually enables it?
我可以创建一个 systemd_%.bbappend
文件来修改 systemd
设置,但是我找不到可以禁用一项服务而启用所有其他服务的位置.
I can create a systemd_%.bbappend
file to modify the systemd
settings, but I can't locate the place where one service can be disabled leaving all others enabled.
我发现的工作解决方案是使用
The working solution I found is to remove the timesyncd
altogether using
PACKAGECONFIG_remove = "timesyncd"
但我想知道这是否是一种合适的方式,是否有一种方法可以禁用它,但留在系统中.
But I wonder if this is a appropriate way and if there is a way to just disable it, but leave in the system.
推荐答案
如果系统在移除其他包后运行良好,则移除包是首选解决方案.更少的包意味着更简单的系统.
If the system runs fine with the other package removed, then removing the package is a preferred solution. Fewer packages means a simpler system.
这篇关于在 Yocto 构建中禁用标准 systemd 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!