diff options
| author | Marek Vasut <marex@denx.de> | 2025-01-21 22:20:52 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-01-22 13:20:29 +0000 |
| commit | 3fb215a3af242e2016a146739a69be746ab8b722 (patch) | |
| tree | 2d98520e45238acd68d6a9611b86a11786c85c0a /meta/conf | |
| parent | 310f9cd967f81869b27c4542a0015cf76c3e2c84 (diff) | |
| download | poky-3fb215a3af242e2016a146739a69be746ab8b722.tar.gz | |
u-boot: kernel-fitimage: Fix dependency loop if UBOOT_SIGN_ENABLE and UBOOT_ENV enabled
In case both UBOOT_SIGN_ENABLE and UBOOT_ENV are enabled and
kernel-fitimage.bbclass is in use to generate signed kernel
fitImage, there is a circular dependency between uboot-sign
and kernel-fitimage bbclasses . The loop looks like this:
kernel-fitimage.bbclass:
- do_populate_sysroot depends on do_assemble_fitimage
- do_assemble_fitimage depends on virtual/bootloader:do_populate_sysroot
- virtual/bootloader:do_populate_sysroot depends on virtual/bootloader:do_install
=> The virtual/bootloader:do_install installs and the
virtual/bootloader:do_populate_sysroot places into
sysroot an U-Boot environment script embedded into
kernel fitImage during do_assemble_fitimage run .
uboot-sign.bbclass:
- DEPENDS on KERNEL_PN, which is really virtual/kernel. More accurately
- do_deploy depends on do_uboot_assemble_fitimage
- do_install depends on do_uboot_assemble_fitimage
- do_uboot_assemble_fitimage depends on virtual/kernel:do_populate_sysroot
=> do_install depends on virtual/kernel:do_populate_sysroot
=> virtual/bootloader:do_install depends on virtual/kernel:do_populate_sysroot
virtual/kernel:do_populate_sysroot depends on virtual/bootloader:do_install
Attempt to resolve the loop. Pull fitimage configuration options into separate
new configuration file image-fitimage.conf so these configuration options can
be shared by both uboot-sign.bbclass and kernel-fitimage.bbclass, and make use
of mkimage -f auto-conf / mkimage -f auto option to insert /signature node key-*
subnode into U-Boot control DT without depending on the layout of kernel fitImage
itself. This is perfectly valid to do, because the U-Boot /signature node key-*
subnodes 'required' property can contain either of two values, 'conf' or 'image'
to authenticate either selected configuration or all of images when booting the
fitImage.
For details of the U-Boot fitImage signing process, see:
https://docs.u-boot.org/en/latest/usage/fit/signature.html
For details of mkimage -f auto-conf and -f auto, see:
https://manpages.debian.org/experimental/u-boot-tools/mkimage.1.en.html#EXAMPLES
Fixes: 5e12dc911d0c ("u-boot: Rework signing to remove interdependencies")
Reviewed-by: Adrian Freihofer <adrian.freihofer@siemens.com>
(From OE-Core rev: 259bfa86f384206f0d0a96a5b84887186c5f689e)
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/conf')
| -rw-r--r-- | meta/conf/image-fitimage.conf | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/conf/image-fitimage.conf b/meta/conf/image-fitimage.conf new file mode 100644 index 0000000000..be9ae30134 --- /dev/null +++ b/meta/conf/image-fitimage.conf | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | # Possible options for fitImage generation, mainly | ||
| 2 | # related to signing of the fitImage content. | ||
| 3 | |||
| 4 | # Description string | ||
| 5 | FIT_DESC ?= "Kernel fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}" | ||
| 6 | |||
| 7 | # Kernel fitImage Hash Algo | ||
| 8 | FIT_HASH_ALG ?= "sha256" | ||
| 9 | |||
| 10 | # Kernel fitImage Signature Algo | ||
| 11 | FIT_SIGN_ALG ?= "rsa2048" | ||
| 12 | |||
| 13 | # Kernel / U-Boot fitImage Padding Algo | ||
| 14 | FIT_PAD_ALG ?= "pkcs-1.5" | ||
| 15 | |||
| 16 | # Generate keys for signing Kernel fitImage | ||
| 17 | FIT_GENERATE_KEYS ?= "0" | ||
| 18 | |||
| 19 | # Size of private keys in number of bits | ||
| 20 | FIT_SIGN_NUMBITS ?= "2048" | ||
| 21 | |||
| 22 | # args to openssl genrsa (Default is just the public exponent) | ||
| 23 | FIT_KEY_GENRSA_ARGS ?= "-F4" | ||
| 24 | |||
| 25 | # args to openssl req (Default is -batch for non interactive mode and | ||
| 26 | # -new for new certificate) | ||
| 27 | FIT_KEY_REQ_ARGS ?= "-batch -new" | ||
| 28 | |||
| 29 | # Standard format for public key certificate | ||
| 30 | FIT_KEY_SIGN_PKCS ?= "-x509" | ||
| 31 | |||
| 32 | # Sign individual images as well | ||
| 33 | FIT_SIGN_INDIVIDUAL ?= "0" | ||
| 34 | |||
| 35 | FIT_CONF_PREFIX ?= "conf-" | ||
| 36 | FIT_CONF_PREFIX[doc] = "Prefix to use for FIT configuration node name" | ||
| 37 | |||
| 38 | FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio" | ||
| 39 | |||
| 40 | # Allow user to select the default DTB for FIT image when multiple dtb's exists. | ||
| 41 | FIT_CONF_DEFAULT_DTB ?= "" | ||
| 42 | |||
| 43 | # length of address in number of <u32> cells | ||
| 44 | # ex: 1 32bits address, 2 64bits address | ||
| 45 | FIT_ADDRESS_CELLS ?= "1" | ||
| 46 | |||
| 47 | # Keys used to sign individually image nodes. | ||
| 48 | # The keys to sign image nodes must be different from those used to sign | ||
| 49 | # configuration nodes, otherwise the "required" property, from | ||
| 50 | # UBOOT_DTB_BINARY, will be set to "conf", because "conf" prevails on "image". | ||
| 51 | # Then the images signature checking will not be mandatory and no error will be | ||
| 52 | # raised in case of failure. | ||
| 53 | # UBOOT_SIGN_IMG_KEYNAME = "dev2" # keys name in keydir (eg. "dev2.crt", "dev2.key") | ||
