Skip to contentSkip to conversation

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

PATCH New Tobias Pistora 1 participant 1 message Sep 24

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kernel-fit-image: remove fatal error when .crt file is missing

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

---
 meta/lib/oe/fitimage.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
meta/lib/oe/fitimage.py +5 -2
index 1ac4b2c59d..484e5c5ee0 100644
@@ -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:
Signature · 1 line
2.47.3