From patchwork Sat Nov 21 08:59:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswanath Kraleti X-Patchwork-Id: 105130 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.13644.1795251595558521364 for ; Sat, 21 Nov 2026 00:59:55 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@qualcomm.com header.s=qcppdkim1 header.b=bXmzvFkf; dkim=pass header.i=@oss.qualcomm.com header.s=google header.b=Ywp33Pvt; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: oss.qualcomm.com, ip: 205.220.180.131, mailfrom: viswanath.kraleti@oss.qualcomm.com) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AL8BBvg1648231 for ; Sat, 21 Nov 2026 08:59:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=rvGV45npP26 MXcGA3A5iKRa2YiNJs/3X2gT5SQnxmrU=; b=bXmzvFkfpVc1fQcA/E7EroJ+jHG JOzT73ocDhWJjAPusYvxleqq2M+gArce20WJmuDtzhhGRJqRZWB1VlxxJC7KH+aN vBw25gUMMCJCecj3wF9co72VA/5rMebY8+Lm6woK48WkXPgH34MgVfbnAPFsvpw+ /E9cSQyhU+WdcqwalCdMAFlm3cSraX3jJZFvbdtP4YXX7W3fv2qmt0wBBXSa2u6K 0wTYrruy0w+FDXR+3O2PjbgDHObSx8OKiuJIxn0c06kadfrgssCfaXG1+lp0//ro JCgBwH6Ilhoo2YxGI9ZedbJ/0ngPMi7GiLH0ZpVMFYrYcU6LnBQCMxD204Q== Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j32w00mcw-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 21 Nov 2026 08:59:54 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-30bcb065bfdso1900702eec.0 for ; Sat, 21 Nov 2026 00:59:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795251593; x=1795856393; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rvGV45npP26MXcGA3A5iKRa2YiNJs/3X2gT5SQnxmrU=; b=Ywp33PvtTZubbplThefOtRvds/fFj1N1neTQttuzs8yCl7O0bslD7h08R40aiRbRiQ +V8bFX4Gw6CS+zDRtT2vNfCC0zlDrct98dNd7baivh03NFV31mGlL9jTuM47mvRAEupb erZ4UmjLtpVOtOMQcyK0sh4obWTFsvmHWYyXg9DTLj8cZWJRVIS20JOHx41j02RqO3PI PNmBXHZK3AW769p+fpYe28QuyM+EvbvOEtXEFU6DkqGl43t551/SfQcBe7JN9LknL0Wc IoUzslpTZoLfTcxexCm2BnbndVYweGlgePN0akBfJyRBAbrhY6Qr7EGCGfnjcgLgxPxM oxeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795251593; x=1795856393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=rvGV45npP26MXcGA3A5iKRa2YiNJs/3X2gT5SQnxmrU=; b=nPI57MiRdbTbfYSfWIFSiuByP05PnqZlcpo+XMmuaxKBMZmVPAdfhQMtFx2sc6YNuZ uaFdTpu/V+JkvYoth8XZ68k1dT9AJcVhGvCrfnvjFxYoXJNaT4WiyWGmyRvsf/Zayhb9 r7EcpRj3AhKDzNnZ4vreQA7NctuWqKLjP7K4vK65vTCSVtzGTSe2XmfO3aFzSSHS/4D6 vDkQFmOELQLeQMZCcyVkZlCL1kLCDyyL7nzgW5E3m/fP2MO7/nbBH5ZKFGZWoke7AuW1 /cU2psZN7Qz0v2vzCst99B3Ln2MfrFdoaePlkWqodMiMrrCk/bdxje78EqbJDTD+qDWF 1DRw== X-Gm-Message-State: APuU4Z/sWWz126uy4z1kgCk/BfYMxgbHyyUt/C3sSpBOm/0drGdSaA+M yDEe6aeai4cGZPvEDmx1Yg29WaHaoZVIJPnbqkX1YBO+simTvPFlYplEHe28dEsyn+P3gyNeUv2 p8o/gtPpCTDhoPJ8A6vGayXku1emgbWGrR4iDjaB+jiW7/BXcCsksB571+pm9EAWUOscm8kJHwd OTyt+rA/nLGcU+pYI/4w== X-Gm-Gg: AZFdTZd+kl6WpBWxBCvkawZ3mHzUiXqCrXuJUGY0wfq24YFlgFelt44AI0k5NTB9tFJ julZ7RdaMqZt1GO4eXDawA6bIi/1UE9pCIcdfgGM6cRhHMCPVaM9/3ewjLZSZksN3SYq9m5woWV 5b2kdc8SyqAobcGC5c1S6aFqfb7XErtXEbB8WYc5VmQIDYUZu9MzRQRfbZsk+QuEIUIL6zRSdrw bL6wMFDHkndvFoJZVmQN4P1Jf33Cvf/tMAQkqxc8E2IlZNvA5pt0TgE15iuHaw/AVpaRb4hvqxg dmEmoLgCb8gISLyuHZU4fDX5ROzRN7bT8Hl0NcbfxGDGzlE58c/q1zCW35+boGbJr0RNHXNyWVb lDRToimsdhAsDPClYghVzr820Pl1YhwZTQIEa7dyR/epxKNbMlQbnRzhnuuAYPFP8g1FwwNhBJm mQqoDb7feoACkVZ0JQg5Tkk10EMXE/QcQHryx/LJGG7L0= X-Received: by 2002:a05:7300:2301:b0:385:4c54:3c8c with SMTP id 5a478bee46e88-3856c0c9403mr7859910eec.1.1795251593154; Sat, 21 Nov 2026 00:59:53 -0800 (PST) X-Received: by 2002:a05:7300:2301:b0:385:4c54:3c8c with SMTP id 5a478bee46e88-3856c0c9403mr7859873eec.1.1795251592247; Sat, 21 Nov 2026 00:59:52 -0800 (PST) Received: from hyd-e160-a52-10.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38567cafec4sm17887231eec.26.2026.11.21.00.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Nov 2026 00:59:51 -0800 (PST) From: Viswanath Kraleti To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer , Ricardo Salveti , Viswanath Kraleti Subject: [OE-core][PATCH v2 1/4] uboot-sign: add UBOOT_FIT_MKIMAGE_EXTRA_OPTS Date: Sat, 21 Nov 2026 14:29:34 +0530 Message-ID: <20261121085937.411140-2-viswanath.kraleti@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261121085937.411140-1-viswanath.kraleti@oss.qualcomm.com> References: <20261121085937.411140-1-viswanath.kraleti@oss.qualcomm.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIxMDAzNSBTYWx0ZWRfX5GWteAYvAkDz ciaAvfu7AieC879JwN0Tpd98yDZ/G1MDoQnQ/JPnRg8nWkHhDgVskMod9xHYUbpOEXLWwKH/3ES 3XJBcghXQBSU1nLzp6aZ3yCskQGcbJ4qplf+dsWLWaEkm0dxdXgJeuyHOBQ4UAHx8pH/S2DL6ym +KBkbvSlH7BpSG65t48cXh1zuIY7cS57TGGJxmp5gTy5JfjTcrgjlWV3L2dmQrsRS08frWszmJC hI9tfHOY5DxBM+Ra8pbUW1quG/MJRkAZHEJnP8uTsWvXrDVzUxNZ73MwISDoBDyhAyyc8c3BHtu ygyDoS4iIeR32JkszBxmqxdLfFioct7mBJyvbQULJ5litdDxsTzVbUaDPSR37PO4znnqu3wTYdU sXomnkalqOwtRsz33J3uyyQax4ZWxoTcELHJ/7yCFtcC8gwSrYZEXOi5PwnJowSet7EiW2pZLTl Y03ztkJkxd+dVNEKOOQ== X-Proofpoint-ORIG-GUID: yYaVFmzmBQ5GRcHUBdoHzD9pkxkZVktT X-Proofpoint-GUID: yYaVFmzmBQ5GRcHUBdoHzD9pkxkZVktT X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIxMDAzNSBTYWx0ZWRfX31uT1jRa8fF2 IM0X4eijgV0oYooR9vwGHPJhZ7GwXGVyJPL2fY7VW7Ti3EMYaegKSXIP+Ol1ONcdGEuReOR7XZl 7GdC2nCVDjq8j/wHzbQ82Kc2W6HOagc= X-Authority-Analysis: v=2.4 cv=S+dMU4sP c=1 sm=1 tr=0 ts=6b015d8a cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=GFXrzsOziNBv6lcdXcwA:9 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-21_02,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 bulkscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 spamscore=0 adultscore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611210035 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 ; Sat, 21 Nov 2026 08:59:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250843 There is no way to pass options such as -E, which places the image data after the FIT structure, to the mkimage call creating the U-Boot fitImage. Such an option also has to be repeated when signing, since mkimage -F moves external data back into the FIT unless -E is given again. Add UBOOT_FIT_MKIMAGE_EXTRA_OPTS and pass it to the mkimage calls that create and sign the U-Boot fitImage, and extend the selftest to check that -E is kept through signing. It is separate from FIT_MKIMAGE_EXTRA_OPTS, so that options meant for the kernel FIT image do not change the U-Boot one. AI-Generated: Uses Claude Code Signed-off-by: Viswanath Kraleti --- meta/classes-recipe/uboot-sign.bbclass | 8 +++++ meta/lib/oeqa/selftest/cases/fitimage.py | 44 ++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass index 409f6376b1..c1dae56582 100644 --- a/meta/classes-recipe/uboot-sign.bbclass +++ b/meta/classes-recipe/uboot-sign.bbclass @@ -75,6 +75,11 @@ SPL_WITH_DTB_BINARY ?= "" # U-Boot fitImage description UBOOT_FIT_DESC ?= "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}" +# Additional mkimage options for the U-Boot fitImage, passed both when +# creating and when signing it, so that an option such as "-E", which places +# the image data after the FIT structure, is kept by mkimage -F +UBOOT_FIT_MKIMAGE_EXTRA_OPTS ?= "" + # U-Boot fitImage Hash Algo UBOOT_FIT_HASH_ALG ?= "sha256" @@ -560,6 +565,7 @@ EOF # ${UBOOT_MKIMAGE} \ ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \ + ${UBOOT_FIT_MKIMAGE_EXTRA_OPTS} \ -f ${UBOOT_ITS} \ ${UBOOT_FITIMAGE_BINARY} @@ -588,6 +594,7 @@ EOF cp ${SPL_DIR}/${SPL_DTB_BINARY} ${SPL_DIR}/${SPL_DTB_SIGNED} ${UBOOT_MKIMAGE_SIGN} \ ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \ + ${UBOOT_FIT_MKIMAGE_EXTRA_OPTS} \ -F -k "${SPL_SIGN_KEYDIR}" \ -K "${SPL_DIR}/${SPL_DTB_SIGNED}" \ -r ${UBOOT_FITIMAGE_BINARY} \ @@ -601,6 +608,7 @@ EOF # Sign the U-boot FIT image ${UBOOT_MKIMAGE_SIGN} \ ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \ + ${UBOOT_FIT_MKIMAGE_EXTRA_OPTS} \ -F -k "${SPL_SIGN_KEYDIR}" \ -r ${UBOOT_FITIMAGE_BINARY} \ ${SPL_MKIMAGE_SIGN_ARGS} diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py index 1fad53b16c..73b1d68fcd 100644 --- a/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/meta/lib/oeqa/selftest/cases/fitimage.py @@ -2133,6 +2133,50 @@ UBOOT_FIT_HASH_ALG = "sha256" self._test_fitimage(bb_vars) + def test_sign_uboot_fit_image_extra_opts(self): + """ + Summary: Check if UBOOT_FIT_MKIMAGE_EXTRA_OPTS is passed to + mkimage both when creating and when signing the U-Boot + fitImage. + Expected: 1) U-Boot its and FIT image are built and signed + successfully + 2) UBOOT_FIT_MKIMAGE_EXTRA_OPTS = "-E" places the image + data after the FIT structure and signing keeps it + there: the image nodes have data-offset instead of + data + Product: oe-core + Author: Viswanath Kraleti + """ + machine = self._get_machine_or_skip() + config = """ +# Enable creation and signing of the U-Boot fitImage, with external data +UBOOT_FITIMAGE_ENABLE = "1" +SPL_SIGN_ENABLE = "1" +SPL_SIGN_KEYNAME = "spl-oe-selftest" +SPL_SIGN_KEYDIR = "${TOPDIR}/signing-keys" +UBOOT_ENTRYPOINT = "0x80000000" +UBOOT_LOADADDRESS = "0x80000000" +UBOOT_DTB_LOADADDRESS = "0x82000000" +SPL_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000" +UBOOT_EXTLINUX = "0" +UBOOT_FIT_GENERATE_KEYS = "1" +UBOOT_FIT_HASH_ALG = "sha256" +UBOOT_FIT_MKIMAGE_EXTRA_OPTS = "-E" +""" + config = FitImageTestCase._config_add_machine_settings(config, machine, keys=["UBOOT_MACHINE", "SPL_BINARY", "UBOOT_DTB_BINARY", "UBOOT_ARCH"]) + config = self._require_machine_capability(config, machine, '_cap_spl_dtb') + self.write_config(config) + bb_vars = self._fit_get_bb_vars() + self._test_fitimage(bb_vars) + + fitimage_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "u-boot-fitImage-%s" % bb_vars['MACHINE']) + dtc_bindir = FitImageTestCase._setup_native('dtc-native') + fdtget_path = os.path.join(dtc_bindir, 'fdtget') + for node in ('/images/uboot', '/images/fdt'): + self._verify_dtb_property(dtc_bindir, fitimage_path, node, 'data', None, absent=True) + result = runCmd('%s %s %s data-offset' % (fdtget_path, fitimage_path, node)) + self.logger.debug("%s data-offset: %s" % (node, result.output)) + def test_sign_cascaded_uboot_fit_image(self): """ Summary: Check if U-Boot FIT image and Image Tree Source (its) are From patchwork Sat Nov 21 08:59:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswanath Kraleti X-Patchwork-Id: 105131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.13756.1795251597512572119 for ; Sat, 21 Nov 2026 00:59:57 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@qualcomm.com header.s=qcppdkim1 header.b=aQzCWocN; dkim=pass header.i=@oss.qualcomm.com header.s=google header.b=V2/Q4hOq; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: oss.qualcomm.com, ip: 205.220.180.131, mailfrom: viswanath.kraleti@oss.qualcomm.com) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AL8ArwS063713 for ; Sat, 21 Nov 2026 08:59:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=TcWz0o6CtX8 KNnB6JogZm/3GnRLCjqHBdaQTVPn6lEg=; b=aQzCWocNwbSa+WwaVqAiKXUIcPD S0YIQQTbRn4oyCNu/5G8vDzVJrAl4yUVdUPqOwD178/FAGU7knC5VU5WiaORviru g8gl6qhhM4uUMrTikLHt6Ap4SXCdubSi6I8v9fZa2T9rdfvk1vv8MH+PSX6okY6T G80Fr80IJb8smPygN3AhcYdfyeb94jclh3ET99MPh1bvg7YnHCqSkGA9LYeFoi6E wRuwRQvDhF/1WHUQG5yrxWLbrI0du75+4sbPntZQA1xBjIm6zcuXO91lpDJ6WBl4 YLrTpXWJY5WA5NaIZbv0veDtT8oP9mjYhJN1s5M59jh4C6//NPOLvzN4BiQ== Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j33cu0k55-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 21 Nov 2026 08:59:56 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-386a0f79047so150979eec.1 for ; Sat, 21 Nov 2026 00:59:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795251595; x=1795856395; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=TcWz0o6CtX8KNnB6JogZm/3GnRLCjqHBdaQTVPn6lEg=; b=V2/Q4hOq7d5Bg0EPZBKs/GFwHftznuJ4hOFJtbRkIF8TCdm47EKeqopX7SGp1s4RR+ bge+bMeeBBZ1ph+50uuXrcHxVs7O0UllVaicIFnpQfbMSEjV2Uxv+Pn4NQ4YJmhBw3CR CuwBTjqRZHPN9ewoL5hczLy78dSeHZ+Kw4EpOBAGEfI/yQDrpdqcoI6YK3TuuKRyrRVL l3BXyWN2JVZAs5Wm/0nLdivWY6J96j7uI8LDj8bu30qhmyiQlyPaqntAM3JiPRj84Df6 zEfw8+Mx10mdEcrm2aMgPgKBp3YDPrEQ9DnXJ29vM6bAMwFoW4VZ/4+fdpNtZLeqgbN0 vd/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795251595; x=1795856395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=TcWz0o6CtX8KNnB6JogZm/3GnRLCjqHBdaQTVPn6lEg=; b=huuz+y2sbgtBHFcd6BtU6EFVzshnEeOx1/WwFTiwCSUYUmRf/1+txjvz5skVneRi0p BcqJaWpFF/YNryB/DUqbn1QWSy2oPaaUVkPklQlnPgmjrdqCt8mG3K3JctqwTQP0BXNf OfFREMI2I1MHeUTSJG6aJ8EJenlpa1umpFT71bztF4WK1AYCPEL9I1yefmre49EEikQN fHihVFgx3uxGEA/R2FMgZk3QKhOocSUOlQ8Rk9Eluf3YiaQfF4+V3c2QmUwK2Rz54jaG FqtrIj9zLFigARBJPVkyxDQoPC7krlYi/tMye/tAY0OGyARdk060KeQ7ZFjf6yiqHqX1 4gcQ== X-Gm-Message-State: APuU4Z/auFcfbJwnUunJey7f0WHaSYF1IPv5DgdnuwfFz1+6KXVO/YBj JrKnbcA8igu4rknE6oYYc9cn9JuTLJTQMiwg90ghE8U7Hh2B8CCKNS+Nr5MfyU+st4Lmpk5Vnq+ Eb8mYcMoP+TG9gEkdBBm/e/P2Iog5FMqoMcXAjgL0EwGcNz1mpU5LaMoOaMujVXUkQWC2HPkYau s4EJj6Qd45gthlUzd1YQ== X-Gm-Gg: AZFdTZdcSYOA+tHKGEcKuiLt0DN8xDbdVgIxkBwl84czIcNRy/Xco4lNYjX5f5b71+E xca/aJXggzaf0N4eniX5XJDDjIHgO3xC07nF7/ncqnWd3dRedWDHzYKs/8IdMyf3jvc0zFka6Ja w+seL7HT/UozC/UYGNZcP5As4IWn84W/xRLWUNNYydqj3RPEaZKj1oqB1ta4Ew56J0VRTWiDaJx bibKzsBGRMH4dYdRUxAnYk5/WwBP7IBWRq3YDin65VaSQgYg81wPZNpxUusj/XreE+sCdx/2VHq 3NZ4IrYguUU2/mXILU96TlRt2cHntvmNTWJAlXfn+tqLaYby14NYjLVJXZRWdwsQeUJ8VcTH4tK p5Lokw8FoDMkdhFjZGH0I1CpsBYZEiG78eyDlWEHD5qK2i4caUzgUEZ7fUPfDOcEAs4mY5MfcIj GdpqatRsdjfTt3wyCWwwc9Vk955RlonS5b/laTh8RSclg= X-Received: by 2002:a05:7301:1a02:b0:376:b957:c08 with SMTP id 5a478bee46e88-3856fe5acd0mr5432216eec.9.1795251595123; Sat, 21 Nov 2026 00:59:55 -0800 (PST) X-Received: by 2002:a05:7301:1a02:b0:376:b957:c08 with SMTP id 5a478bee46e88-3856fe5acd0mr5432208eec.9.1795251594557; Sat, 21 Nov 2026 00:59:54 -0800 (PST) Received: from hyd-e160-a52-10.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38567cafec4sm17887231eec.26.2026.11.21.00.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Nov 2026 00:59:54 -0800 (PST) From: Viswanath Kraleti To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer , Ricardo Salveti , Viswanath Kraleti Subject: [OE-core][PATCH v2 2/4] uboot-sign: write the image hash and signature nodes in one place Date: Sat, 21 Nov 2026 14:29:35 +0530 Message-ID: <20261121085937.411140-3-viswanath.kraleti@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261121085937.411140-1-viswanath.kraleti@oss.qualcomm.com> References: <20261121085937.411140-1-viswanath.kraleti@oss.qualcomm.com> MIME-Version: 1.0 X-Proofpoint-GUID: _XbY9kAihEh3gxSuAosny786X0TP1piM X-Proofpoint-ORIG-GUID: _XbY9kAihEh3gxSuAosny786X0TP1piM X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIxMDAzNSBTYWx0ZWRfX9xrAk72vuEq+ bDk1SUQqUp4xMX8DtJtUU+4jHhpCGGSm/mmkktMRqwtNLZNet1LY6/hMS5CVHRuZONq1Szi6oCA vO4VLnssvA6ykHXBhtxwrSCWn+OXFALDOQDG7bOw9Wr/APUwy6K/ClqQNzdStSGwFqYIpLJpgZp bNmZyKYL+MQoM+Gw68cjKQ1mz21UBLfzpTKBf4NDGJ5ZeAHvWdXIj4PTU1zPlKdyoe69MuzOVsD 5Z0TnUXcLGQLrM6FhiGF8vENCpgT5uSta6i7Aqx3msPhnQNsvt2WaTvGd4ymu85OOZ7V1d6OGrj VHWL4dKTN0+oI2gLWNfVTui8O2Fvh+N+mIgvl2GDSn3aTLeWkpr2/Pjmp30pcjgREYuTPtZdLPs FiDzUZuNee2CqZLfUF+96Sejxpfvj/ruqX7iMxnf73/SBNNW4YSrxYUbqoYenUs44Dlt7AisW8Y qTz0i+CshNApVrp4xUw== X-Authority-Analysis: v=2.4 cv=MM71C8Zl c=1 sm=1 tr=0 ts=6b015d8c cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=3fAs9qo7yUOUnOsMBkcA:9 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIxMDAzNSBTYWx0ZWRfXyvf87uhv3Kv/ fcMmHtJYlVxZjPVMWjKv2PLm8NG2wlJd9XglEEOL8lqTjAr5FPkny8OyG/7ArtYSgQyyPSPKg6g UW6ej5Ms0Ytkr1AeOT/FpQMUMX+7ofs= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-21_02,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 phishscore=0 spamscore=0 bulkscore=0 impostorscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611210035 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 ; Sat, 21 Nov 2026 08:59:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250844 The uboot, fdt, tee and atf image nodes each carry their own copy of the hash and signature nodes SPL_SIGN_CONF and SPL_SIGN_INDIVIDUAL ask for. Write them from uboot_fitimage_image_signing instead, so that every image node is signed the same way, including the ones added next. AI-Generated: Uses Claude Code Signed-off-by: Viswanath Kraleti --- meta/classes-recipe/uboot-sign.bbclass | 83 +++++++------------------- 1 file changed, 22 insertions(+), 61 deletions(-) diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass index c1dae56582..1c738f7f9d 100644 --- a/meta/classes-recipe/uboot-sign.bbclass +++ b/meta/classes-recipe/uboot-sign.bbclass @@ -352,19 +352,9 @@ do_uboot_generate_rsa_keys() { addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compile -# Create a ITS file for the atf -uboot_fitimage_atf() { - cat << EOF >> ${UBOOT_ITS} - atf { - description = "ARM Trusted Firmware"; - data = /incbin/("${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_IMAGE}"); - type = "firmware"; - arch = "${UBOOT_ARCH}"; - os = "arm-trusted-firmware"; - load = <${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_LOADADDRESS}>; - entry = <${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_ENTRYPOINT}>; - compression = "none"; -EOF +# Write the hash and signature nodes of the image node being written, as +# SPL_SIGN_CONF and SPL_SIGN_INDIVIDUAL ask for them +uboot_fitimage_image_signing() { if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${SPL_SIGN_CONF}" = "1" ] ; then cat << EOF >> ${UBOOT_ITS} hash-1 { @@ -381,6 +371,22 @@ EOF }; EOF fi +} + +# Create a ITS file for the atf +uboot_fitimage_atf() { + cat << EOF >> ${UBOOT_ITS} + atf { + description = "ARM Trusted Firmware"; + data = /incbin/("${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_IMAGE}"); + type = "firmware"; + arch = "${UBOOT_ARCH}"; + os = "arm-trusted-firmware"; + load = <${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_LOADADDRESS}>; + entry = <${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_ENTRYPOINT}>; + compression = "none"; +EOF + uboot_fitimage_image_signing cat << EOF >> ${UBOOT_ITS} }; @@ -400,22 +406,7 @@ uboot_fitimage_tee() { entry = <${UBOOT_FIT_TEE_ENTRYPOINT}>; compression = "none"; EOF - if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${SPL_SIGN_CONF}" = "1" ] ; then - cat << EOF >> ${UBOOT_ITS} - hash-1 { - algo = "${UBOOT_FIT_HASH_ALG}"; - }; -EOF - fi - - if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${SPL_SIGN_INDIVIDUAL}" = "1" ] ; then - cat << EOF >> ${UBOOT_ITS} - signature { - algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}"; - key-name-hint = "${SPL_SIGN_KEYNAME}"; - }; -EOF - fi + uboot_fitimage_image_signing cat << EOF >> ${UBOOT_ITS} }; @@ -449,22 +440,7 @@ uboot_fitimage_assemble() { entry = <${UBOOT_FIT_UBOOT_ENTRYPOINT}>; EOF - if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${SPL_SIGN_CONF}" = "1" ] ; then - cat << EOF >> ${UBOOT_ITS} - hash-1 { - algo = "${UBOOT_FIT_HASH_ALG}"; - }; -EOF - fi - - if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${SPL_SIGN_INDIVIDUAL}" = "1" ] ; then - cat << EOF >> ${UBOOT_ITS} - signature { - algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}"; - key-name-hint = "${SPL_SIGN_KEYNAME}"; - }; -EOF - fi + uboot_fitimage_image_signing cat << EOF >> ${UBOOT_ITS} }; @@ -476,22 +452,7 @@ EOF compression = "none"; EOF - if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${SPL_SIGN_CONF}" = "1" ] ; then - cat << EOF >> ${UBOOT_ITS} - hash-1 { - algo = "${UBOOT_FIT_HASH_ALG}"; - }; -EOF - fi - - if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${SPL_SIGN_INDIVIDUAL}" = "1" ] ; then - cat << EOF >> ${UBOOT_ITS} - signature { - algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}"; - key-name-hint = "${SPL_SIGN_KEYNAME}"; - }; -EOF - fi + uboot_fitimage_image_signing cat << EOF >> ${UBOOT_ITS} }; From patchwork Sat Nov 21 08:59:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswanath Kraleti X-Patchwork-Id: 105132 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.13645.1795251600282560822 for ; Sat, 21 Nov 2026 01:00:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@qualcomm.com header.s=qcppdkim1 header.b=GQuBEYeh; dkim=pass header.i=@oss.qualcomm.com header.s=google header.b=ED2Wc7Gp; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: oss.qualcomm.com, ip: 205.220.180.131, mailfrom: viswanath.kraleti@oss.qualcomm.com) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AL8Au3P064178 for ; Sat, 21 Nov 2026 08:59:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=Tye4JhmvF8U cmTwaTwQ+IS10CLjCNYYRF5KVR4efjM8=; b=GQuBEYeh9Esmea6HoXVxI7dqoOz lbv8K/jvT6RH+dQhD0pDfFZvs+sox10Ws0M/o0qNbNmxWL6CxJYM/61ckMs9Eqgf r/OZtJgT1sqO/hLYZsK6AQ4PqXnEOPtnTv2WnsYKkGRQqaxVw1brwKpmnhN9Ug2U twvyea5vnNU0+NgIFfyddSjjM62nsoaK4I93pTuLUZ6RtnpcUjPjIYOELLDS0Hzf XXSWBJJ+W22NqOy7ZKK+YbK8XpxCQKLp42hwRGZ34aqHhh6NcpAmrft/hTcCokYq GoNRcjLfkZRP5POBPCTVvSkf97GITSUj+R7v+rHivpF03koecaWhtLmHZdg== Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j33cu0k58-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 21 Nov 2026 08:59:58 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-383ec96a7deso1933939eec.1 for ; Sat, 21 Nov 2026 00:59:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795251598; x=1795856398; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Tye4JhmvF8UcmTwaTwQ+IS10CLjCNYYRF5KVR4efjM8=; b=ED2Wc7Gpyl4yp1P0XqlOmSxb8nf53BMHDQwt+zgSD/EMOkt417OjjG47XQ2nFvexOl sKYlZVofy0/4h4PLsYvkN9r8b7uKZkrqZ2I1ab9J9RJdUO0OqXSrcffsNQUfASDGU8Ht XAufxF0gMKBF0wvr3IkGaz0c+i0gFAoaCOa+ssYQya1+eloReMxM+K0IQd0bHO0StP9l zk5UCNiF0qMwrt61kvxjkt0wFF8YjrdMTFNQWbYu9QqoPPAM2JdOUAwWXB9Hr3mDmxTO wv4aYxx4dUGELibPrNPQTOZyzL+h19CHoE3VRBAlnBm3ELIFtQmeh6tNXdZTWw3NQ0Qz tGgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795251598; x=1795856398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Tye4JhmvF8UcmTwaTwQ+IS10CLjCNYYRF5KVR4efjM8=; b=mRdG8aRgFn0QsEDokv/S6DXShQiD8IDSygMkjycYZgkaXj3fKrzsOJCgFllj7dKp4K PlrFBemtnTbVcD6r3tORNEO6t38nai3ijZSD9piaExmzYiB2gTR4vmAb/WJluHa9d+0X dIxHjyskDgpPEGjUy+td4rgzLlYKAGIpxOPE4ODIU4GxmrxjuX/vvB2omqw9rHBZdo+b BSUR0P4AoRPS85e10BJ74QSP7Cm4AKxcvGAh+hMoFRUhmnkZPvp79F1QK51lVXvPUpGy JEynYIALGfPLUNzdNi8AWCUTMktg5YJYJEINOe/j89QK2KVPIi97An5Q0XhJUbRUE0GS h8UQ== X-Gm-Message-State: APuU4Z+G+/EeM//7NEcxuM2MGTRfmcNTUsZStIncIxKiseD9SYrF4ZeM U6wkw1ZbGrVdxXYQi93gozQfxxFIm1cJZnTnAtlT5SWdiakkn3uu8xi5Tzj8PGFnEVrYUXXKl3R dX65Em4O55nLYdEUTG0jEDzDOyydpKZQplgB9Kr1xqUX0PVAYNjEHTLHy0nLogiyci8BI5AfPxy tH6Hu4VD7Eq1p8ChX70Q== X-Gm-Gg: AZFdTZegUgsiZLZVl/mufvliS7kWvVB7PCyd8QUnBmQIhIadSgG6KD5F1ozZP0Lmah1 OKnUge/VVLXDVWmUP7E9wctWTiE4rhdjyM3ZO5a04O4tPgurk+E/Gh4xlnWZp1peG9GJBNioaDq F9VUbd4Q5OdHfYgIEJ2JmcllP1lM6KgHnwWhT1vrYDSvH6yleAVwUCyzO5GLPAKm8lGMlHhFLLA l7R14U1pQ6Pm3ucnb2KSATpyeLd4l5Whxx+OX51Cq97nypXPvE2KUfWFy6FQ1NqToPyvauPt+93 GLdOA/ACo+o0cmeMqHKVIW0gvz0hlwXiveooRofm5ZBL320zgZUKC9hpKvUFee5pNNFQTUR8uVP BB4TNF8KJNO2PjtQsoU2DqC/lcRedosXL6ohiCuikBX8C0FySMpCquRCR+nj86x5+p4p3kdjIRP ipcuZZeJbXFtStugSqUr17SBEtwnIT7ABBXrrbn9KE4mM= X-Received: by 2002:a05:7300:7b26:b0:380:f32e:d257 with SMTP id 5a478bee46e88-3856f6524a1mr5180852eec.13.1795251597693; Sat, 21 Nov 2026 00:59:57 -0800 (PST) X-Received: by 2002:a05:7300:7b26:b0:380:f32e:d257 with SMTP id 5a478bee46e88-3856f6524a1mr5180828eec.13.1795251597015; Sat, 21 Nov 2026 00:59:57 -0800 (PST) Received: from hyd-e160-a52-10.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38567cafec4sm17887231eec.26.2026.11.21.00.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Nov 2026 00:59:56 -0800 (PST) From: Viswanath Kraleti To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer , Ricardo Salveti , Viswanath Kraleti Subject: [OE-core][PATCH v2 3/4] uboot-sign: add UBOOT_FIT_LOADABLES Date: Sat, 21 Nov 2026 14:29:36 +0530 Message-ID: <20261121085937.411140-4-viswanath.kraleti@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261121085937.411140-1-viswanath.kraleti@oss.qualcomm.com> References: <20261121085937.411140-1-viswanath.kraleti@oss.qualcomm.com> MIME-Version: 1.0 X-Proofpoint-GUID: _0X_iY21aKVGcJ8Gna9byl6HG5t9xCgN X-Proofpoint-ORIG-GUID: _0X_iY21aKVGcJ8Gna9byl6HG5t9xCgN X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIxMDAzNSBTYWx0ZWRfX4lOGeideBypq oDRQeYbQlwc0j/yeDMHzLSQIcnI1a5Y9ctip2jUbVJh2Jg0rzRGz5/Wgp3aW+CObt7lmdlISde/ j5dt59tZWyvXKybGPSOCSZfkgQEtkWrs1Kgf2yHW0FRw79QkpVzGKpMiSpTFnGo7MadrNZGyfpK BC3XDHq8jD6iiLRjJuZYfkTTJDKTliWMgOp+2njTne6KhO2qcYUNlMRJ4eggc2NZPCUwWGsrcoW DG9kcIzfKEeH3w8TbPR0Lg1zoyP0SxcCayohoQKb6Lb94l2XKamWOjfXNuMZmRrRn8v2Vj/sNw5 0hzuVEw3ihPJ6JZS9e0urGgV/XQLwjpB+UbH/BFWyEbQkFjMRGPdv6pQk2OSZA4mFRLvisVdjCZ vggc7apWpBrqYlQy2on0V0CvjENsqiC3gFkz/FI4EDihGDzEqCnpvPsYaZ4N1isQUzqxDZpaICo giLLCxXMNiy/tEzkVNQ== X-Authority-Analysis: v=2.4 cv=MM71C8Zl c=1 sm=1 tr=0 ts=6b015d8e cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=1S-zBF3sY3yuuNrEChkA:9 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIxMDAzNSBTYWx0ZWRfX+oPf6wYjmD0K laPbh3boU7xCKpl2Km02NmXs/PbISOtuzJBszXiJiDeyqQL1Gx0IaJh4T4oUrbCYc53blFIKKZH zc5EpTzLO9Jh4TNSq8YbPP+uOqg5A5Q= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-21_02,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 phishscore=0 spamscore=0 bulkscore=0 impostorscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611210035 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 ; Sat, 21 Nov 2026 09:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250845 A machine adding firmware images to the U-Boot FIT has to write their nodes itself, as ITS text in UBOOT_FIT_USER_SETTINGS, together with the hash and signature nodes the class would give them. Those copies of the signing logic go stale: they miss SPL_SIGN_INDIVIDUAL, or keep their hash nodes when signing is off. Add UBOOT_FIT_LOADABLES, a list of image node names, each described by UBOOT_FIT_LOADABLE_FILENAME, _LOADADDRESS, _ENTRYPOINT, _TYPE, _ARCH, _OS, _COMPRESSION and _DESCRIPTION varflags named after the node, as FIT_LOADABLES does for the kernel FIT image, and UBOOT_FIT_CONF_LOADABLES to load them from the configuration. The class writes their nodes like its own, hash and signature nodes included. The varflags are read as the task runs, so a prefunc can still set addresses only known once a dependency has deployed. Teach the U-Boot FIT selftests about the loadable images, and add tests for them both unsigned and individually signed. AI-Generated: Uses Claude Code Signed-off-by: Viswanath Kraleti --- meta/classes-recipe/uboot-sign.bbclass | 98 ++++++++++++ meta/lib/oeqa/selftest/cases/fitimage.py | 189 ++++++++++++++++++++++- 2 files changed, 284 insertions(+), 3 deletions(-) diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass index 1c738f7f9d..90921c10dd 100644 --- a/meta/classes-recipe/uboot-sign.bbclass +++ b/meta/classes-recipe/uboot-sign.bbclass @@ -121,6 +121,28 @@ UBOOT_FIT_TEE_IMAGE ?= "tee-raw.bin" # User specific settings UBOOT_FIT_USER_SETTINGS ?= "" +# Additional images for the U-Boot fitImage, as a space separated list of +# image node names, like FIT_LOADABLES for the kernel FIT image. Each one is +# described by varflags named after its node, e.g.: +# +# UBOOT_FIT_LOADABLES = "fw" +# UBOOT_FIT_LOADABLE_FILENAME[fw] = "fw.bin" +# UBOOT_FIT_LOADABLE_LOADADDRESS[fw] = "0x80400000" +# UBOOT_FIT_LOADABLE_ENTRYPOINT[fw] = "0x80400000" +# UBOOT_FIT_LOADABLE_TYPE[fw] = "firmware" +# UBOOT_FIT_LOADABLE_ARCH[fw] = "arm64" +# UBOOT_FIT_LOADABLE_OS[fw] = "elf" +# UBOOT_FIT_LOADABLE_COMPRESSION[fw] = "none" +# UBOOT_FIT_LOADABLE_DESCRIPTION[fw] = "Firmware image" +# +# FILENAME and LOADADDRESS are required. FILENAME is absolute or relative to +# the U-Boot build directory, as the images are packed from there rather than +# from DEPLOY_DIR_IMAGE. ENTRYPOINT and OS are left out if not set, TYPE +# defaults to "firmware", ARCH to ${UBOOT_ARCH}, COMPRESSION to "none" and +# DESCRIPTION to " loadable". The nodes get the same hash and signature +# nodes as the class's own. +UBOOT_FIT_LOADABLES ?= "" + # U-Boot fitImage configuration description UBOOT_FIT_CONF_DESC ?= "Boot with signed U-Boot FIT" @@ -132,6 +154,10 @@ UBOOT_FIT_CONF_FIRMWARE ?= "" # It is a comma-separated list of strings. UBOOT_FIT_CONF_USER_LOADABLES ?= '' +# Images from UBOOT_FIT_LOADABLES loaded by the configuration, after its own, +# as a space separated list of node names +UBOOT_FIT_CONF_LOADABLES ?= "" + UBOOT_FIT_UBOOT_LOADADDRESS ?= "${UBOOT_LOADADDRESS}" UBOOT_FIT_UBOOT_ENTRYPOINT ?= "${UBOOT_ENTRYPOINT}" @@ -413,6 +439,65 @@ EOF EOF } +# Create a ITS image node for an image from UBOOT_FIT_LOADABLES, given its +# name, file, load address, entry point, type, arch, os, compression and +# description +uboot_fitimage_loadable() { + if [ -z "$2" ] || [ -z "$3" ] ; then + bbfatal "UBOOT_FIT_LOADABLES: $1 needs UBOOT_FIT_LOADABLE_FILENAME[$1] and UBOOT_FIT_LOADABLE_LOADADDRESS[$1]" + fi + + cat << EOF >> ${UBOOT_ITS} + $1 { + description = "$9"; + data = /incbin/("$2"); + type = "$5"; + arch = "$6"; +EOF + if [ -n "$7" ] ; then + echo " os = \"$7\";" >> ${UBOOT_ITS} + fi + echo " load = <$3>;" >> ${UBOOT_ITS} + if [ -n "$4" ] ; then + echo " entry = <$4>;" >> ${UBOOT_ITS} + fi + echo " compression = \"$8\";" >> ${UBOOT_ITS} + + uboot_fitimage_image_signing + + cat << EOF >> ${UBOOT_ITS} + }; +EOF +} + +# The uboot_fitimage_loadable calls for UBOOT_FIT_LOADABLES. The varflags are +# read as the task runs, so that a prefunc can still set them. +def uboot_fitimage_loadables(d): + import shlex + cmds = [] + for name in (d.getVar('UBOOT_FIT_LOADABLES') or '').split(): + def flag(var, default=''): + return d.getVarFlag(var, name) or default + args = [name, + flag('UBOOT_FIT_LOADABLE_FILENAME'), + flag('UBOOT_FIT_LOADABLE_LOADADDRESS'), + flag('UBOOT_FIT_LOADABLE_ENTRYPOINT'), + flag('UBOOT_FIT_LOADABLE_TYPE', 'firmware'), + flag('UBOOT_FIT_LOADABLE_ARCH', d.getVar('UBOOT_ARCH')), + flag('UBOOT_FIT_LOADABLE_OS'), + flag('UBOOT_FIT_LOADABLE_COMPRESSION', 'none'), + flag('UBOOT_FIT_LOADABLE_DESCRIPTION', '%s loadable' % name)] + cmds.append('uboot_fitimage_loadable ' + ' '.join(shlex.quote(a) for a in args)) + return '\n'.join(cmds) + +# The calls to uboot_fitimage_loadable only appear once the image list is +# expanded, and the varflags are read through a name +uboot_fitimage_assemble[vardeps] += "uboot_fitimage_loadable \ + UBOOT_FIT_LOADABLE_FILENAME UBOOT_FIT_LOADABLE_LOADADDRESS \ + UBOOT_FIT_LOADABLE_ENTRYPOINT UBOOT_FIT_LOADABLE_TYPE \ + UBOOT_FIT_LOADABLE_ARCH UBOOT_FIT_LOADABLE_OS \ + UBOOT_FIT_LOADABLE_COMPRESSION UBOOT_FIT_LOADABLE_DESCRIPTION" + # Create a ITS file for the U-boot FIT, for use when # we want to sign it so that the SPL can verify it uboot_fitimage_assemble() { @@ -474,10 +559,23 @@ EOF printf "%b" "${UBOOT_FIT_USER_SETTINGS}" >> ${UBOOT_ITS} fi + ${@uboot_fitimage_loadables(d)} + if [ -n "${UBOOT_FIT_CONF_USER_LOADABLES}" ] ; then conf_loadables="${conf_loadables}${UBOOT_FIT_CONF_USER_LOADABLES}" fi + for image in ${UBOOT_FIT_CONF_LOADABLES} ; do + case " ${UBOOT_FIT_LOADABLES} " in + *" $image "*) + conf_loadables="${conf_loadables}, \"$image\"" + ;; + *) + bbfatal "UBOOT_FIT_CONF_LOADABLES: $image is not in UBOOT_FIT_LOADABLES" + ;; + esac + done + conf_sign_images="" conf_sign_images_sep="" diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py index 73b1d68fcd..e3d078ed78 100644 --- a/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/meta/lib/oeqa/selftest/cases/fitimage.py @@ -1674,10 +1674,12 @@ class UBootFitImageTests(FitImageTestCase): BOOTLOADER_RECIPE = "virtual/bootloader" - def _fit_get_bb_vars(self, additional_vars=[]): + def _fit_get_bb_vars(self, additional_vars=[], flags=None): """Get bb_vars as needed by _test_sign_fit_image - Call the get_bb_vars function once and get all variables needed by the test case. + Call the get_bb_vars_flags function once and get all variables needed by + the test case. flags maps variable names to lists of flag names. The + flags are returned as dict {flag name: value} for their variable name. """ internal_used = { 'DEPLOY_DIR_IMAGE', @@ -1706,9 +1708,11 @@ class UBootFitImageTests(FitImageTestCase): 'UBOOT_FIT_ARM_TRUSTED_FIRMWARE', 'UBOOT_FIT_CONF_DESC', 'UBOOT_FIT_CONF_FIRMWARE', + 'UBOOT_FIT_CONF_LOADABLES', 'UBOOT_FIT_CONF_USER_LOADABLES', 'UBOOT_FIT_DESC', 'UBOOT_FIT_HASH_ALG', + 'UBOOT_FIT_LOADABLES', 'UBOOT_FIT_SIGN_ALG', 'UBOOT_FIT_TEE_ENTRYPOINT', 'UBOOT_FIT_TEE_IMAGE', @@ -1724,10 +1728,60 @@ class UBootFitImageTests(FitImageTestCase): 'UBOOT_SIGN_KEYDIR', 'UBOOT_SIGN_KEYNAME', } - bb_vars = get_bb_vars(list(internal_used | set(additional_vars)), UBootFitImageTests.BOOTLOADER_RECIPE) + bb_vars, bb_flags = get_bb_vars_flags(list(internal_used | set(additional_vars)), flags, + UBootFitImageTests.BOOTLOADER_RECIPE) + bb_vars.update(bb_flags) self.logger.debug("bb_vars: %s" % pprint.pformat(bb_vars, indent=4)) return bb_vars + # The varflags describing each UBOOT_FIT_LOADABLES entry + UBOOT_FIT_LOADABLE_FLAGS = [ + 'UBOOT_FIT_LOADABLE_ARCH', + 'UBOOT_FIT_LOADABLE_COMPRESSION', + 'UBOOT_FIT_LOADABLE_DESCRIPTION', + 'UBOOT_FIT_LOADABLE_ENTRYPOINT', + 'UBOOT_FIT_LOADABLE_FILENAME', + 'UBOOT_FIT_LOADABLE_LOADADDRESS', + 'UBOOT_FIT_LOADABLE_OS', + 'UBOOT_FIT_LOADABLE_TYPE', + ] + + # dumpimage names of the image types used by the UBOOT_FIT_LOADABLES tests + UBOOT_FIT_LOADABLE_TYPE_NAMES = { + 'firmware': 'Firmware', + 'standalone': 'Standalone Program', + } + + @staticmethod + def _get_uboot_loadables(bb_vars): + """Return the image node names in UBOOT_FIT_LOADABLES""" + return (bb_vars.get('UBOOT_FIT_LOADABLES') or '').split() + + @staticmethod + def _get_uboot_loadable_settings(bb_vars, loadable): + """Return the settings of an UBOOT_FIT_LOADABLES image, defaults applied as by the class""" + def flag(var, default=None): + return (bb_vars.get(var) or {}).get(loadable) or default + return { + 'filename': flag('UBOOT_FIT_LOADABLE_FILENAME'), + 'loadaddress': flag('UBOOT_FIT_LOADABLE_LOADADDRESS'), + 'entrypoint': flag('UBOOT_FIT_LOADABLE_ENTRYPOINT'), + 'type': flag('UBOOT_FIT_LOADABLE_TYPE', 'firmware'), + 'arch': flag('UBOOT_FIT_LOADABLE_ARCH', bb_vars['UBOOT_ARCH']), + 'os': flag('UBOOT_FIT_LOADABLE_OS'), + 'compression': flag('UBOOT_FIT_LOADABLE_COMPRESSION', 'none'), + 'description': flag('UBOOT_FIT_LOADABLE_DESCRIPTION', '%s loadable' % loadable), + } + + def _gen_uboot_loadable_dummy_images(self, bb_vars): + """Generate dummy files for the UBOOT_FIT_LOADABLES images""" + for loadable in UBootFitImageTests._get_uboot_loadables(bb_vars): + filename = UBootFitImageTests._get_uboot_loadable_settings(bb_vars, loadable)['filename'] + self.assertTrue(os.path.isabs(filename), + "The test images need an absolute UBOOT_FIT_LOADABLE_FILENAME[%s]" % loadable) + with open(filename, 'wb') as f: + f.write(os.urandom(256)) + def _bitbake_fit_image(self, bb_vars): """Bitbake the bootloader and return the paths to the its file and the FIT image""" machine = bb_vars['MACHINE'] @@ -1763,6 +1817,7 @@ class UBootFitImageTests(FitImageTestCase): images.append('tee') if bb_vars['UBOOT_FIT_ARM_TRUSTED_FIRMWARE'] == "1": images.append('atf') + images += UBootFitImageTests._get_uboot_loadables(bb_vars) # if bb_vars['UBOOT_FIT_USER_SETTINGS']: # configuration nodes @@ -1835,6 +1890,22 @@ class UBootFitImageTests(FitImageTestCase): 'compression = "none";', ] loadables.insert(0, "atf") + for loadable in UBootFitImageTests._get_uboot_loadables(bb_vars): + settings = UBootFitImageTests._get_uboot_loadable_settings(bb_vars, loadable) + its_field_check += [ + '%s {' % loadable, + 'description = "%s";' % settings['description'], + 'data = /incbin/("%s");' % settings['filename'], + 'type = "%s";' % settings['type'], + 'arch = "%s";' % settings['arch'], + ] + if settings['os']: + its_field_check.append('os = "%s";' % settings['os']) + its_field_check.append('load = <%s>;' % settings['loadaddress']) + if settings['entrypoint']: + its_field_check.append('entry = <%s>;' % settings['entrypoint']) + its_field_check.append('compression = "%s";' % settings['compression']) + loadables += (bb_vars.get('UBOOT_FIT_CONF_LOADABLES') or '').split() its_field_check += [ 'default = "conf";', 'description = "%s";' % bb_vars['UBOOT_FIT_CONF_DESC'], @@ -1894,6 +1965,18 @@ class UBootFitImageTests(FitImageTestCase): "Load Address": bb_vars['UBOOT_FIT_ARM_TRUSTED_FIRMWARE_LOADADDRESS'], # "Entry Point": bb_vars['UBOOT_FIT_ARM_TRUSTED_FIRMWARE_ENTRYPOINT'], not printed by mkimage? } + for loadable in UBootFitImageTests._get_uboot_loadables(bb_vars): + settings = UBootFitImageTests._get_uboot_loadable_settings(bb_vars, loadable) + req_sections[loadable] = { + "Load Address": settings['loadaddress'], + } + type_name = UBootFitImageTests.UBOOT_FIT_LOADABLE_TYPE_NAMES.get(settings['type']) + if type_name: + req_sections[loadable]["Type"] = type_name + # dumpimage prints the entry point of standalone images, not of firmware ones + if settings['entrypoint'] and settings['type'] == 'standalone': + req_sections[loadable]["Entry Point"] = settings['entrypoint'] + loadables += (bb_vars.get('UBOOT_FIT_CONF_LOADABLES') or '').split() req_sections["conf"] = { "Kernel": "unavailable", "FDT": "fdt", @@ -2177,6 +2260,106 @@ UBOOT_FIT_MKIMAGE_EXTRA_OPTS = "-E" result = runCmd('%s %s %s data-offset' % (fdtget_path, fitimage_path, node)) self.logger.debug("%s data-offset: %s" % (node, result.output)) + UBOOT_FIT_LOADABLES_CONFIG = """ +# Two images from UBOOT_FIT_LOADABLES: loadable1 with only the required +# settings, loadable2 with all of them, loaded by the configuration +UBOOT_FIT_LOADABLES = "loadable1 loadable2" +UBOOT_FIT_LOADABLE_FILENAME[loadable1] = "${TOPDIR}/loadable1-dummy.bin" +UBOOT_FIT_LOADABLE_LOADADDRESS[loadable1] = "0x80400000" +UBOOT_FIT_LOADABLE_FILENAME[loadable2] = "${TOPDIR}/loadable2-dummy.bin" +UBOOT_FIT_LOADABLE_LOADADDRESS[loadable2] = "0x80500000" +UBOOT_FIT_LOADABLE_ENTRYPOINT[loadable2] = "0x80500100" +UBOOT_FIT_LOADABLE_TYPE[loadable2] = "standalone" +UBOOT_FIT_LOADABLE_ARCH[loadable2] = "arm" +UBOOT_FIT_LOADABLE_OS[loadable2] = "elf" +UBOOT_FIT_LOADABLE_COMPRESSION[loadable2] = "gzip" +UBOOT_FIT_LOADABLE_DESCRIPTION[loadable2] = "The second loadable" +UBOOT_FIT_CONF_LOADABLES = "loadable2" +""" + + def _fit_get_bb_vars_loadables(self, loadables=['loadable1', 'loadable2']): + """Get bb_vars including the varflags of UBOOT_FIT_LOADABLES_CONFIG""" + return self._fit_get_bb_vars(flags={flag: loadables for flag in UBootFitImageTests.UBOOT_FIT_LOADABLE_FLAGS}) + + def _check_uboot_loadable_defaults(self, bb_vars): + """Check that loadable1 of UBOOT_FIT_LOADABLES_CONFIG has no entry and os property""" + fitimage_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "u-boot-fitImage-%s" % bb_vars['MACHINE']) + dtc_bindir = FitImageTestCase._setup_native('dtc-native') + for prop in ('entry', 'os'): + self._verify_dtb_property(dtc_bindir, fitimage_path, '/images/loadable1', prop, None, absent=True) + + def test_uboot_fit_image_loadables(self): + """ + Summary: Check if the images from UBOOT_FIT_LOADABLES are added + to the U-Boot FIT image and Image Tree Source (its). + Expected: 1) U-Boot its and FIT image are built successfully + 2) Each UBOOT_FIT_LOADABLES entry has an image node with + the properties from its UBOOT_FIT_LOADABLE_* varflags, + or their defaults when not set: type "firmware", + arch UBOOT_ARCH, compression "none", description + " loadable" and no entry or os property + 3) The configuration loads the images listed in + UBOOT_FIT_CONF_LOADABLES after its own ones + 4) Dumping the FIT image shows the image nodes + Product: oe-core + Author: Viswanath Kraleti + """ + machine = self._get_machine_or_skip() + config = """ +# Enable creation of the U-Boot fitImage +UBOOT_FITIMAGE_ENABLE = "1" +UBOOT_LOADADDRESS = "0x80080000" +UBOOT_ENTRYPOINT = "0x80080000" +""" + UBootFitImageTests.UBOOT_FIT_LOADABLES_CONFIG + config = FitImageTestCase._config_add_machine_settings(config, machine, keys=["UBOOT_MACHINE", "SPL_BINARY"]) + self.write_config(config) + bb_vars = self._fit_get_bb_vars_loadables() + self._gen_uboot_loadable_dummy_images(bb_vars) + self._test_fitimage(bb_vars) + self._check_uboot_loadable_defaults(bb_vars) + + def test_sign_uboot_fit_image_loadables_individual(self): + """ + Summary: Check if the images from UBOOT_FIT_LOADABLES are signed + like the other images of the U-Boot FIT image when the + individual images are signed (SPL_SIGN_INDIVIDUAL = "1"). + Expected: 1) U-Boot its and FIT image are built and signed + successfully + 2) The its file has a signature node in each image node, + those from UBOOT_FIT_LOADABLES included + 3) Dumping the FIT image shows signatures for all the + images + 4) SPL_MKIMAGE_SIGN_ARGS is passed to mkimage for each + signed image + Product: oe-core + Author: Viswanath Kraleti + """ + machine = self._get_machine_or_skip() + config = """ +# Enable creation and signing of the individual U-Boot fitImage images +UBOOT_FITIMAGE_ENABLE = "1" +SPL_SIGN_ENABLE = "1" +SPL_SIGN_CONF = "0" +SPL_SIGN_INDIVIDUAL = "1" +SPL_SIGN_KEYNAME = "spl-loadables-oe-selftest" +SPL_SIGN_KEYDIR = "${TOPDIR}/signing-keys" +UBOOT_ENTRYPOINT = "0x80000000" +UBOOT_LOADADDRESS = "0x80000000" +UBOOT_DTB_LOADADDRESS = "0x82000000" +SPL_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000" +SPL_MKIMAGE_SIGN_ARGS = "-c 'a smart U-Boot loadables comment'" +UBOOT_EXTLINUX = "0" +UBOOT_FIT_GENERATE_KEYS = "1" +UBOOT_FIT_HASH_ALG = "sha256" +""" + UBootFitImageTests.UBOOT_FIT_LOADABLES_CONFIG + config = FitImageTestCase._config_add_machine_settings(config, machine, keys=["UBOOT_MACHINE", "SPL_BINARY", "UBOOT_DTB_BINARY", "UBOOT_ARCH"]) + config = self._require_machine_capability(config, machine, '_cap_spl_dtb') + self.write_config(config) + bb_vars = self._fit_get_bb_vars_loadables() + self._gen_uboot_loadable_dummy_images(bb_vars) + self._test_fitimage(bb_vars) + self._check_uboot_loadable_defaults(bb_vars) + def test_sign_cascaded_uboot_fit_image(self): """ Summary: Check if U-Boot FIT image and Image Tree Source (its) are From patchwork Sat Nov 21 08:59:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswanath Kraleti X-Patchwork-Id: 105133 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.13646.1795251603901382196 for ; Sat, 21 Nov 2026 01:00:04 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@qualcomm.com header.s=qcppdkim1 header.b=muttNple; dkim=pass header.i=@oss.qualcomm.com header.s=google header.b=aTbLtDjx; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: oss.qualcomm.com, ip: 205.220.180.131, mailfrom: viswanath.kraleti@oss.qualcomm.com) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AL8BhDK2262299 for ; Sat, 21 Nov 2026 09:00:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=dk+D51k/Fwd /y0ckngKBDo/xfT+GWYK/8927r7SMSgk=; b=muttNplereTACr/oKfXKzPtbP7l ucJMhB76Xavnpay0oNsWgqd5s890/3Xbs2BHg3E4ZleQwtzrQd+4+HqfNHXfKhYl QSzPQYCnrIVww/08JXpcDZ7w+SqjBasTvI4mLwQBBiQEl9D04/RvI8JfgsW5QY4b +aINQ2GaET20mo+QVZPJsVSUbqkTw6ExkdJwPQu9uC9DRP8rjbTI9XwiclglOjMl FEaArnY3pZbqo5AdpMiWUsVNxuKWJSNmmhgtEYhcr6Ew/CfWn85eNTFuVsPA5rVn o+RqtRjdIjdBUAA9e6x6bWynu+mfl5R+LGYakWecvGXzeFRw7w3BTKkFWdw== Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j30nnrxud-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 21 Nov 2026 09:00:01 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-38355b03cb8so1683159eec.0 for ; Sat, 21 Nov 2026 01:00:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1795251600; x=1795856400; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=dk+D51k/Fwd/y0ckngKBDo/xfT+GWYK/8927r7SMSgk=; b=aTbLtDjx/PU5lW/Wb+F4t+LEYPvOWAq7W8qGYoYca3xpd1I2xS7N5V/sLRkodKfRT2 qfSuGRfcoqhGeN5WDcvo7ntGPqzjWOTpVgOwRq6zEHa9GSN4NKJ0GDBT+Y0YLpOIe6m7 Y3y9eck5lmMmSE4y2VjMS8hm2W/LPL8EPjOEP+ztUbDQFMfbHAoRxxv+/1OAKtxfkd8F mKc5GM+QRpd0i/6c/p7UXPcF2E+XrLcpLdmxp5XqNEY0yruP0tIEfH8xps3V4Gzrid1I jVdgd/osszYL0BtAJxFC3TTxlU6rhGlJoLgJzuoWv8YsnK37CutL7I254Ro3kPhaUfSX FqPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795251600; x=1795856400; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=dk+D51k/Fwd/y0ckngKBDo/xfT+GWYK/8927r7SMSgk=; b=hhFqSrtarmpAbZdg/f5hwGVQpCFa4FuwMkCEY4s7hEcHDa2Q5OlQKNatIyYNFzNPNH wsJh/kskKWnAKsp4TO+H0QNAJpsg/MNWgY4BUp7up7QfPNP5gVGi3Pe6o6bzgYOQBEny ienJbJH6Rstv50AVFZ26/EnnMDAy6JlJZ/aBTOjin1ww/ilM7IljNTOQvExdu5eJwvTN oNkAS7HQMwMywcKBDIsbHYPdIY1uMWAXYUhn241pOJGfOX22DjvkEMHcan4t3VxAhe3k RvdW7DpgQrRuy41s1UH3o76krgmXzAja8bJBMNuGtcYwMG8HxQrt2awkJ4hYvnTlr4lN HgeQ== X-Gm-Message-State: APuU4Z9CU0oLl9vwNOnLRYWUJJqd0W10Y3zfJrN1u/55hvnztqm3hY92 vuPIwInd1jQShFx1w+kfBUoimnSmchiIyKnTMM09V8vY2Wcxncq3KcPBIwF+SETpARZqdmODnBl hH1Ze7Wic9kbC3beaZXlldiOZNm3f/ExguDRlp+sfPsoMgsSYpG5i6NFR43P00maS7kVkrMwLNc /HTVCducyPItt5kJ6H0g== X-Gm-Gg: AZFdTZdzO8Py2pqXFYbW9bWu09cyzz7GT9wlLYEStA83I4n/fG93mkOaZwO61yt5jEU pDUgkx3vnPyCjSotVZzwCZf6qTI0KJplL96YI0ZpQO6SLbHNqdqnG3JbPwjJ0CgbxH7QdrSmACs WKka2XmnQBslviZsPQbBf+trBKuCRT73eCTCE9svSJHt+bMahYVlAkazozYAp1LIecop2IHlOSB 3Ubhb+pTkBA5UXv9eLrjUK7WylqOUfT1w66nTPqOZPIqRkQjo5Elz29K7dzg9omBXQgJEaI+P7o Wm3aE2Ok6+ZEbc7SMUhb5I/PC0vfUb8/MNwdfKXyfv2YHTe34Y7nXG65OQgcafqg04yv0XGwbVb ZPeArgBJ7DFZB+TwbgKWqcSDsE+iRlrbiADVNPSrxQD2CP9c2Xwa4Xecgbn9puA3g+jwo0P+3JW ioULPbIa0iNaakazJpCXdimgkjD83F7x+syhFJA56Hasg= X-Received: by 2002:a05:693c:881b:10b0:384:b791:6a41 with SMTP id 5a478bee46e88-3857073e4f8mr5636566eec.29.1795251600091; Sat, 21 Nov 2026 01:00:00 -0800 (PST) X-Received: by 2002:a05:693c:881b:10b0:384:b791:6a41 with SMTP id 5a478bee46e88-3857073e4f8mr5636544eec.29.1795251599404; Sat, 21 Nov 2026 00:59:59 -0800 (PST) Received: from hyd-e160-a52-10.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38567cafec4sm17887231eec.26.2026.11.21.00.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Nov 2026 00:59:59 -0800 (PST) From: Viswanath Kraleti To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer , Ricardo Salveti , Viswanath Kraleti Subject: [OE-core][PATCH v2 4/4] uboot-sign: add UBOOT_FIT_CONFIGURATIONS Date: Sat, 21 Nov 2026 14:29:37 +0530 Message-ID: <20261121085937.411140-5-viswanath.kraleti@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261121085937.411140-1-viswanath.kraleti@oss.qualcomm.com> References: <20261121085937.411140-1-viswanath.kraleti@oss.qualcomm.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIxMDAzNSBTYWx0ZWRfXyhujyx97Fpqx lvZXN3xgae2PimUkGyDm8uTC97Wn8XE52UHrU6Ji0MpdkJUxoiMrnFAF8ouydgaSSKRoKGDt4N6 leFVOhU5b+SZWA3OUor5xQMJBTmoArCKf38LEHDSzhdWDeck1PuHwF+DMTe+tCS1jBq2mVi5rXi /+w753f7EX9Ey1FyKcd90JaaA0RzM+KcPr2UREdQeigLjac33Frh+pVcq6cCMxuFpV3+q8phJwR kn+14u18I2LxoOWeTAx8Mz2TYlwGCs+cIP+jLCy/AyKbQd4NbVKXiWINcc+0FC8mE6f7tIP/JPk ZWuBwRWgb1WZnbR+dzL2D0wClQT3GmpgfRhL2L1g9oCq+BMJqdg98ZQt4dJBSlmUInZFoG8E9hg tslcxsIUa1WbmOmeg3otZ5aEtX3iWzuNiBNnyzvNvoTMpw/Yct2to8TO+GFt4cF+FXndi77pS+T J5SBViWaa54m1mS5WIw== X-Proofpoint-ORIG-GUID: cgAiJA4GJ3Oyx6ezicj6W5LsWTr5jhJM X-Authority-Analysis: v=2.4 cv=LITz05W9 c=1 sm=1 tr=0 ts=6b015d91 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=bRHZ-vucfTJdUhQUPqQA:9 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIxMDAzNSBTYWx0ZWRfXyXdlFasmPb8O A5kR5JU/370ayBZK0B9xVb6CrPMPkrLK0LOj1mZ93Aa9aFVV2mMNhzAlxIXScaagNOBIGdoIDcY RuCeiwC77vdkVA+CrU8ye+Ubz3Ggfbc= X-Proofpoint-GUID: cgAiJA4GJ3Oyx6ezicj6W5LsWTr5jhJM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-21_02,2026-11-19_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611210035 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 ; Sat, 21 Nov 2026 09:00:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250846 The U-Boot FIT only ever has the one configuration. An SPL that loads its images in stages, such as one loading firmware from a "pre-ddr" configuration ahead of DDR init and the rest from a "post-ddr" one, cannot get the other configurations into it, short of writing them as ITS text along with their signature nodes. Add UBOOT_FIT_CONFIGURATIONS, a list of configuration node names written after the default configuration, each described by UBOOT_FIT_CONFIGURATION_LOADABLES, _FIRMWARE and _DESCRIPTION varflags named after the node. Write every configuration, the default one included, from uboot_fitimage_configuration, so that they are all signed alike, and run fit_check_sign with -c for each of the additional configurations, as it otherwise only checks the default one. Teach the U-Boot FIT selftests about the additional configurations, have them check every configuration with fit_check_sign, and add a test signing two additional configurations. AI-Generated: Uses Claude Code Signed-off-by: Viswanath Kraleti --- meta/classes-recipe/uboot-sign.bbclass | 150 ++++++++++++++++++----- meta/lib/oeqa/selftest/cases/fitimage.py | 119 +++++++++++++++++- 2 files changed, 234 insertions(+), 35 deletions(-) diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass index 90921c10dd..c46a0d5f04 100644 --- a/meta/classes-recipe/uboot-sign.bbclass +++ b/meta/classes-recipe/uboot-sign.bbclass @@ -158,6 +158,19 @@ UBOOT_FIT_CONF_USER_LOADABLES ?= '' # as a space separated list of node names UBOOT_FIT_CONF_LOADABLES ?= "" +# Additional configurations for the U-Boot fitImage, written after the +# default one, as a space separated list of configuration node names. Each +# one is described by varflags named after its node: +# UBOOT_FIT_CONFIGURATION_LOADABLES[name] images it loads, as a space +# separated list of image node +# names (required) +# UBOOT_FIT_CONFIGURATION_FIRMWARE[name] image to boot first, if any +# UBOOT_FIT_CONFIGURATION_DESCRIPTION[name] +# description, the node name if +# not set +# They are signed like the default configuration. +UBOOT_FIT_CONFIGURATIONS ?= "" + UBOOT_FIT_UBOOT_LOADADDRESS ?= "${UBOOT_LOADADDRESS}" UBOOT_FIT_UBOOT_ENTRYPOINT ?= "${UBOOT_ENTRYPOINT}" @@ -490,19 +503,107 @@ def uboot_fitimage_loadables(d): cmds.append('uboot_fitimage_loadable ' + ' '.join(shlex.quote(a) for a in args)) return '\n'.join(cmds) -# The calls to uboot_fitimage_loadable only appear once the image list is +# Create a ITS configuration node, given its name, description, firmware, +# loadables and fdt image, signed as SPL_SIGN_CONF asks for it +uboot_fitimage_configuration() { + conf_firmware="" + conf_fdt="" + conf_sign_images="\"loadables\"" + + if [ -n "$3" ] ; then + conf_firmware="firmware = \"$3\";" + conf_sign_images="\"firmware\", ${conf_sign_images}" + fi + + if [ -n "$5" ] ; then + conf_fdt="fdt = \"$5\";" + conf_sign_images="${conf_sign_images}, \"fdt\"" + fi + + cat << EOF >> ${UBOOT_ITS} + $1 { + description = "$2"; + ${conf_firmware} + loadables = $4; + ${conf_fdt} +EOF + + if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${SPL_SIGN_CONF}" = "1" ] ; then + cat << EOF >> ${UBOOT_ITS} + signature { + algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}"; + key-name-hint = "${SPL_SIGN_KEYNAME}"; + sign-images = ${conf_sign_images}; + }; +EOF + fi + + cat << EOF >> ${UBOOT_ITS} + }; +EOF +} + +# Create a ITS configuration node for a configuration from +# UBOOT_FIT_CONFIGURATIONS, given its name, description, firmware and +# loadables +uboot_fitimage_user_configuration() { + images="uboot fdt ${UBOOT_FIT_LOADABLES}" + if [ "${UBOOT_FIT_TEE}" = "1" ] ; then + images="$images tee" + fi + if [ "${UBOOT_FIT_ARM_TRUSTED_FIRMWARE}" = "1" ] ; then + images="$images atf" + fi + + if [ -z "$4" ] ; then + bbfatal "UBOOT_FIT_CONFIGURATIONS: $1 needs UBOOT_FIT_CONFIGURATION_LOADABLES[$1]" + fi + + loadables="" + for image in $3 $4 ; do + case " $images " in + *" $image "*) + ;; + *) + bbfatal "UBOOT_FIT_CONFIGURATIONS: $1 has no $image image to load" + ;; + esac + done + for image in $4 ; do + loadables="${loadables}${loadables:+, }\"$image\"" + done + + uboot_fitimage_configuration "$1" "$2" "$3" "$loadables" "" +} + +# The uboot_fitimage_user_configuration calls for UBOOT_FIT_CONFIGURATIONS +def uboot_fitimage_user_configurations(d): + import shlex + cmds = [] + for name in (d.getVar('UBOOT_FIT_CONFIGURATIONS') or '').split(): + args = [name, + d.getVarFlag('UBOOT_FIT_CONFIGURATION_DESCRIPTION', name) or name, + d.getVarFlag('UBOOT_FIT_CONFIGURATION_FIRMWARE', name) or '', + ' '.join((d.getVarFlag('UBOOT_FIT_CONFIGURATION_LOADABLES', name) or '').split())] + cmds.append('uboot_fitimage_user_configuration ' + ' '.join(shlex.quote(a) for a in args)) + return '\n'.join(cmds) + +# The calls to uboot_fitimage_loadable and +# uboot_fitimage_user_configuration only appear once the lists are # expanded, and the varflags are read through a name uboot_fitimage_assemble[vardeps] += "uboot_fitimage_loadable \ + uboot_fitimage_user_configuration \ UBOOT_FIT_LOADABLE_FILENAME UBOOT_FIT_LOADABLE_LOADADDRESS \ UBOOT_FIT_LOADABLE_ENTRYPOINT UBOOT_FIT_LOADABLE_TYPE \ UBOOT_FIT_LOADABLE_ARCH UBOOT_FIT_LOADABLE_OS \ - UBOOT_FIT_LOADABLE_COMPRESSION UBOOT_FIT_LOADABLE_DESCRIPTION" + UBOOT_FIT_LOADABLE_COMPRESSION UBOOT_FIT_LOADABLE_DESCRIPTION \ + UBOOT_FIT_CONFIGURATION_LOADABLES UBOOT_FIT_CONFIGURATION_FIRMWARE \ + UBOOT_FIT_CONFIGURATION_DESCRIPTION" # Create a ITS file for the U-boot FIT, for use when # we want to sign it so that the SPL can verify it uboot_fitimage_assemble() { conf_loadables="\"uboot\"" - conf_firmware="" rm -f ${UBOOT_ITS} ${UBOOT_FITIMAGE_BINARY} # First we create the ITS script @@ -576,45 +677,19 @@ EOF esac done - conf_sign_images="" - conf_sign_images_sep="" - - if [ -n "${UBOOT_FIT_CONF_FIRMWARE}" ] ; then - conf_firmware="firmware = \"${UBOOT_FIT_CONF_FIRMWARE}\";" - conf_sign_images="${conf_sign_images}${conf_sign_images_sep}\"firmware\"" - conf_sign_images_sep=", " - fi - - if [ -n "${conf_loadables}" ] ; then - conf_sign_images="${conf_sign_images}${conf_sign_images_sep}\"loadables\"" - conf_sign_images_sep=", " - fi - conf_sign_images="${conf_sign_images}${conf_sign_images_sep}\"fdt\"" - cat << EOF >> ${UBOOT_ITS} }; configurations { default = "conf"; - conf { - description = "${UBOOT_FIT_CONF_DESC}"; - ${conf_firmware} - loadables = ${conf_loadables}; - fdt = "fdt"; EOF - if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${SPL_SIGN_CONF}" = "1" ] ; then - cat << EOF >> ${UBOOT_ITS} - signature { - algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}"; - key-name-hint = "${SPL_SIGN_KEYNAME}"; - sign-images = ${conf_sign_images}; - }; -EOF - fi + uboot_fitimage_configuration "conf" "${UBOOT_FIT_CONF_DESC}" \ + "${UBOOT_FIT_CONF_FIRMWARE}" "${conf_loadables}" "fdt" + + ${@uboot_fitimage_user_configurations(d)} cat << EOF >> ${UBOOT_ITS} - }; }; }; EOF @@ -663,6 +738,15 @@ EOF ${UBOOT_FIT_CHECK_SIGN} \ -k "${SPL_DIR}/${SPL_DTB_SIGNED}" \ -f ${UBOOT_FITIMAGE_BINARY} + + # fit_check_sign only checks the default configuration + # unless told otherwise, so check the others too + for conf in ${UBOOT_FIT_CONFIGURATIONS} ; do + ${UBOOT_FIT_CHECK_SIGN} \ + -k "${SPL_DIR}/${SPL_DTB_SIGNED}" \ + -f ${UBOOT_FITIMAGE_BINARY} \ + -c "$conf" + done else # Sign the U-boot FIT image ${UBOOT_MKIMAGE_SIGN} \ diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py index e3d078ed78..5db1f0940a 100644 --- a/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/meta/lib/oeqa/selftest/cases/fitimage.py @@ -1710,6 +1710,7 @@ class UBootFitImageTests(FitImageTestCase): 'UBOOT_FIT_CONF_FIRMWARE', 'UBOOT_FIT_CONF_LOADABLES', 'UBOOT_FIT_CONF_USER_LOADABLES', + 'UBOOT_FIT_CONFIGURATIONS', 'UBOOT_FIT_DESC', 'UBOOT_FIT_HASH_ALG', 'UBOOT_FIT_LOADABLES', @@ -1773,6 +1774,29 @@ class UBootFitImageTests(FitImageTestCase): 'description': flag('UBOOT_FIT_LOADABLE_DESCRIPTION', '%s loadable' % loadable), } + # The varflags describing each UBOOT_FIT_CONFIGURATIONS entry + UBOOT_FIT_CONFIGURATION_FLAGS = [ + 'UBOOT_FIT_CONFIGURATION_DESCRIPTION', + 'UBOOT_FIT_CONFIGURATION_FIRMWARE', + 'UBOOT_FIT_CONFIGURATION_LOADABLES', + ] + + @staticmethod + def _get_uboot_configurations(bb_vars): + """Return the configuration node names: the default one, then UBOOT_FIT_CONFIGURATIONS""" + return ['conf'] + (bb_vars.get('UBOOT_FIT_CONFIGURATIONS') or '').split() + + @staticmethod + def _get_uboot_configuration_settings(bb_vars, configuration): + """Return the settings of an UBOOT_FIT_CONFIGURATIONS entry, defaults applied as by the class""" + def flag(var, default=None): + return (bb_vars.get(var) or {}).get(configuration) or default + return { + 'description': flag('UBOOT_FIT_CONFIGURATION_DESCRIPTION', configuration), + 'firmware': flag('UBOOT_FIT_CONFIGURATION_FIRMWARE'), + 'loadables': flag('UBOOT_FIT_CONFIGURATION_LOADABLES', '').split(), + } + def _gen_uboot_loadable_dummy_images(self, bb_vars): """Generate dummy files for the UBOOT_FIT_LOADABLES images""" for loadable in UBootFitImageTests._get_uboot_loadables(bb_vars): @@ -1821,7 +1845,7 @@ class UBootFitImageTests(FitImageTestCase): # if bb_vars['UBOOT_FIT_USER_SETTINGS']: # configuration nodes - configurations = [ 'conf'] + configurations = UBootFitImageTests._get_uboot_configurations(bb_vars) spl_sign_enable = bb_vars['SPL_SIGN_ENABLE'] == "1" spl_sign_individual = spl_sign_enable and bb_vars['SPL_SIGN_INDIVIDUAL'] == "1" @@ -1918,6 +1942,20 @@ class UBootFitImageTests(FitImageTestCase): sign_images.append("firmware") sign_images += ["loadables", "fdt"] its_field_check.append('sign-images = "%s";' % '", "'.join(sign_images)) + for configuration in UBootFitImageTests._get_uboot_configurations(bb_vars)[1:]: + settings = UBootFitImageTests._get_uboot_configuration_settings(bb_vars, configuration) + its_field_check += [ + '%s {' % configuration, + 'description = "%s";' % settings['description'], + ] + sign_images = [] + if settings['firmware']: + its_field_check.append('firmware = "%s";' % settings['firmware']) + sign_images.append("firmware") + its_field_check.append('loadables = "%s";' % '", "'.join(settings['loadables'])) + sign_images.append("loadables") + if bb_vars['SPL_SIGN_ENABLE'] == "1" and bb_vars['SPL_SIGN_CONF'] == "1": + its_field_check.append('sign-images = "%s";' % '", "'.join(sign_images)) return its_field_check def _get_req_sigvalues_config(self, bb_vars): @@ -1982,6 +2020,16 @@ class UBootFitImageTests(FitImageTestCase): "FDT": "fdt", "Loadables": ','.join(loadables), } + configurations = UBootFitImageTests._get_uboot_configurations(bb_vars) + for configuration in configurations[1:]: + settings = UBootFitImageTests._get_uboot_configuration_settings(bb_vars, configuration) + req_sections[configuration] = { + "Description": settings['description'], + "Kernel": "unavailable", + "Loadables": ','.join(settings['loadables']), + } + if settings['firmware']: + req_sections[configuration]["Firmware"] = settings['firmware'] # Add signing related properties if needed uboot_fit_hash_alg = bb_vars['UBOOT_FIT_HASH_ALG'] @@ -1993,7 +2041,7 @@ class UBootFitImageTests(FitImageTestCase): num_signatures = 0 if spl_sign_enable == "1": for section in req_sections: - if section.startswith('conf'): + if section in configurations: if spl_sign_conf == "1": req_sections[section]['Sign algo'] = "%s,%s:%s" % \ (uboot_fit_hash_alg, uboot_fit_sign_alg, spl_sign_keyname) @@ -2040,6 +2088,11 @@ class UBootFitImageTests(FitImageTestCase): "%s,%s" % (uboot_fit_hash_alg, uboot_fit_sign_alg)) self._verify_dtb_property(dtc_bindir, spl_dtb_path, key_dtb_path, "key-name-hint", spl_sign_keyname) + # Check the signature of each configuration with the key in the SPL DTB + if bb_vars['SPL_SIGN_CONF'] == "1": + for configuration in UBootFitImageTests._get_uboot_configurations(bb_vars): + self._verify_fit_image_signature(uboot_tools_bindir, fitimage_path, spl_dtb_path, configuration) + # Search for the string passed to mkimage in each signed section of the FIT image. # Looks like mkimage supports to add a comment but does not support to read it back. a_comment = FitImageTestCase._get_uboot_mkimage_sign_args(bb_vars['SPL_MKIMAGE_SIGN_ARGS']) @@ -2360,6 +2413,68 @@ UBOOT_FIT_HASH_ALG = "sha256" self._test_fitimage(bb_vars) self._check_uboot_loadable_defaults(bb_vars) + def test_sign_uboot_fit_image_configurations(self): + """ + Summary: Check if the configurations from UBOOT_FIT_CONFIGURATIONS + are added to the U-Boot FIT image and Image Tree Source + (its) and signed like the default configuration. + Expected: 1) U-Boot its and FIT image are built and signed + successfully + 2) Each UBOOT_FIT_CONFIGURATIONS entry has a configuration + node after the default one, with the firmware, + loadables and description from its + UBOOT_FIT_CONFIGURATION_* varflags, the description + defaulting to the node name, and no fdt property + 3) Each configuration has a signature node covering its + firmware and loadables + 4) Dumping the FIT image shows signatures for all the + configurations, and fit_check_sign verifies each of + them with the key in the SPL DTB + 5) SPL_MKIMAGE_SIGN_ARGS is passed to mkimage for each + signed configuration + Product: oe-core + Author: Viswanath Kraleti + """ + machine = self._get_machine_or_skip() + config = """ +# Enable creation and signing of the U-Boot fitImage +UBOOT_FITIMAGE_ENABLE = "1" +SPL_SIGN_ENABLE = "1" +SPL_SIGN_KEYNAME = "spl-configurations-oe-selftest" +SPL_SIGN_KEYDIR = "${TOPDIR}/signing-keys" +UBOOT_ENTRYPOINT = "0x80000000" +UBOOT_LOADADDRESS = "0x80000000" +UBOOT_DTB_LOADADDRESS = "0x82000000" +SPL_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000" +SPL_MKIMAGE_SIGN_ARGS = "-c 'a smart U-Boot configurations comment'" +UBOOT_EXTLINUX = "0" +UBOOT_FIT_GENERATE_KEYS = "1" +UBOOT_FIT_HASH_ALG = "sha256" + +# Two more configurations: pre-ddr boots loadable1 and loads loadable2, +# minimal only loads U-Boot and has no description set +UBOOT_FIT_CONFIGURATIONS = "pre-ddr minimal" +UBOOT_FIT_CONFIGURATION_FIRMWARE[pre-ddr] = "loadable1" +UBOOT_FIT_CONFIGURATION_LOADABLES[pre-ddr] = "loadable2" +UBOOT_FIT_CONFIGURATION_DESCRIPTION[pre-ddr] = "Boot ahead of the DDR init" +UBOOT_FIT_CONFIGURATION_LOADABLES[minimal] = "uboot" +""" + UBootFitImageTests.UBOOT_FIT_LOADABLES_CONFIG + config = FitImageTestCase._config_add_machine_settings(config, machine, keys=["UBOOT_MACHINE", "SPL_BINARY", "UBOOT_DTB_BINARY", "UBOOT_ARCH"]) + config = self._require_machine_capability(config, machine, '_cap_spl_dtb') + self.write_config(config) + configurations = ['pre-ddr', 'minimal'] + flags = {flag: ['loadable1', 'loadable2'] for flag in UBootFitImageTests.UBOOT_FIT_LOADABLE_FLAGS} + flags.update({flag: configurations for flag in UBootFitImageTests.UBOOT_FIT_CONFIGURATION_FLAGS}) + bb_vars = self._fit_get_bb_vars(flags=flags) + self._gen_uboot_loadable_dummy_images(bb_vars) + self._test_fitimage(bb_vars) + + # The additional configurations load no device tree + fitimage_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "u-boot-fitImage-%s" % bb_vars['MACHINE']) + dtc_bindir = FitImageTestCase._setup_native('dtc-native') + for configuration in configurations: + self._verify_dtb_property(dtc_bindir, fitimage_path, '/configurations/%s' % configuration, 'fdt', None, absent=True) + def test_sign_cascaded_uboot_fit_image(self): """ Summary: Check if U-Boot FIT image and Image Tree Source (its) are