Re: Change (and remove unused) init system on a per-image basis #yocto #bitbake #systemd #sysvinit


Khem Raj
 

you are better off by having two different DISTROs like poky and poky-altcfg is.

On 3/24/21 7:12 AM, lel@... wrote:
Hi all,
I would like to change the init system (systemd / SysVinit) on a per-image basis.
Therefore I added both "systemd" and "sysvinit" to my DISTRO_FEATURES.
I set this inside my *image-systemd.bb* to make sure that systemd is available as a distro feature:
REQUIRED_DISTRO_FEATURES = "systemd"
Now I want to prevent the "unused" init system (in this case sysvinit) from being added to the rootfs.
Therefore I tried something like this inside my *distro.conf*:
DISTRO_FEATURES_BACKFILL_CONSIDERED = "${@bb.utils.contains('REQUIRED_DISTRO_FEATURES', 'systemd', 'sysvinit', '', d)}"
As expected, this leads into the following. So far so good:
$ bitbake image-systemd -e | grep DISTRO_FEATURES_BACKFILL_CONSIDERED=
DISTRO_FEATURES_BACKFILL_CONSIDERED="sysvinit"
But the final rootfs still contains sysvinit scripts (/etc/init.d/*)
Now the strange thing:
If I instead do this inside my *distro.conf*, /etc/init.d is not being created, exactly as I wanted:
DISTRO_FEATURES_BACKFILL_CONSIDERED="sysvinit"
So I don't really understand why this solution doesn't work.
Any help would be appreciated.
Thanks and Regards,
Stefan

Join {yocto@lists.yoctoproject.org to automatically receive all group messages.