From patchwork Thu Dec 3 14:30:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 107208 Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net [185.136.64.228]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15048.1796308258496549749 for ; Thu, 03 Dec 2026 06:30:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm1 header.b=STNvwF33; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.228, mailfrom: fm-1329275-202612031430557493ffc824000207c7-hor8tc@rts-flowmailer.siemens.com) Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 202612031430557493ffc824000207c7 for ; Thu, 03 Dec 2026 15:30:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=adrian.freihofer@siemens.com; h=from:from:sender:to:to:cc:cc:subject:subject:content-type:content-transfer-encoding:content-transfer-encoding:References:In-Reply-To:Date:Message-ID:MIME-Version; bh=EjBrjIE0KdKXOm8roeF4t+MEUzQUObStyo1CxSTuQBc=; b=STNvwF33xsd/yORw7FcM8ybmeZHM/0ua8xOo/XISBhESBQ+kIx44PXAqCW4gHsh6gG/yE3 ZPI3jB2ltjd3zmVqm8DNQgUDvk4Iyf9Wr4mgdZqDEQJeBC95MM/NHL8oacPZsRZaZkoWaKEB K3KPB1yHgWZM56jfdki4DCEXCWutseHw8A0UiNIcvavuhRO/BSHJbPUmoSwseCbO2m6UNyOA HcXB6paYstuaKU5WIuB7QVHQVdiDHMZ2aCN9pW3lh9mKypgdMxuR4+KonK1A1cUbBPhqzfQI cYxabIrsSh9Brhre9cJ4h4H3GmoRE/9n/AF5CBvbcL5lxnVTM9828r8A==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: marex@nabladev.com, Adrian Freihofer Subject: [PATCH 1/8] oe.fitimage: drop unused runCmd import Date: Thu, 3 Dec 2026 15:30:04 +0100 Message-ID: <20261203143044.592073-2-adrian.freihofer@siemens.com> In-Reply-To: <20261203143044.592073-1-adrian.freihofer@siemens.com> References: <20261203143044.592073-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 14:31:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251903 From: Adrian Freihofer runCmd from oeqa.utils.commands has never been used by the library code. Importing the oeqa test framework from a library which is used at build time is not needed. Signed-off-by: Adrian Freihofer --- meta/lib/oe/fitimage.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/meta/lib/oe/fitimage.py b/meta/lib/oe/fitimage.py index dec1da79ff..f2f4b9055b 100644 --- a/meta/lib/oe/fitimage.py +++ b/meta/lib/oe/fitimage.py @@ -10,8 +10,6 @@ import shlex import subprocess import bb -from oeqa.utils.commands import runCmd - class ItsNode: INDENT_SIZE = 8 From patchwork Thu Dec 3 14:30:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 107211 Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15049.1796308258506931461 for ; Thu, 03 Dec 2026 06:30:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm1 header.b=WOFF/XNd; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.226, mailfrom: fm-1329275-2026120314305502b277467300020752-maizan@rts-flowmailer.siemens.com) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 2026120314305502b277467300020752 for ; Thu, 03 Dec 2026 15:30:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=adrian.freihofer@siemens.com; h=from:from:sender:to:to:cc:cc:subject:subject:content-type:content-transfer-encoding:content-transfer-encoding:References:In-Reply-To:Date:Message-ID:MIME-Version; bh=xGAVTx1I1uU+mXLL77cylu2TEPveGcmSgAU+hFofSVs=; b=WOFF/XNdKZAeMwQB0KF8n3bGh8bJHqAEeLSrltGYCLwAnkZzJuHUuQ5pHg4eH+B9irpcPH I85x63aHINv46ODi4+4UgthiXnSrXgHU5mBwMeTp14LSNMulsbXj6UzyQ1EG2dzj0GMWdQGZ TDffZkiXT5UnPi7c8e2403G7tT5BajomMjbpc/qF549TrLfoZ94c4905Voircf+qfQdM/YfR PCY1kMf2pN0JU6irFGCs5ThibjQZ2GlojkSCQBIYCWWvhCMRX7TJtqVBa+EP+B06Y7noL57Z ctaBrHkDe7s/6VjX8z4XZ17JSSejPvXkmNBgL1P4tiDZ/r1XzNGc9cew==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: marex@nabladev.com, Adrian Freihofer Subject: [PATCH 2/8] lib/oe: add fitimage to BBIMPORTS Date: Thu, 3 Dec 2026 15:30:05 +0100 Message-ID: <20261203143044.592073-3-adrian.freihofer@siemens.com> In-Reply-To: <20261203143044.592073-1-adrian.freihofer@siemens.com> References: <20261203143044.592073-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 14:31:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251898 From: Adrian Freihofer The code of oe.fitimage was not part of the task hash of the kernel-fit-image do_compile task. A change of the generated its file or of the mkimage calls did not trigger a rebuild of the FIT image and an outdated FIT image could be restored from sstate. Add fitimage to BBIMPORTS. Then the code parser scans the functions and classes of the module and the ones used by do_compile become task dependencies. The code parser only detects classes which are called, but not base classes. The ItsNode base class implements the emit function which writes the its file. Add it explicitly to the vardeps of do_compile. oe.fitimage does not access the datastore. All variables are read in do_compile and passed as arguments. Hence no new variable dependencies are added. Tested with bitbake -S none linux-yocto-fitimage. The do_compile signature changes after modifying ItsNode, ItsNodeRootKernel or symlink_points_below and is restored after reverting the modification. Signed-off-by: Adrian Freihofer --- meta/classes-recipe/kernel-fit-image.bbclass | 2 ++ meta/lib/oe/__init__.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/meta/classes-recipe/kernel-fit-image.bbclass b/meta/classes-recipe/kernel-fit-image.bbclass index 0c8dac23ee..c167fc8c64 100644 --- a/meta/classes-recipe/kernel-fit-image.bbclass +++ b/meta/classes-recipe/kernel-fit-image.bbclass @@ -216,6 +216,8 @@ python do_compile() { root_node.run_mkimage_sign(fitname) } do_compile[depends] += "virtual/kernel:do_deploy" +# Base classes are not detected by the code parser, only called classes are +do_compile[vardeps] += "oe.fitimage.ItsNode" do_install() { install -d "${D}/${KERNEL_IMAGEDEST}" diff --git a/meta/lib/oe/__init__.py b/meta/lib/oe/__init__.py index 1e47934e6f..fcef7c5747 100644 --- a/meta/lib/oe/__init__.py +++ b/meta/lib/oe/__init__.py @@ -12,4 +12,4 @@ __path__ = extend_path(__path__, __name__) BBIMPORTS = ["qa", "data", "path", "utils", "types", "package", "packagedata", \ "packagegroup", "sstatesig", "lsb", "cachedpath", "license", "qemu", \ "reproducible", "rust", "buildcfg", "go", "spdx30_tasks", "spdx_common", \ - "cve_check", "tune", "classextend", "purl", "kernel", "kernel_module", "sanity"] + "cve_check", "tune", "classextend", "purl", "kernel", "kernel_module", "sanity", "fitimage"] From patchwork Thu Dec 3 14:30:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 107207 Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net [185.136.64.228]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.15324.1796308258583697197 for ; Thu, 03 Dec 2026 06:30:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm1 header.b=jPRAECrN; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.228, mailfrom: fm-1329275-2026120314305591bf53ff3e00020705-mvooaz@rts-flowmailer.siemens.com) Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 2026120314305591bf53ff3e00020705 for ; Thu, 03 Dec 2026 15:30:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=adrian.freihofer@siemens.com; h=from:from:sender:to:to:cc:cc:subject:subject:content-type:content-transfer-encoding:content-transfer-encoding:References:In-Reply-To:Date:Message-ID:MIME-Version; bh=1ocV8yaq0j63SrP+1O2XP19KeuRtcXek8PUC4VFFVhw=; b=jPRAECrNzE9fl6WlTglSx34uI9NlzZmpH9O2+/sM+pScl4ZQo6T07Yd+SKYhDO6JcT5zPD kCUrd233P6YreeEwCP97fKCpPE01YsQ2MjjLGXlVs3+UDkekNywT0oz5LWudEyRKp5PcsHqN /0aTXSt7yp64tivcVJy9qYhUYCjhPDG3jm+0eio5cG/7g0fYteVyg3WfB/3YCR2ix0LtYKoo CbvC292jlO/4/9LB/FlW92UsafuCwra1ZgWVmi9fT8R0urTg1wn9q3XK/AzXNSQOUkeoi4vw BbzZTuuIVVqAp9zz2FLGQUTv5YIcYML3AUo8m+PSU7yOZGXMAetMA0KA==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: marex@nabladev.com, Adrian Freihofer Subject: [PATCH 3/8] oe-selftest: fitimage: avoid overlapping load regions in initramfs bundle test Date: Thu, 3 Dec 2026 15:30:06 +0100 Message-ID: <20261203143044.592073-4-adrian.freihofer@siemens.com> In-Reply-To: <20261203143044.592073-1-adrian.freihofer@siemens.com> References: <20261203143044.592073-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 14:31:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251905 From: Adrian Freihofer test_fit_image_sign_initramfs_bundle loads the kernel at 0x80000000 and the DTB at 0x82000000. With the bundled initramfs the qemuarm64 kernel is about 40 MiB and overlaps the DTB: kernel-1: [0x80000000 - 0x82773200] fdt-foundation-v8.dtb: [0x82000000 - 0x820014a7] Such a FIT image would corrupt the DTB when booted. Newer mkimage detects this since U-Boot commit 21bb6417641c ("tools: mkimage: detect overlapping load regions in FIT configurations") and fails. Load the DTB at 0x88000000 to leave 128 MiB for the kernel. Signed-off-by: Adrian Freihofer --- meta/lib/oeqa/selftest/cases/fitimage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py index 5db1f0940a..7e39d60929 100644 --- a/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/meta/lib/oeqa/selftest/cases/fitimage.py @@ -1440,7 +1440,7 @@ UBOOT_SIGN_KEYNAME = "qemuarmkey" UBOOT_SIGN_KEYDIR ?= "${DEPLOY_DIR_IMAGE}" UBOOT_ENTRYPOINT = "0x80000000" UBOOT_LOADADDRESS = "0x80000000" -UBOOT_DTB_LOADADDRESS = "0x82000000" +UBOOT_DTB_LOADADDRESS = "0x88000000" UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000" UBOOT_MKIMAGE_KERNEL_TYPE = "kernel" UBOOT_EXTLINUX = "0" From patchwork Thu Dec 3 14:30:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 107210 Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.15326.1796308258760458571 for ; Thu, 03 Dec 2026 06:30:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm1 header.b=g8zU4rd3; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-1329275-2026120314305683d0b06de7000207a9-ndbmkj@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 2026120314305683d0b06de7000207a9 for ; Thu, 03 Dec 2026 15:30:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=adrian.freihofer@siemens.com; h=from:from:sender:to:to:cc:cc:subject:subject:content-type:content-transfer-encoding:content-transfer-encoding:References:In-Reply-To:Date:Message-ID:MIME-Version; bh=SvKWpZ7wmCxQBaMIwjLh8YmIR661/VrMPZr8qCCfe/0=; b=g8zU4rd3FkrWXiEljroToSrtY/LKmSLrrwElNIiMzXt0HCbGLkOufUDgeZOLQ/WLkNnDDr zI5Yp1NXuA3SncHJP+QQDa+3YE/xHf59Bp9+MSo+kcDzTrmPyKyShHf0K9Oxeg5G3US0vQf+ R31qAf14V2PQwWTmDN1FTM4MHlCo8oyPXjF7t4Z51Ht/Nsk+KFttBrtFi+wj7YWmJEa7Xznn VY0rDdCGCcYVY8QsArgjrmz7OwYhvCOGEFmh+bCL1qIrMhT056fokvM0IwzfDYYV8dEGxELa VE2ILKoKI0//AykVZD/7ppHMX0B6YcDcKvSioB5aboTKr9aKbHcj/wcQ==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: marex@nabladev.com, Adrian Freihofer Subject: [PATCH 4/8] conf/uboot.conf: move shared U-Boot defaults out of uboot-config Date: Thu, 3 Dec 2026 15:30:07 +0100 Message-ID: <20261203143044.592073-5-adrian.freihofer@siemens.com> In-Reply-To: <20261203143044.592073-1-adrian.freihofer@siemens.com> References: <20261203143044.592073-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 14:31:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251901 From: Adrian Freihofer kernel-fit-image.bbclass inherits uboot-config only for a few mkimage, load address and signing defaults, which also pulls in the U-Boot build configuration logic (UBOOT_CONFIG handling and its sanity checks). Move those defaults unchanged into conf/uboot.conf, required by both uboot-config.bbclass and kernel-fit-image.bbclass, and drop the uboot-config inherit from kernel-fit-image. No change for U-Boot recipes. Kernel FIT recipes no longer get the remaining uboot-config defaults or run its anonymous python; none of these are used by kernel-fit-image. Signed-off-by: Adrian Freihofer --- meta/classes-recipe/kernel-fit-image.bbclass | 3 ++- meta/classes-recipe/uboot-config.bbclass | 21 +--------------- meta/conf/uboot.conf | 26 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 21 deletions(-) create mode 100644 meta/conf/uboot.conf diff --git a/meta/classes-recipe/kernel-fit-image.bbclass b/meta/classes-recipe/kernel-fit-image.bbclass index c167fc8c64..3098573560 100644 --- a/meta/classes-recipe/kernel-fit-image.bbclass +++ b/meta/classes-recipe/kernel-fit-image.bbclass @@ -1,5 +1,6 @@ -inherit kernel-artifact-names uboot-config deploy +inherit kernel-artifact-names deploy +require conf/uboot.conf require conf/image-fitimage.conf S = "${UNPACKDIR}" diff --git a/meta/classes-recipe/uboot-config.bbclass b/meta/classes-recipe/uboot-config.bbclass index 5459430dee..e39d1bce7f 100644 --- a/meta/classes-recipe/uboot-config.bbclass +++ b/meta/classes-recipe/uboot-config.bbclass @@ -45,9 +45,6 @@ def removesuffix(s, suffix): return s[:-len(suffix)] return s -UBOOT_ENTRYPOINT ?= "0x20008000" -UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}" - # When naming the files we install/deploy, the package version and revision # are part of the filename. Create a single variable to represent this and # allow it to be customized if desired. @@ -112,28 +109,12 @@ UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux" UBOOT_EXTLINUX_CONF_NAME ?= "extlinux.conf" UBOOT_EXTLINUX_SYMLINK ?= "${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}-${UBOOT_VERSION}" -# Options for the device tree compiler passed to mkimage '-D' feature: -UBOOT_MKIMAGE_DTCOPTS ??= "" -SPL_MKIMAGE_DTCOPTS ??= "" - -# mkimage command -UBOOT_MKIMAGE ?= "uboot-mkimage" -UBOOT_MKIMAGE_SIGN ?= "${UBOOT_MKIMAGE}" - -# Signature activation -UBOOT_SIGN_ENABLE ?= "0" - -# Arguments passed to mkimage for signing -UBOOT_MKIMAGE_SIGN_ARGS ?= "" -SPL_MKIMAGE_SIGN_ARGS ?= "" +require conf/uboot.conf # Options to deploy the u-boot device tree UBOOT_DTB ?= "" UBOOT_DTB_BINARY ??= "" -# uboot-fit_check_sign command -UBOOT_FIT_CHECK_SIGN ?= "uboot-fit_check_sign" - python () { if bb.utils.to_boolean(d.getVar('UBOOT_INITIAL_ENV_BINARY')) and d.getVar('UBOOT_INITIAL_ENV_BINARY_SIZE') == "": bb.fatal("UBOOT_INITIAL_ENV_BINARY requires setting the U-Boot partition environment size with the UBOOT_INITIAL_ENV_BINARY_SIZE variable") diff --git a/meta/conf/uboot.conf b/meta/conf/uboot.conf new file mode 100644 index 0000000000..ef71edc3d1 --- /dev/null +++ b/meta/conf/uboot.conf @@ -0,0 +1,26 @@ +# Variables shared by U-Boot and FIT image generation. +# Required by uboot-config.bbclass and by classes and recipes that need these +# defaults without the U-Boot build logic, e.g. kernel-fit-image.bbclass. + +# Default kernel load address and entry point for FIT images. +# Machine configurations typically override these in their .conf files. +UBOOT_ENTRYPOINT ?= "0x20008000" +UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}" + +# Options for the device tree compiler passed to mkimage '-D' feature: +UBOOT_MKIMAGE_DTCOPTS ??= "" +SPL_MKIMAGE_DTCOPTS ??= "" + +# mkimage command +UBOOT_MKIMAGE ?= "uboot-mkimage" +UBOOT_MKIMAGE_SIGN ?= "${UBOOT_MKIMAGE}" + +# Signature activation +UBOOT_SIGN_ENABLE ?= "0" + +# Arguments passed to mkimage for signing +UBOOT_MKIMAGE_SIGN_ARGS ?= "" +SPL_MKIMAGE_SIGN_ARGS ?= "" + +# uboot-fit_check_sign command +UBOOT_FIT_CHECK_SIGN ?= "uboot-fit_check_sign" From patchwork Thu Dec 3 14:30:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 107209 Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15053.1796308258763673913 for ; Thu, 03 Dec 2026 06:30:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm1 header.b=HxaH8vka; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-1329275-20261203143056d849019a9300020794-76f7lz@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 20261203143056d849019a9300020794 for ; Thu, 03 Dec 2026 15:30:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=adrian.freihofer@siemens.com; h=from:from:sender:to:to:cc:cc:subject:subject:content-type:content-transfer-encoding:content-transfer-encoding:References:In-Reply-To:Date:Message-ID:MIME-Version; bh=SmLTD9oCxc88TZ8+cBBdtR/Vmv22cQBVACnneIgXYyc=; b=HxaH8vka352NsfAvKiFy+856WSCQLi6YoBR5YKYLHpGEUjvKOue6UPq9aKXPrQEQEvSfaM qKWEHIKOfNvVckPajwrL2U4P6j1g7DBw5ZPU7MDzPi1jPrKsjie+8uxidnbOR3t06QvzxzTx cRRUD2Z1Ie95eBZr6mWh2khEmtNkZ7Z7+dsgWfb31vW6PTrsFlVOvgn5niAEJvofJuvlA7Tb xI4kDcrdglGybHkOqrmBER5V75sEahUsLqPzZqweoFaAelxdedcrEu8/l6A7H8D/gYx96l8O yM2cS0hfiYc16lj3LnnEC1rQ6Ssxzg42KPcr/dogr178Pqs4kq6Z1aiw==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: marex@nabladev.com, Adrian Freihofer Subject: [PATCH 5/8] uboot.conf, image-fitimage.conf: add FIT signing key name defaults Date: Thu, 3 Dec 2026 15:30:08 +0100 Message-ID: <20261203143044.592073-6-adrian.freihofer@siemens.com> In-Reply-To: <20261203143044.592073-1-adrian.freihofer@siemens.com> References: <20261203143044.592073-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 14:31:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251904 From: Adrian Freihofer UBOOT_SIGN_KEYNAME and UBOOT_SIGN_IMG_KEYNAME had no default, so signing without setting them used an empty key name. Default them to "fit-conf-key" and "fit-img-key" in conf/uboot.conf, so U-Boot, the kernel and kernel-signing-keys-native all agree on the key names. Move the FIT_KERNEL_SIGN_* defaults from kernel-fit-image.bbclass to conf/image-fitimage.conf and require conf/uboot.conf in kernel-signing-keys-native, so the key recipe sees the same values as the kernel. Add FIT_KERNEL_SIGN_IMG_KEYNAME, used by the kernel instead of UBOOT_SIGN_IMG_KEYNAME, so the kernel's image key can be set independently of U-Boot. The selftests now read the FIT_KERNEL_SIGN_* variables, which are what kernel-fit-image actually uses. Signed-off-by: Adrian Freihofer --- meta/classes-recipe/kernel-fit-image.bbclass | 6 +---- meta/conf/image-fitimage.conf | 8 ++++++ meta/conf/uboot.conf | 8 ++++++ meta/lib/oeqa/selftest/cases/fitimage.py | 27 ++++++++++--------- .../kernel-signing-keys-native.bb | 1 + 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/meta/classes-recipe/kernel-fit-image.bbclass b/meta/classes-recipe/kernel-fit-image.bbclass index 3098573560..6cfb049b9b 100644 --- a/meta/classes-recipe/kernel-fit-image.bbclass +++ b/meta/classes-recipe/kernel-fit-image.bbclass @@ -51,10 +51,6 @@ INITRAMFS_DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR_IMAGE}" UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel" KERNEL_IMAGEDEST ?= "/boot" -FIT_KERNEL_SIGN_ENABLE ?= "${UBOOT_SIGN_ENABLE}" -FIT_KERNEL_SIGN_KEYNAME ?= "${UBOOT_SIGN_KEYNAME}" -FIT_KERNEL_SIGN_KEYDIR ?= "${UBOOT_SIGN_KEYDIR}" - def apply_dtbvendored(d,dtb): if d.getVar('KERNEL_DTBVENDORED') != "1": mapped_name = os.path.basename(dtb) @@ -84,7 +80,7 @@ python do_compile() { d.getVar("UBOOT_MKIMAGE_SIGN"), d.getVar("UBOOT_MKIMAGE_SIGN_ARGS"), d.getVar('FIT_HASH_ALG'), d.getVar('FIT_SIGN_ALG'), d.getVar('FIT_PAD_ALG'), d.getVar('FIT_KERNEL_SIGN_KEYNAME'), - oe.types.boolean(d.getVar('FIT_SIGN_INDIVIDUAL')), d.getVar('UBOOT_SIGN_IMG_KEYNAME') + oe.types.boolean(d.getVar('FIT_SIGN_INDIVIDUAL')), d.getVar('FIT_KERNEL_SIGN_IMG_KEYNAME') ) # Prepare a kernel image section. diff --git a/meta/conf/image-fitimage.conf b/meta/conf/image-fitimage.conf index 24a2458cc9..e712e8bae5 100644 --- a/meta/conf/image-fitimage.conf +++ b/meta/conf/image-fitimage.conf @@ -32,6 +32,14 @@ FIT_KEY_SIGN_PKCS ?= "-x509" # Sign individual images as well FIT_SIGN_INDIVIDUAL ?= "0" +# Kernel FIT image signing: these mirror the U-Boot signing variables so that +# kernel recipes can independently enable/override signing without affecting +# the U-Boot recipe's own UBOOT_SIGN_* settings. +FIT_KERNEL_SIGN_ENABLE ?= "${UBOOT_SIGN_ENABLE}" +FIT_KERNEL_SIGN_KEYNAME ?= "${UBOOT_SIGN_KEYNAME}" +FIT_KERNEL_SIGN_IMG_KEYNAME ?= "${UBOOT_SIGN_IMG_KEYNAME}" +FIT_KERNEL_SIGN_KEYDIR ?= "${UBOOT_SIGN_KEYDIR}" + FIT_CONF_PREFIX ?= "conf-" FIT_CONF_PREFIX[doc] = "Prefix to use for FIT configuration node name" diff --git a/meta/conf/uboot.conf b/meta/conf/uboot.conf index ef71edc3d1..01e0b6cc7e 100644 --- a/meta/conf/uboot.conf +++ b/meta/conf/uboot.conf @@ -18,6 +18,14 @@ UBOOT_MKIMAGE_SIGN ?= "${UBOOT_MKIMAGE}" # Signature activation UBOOT_SIGN_ENABLE ?= "0" +# Base name of the key pair used to sign FIT configuration nodes +# (files: /.key and .crt). +UBOOT_SIGN_KEYNAME ?= "fit-conf-key" + +# Base name of the key pair used to sign individual image nodes +# (FIT_SIGN_INDIVIDUAL = "1" only). +UBOOT_SIGN_IMG_KEYNAME ?= "fit-img-key" + # Arguments passed to mkimage for signing UBOOT_MKIMAGE_SIGN_ARGS ?= "" SPL_MKIMAGE_SIGN_ARGS ?= "" diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py index 7e39d60929..0180a3c962 100644 --- a/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/meta/lib/oeqa/selftest/cases/fitimage.py @@ -711,6 +711,9 @@ class KernelFitImageBase(FitImageTestCase): 'UBOOT_FIT_TEE_IMAGE', 'UBOOT_FIT_TEE_LOADADDRESS', 'UBOOT_FIT_TEE_ENTRYPOINT', + 'FIT_KERNEL_SIGN_ENABLE', + 'FIT_KERNEL_SIGN_KEYNAME', + 'FIT_KERNEL_SIGN_IMG_KEYNAME', } bb_vars, bb_flags = get_bb_vars_flags([*internal_used, *additional_vars], flags, self.kernel_recipe) bb_vars = {var: val or None for var, val in bb_vars.items()} @@ -806,7 +809,7 @@ class KernelFitImageBase(FitImageTestCase): initramfs_image = bb_vars['INITRAMFS_IMAGE'] initramfs_image_bundle = bb_vars['INITRAMFS_IMAGE_BUNDLE'] loadables = FitImageTestCase._get_loadables(bb_vars) - uboot_sign_enable = bb_vars.get('UBOOT_SIGN_ENABLE') + uboot_sign_enable = bb_vars.get('FIT_KERNEL_SIGN_ENABLE') # image nodes images = ['kernel-1'] @@ -957,7 +960,7 @@ class KernelFitImageBase(FitImageTestCase): def _get_req_sigvalues_config(self, bb_vars): """Generate a dictionary of expected configuration signature nodes""" - if bb_vars.get('UBOOT_SIGN_ENABLE') != "1": + if bb_vars.get('FIT_KERNEL_SIGN_ENABLE') != "1": return {} sign_images = '"kernel"' dtb_files, _ = FitImageTestCase._get_dtb_files(bb_vars) @@ -971,7 +974,7 @@ class KernelFitImageBase(FitImageTestCase): sign_images += ', "setup"' req_sigvalues_config = { 'algo': '"%s,%s"' % (bb_vars['FIT_HASH_ALG'], bb_vars['FIT_SIGN_ALG']), - 'key-name-hint': '"%s"' % bb_vars['UBOOT_SIGN_KEYNAME'], + 'key-name-hint': '"%s"' % bb_vars['FIT_KERNEL_SIGN_KEYNAME'], 'sign-images': sign_images, } return req_sigvalues_config @@ -982,7 +985,7 @@ class KernelFitImageBase(FitImageTestCase): return {} req_sigvalues_image = { 'algo': '"%s,%s"' % (bb_vars['FIT_HASH_ALG'], bb_vars['FIT_SIGN_ALG']), - 'key-name-hint': '"%s"' % bb_vars['UBOOT_SIGN_IMG_KEYNAME'], + 'key-name-hint': '"%s"' % bb_vars['FIT_KERNEL_SIGN_IMG_KEYNAME'], } return req_sigvalues_image @@ -996,9 +999,9 @@ class KernelFitImageBase(FitImageTestCase): initramfs_image = bb_vars['INITRAMFS_IMAGE'] initramfs_image_bundle = bb_vars['INITRAMFS_IMAGE_BUNDLE'] loadables = FitImageTestCase._get_loadables(bb_vars) - uboot_sign_enable = bb_vars['UBOOT_SIGN_ENABLE'] - uboot_sign_img_keyname = bb_vars['UBOOT_SIGN_IMG_KEYNAME'] - uboot_sign_keyname = bb_vars['UBOOT_SIGN_KEYNAME'] + uboot_sign_enable = bb_vars['FIT_KERNEL_SIGN_ENABLE'] + uboot_sign_img_keyname = bb_vars['FIT_KERNEL_SIGN_IMG_KEYNAME'] + uboot_sign_keyname = bb_vars['FIT_KERNEL_SIGN_KEYNAME'] num_signatures = 0 req_sections = { "kernel-1": { @@ -1080,7 +1083,7 @@ class KernelFitImageBase(FitImageTestCase): def _check_signing(self, bb_vars, sections, req_sections, num_signatures, uboot_tools_bindir, fitimage_path): """Verify the signature nodes in the FIT image""" - if bb_vars['UBOOT_SIGN_ENABLE'] == "1": + if bb_vars['FIT_KERNEL_SIGN_ENABLE'] == "1": self.logger.debug("Verifying signatures in the FIT image") else: self.logger.debug("FIT image is not signed. Signature verification is not needed.") @@ -1088,8 +1091,8 @@ class KernelFitImageBase(FitImageTestCase): fit_hash_alg = bb_vars['FIT_HASH_ALG'] fit_sign_alg = bb_vars['FIT_SIGN_ALG'] - uboot_sign_keyname = bb_vars['UBOOT_SIGN_KEYNAME'] - uboot_sign_img_keyname = bb_vars['UBOOT_SIGN_IMG_KEYNAME'] + uboot_sign_keyname = bb_vars['FIT_KERNEL_SIGN_KEYNAME'] + uboot_sign_img_keyname = bb_vars['FIT_KERNEL_SIGN_IMG_KEYNAME'] deploy_dir_image = bb_vars['DEPLOY_DIR_IMAGE'] kernel_deploysubdir = bb_vars['KERNEL_DEPLOYSUBDIR'] fit_sign_individual = bb_vars['FIT_SIGN_INDIVIDUAL'] @@ -1535,7 +1538,7 @@ class FitImagePyTests(KernelFitImageBase): 'UBOOT_MKIMAGE': "uboot-mkimage", 'UBOOT_MKIMAGE_SIGN': "uboot-mkimage", 'UBOOT_MKIMAGE_SIGN_ARGS': "", - 'UBOOT_SIGN_ENABLE': "0", + 'FIT_KERNEL_SIGN_ENABLE': "0", 'UBOOT_SIGN_KEYDIR': None, 'UBOOT_SIGN_KEYNAME': None, 'UBOOT_SIGN_IMG_KEYNAME': None, @@ -1557,7 +1560,7 @@ class FitImagePyTests(KernelFitImageBase): bb_vars["FIT_DESC"], bb_vars["FIT_ADDRESS_CELLS"], bb_vars['HOST_PREFIX'], bb_vars['UBOOT_ARCH'], bb_vars['FIT_OS'], bb_vars["FIT_CONF_PREFIX"], - oe.types.boolean(bb_vars['UBOOT_SIGN_ENABLE']), bb_vars["UBOOT_SIGN_KEYDIR"], + oe.types.boolean(bb_vars['FIT_KERNEL_SIGN_ENABLE']), bb_vars["UBOOT_SIGN_KEYDIR"], bb_vars["UBOOT_MKIMAGE"], bb_vars["UBOOT_MKIMAGE_DTCOPTS"], bb_vars["UBOOT_MKIMAGE_SIGN"], bb_vars["UBOOT_MKIMAGE_SIGN_ARGS"], bb_vars['FIT_HASH_ALG'], bb_vars['FIT_SIGN_ALG'], bb_vars['FIT_PAD_ALG'], diff --git a/meta/recipes-kernel/kernel-signing-keys/kernel-signing-keys-native.bb b/meta/recipes-kernel/kernel-signing-keys/kernel-signing-keys-native.bb index f346f1648a..4f066a1789 100644 --- a/meta/recipes-kernel/kernel-signing-keys/kernel-signing-keys-native.bb +++ b/meta/recipes-kernel/kernel-signing-keys/kernel-signing-keys-native.bb @@ -15,6 +15,7 @@ SUMMARY = "Signing keys for the kernel FIT image" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +require conf/uboot.conf require conf/image-fitimage.conf DEPENDS += "openssl-native" From patchwork Thu Dec 3 14:30:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 107206 Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15051.1796308258669786160 for ; Thu, 03 Dec 2026 06:30:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm1 header.b=F3b4iT6H; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.227, mailfrom: fm-1329275-2026120314305688cd9be15e0002075a-vqdhha@rts-flowmailer.siemens.com) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 2026120314305688cd9be15e0002075a for ; Thu, 03 Dec 2026 15:30:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=adrian.freihofer@siemens.com; h=from:from:sender:to:to:cc:cc:subject:subject:content-type:content-transfer-encoding:content-transfer-encoding:References:In-Reply-To:Date:Message-ID:MIME-Version; bh=eppzsc07tf2jPLiLHcOkN9AG0xZejG1vhSQWk70LXzs=; b=F3b4iT6H3cPc18427xSTc5UcU3tCu0sfETuGBLAQ8ofFjp6YTrlOOIRSpPv1Nhc3qTVo3h dpPrr+wyoyr2nkY4FukYMlAszwtbO+vR0PHV5IOfrwGwyvEkrsc2MA9N3Ef4SM0gmU8tJqdI vJwlgRawPGXjl8WVzBAntCiY7FSV6NmRmIY8o0dMaQyVWfm8wnCZVTJu6SDB+GuE1GiClFCy ljbDhUgJEwLqYYHY0I0LUxWNtah8vahg0djHRl2EXmL7Q3FV434C5JFhg651E7KGXMNPl7KT 9rrsVpMybFCz0BAd5jbNgKLeMfD4SaT6WDGn1BgdJwxRuOH6UydtXz6w==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: marex@nabladev.com, Adrian Freihofer Subject: [PATCH 6/8] u-boot-tools: install fdt_add_pubkey Date: Thu, 3 Dec 2026 15:30:09 +0100 Message-ID: <20261203143044.592073-7-adrian.freihofer@siemens.com> In-Reply-To: <20261203143044.592073-1-adrian.freihofer@siemens.com> References: <20261203143044.592073-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 14:31:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251897 From: Adrian Freihofer fdt_add_pubkey adds a public key from /.crt to a DTB without signing anything. It is built by cross_tools since U-Boot 2023.04 but was not installed. uboot-sign will use it to add the kernel FIT verification keys to the U-Boot DTB. Signed-off-by: Adrian Freihofer --- meta/recipes-bsp/u-boot/u-boot-tools.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meta/recipes-bsp/u-boot/u-boot-tools.inc b/meta/recipes-bsp/u-boot/u-boot-tools.inc index 738d843591..b94a360784 100644 --- a/meta/recipes-bsp/u-boot/u-boot-tools.inc +++ b/meta/recipes-bsp/u-boot/u-boot-tools.inc @@ -56,6 +56,10 @@ do_install () { install -m 0755 tools/fit_check_sign ${D}${bindir}/uboot-fit_check_sign ln -sf uboot-fit_check_sign ${D}${bindir}/fit_check_sign + # fdt_add_pubkey + install -m 0755 tools/fdt_add_pubkey ${D}${bindir}/uboot-fdt_add_pubkey + ln -sf uboot-fdt_add_pubkey ${D}${bindir}/fdt_add_pubkey + # mkeficapsule install -m 0755 tools/mkeficapsule ${D}${bindir}/uboot-mkeficapsule ln -sf uboot-mkeficapsule ${D}${bindir}/mkeficapsule @@ -63,7 +67,7 @@ do_install () { ALLOW_EMPTY:${PN} = "1" FILES:${PN} = "" -FILES:${PN}-mkimage = "${bindir}/uboot-mkimage ${bindir}/mkimage ${bindir}/uboot-dumpimage ${bindir}/dumpimage ${bindir}/uboot-fit_check_sign ${bindir}/fit_check_sign" +FILES:${PN}-mkimage = "${bindir}/uboot-mkimage ${bindir}/mkimage ${bindir}/uboot-dumpimage ${bindir}/dumpimage ${bindir}/uboot-fit_check_sign ${bindir}/fit_check_sign ${bindir}/uboot-fdt_add_pubkey ${bindir}/fdt_add_pubkey" FILES:${PN}-mkenvimage = "${bindir}/uboot-mkenvimage ${bindir}/mkenvimage" FILES:${PN}-mkeficapsule = "${bindir}/uboot-mkeficapsule ${bindir}/mkeficapsule" From patchwork Thu Dec 3 14:30:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 107213 Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net [185.136.64.225]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15052.1796308258693565343 for ; Thu, 03 Dec 2026 06:30:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm1 header.b=hcQ054+8; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.225, mailfrom: fm-1329275-20261203143056d271f1baaa00020798-utxz_d@rts-flowmailer.siemens.com) Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 20261203143056d271f1baaa00020798 for ; Thu, 03 Dec 2026 15:30:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=adrian.freihofer@siemens.com; h=from:from:sender:to:to:cc:cc:subject:subject:content-type:content-transfer-encoding:content-transfer-encoding:References:In-Reply-To:Date:Message-ID:MIME-Version; bh=NdkhV6B1T3Nosw2ZlmLwymnIedIK+FSSIBq5/p9qWyo=; b=hcQ054+8afLR/7weRhopQPf/pFAB/v9ofQHZHes7r1IILGHLTACs7INLdMU+wqBMd66hmm YyCjoAabO7FSPFYt4E4jEeO/SRK2Qbe9kYREFagPZVISdAuLTdKP26MBVMvxB1FfSYjGTAlI w5HTAStkCp2ZPL4HnYS8Xk9RdcsudaIItUcChBRKK0P9WxwSojr9K6KzPDMsP2lbw2xZBrg0 SnH/ncrXmmplBLRJlvQtSn7GmnjJqfXNNHTebcbmIWH4aqZYi17/A+j1oDqkg7Q+j/Q+rIok XVWKc5y3zZLQwwZ+VKUwh8cKdfDfEq2eooxD1YSbtUgZ4OkVH1cCrH9g==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: marex@nabladev.com, Adrian Freihofer Subject: [PATCH 7/8] uboot-sign: add public keys to the U-Boot DTB with fdt_add_pubkey Date: Thu, 3 Dec 2026 15:30:10 +0100 Message-ID: <20261203143044.592073-8-adrian.freihofer@siemens.com> In-Reply-To: <20261203143044.592073-1-adrian.freihofer@siemens.com> References: <20261203143044.592073-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 14:31:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251900 From: Adrian Freihofer concat_dtb signed a dummy FIT image with mkimage only to get the public keys written into the U-Boot DTB. This required the private keys in the U-Boot build, although only the certificates are needed. With keys held in an HSM, the U-Boot build would also need access to the HSM. Use fdt_add_pubkey instead, which only reads .crt and sets the same required and algo properties. The dummy unused.itb and the fit_check_sign self-test against it are dropped. UBOOT_MKIMAGE_SIGN_ARGS and UBOOT_MKIMAGE_DTCOPTS no longer apply to concat_dtb. The oe-selftest fitimage tests check the keys in the U-Boot DTB and verify the signed kernel FIT image against it. Signed-off-by: Adrian Freihofer --- meta/classes-recipe/uboot-sign.bbclass | 61 ++++++-------------------- meta/conf/uboot.conf | 3 ++ 2 files changed, 16 insertions(+), 48 deletions(-) diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass index c46a0d5f04..1aa7e04f4d 100644 --- a/meta/classes-recipe/uboot-sign.bbclass +++ b/meta/classes-recipe/uboot-sign.bbclass @@ -11,8 +11,7 @@ # certificate in a directory and to define the following variable: # # UBOOT_SIGN_KEYDIR = "/keys/directory" -# UBOOT_SIGN_KEYNAME = "dev" # keys name in keydir (eg. "dev.crt", "dev.key") -# UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000" +# UBOOT_SIGN_KEYNAME = "dev" # key name in keydir (eg. "dev.crt") # UBOOT_SIGN_ENABLE = "1" # # As verified boot depends on fitImage generation, following is also required: @@ -200,58 +199,24 @@ concat_dtb() { # support is kept to avoid breakage of existing layers, but # it is highly recommended to avoid FIT_SIGN_INDIVIDUAL = "1", # i.e. set FIT_SIGN_INDIVIDUAL = "0" . + # Add the public keys of the kernel FIT signing keys to the + # U-Boot DTB. Only the certificates (.crt) are needed. if [ "${FIT_SIGN_INDIVIDUAL}" = "1" ] ; then - # Sign dummy image images in order to - # add the image signing keys to our dtb - ${UBOOT_MKIMAGE_SIGN} \ - ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \ - -f auto \ + ${UBOOT_FDT_ADD_PUBKEY} \ + -a "${FIT_HASH_ALG},${FIT_SIGN_ALG}" \ -k "${UBOOT_SIGN_KEYDIR}" \ - -o "${FIT_HASH_ALG},${FIT_SIGN_ALG}" \ - -g "${UBOOT_SIGN_IMG_KEYNAME}" \ - -K "${UBOOT_DTB_BINARY}" \ - -d /dev/null \ - -r ${B}/unused.itb \ - ${UBOOT_MKIMAGE_SIGN_ARGS} + -n "${UBOOT_SIGN_IMG_KEYNAME}" \ + -r image \ + "${UBOOT_DTB_BINARY}" fi - # Sign dummy image configurations in order to - # add the configuration signing keys to our dtb - ${UBOOT_MKIMAGE_SIGN} \ - ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \ - -f auto-conf \ + ${UBOOT_FDT_ADD_PUBKEY} \ + -a "${FIT_HASH_ALG},${FIT_SIGN_ALG}" \ -k "${UBOOT_SIGN_KEYDIR}" \ - -o "${FIT_HASH_ALG},${FIT_SIGN_ALG}" \ - -g "${UBOOT_SIGN_KEYNAME}" \ - -K "${UBOOT_DTB_BINARY}" \ - -d /dev/null \ - -r ${B}/unused.itb \ - ${UBOOT_MKIMAGE_SIGN_ARGS} + -n "${UBOOT_SIGN_KEYNAME}" \ + -r conf \ + "${UBOOT_DTB_BINARY}" - # Verify the dummy fitImage signature against u-boot.dtb - # augmented using public key material. - # - # This only works for FIT_SIGN_INDIVIDUAL = "0", because - # mkimage -f auto-conf does not support -F to extend the - # existing unused.itb , and instead rewrites unused.itb - # from scratch. - # - # Using two separate unused.itb for mkimage -f auto and - # mkimage -f auto-conf invocation above would not help, as - # the signature verification process below checks whether - # all keys inserted into u-boot.dtb /signature node pass - # the verification. Separate unused.itb would each miss one - # of the signatures. - # - # The FIT_SIGN_INDIVIDUAL = "1" support is kept to avoid - # breakage of existing layers, but it is highly recommended - # to not use FIT_SIGN_INDIVIDUAL = "1", i.e. set - # FIT_SIGN_INDIVIDUAL = "0" . - if [ "${FIT_SIGN_INDIVIDUAL}" != "1" ] ; then - ${UBOOT_FIT_CHECK_SIGN} \ - -k "${UBOOT_DTB_BINARY}" \ - -f ${B}/unused.itb - fi cp ${UBOOT_DTB_BINARY} ${UBOOT_DTB_SIGNED} fi diff --git a/meta/conf/uboot.conf b/meta/conf/uboot.conf index 01e0b6cc7e..e08a3c46bb 100644 --- a/meta/conf/uboot.conf +++ b/meta/conf/uboot.conf @@ -32,3 +32,6 @@ SPL_MKIMAGE_SIGN_ARGS ?= "" # uboot-fit_check_sign command UBOOT_FIT_CHECK_SIGN ?= "uboot-fit_check_sign" + +# uboot-fdt_add_pubkey command, adds the public keys (.crt) to the U-Boot DTB +UBOOT_FDT_ADD_PUBKEY ?= "uboot-fdt_add_pubkey" From patchwork Thu Dec 3 14:30:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 107212 Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net [185.136.64.228]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15050.1796308258637365089 for ; Thu, 03 Dec 2026 06:30:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm1 header.b=SNbpUNp9; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.228, mailfrom: fm-1329275-2026120314305661f19f489e000207af-nv79ij@rts-flowmailer.siemens.com) Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 2026120314305661f19f489e000207af for ; Thu, 03 Dec 2026 15:30:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=adrian.freihofer@siemens.com; h=from:from:sender:to:to:cc:cc:subject:subject:content-type:content-transfer-encoding:content-transfer-encoding:References:In-Reply-To:Date:Message-ID:MIME-Version; bh=6HIL0j5k9wtEitGiPAwT2p00KFPKamvm/1Yome4Ye4A=; b=SNbpUNp92KNwW3V7aU0yAznuWFU2ZRD62vw7d77I4hzasFonvnU9UVj2oDqX1YzHCYrYRI yRJaPo5Z+Dopab/5LdW37/OMYYCvmIQXJYIT3yfpcxuVr0Dc906+UdRIPze+fyU9faOSIAuk rpFdwf9GykCGdCvqCbjXVNwRlLsuyCF7FS0dT2Dv54Io1l/1VwZ8KBe14/nETXj4u2w3PUWp Gh89SrUDJfkdS5iHzY70wo4WETV8lZdAKyp4AkcV99OfIi4SSgsyYX++yyQv8iIq8VjceYVc kH98Vjb30M5xZtvk456Lpp2pXGzwl/vzH2fknzgd26HdRIvl+YN+fytw==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: marex@nabladev.com, Adrian Freihofer Subject: [PATCH 8/8] oe-selftest: fitimage: add test_sign_uboot_kernel_crt_only Date: Thu, 3 Dec 2026 15:30:11 +0100 Message-ID: <20261203143044.592073-9-adrian.freihofer@siemens.com> In-Reply-To: <20261203143044.592073-1-adrian.freihofer@siemens.com> References: <20261203143044.592073-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 14:31:05 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251899 From: Adrian Freihofer Check that uboot-sign adds the kernel FIT public keys to the U-Boot DTB when only the certificates are available, as with keys in an HSM. Signed-off-by: Adrian Freihofer --- meta/lib/oeqa/selftest/cases/fitimage.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py index 0180a3c962..ee7f52e1ca 100644 --- a/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/meta/lib/oeqa/selftest/cases/fitimage.py @@ -2646,6 +2646,29 @@ FIT_SIGN_INDIVIDUAL = "1" # Just check the DTB of u-boot since there is no u-boot FIT image self._check_kernel_dtb(bb_vars) + def test_sign_uboot_kernel_crt_only(self): + """ + Summary: Check if the public keys for verifying the kernel FIT + image are added to the U-Boot DTB if only the + certificates are available, e.g. because the private + keys are in an HSM. + Expected: The U-Boot build succeeds without the .key file and + the U-Boot DTB has the signature node. + """ + machine = self._get_machine_or_skip() + config = """ +UBOOT_SIGN_ENABLE = "1" +UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys-crt-only" +""" + config = FitImageTestCase._config_add_machine_settings(config, machine, keys=["UBOOT_MACHINE", "UBOOT_DTB_BINARY", "UBOOT_ARCH"]) + self.write_config(config) + bb_vars = self._fit_get_bb_vars() + self._gen_signing_key(bb_vars) + os.remove(os.path.join(bb_vars['UBOOT_SIGN_KEYDIR'], bb_vars['UBOOT_SIGN_KEYNAME'] + '.key')) + + self._bitbake_fit_image(bb_vars) + self._check_kernel_dtb(bb_vars) + def test_sign_uboot_fit_image_without_spl(self): """