We’re managing a distro layer which supports several targets, primarily qemu and Raspberry Pi 3. We have a single set of layers which are always enabled and the target is selected using the MACHINE variable as is usual when using Yocto Project. We also need to be enable to enable or disable Mender support as an IMAGE_FEATURE or DISTRO_FEATURE.
The meta-raspberrypi BSP layer is an example of what should happen here. We can always include the meta-raspberrypi layer and it does not force us to build for a Raspberry Pi target, we can still successfully build for a qemu target. The behaviour of the qemu images is not changed by meta-raspberrypi.
The Mender meta-mender-raspberrypi layer causes problems for us though - this layer forcibly changes
MENDER_FEATURES_DISABLE. Unconditionally disabling
mender-grub prevents us from building for targets that use grub (such as qemu). Unconditionally enabling
mender-image-sd leads to a long list of errors if the
mender-image feature isn’t also enabled.
To fix this the meta-mender-raspberrypi layer should only modify these variables if the underlying
mender-image feature is already enabled and the target MACHINE is actually a Raspberry Pi device.