openembedded / meta-openembedded

MIT License
415 stars 719 forks source link

fitimage: add support to build arbitrary FIT images #882

Closed ejoerns closed 1 month ago

ejoerns commented 1 month ago

The FIT image support in OE is quite limited: 1) No support to build an arbitrary number of FIT images since the FIT image generation is tightly coupled to the kernel image. 2) A lot of U_BOOT-specific variables which may not be necessary for other bootloaders. 3) No usage of the meta-oe signing.bbclass for signed FIT images.

This alternative class is added to solve the above-mentioned problems: 1) The class can be inherited by an arbitrary number of <fit-image-name>.bb recipes to generate FIT images 2) No U_BOOT-specific variables are used 3) <fit-image-name>.bb recipes can prepend the do_fitimage() to provide the key using the signing.bbclass e.g.:

    do_fitimage:prepend() {
        signing_prepare
        signing_use_role "${FITIMAGE_SIGNING_KEY_ROLE}"
    }

Then enable and configure signing as follows:

    FITIMAGE_SIGN = "1"
    FITIMAGE_MKIMAGE_EXTRA_ARGS = "--engine pkcs11"
    FITIMAGE_SIGN_KEYDIR = "${PKCS11_URI}

This class is inspired by the meta-phytec fitimage.bbclass [1].

[1] https://git.phytec.de/meta-phytec/tree/classes/fitimage.bbclass

ejoerns commented 1 month ago

Added FITIMAGE_CONFIG_PREFIX ?= "conf-"as prefix for configuration sections to better align with the oe-core pendant to ease migration if desired.

kraj commented 1 month ago

applied with b20be52a4e