Hello @Mowlwurf,
In this case, you cannot run bitbake foo-extra
since foo-extra is not a standalone recipe. It is a subpackage of the main recipe foo
. I got a reference minimal image (BSP 7) build working with your requirements for installing conditional systemd services.
I created a new layer called meta-customer
for this:
meta-customer
├── conf
│ └── layer.conf
├── COPYING.MIT
├── README
└── recipes-foo
└── foo
├── files
│ ├── bar.service
│ └── foo.service
└── foo_1.0.bb
I modified my recipe for foo as follows:
SUMMARY = "example recipe"
PR = "r0"
DESCRIPTION = "Recipe created by bitbake-layers"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI += "file://foo.service"
SRC_URI += "file://bar.service"
inherit systemd
do_install() {
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/foo.service ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/bar.service ${D}${systemd_unitdir}/system/
}
# Define systemd support
SYSTEMD_PACKAGES = "${PN} ${PN}-extra"
SYSTEMD_SERVICE:${PN} = "foo.service"
SYSTEMD_SERVICE:${PN}-extra = "bar.service"
SYSTEMD_AUTO_ENABLE:${PN}-extra = "disable"
PACKAGES += "${PN}-extra"
FILES:${PN}-extra = "${systemd_unitdir}/system/bar.service"
FILES:${PN} += "${systemd_unitdir}/system/foo.service"
Next, you need to include foo
and foo-extra
packages in your image by adding the following in your build/conf/local.conf
file:
IMAGE_INSTALL:append = " foo"
IMAGE_INSTALL:append = " foo-extra"
After this, you can test by rebuilding your package and image:
bitbake -c clean foo
bitbake foo
bitbake tdx-reference-minimal-image
Let me know how it goes if you get a chance to test this.