0

I would like to change the init system on a per-image basis. I have created a sample image as pointed out here. This works well, but I also want to remove the unused init system (in this case SysVinit) from rootfs.

Therefore I tried something like this inside my distro config: (REQUIRED_DISTRO_FEATURES = "systemd" is set inside my image.bb)

DISTRO_FEATURES_BACKFILL_CONSIDERED = "${@bb.utils.contains('REQUIRED_DISTRO_FEATURES', 'systemd', 'sysvinit', '', d)}"

Finally it results into this, exactly what I expect:

$ bitbake sample-image-systemd -e | grep DISTRO_FEATURES_BACKFILL_CONSIDERED=
DISTRO_FEATURES_BACKFILL_CONSIDERED="sysvinit"

So far so good. But the final rootfs still contains sysvinit scripts (/etc/init.d/*)

If I do the following inside my distro config everything works well and /etc/init.d is not created:

DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"

So I don't really understand the difference and why my solution doesn't work.

Stefan
  • 1
  • 1

1 Answers1

0

The difference is that that systemd recipe does not have a dependency to your recipe which is good because if it had it would be a circular dependency. So, variables defined in your recipe are not expanded or accessible by the systemd recipe

Now to better explain this you can run the following command.

$ bitbake systemd -e | grep DISTRO_FEATURES_BACKFILL_CONSIDERED=

The result should be

DISTRO_FEATURES_BACKFILL_CONSIDERED=""

This happens because the sample-image-systemd recipe variables are not expanded and used while you are building/packaging/etc the systemd recipe. To make a variable global or accessible by all recipes you should add it to your distro config or your local config.

Falital
  • 177
  • 5