diff mbox series

[v2] kernel-fit-image: remove fatal error when .crt file is missing

Message ID 20260924092327.26115-1-pistora.tobias@gmail.com
State New
Headers show
Series [v2] kernel-fit-image: remove fatal error when .crt file is missing | expand

Commit Message

Tobias Pistora Sept. 24, 2026, 9:23 a.m. UTC
Fixes [YOCTO #16427]

The minimal requirement of mkimage for signing a fitImage is a private
key file (.key -> using -k). Passing a public key file (.crt) is only
necessary when a key-destination is provided (-K). The -K option is
optional in the kernel-fit-image signing process and can be passed only
by the user via UBOOT_MKIMAGE_SIGN_ARGS. Therefore, providing a private
.crt key file is optional and should not cause a fatal error when
missing.

changes in v2:
- fix shortlog format

Signed-off-by: Tobias Pistora <pistora.tobias@gmail.com>
---
 meta/lib/oe/fitimage.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oe/fitimage.py b/meta/lib/oe/fitimage.py
index 1ac4b2c59d..484e5c5ee0 100644
--- a/meta/lib/oe/fitimage.py
+++ b/meta/lib/oe/fitimage.py
@@ -593,8 +593,11 @@  class ItsNodeRootKernel(ItsNode):
             if not os.path.exists(key_path + '.pem'):
                 bb.fatal("ECDSA signing requires '%s.pem'" % key_path)
         else:
-            if not os.path.exists(key_path + '.key') or not os.path.exists(key_path + '.crt'):
-                bb.fatal("%s.key or .crt does not exist" % key_path)
+            if not os.path.exists(key_path + '.key'):
+                bb.fatal("%s.key (private key) does not exist" % key_path)
+            # public key is only necessary when passing -K option to mkimage
+            if not os.path.exists(key_path + '.crt'):
+                bb.debug(1, "%s.crt (public key) does not exist" % key_path)
 
     def run_mkimage_sign(self, fitfile):
         if not self._sign_enable: