From patchwork Thu Feb 12 00:13:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1824 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855269; bh=b5WzA283SatbGnWvWadt1Ae/D1uOiGaOl6Wl4Q9/pgg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=PVgOk8+FM/ho4ctTpBWEhS6HNk4/ToJrqeCL6ryAU1ymMRMM0yyOxzTCVAFE6zrhx mZmC9E7crVXAy6Qb+nx+buboNGXE7j2eZyoHsKsMFLsG2s/0yrbzQcmOUB/DXF8514 rlU4/uSuxzCm+1pJxxlMXQ5XIzMDxFrWD63RXDAV+vfzeiKaJFYW5IM/tQVt6DH5NQ he7t7fvAnfq9ce9zlThjHuK/2QigNaDEBEia8+6Z/3hdcoUqZewg4Xs6TYJSPx//on gWJCjutKDxHkQ1dVqE6YsptLf1bHcW/rYxJKaI8v9CUVegXEGLe1Wvvsj5Kf/58Qin Whp5rLEyCE3Vg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 790BB69A99 for ; Wed, 11 Feb 2026 17:14:29 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id JHF0RoTVULhV for ; Wed, 11 Feb 2026 17:14:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855269; bh=b5WzA283SatbGnWvWadt1Ae/D1uOiGaOl6Wl4Q9/pgg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=PVgOk8+FM/ho4ctTpBWEhS6HNk4/ToJrqeCL6ryAU1ymMRMM0yyOxzTCVAFE6zrhx mZmC9E7crVXAy6Qb+nx+buboNGXE7j2eZyoHsKsMFLsG2s/0yrbzQcmOUB/DXF8514 rlU4/uSuxzCm+1pJxxlMXQ5XIzMDxFrWD63RXDAV+vfzeiKaJFYW5IM/tQVt6DH5NQ he7t7fvAnfq9ce9zlThjHuK/2QigNaDEBEia8+6Z/3hdcoUqZewg4Xs6TYJSPx//on gWJCjutKDxHkQ1dVqE6YsptLf1bHcW/rYxJKaI8v9CUVegXEGLe1Wvvsj5Kf/58Qin Whp5rLEyCE3Vg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 68B6D69A90 for ; Wed, 11 Feb 2026 17:14:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855267; bh=gy1M/+oC4X19z/dER4b567zbcvNEemHGAmQC3nwI0+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ua1d373exz2h/76n3LHz+ZuLU8vL+u5FyZwqyLm6/1t/RnuFAIgrp76HxTjkNuxad Z9MhBXTg+yOVihD37zGoVbnW74kSNtKZ23VLKyxadsKxJnfcJc2MQZkWNU5neEcWHV PKA6eBDpOutHAZGhYglOxnx+9jVXIpRltavw2eR56uNXo5g2eWwGFMSfb6rWXi1s8e zWHJgp6OxL32rPX47JAC3XqAphscRminZg/prf6RKIr18dWSi8A11q10B5QrGB1uFG Wg7LmNHb47rLMlvh6YDMcFWUmzTBBtzzmZoSxL98DWYlses6xFSP1mXiSEplyr57+z 1qfbPgmvswG7g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 68F1069A90; Wed, 11 Feb 2026 17:14:27 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id nTmLMcB2Ke3k; Wed, 11 Feb 2026 17:14:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855264; bh=fZFX3/OUbFz5MZgELnE5ObtL9xIYu9e9ojZfbIZ/CjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CVkPC0gpzg8PVe8QE1iKSiVRNMyGmyWV7XH7mbm7Mk8u5u09iDyGoosi13B0NPIzW OK6HJf8Qt5d8wW9+qr0xznlGtfehp63GuTc3mXG5AzjLtySe5IvPUZ81XfjfnDhYE9 W+fhP7m0qNlzAMgK7jkaUksL3k57gdAASOmfUEydCxUMmHwT6J5c7AwAiI9Dpzm1qM OHZf5cWuBQBqPt3NHMV3tPSFYOzAPTH6v+cxvHZV/EKylcRNVR+kN1+Rb0hdC8yBG/ PC0vnLwfv+sID4cr2V8h3SDfptMKV0zY6d4XqNiAsUP775s/QchKqOUYbaC2YeCnma ky/ofrSpDPAYg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 87513699C6; Wed, 11 Feb 2026 17:14:24 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:52 -0700 Message-ID: <20260212001410.1919749-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JVLRX2QEUAESOMOS3BISOIFDWPVCLV7M X-Message-ID-Hash: JVLRX2QEUAESOMOS3BISOIFDWPVCLV7M X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/15] board_f: Skip the FDT relocation when not relocating List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass When GD_FLG_SKIP_RELOC is set (e.g. for EFI applications), U-Boot does not relocate itself, so the reserved FDT destination address is not valid. Attempting to memcpy the FDT to this address causes a page fault on RISC-V EFI apps. Add a GD_FLG_SKIP_RELOC check before the FDT copy in reloc_and_fix_fdt() so the FDT blob pointer is left unchanged when relocation is skipped. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- common/board_f.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/board_f.c b/common/board_f.c index ec0bdee7321..448cf2e319a 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -665,7 +665,8 @@ static int init_post(void) static int reloc_and_fix_fdt(void) { if (!IS_ENABLED(CONFIG_OF_EMBED)) { - if (gd->boardf->new_fdt) { + if (!(gd->flags & GD_FLG_SKIP_RELOC) && + gd->boardf->new_fdt) { memcpy(gd->boardf->new_fdt, gd->fdt_blob, fdt_totalsize(gd->fdt_blob)); gd->fdt_blob = gd->boardf->new_fdt; From patchwork Thu Feb 12 00:13:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1825 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855274; bh=wi6qD+lo20ip8HhxD2FKFzsO8IW9Z9xDvMn+7aNQhsE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=JFYyVeXxYeZ4EyLlwdZGQhn9QKF9Eebq69Pa92wv1/qICk9JMZIk4HIqmILqXAHTj 5m+X/IX8MY97Uope8I5fib3h93ihHiYbpOeyne+5le6jNhcZiRU4bl31+YPqE01lK2 /7+Bwzz717TeAtSHA2L9nCYbj/LoQdWyYRD1r/zZsXBL8Lov07SnIkAdePCCT3NdVR wexpl2cMf9U5zmUPxJM2q0dw5ZOSVt2P5UCu8W1PeuRASBpSEQHqMfkC7Cd52ykmCo +jgqHaB3yIO5sTQ875U1aj0h7uWjgcXSJzP8kNPbaZEyzOzuuyA9augUQSNA0IYQST axKwkXlPIq3Zg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6FDBD69A99 for ; Wed, 11 Feb 2026 17:14:34 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id JdNPGFTb76yT for ; Wed, 11 Feb 2026 17:14:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855274; bh=wi6qD+lo20ip8HhxD2FKFzsO8IW9Z9xDvMn+7aNQhsE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=JFYyVeXxYeZ4EyLlwdZGQhn9QKF9Eebq69Pa92wv1/qICk9JMZIk4HIqmILqXAHTj 5m+X/IX8MY97Uope8I5fib3h93ihHiYbpOeyne+5le6jNhcZiRU4bl31+YPqE01lK2 /7+Bwzz717TeAtSHA2L9nCYbj/LoQdWyYRD1r/zZsXBL8Lov07SnIkAdePCCT3NdVR wexpl2cMf9U5zmUPxJM2q0dw5ZOSVt2P5UCu8W1PeuRASBpSEQHqMfkC7Cd52ykmCo +jgqHaB3yIO5sTQ875U1aj0h7uWjgcXSJzP8kNPbaZEyzOzuuyA9augUQSNA0IYQST axKwkXlPIq3Zg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5DDFF69A88 for ; Wed, 11 Feb 2026 17:14:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855271; bh=79rO/3DgEQtSuqdxyr8i6H5g1ra7n7RzwxSftj9h8is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2QXI2S+jdXseIeXdQ5LwH4rX2bO99MINV9WvkoK4m679LkC/AqTvmLk3P+F+ixgn sVH4GrPmF0J8P/+zi+Xi+vE8rGkE699ToMBQvpei9KPPchI7M+Dp/0HQFqYAJI5frf ySLZwxz6tzlz9Biq4I0xft/xyHF6Wk5AyLlLGbi5g5lcZGuZZvqX6foH+rGOJ78gPv fOcEAZxOCCsqqw3E8If/wokjy7s9zWmJOPPCebrbR5Hoi+lfqurDTSEOVd0qzCuh9t pUCm1UcaHxiiXR5ft4kXBKR2KV9vgAonBDBz6t1lEzCsABPT+OH6ZjNQhcwmkMUI80 8Rv/V49LxA0jA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BC9C169A9E; Wed, 11 Feb 2026 17:14:31 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id BNFwRG3jUFsJ; Wed, 11 Feb 2026 17:14:31 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855266; bh=ZMnqkLRBlpsug5tmpEX/gQwUaf5o8hpS6xD/CIuaBjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOMFMg4SrNHcpb3M5YV/LSy7BAP8zprakLPHXedAcHyx2WRVfCaXtNIWwI/hbnUfv QP44PhZxmTJ92Mmvc4pPauwFgh5rTgy7kx4ktZ+nf1rcDsg6HGHZRwPcKsB/hMEd6l t59/FZUUaJkCTsetzOJues6K9d9gd0vFxFZq1eiTEHxLM1StHMXX86ZL3uY890BiWN 1BFWiCnYAQAUeR5KnmpKPSiHCkCbNcblRNWKXx0bkd9jyI7KE04wGjRBsxsHhOBspw dx82ClOJ2kW2MLIv+2HkCRsqXjAguk11X/fJ5u1ik5KWu0WQ73jpUmm8Na8kyWZwtL f9vwHMCo2nPzQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9FAD369A88; Wed, 11 Feb 2026 17:14:25 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:53 -0700 Message-ID: <20260212001410.1919749-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: XJYU2VOKFCHH4XCWREK4T2Y7GKEMTO3K X-Message-ID-Hash: XJYU2VOKFCHH4XCWREK4T2Y7GKEMTO3K X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/15] board_r: Skip set_gd() for RISC-V EFI applications List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass board_init_r() unconditionally calls set_gd(new_gd) for RISC-V, but the EFI application entry point passes NULL as the new_gd parameter. This zeroes the gp register (which holds the global data pointer), causing an immediate page fault when gd is next accessed. For EFI apps the global data pointer is already set correctly by efi_app.c before calling board_init_r(), so skip the set_gd() call. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- common/board_r.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/board_r.c b/common/board_r.c index c0f1ea9f003..18258b4fa0a 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -793,7 +793,8 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) arch_setup_gd(new_gd); #if defined(CONFIG_RISCV) - set_gd(new_gd); + if (!IS_ENABLED(CONFIG_EFI_APP)) + set_gd(new_gd); #elif !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64) gd = new_gd; #endif From patchwork Thu Feb 12 00:13:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1826 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855276; bh=tMM0+UBs/ZGnkmTdliP12xOqGnSMeRg376a6jDBxVWw=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DYm/aWUA07X7U8bUoAkSqL9363uvcPbSUbS+dMMQsmqfyayfJA36+NdnTiqVDdiO8 5JZgTnzGSnbUzpzYWvDO7eVLRzuCGIZ+dCBUWTXFgMbHOgpPN1QTG965m6FpRW5UWf vwFBKBSrlZn2lknILti3MdCj+0y796g0u7MD2r4dQxGrT0ckle6v16jqFiakKWH2tU dF7EdsKhXw0soTcaw0QhxVNqK7y+Uv+NvLWg576A28kyq5zYBE6yMBFW9yzcrJgbX5 zrQ8t3/Jaf5cDHu505gfHPUHcWASKNnpGOVgHH+WNT4VLqNPVIhMCqMlQI3nqTh/Tj msAxdxMUPeGBg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DE3BB69A9E for ; Wed, 11 Feb 2026 17:14:36 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id cMvAEcIKXGB2 for ; Wed, 11 Feb 2026 17:14:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855274; bh=tMM0+UBs/ZGnkmTdliP12xOqGnSMeRg376a6jDBxVWw=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=M6Pnh8IAQFbND5y+gkxjfrmMpY+s5YUHlkDo8Jhf6j6/yNTJodNt/y6UrSnRSqxj8 GcxqYTQP7Aeh2EL4nH1jhX5Lnl8RTm2s+X+8Zi85+6gE6YfuK3fc4hNkbS8yae9InF 8jjDotpIGJoL6NpgeDmukVLQLMxxR9CB6RIVKm9DHkJs2gN3K+k4GQezeJ35ZCrgTA dJw3pzcD6G+CW346HzGPvTaQCp3pEAySwo3sNk3OafwNX5y5NeOt1WRB8yvji3ixnA Yi9h7tTTobL0jXlM4yrr8toiRGPxHmKB/IwD0SszLDCtaH7JBYQuvuG2+t5vYLcYH/ yEreUdL6ZpWvw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E07F669A88 for ; Wed, 11 Feb 2026 17:14:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855271; bh=TjsAhvwguOAESKRcPw5gE/mvORkNOcPP2PuSU7Zbamg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r/nlZ1XDSP8IevvMqju/pXUKVWlaDJ1DDD9kpSATXydb/iRYn5Noh74lZ5POTUraS 6CTmrBGCN7pfJ7hFIDEbDCaqlI+dWe7xaWVGCniwDXiWpiohb3K9AZkBfRtPQuYGzu M/plxNJmAkzaz2SygdcsTTvMhfBpH7m40tFygURN5n7QIzAZboZA0DrEyqVRtm1uls bBC4B43Uc0gsQf1NMjo83TSqbmG8c1002YAxenqEXshX2p8rLpbMGIshMgHPwtUYf6 KU67HBx/MZekH/5FqW+VFnebjylZPE3DBg1rPhZqjHpwmSPF1lhCOxOzHzXXQyHS7y DFHHWzJqxt4zA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D0B5969A88; Wed, 11 Feb 2026 17:14:31 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 4mxt8DJvWZkN; Wed, 11 Feb 2026 17:14:31 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855270; bh=UWm9QYuo61abosHEwqHFPg3/mzklH/PuHqjdu5sI3rI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sJrj8qv3jOmltKmVGGkQn3N0LYKeaH3rnVcNYu1pLihABqN8a7PXMzxEqcFiPKucA U7INeAvFHxGn6dzUvQpSPE4pSLz9JubNoVDMM5exA/+IR99z1qaZDPXLEt6nHpwYdI 1GqJzeujlgjIdVk4ma1rQ5A/tas7NEMxowi+qZWOyu70zwjf7y2BFxPWoA67yJlmK9 IymhEFkpLXhGOzX0oLP3W5yP6zkXKzGMMiy/AunjXLB3jN26tBKBcEO9wwA2TSEbPi xktSy+v7qvzHTZEPdfAh8pBUTgZBDPTw9TfWrNcXuRXdQktfRd7G21jVpKEpMMW+2A RWyr5S2Hpuw0A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 59F0069A93; Wed, 11 Feb 2026 17:14:30 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:54 -0700 Message-ID: <20260212001410.1919749-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5ERDIZSMN545PTAY6H6NLBYJKI7NTCZL X-Message-ID-Hash: 5ERDIZSMN545PTAY6H6NLBYJKI7NTCZL X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/15] riscv: Disable OF_BOARD_FIXUP for EFI applications List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The OF_BOARD_FIXUP event handler riscv_fdt_copy_resv_mem_node() tries to expand the FDT in place by 1 KiB to copy reserved-memory nodes from the firmware device tree. For EFI applications the FDT is embedded with no extra space, so fdt_open_into() fails and causes a crash. Disable OF_BOARD_FIXUP for EFI_APP builds. The EFI application does not need to copy firmware reserved-memory nodes since it runs on top of the UEFI firmware which manages its own memory map. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 3434dd0e169..378a974f06c 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -500,7 +500,7 @@ config STACK_SIZE_SHIFT default 14 config OF_BOARD_FIXUP - default y if OF_SEPARATE && RISCV_SMODE + default y if OF_SEPARATE && RISCV_SMODE && !EFI_APP menu "Use assembly optimized implementation of memory routines" From patchwork Thu Feb 12 00:13:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1827 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855281; bh=u5pfBV2LHRkGxQJ7lHHsWzuZUCsD2RT6rMfmQ0mBkG0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XtBPpfGYLzkzFCR90X8LKOWZmwJRMHWQzYkNxOLJyn9HtBnzQ6Ruh68cd0diDpwZn RUxIj3gGzfA36Uc2ENOIxlccaIN0a56TcfgMYMsjQxhSHF53AVWEZGEsYjjxCXoLNi Aiv0n67DKtvG9efpNkGqJrRESncX5V6DDWqgZZP6RzcwjeHUrhGXVhh4mqgl4EZQH/ eZx0B0QzZNCMp0zO5XNeq9tWGnn52g+QPhNRL37vdMiBRFCItHDnZU79ZCmguv8xGc a7Na+CiEVNAWJz/WwxOaLHv7A2DZq1Ds1tVhkFU3PMRDN4VmbTlKVQ/2fYGqRcZZLS kugf8txW+mMZw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6CE73699C6 for ; Wed, 11 Feb 2026 17:14:41 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id o51DLtfBmEHT for ; Wed, 11 Feb 2026 17:14:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855281; bh=u5pfBV2LHRkGxQJ7lHHsWzuZUCsD2RT6rMfmQ0mBkG0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XtBPpfGYLzkzFCR90X8LKOWZmwJRMHWQzYkNxOLJyn9HtBnzQ6Ruh68cd0diDpwZn RUxIj3gGzfA36Uc2ENOIxlccaIN0a56TcfgMYMsjQxhSHF53AVWEZGEsYjjxCXoLNi Aiv0n67DKtvG9efpNkGqJrRESncX5V6DDWqgZZP6RzcwjeHUrhGXVhh4mqgl4EZQH/ eZx0B0QzZNCMp0zO5XNeq9tWGnn52g+QPhNRL37vdMiBRFCItHDnZU79ZCmguv8xGc a7Na+CiEVNAWJz/WwxOaLHv7A2DZq1Ds1tVhkFU3PMRDN4VmbTlKVQ/2fYGqRcZZLS kugf8txW+mMZw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5B4B169A88 for ; Wed, 11 Feb 2026 17:14:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855279; bh=j5av7G9nUvFdXJArK3K4xaadTO65BbFjRwaQgWWueCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ssKfx9mB4H5P0Vvcf6p7XXhkmPOH5LK5G2lFqPmWjJDHhaAmf8+pvBVz7Ehc3zrko TmhyaTWS3/4gNhylJ531U2263YZSLUmpZ1dWSuN9VUETy64wuANQXE7tM8tLbUtEye mTVnzDQZWaIhyvQh02UAoAf/ArQZ93HG7PNdqMCj/XqxJWpkFjt764H8ipYrK2bheo 0sjsxyzoRb9qYnmzcKAEOoqpVmWd4V6N+zw7s/++WecaIkM8kxMW1iy2gXuPBcMeCl Ua6mosJ5tTEA5YrQpELLLLnsHGWJy3+U1gpkhk1Rvl3sb8FpBZ0/p+wCs37aYWB3vy MHb3Yn0Sx2H4Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3234A69A88; Wed, 11 Feb 2026 17:14:39 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id BKaBZiYWeNs0; Wed, 11 Feb 2026 17:14:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855271; bh=sPln7iOM6rbfFCUlntvAW9GC1UkXJcZ/1agwhDLuC+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cUoDWlgl55fdB/qlm1N20chLTdCbpC/kG35SWIiJYdzfAktBHBnctUy3wFL8LQL34 AoZfV4zRw140bUr1B6YkaYJ+c16WyQWr7uQ2rM/HFHzDtfIOENpCNqdg3d9dqljsTE /JgIqUlb4utKU0e9tfeRZt7YXJGHdIpvn0a14Vr4nI9idyQwp5ZCHGRKxCAAcNrQGO w9KqP8tuN0rsCSa4QuOpq0R8ta5J7Y6C/fQalvUkgNfq9f4cXMZg1YW74NuU9xqSHm 5HvMAbHkxKuGvTpL/5hY5t1AOC25rGPD83rveHtiAFUhuR22cEivb0ay7Pvzn5D62E yCoQpv+GnvJew== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6BD77699C6; Wed, 11 Feb 2026 17:14:31 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:55 -0700 Message-ID: <20260212001410.1919749-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UK2TL5NF4GIHDHWIVXXOCASXZC3DMKZH X-Message-ID-Hash: UK2TL5NF4GIHDHWIVXXOCASXZC3DMKZH X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/15] riscv: timer: Read timebase frequency from the firmware FDT List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The RISC-V timer driver reads the clock rate from /cpus/timebase-frequency in U-Boot's own device tree. For EFI applications this property may not be present, since the embedded DTB is minimal. Add a fallback that reads the timebase frequency from the firmware- provided FDT, which is available via the EFI configuration tables. To support this, scan for EFI_FDT_GUID in scan_tables() and store the address via a new gd_set_firmware_fdt_addr() accessor. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- drivers/timer/riscv_timer.c | 13 +++++++++++++ include/asm-generic/global_data.h | 8 ++++++++ lib/efi_client/efi_app.c | 3 +++ 3 files changed, 24 insertions(+) diff --git a/drivers/timer/riscv_timer.c b/drivers/timer/riscv_timer.c index 1f4980ceb38..ca28d1297d7 100644 --- a/drivers/timer/riscv_timer.c +++ b/drivers/timer/riscv_timer.c @@ -15,8 +15,12 @@ #include #include #include +#include #include #include +#include + +DECLARE_GLOBAL_DATA_PTR; static u64 notrace riscv_timer_get_count(struct udevice *dev) { @@ -89,6 +93,15 @@ static int riscv_timer_probe(struct udevice *dev) "/cpus", "timebase-frequency", 0); } + /* For EFI apps, try the firmware-provided FDT */ + if (!rate && IS_ENABLED(CONFIG_EFI_APP) && + gd_firmware_fdt_addr()) { + void *fw_fdt = map_sysmem(gd_firmware_fdt_addr(), 0); + + rate = fdt_getprop_u32_default(fw_fdt, "/cpus", + "timebase-frequency", 0); + } + uc_priv->clock_rate = rate; /* With rate==0, timer uclass post_probe might later fail with -EINVAL. diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index b17a2e4650b..86204e372aa 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -563,6 +563,14 @@ static_assert(sizeof(struct global_data) == GD_SIZE); #define gd_set_smbios_start(addr) #endif +#ifdef CONFIG_RISCV +#define gd_firmware_fdt_addr() gd->arch.firmware_fdt_addr +#define gd_set_firmware_fdt_addr(addr) gd->arch.firmware_fdt_addr = addr +#else +#define gd_firmware_fdt_addr() 0UL +#define gd_set_firmware_fdt_addr(addr) +#endif + #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) #define gd_multi_dtb_fit() gd->multi_dtb_fit #define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb diff --git a/lib/efi_client/efi_app.c b/lib/efi_client/efi_app.c index 178571d9970..d36ed959f95 100644 --- a/lib/efi_client/efi_app.c +++ b/lib/efi_client/efi_app.c @@ -172,6 +172,7 @@ static void scan_tables(struct efi_system_table *sys_table) efi_guid_t acpi = EFI_ACPI_TABLE_GUID; efi_guid_t smbios = SMBIOS_TABLE_GUID; efi_guid_t smbios3 = SMBIOS3_TABLE_GUID; + efi_guid_t fdt = EFI_FDT_GUID; uint i; for (i = 0; i < sys_table->nr_tables; i++) { @@ -182,6 +183,8 @@ static void scan_tables(struct efi_system_table *sys_table) else if (!memcmp(&tab->guid, &smbios, sizeof(efi_guid_t)) || !memcmp(&tab->guid, &smbios3, sizeof(efi_guid_t))) gd_set_smbios_start(map_to_sysmem(tab->table)); + else if (!memcmp(&tab->guid, &fdt, sizeof(efi_guid_t))) + gd_set_firmware_fdt_addr((ulong)tab->table); } } From patchwork Thu Feb 12 00:13:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1828 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855283; bh=yByY1GXyFlRS5C+S45+0zZ7t3mJK841W5ELzGXDdw58=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=r0Wm0TKcEEaQs1QG08zVOjRZevTgp/bToNYc0V8b7qJBfVly5V2ttH4eBmHXFRtWd 2bpplNtxrrtyUBPVbYDpl1V8Zaaw/UN0rmNncETHKJQQ3F9x8uxaJ/ZtgZ022zdHjm RttNHyqDJxPG4R4R2zT1Tn2P/d6dVHLP1qgU60rCs4Z2hp9J5/gNPG38uCWkygL2hD dzBDvkKYH7Rgyr+8cX2krMpXtu+2pLMAJhDbSQLaNbqzfxYoewuZ6oQ6++jviuKs97 qRiaru1GJCgVE8r7DxhUixab58HMGRGxIT/s8ciiUzk2DpuUgGbyMXtMTQtawLxDb3 5E/fyPNasC0Xg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CBEEC69A88 for ; Wed, 11 Feb 2026 17:14:43 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 23PxjQ8lMRg1 for ; Wed, 11 Feb 2026 17:14:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855281; bh=yByY1GXyFlRS5C+S45+0zZ7t3mJK841W5ELzGXDdw58=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DYUDnfXjhWT5R5d3wnShCorO5Rnek1BsTjYwl8WXMKHFHSNP7VLtQAXEROB/GQIdI kWi7DNCykSvvc4/oZDdBFxTzHtDDCN2mFQC4Q/NVaUp+b8IXRrT54qIIgVpHTYoypd 1CUVXq/C5mL/kruhdu8Q7HvvJGlQjZlO9BiqNVjSCAhlIHDXToUnbSLFlsTyZp4a2N sAfJsA8FaSmPuNOuizsNgpbRRJrX16EQxrNjch9WrTF7AMt18sjUwxSdLGJL3B2ZAP J3aEyUGFPNzt1piXanwX6sTit7GtOxR1FT+b45nP+s2M9sCJ2Fs5oCByUaHngHPgbX jGP4xrD7jlsGw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C61AA69A99 for ; Wed, 11 Feb 2026 17:14:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855279; bh=pMNT3T/W5iT7GVZg8vUp2yxpZzFLFNsEI8ksT8qliwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QsB5UKKxF+xfXEfZsZHZDsTsLfyKkimFhz0WdJhrIFGFViF8EjkYR68NJP5f9GTqf 6UQfgEQrJVOKxl5onAoBsdJ+4je75hzRDbJHhU0E9OV/51SFE49w7MdSy5Q6TS8SkU N/KCdQ95S2Y+ytvkEkjcQwLOzQSaGjTexnLI+L68/hdSBeyQZoVDlJWrikVmiBHly2 Z6oUzBdT+a4Clp89DDZfcUa5AEmiOVGGLOEK1XIGbMuy9PxNiyLZDvTYYyshfKhH+o XjCuyVpqt6NHTM6Fl6Wk8T5Shn1JRSgVncvJjEtnTG20CObSUukWAEMxld9dJ1H0QF cTSySyAoa5iwg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3B51C699C6; Wed, 11 Feb 2026 17:14:39 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id y9MTll1vQneV; Wed, 11 Feb 2026 17:14:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855276; bh=0bvY/xKhXqNOr4M+Jg0aC72S5iwCi9ypMJFYv8rXNkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQBxbx12WEq/TU5V957F5UKSEqLxfpabhjMPGGsNcd2p1nvg67zvlfMBg8Mc7qYcC FKmaepD5xi1EBwQD2S819x7NlvEyTDZGnZV2MwlJIyb6mJXd/Y/sr06fi7duc0AGFM lJyqyUMeiYUMpGnWULs5MCMb/ABS5e7H6SoLzhtmzwEikK+2my8ztqENGtKPQ7z5pT q3k9MhA4j1NQHnmyfymJGVhs1pMMtqPgzbmGZRfmOYBGf9HQqF2fVlljhgdo9xItHC Ii3GL1pV5kAcVP8fuq7/jZkoMiwvkcy1rDPpwugD8grLpk2j6OiMey/HS06Gj8+QAi U2ggOZ+DI3KiQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 45DFD69A99; Wed, 11 Feb 2026 17:14:36 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:56 -0700 Message-ID: <20260212001410.1919749-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5A3KN5JLPXB75P5XR2SFN3HEXIXUVOHF X-Message-ID-Hash: 5A3KN5JLPXB75P5XR2SFN3HEXIXUVOHF X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/15] riscv: Add the EFI table field to arch_global_data List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The EFI client code stores the EFI system table address in gd->arch.table. This field exists in the x86 and ARM arch_global_data but is missing for RISC-V, so add it. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/include/asm/global_data.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/riscv/include/asm/global_data.h b/arch/riscv/include/asm/global_data.h index 47b5e2cfc8f..1ef82f35fb0 100644 --- a/arch/riscv/include/asm/global_data.h +++ b/arch/riscv/include/asm/global_data.h @@ -42,6 +42,9 @@ struct arch_global_data { #endif #ifdef CONFIG_SMBIOS ulong smbios_start; /* Start address of SMBIOS table */ +#endif +#ifdef CONFIG_EFI_CLIENT + ulong table; /* holds the table address from previous EFI firmware */ #endif struct resume_data *resume; }; From patchwork Thu Feb 12 00:13:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1829 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855285; bh=htzskcPobYbrVNqtyhmfd+I+JklFv/gd4hdqlKXO6tU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=GX6znbjj1BCmjsgC7l1Jqzoky1SErAYBq15Q2Cg1pGI1YyQtOfebhkze8aCEzQEW2 arihAybmaTtegX4uPPb/3aScMGEYcy7wCPqX9Zk5qCreqInyFiS47AQHj8h3i4bP6k FHQwWXlsucGxzRyasZxx72+ndFAqxXscV2r7KMeonO2S5GTvl74hPIcrUtd2W1qSVH fd5llYVZKhYQQQ1YK13QQ07Td6/D2Xz7qiCp017uCeGl5bj4xo8HNWYS+YYPYfPjNB vSDsrns6x3PTUCB50tj4XyVxf3etk2+/A/mt7gD/zvsHsgirFk4u7IXvcYNw1xBnQx 1YOrqmM8j5pAw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 361C569AA4 for ; Wed, 11 Feb 2026 17:14:45 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id VKcAu_rIg1jW for ; Wed, 11 Feb 2026 17:14:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855284; bh=htzskcPobYbrVNqtyhmfd+I+JklFv/gd4hdqlKXO6tU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=vNz2M3xQ3Z84hSu7V2z/E6j8xgC/FyNtlKT+FdcJMa6i6VXXVk+4RXdL+1u60vsAO wWFHW6/kZrc5RnazqWs06STO1rw0Q0g1qOr7iFJz7D5AYh4Ht4Ww2JbNYDENFe3mKG 2y1Y2VOlxmQN/Wp8UOF6XANGLH49JHLHPAZ6fB2q43jZ1ZBiqKDt3k02MhulxnLXh+ mcK67CaDj7/NhzNrNoMmH3OmqXviGBR53zkEz/2abEWtKrZplSUlimtE3XGF8itghK py0u8AkMJW23PphEqdz768Xmm9G71lMZGABuP7Lp1ArnUQM4i5HOKgSmu5w7P8aWYd XVg2VVY7VdKzw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 51F7F699C6 for ; Wed, 11 Feb 2026 17:14:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855281; bh=6L5SNWThDQNQJEd1zofoAlVFlDHoplXryP4iVBuq/ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z7Sl6Oy4TS8DibLSx2lJ3DFW3mz9BHm3JXHkmI7BpR/PKLs2oICd/zxioJ2gSfv1L jR16RXLbobF4EGPjNeFlQfsn+Hju/giTltKOmpdVaj1qU4PBw/eO1MCtIQ4zRZBqvA 0RohHVP/dsXGMgSJ6FOF+9eosva/+GbC3jTunk4L2dtCV+VJBy/ylUGCvW4VTJl2Qx 9RZhozPN/TwF27jdNgX2XJlxR4+Z7LnKhCIMTgo7p/6ghR52vSkSDF8ss3VLHb8a5g 7MHzaM8LfGS/I6xOzyqlZ08Xr89qzY+zsCHi/znwnKsQyCpTF4NSjz1uRCQEEnp/0P KT14fc5F2HXvA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7629C69A88; Wed, 11 Feb 2026 17:14:41 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 9kI5sP765OCi; Wed, 11 Feb 2026 17:14:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855277; bh=nYZyBweUBkD5ELfd0caUfwwTKZKNRp0CeH0/ySlUng0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XHzRlfP36LbkiUwVvcxB2lmL6xxjgcG/NkdAoXbb4wMbLsvg76R+1xBPkt2DBWJZB TaMrUJfhGPiXdf1UeoviRYMElyvkSpSb7HWQSUvDeFKUe842zaKhlRuVy2h7dO+fu3 GdHCbnmdSJT9v+uobtJHlpjfN2yLS5eZKDT/guTvcXoVXrkVZk00VA9N6kLbKXjRxZ LfJj8m8ZG8wRjJ5WcNNkqrAU3YVW55PUR9Ls5JF+jlgcYI7bnZJrLZobef1WF08h6H Y9NQ64BHJDu/9/hgD7Ulih/EtI3MzOjTd5ZX6dPMRGEfMPGtLsSqdaiXcnZhOOMhmJ SqrSlCHT83hPg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 200D069AAC; Wed, 11 Feb 2026 17:14:37 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:57 -0700 Message-ID: <20260212001410.1919749-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5MW3LPHU575IC2OF6REQN5PO7PYGIXDX X-Message-ID-Hash: 5MW3LPHU575IC2OF6REQN5PO7PYGIXDX X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/15] riscv: Exclude -static -pie from LDFLAGS for EFI apps List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The RISC-V LDFLAGS_u-boot includes -static -pie, which conflicts with the -shared flag needed for building EFI applications as shared objects. Guard these flags with ifndef CONFIG_EFI_APP so that EFI app builds can use their own linker flags. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/config.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk index 9f16dda92a0..123b5d24cca 100644 --- a/arch/riscv/config.mk +++ b/arch/riscv/config.mk @@ -27,7 +27,9 @@ endif PLATFORM_CPPFLAGS += -ffixed-x3 -fpic PLATFORM_RELFLAGS += -fno-common -ffunction-sections -fdata-sections +ifndef CONFIG_EFI_APP LDFLAGS_u-boot += --gc-sections -static -pie +endif EFI_CRT0 := crt0_riscv_efi.o EFI_RELOC := reloc_riscv_efi.o From patchwork Thu Feb 12 00:13:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1830 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855288; bh=XUH72L7yc4l4LOCEbnBmOj2cm9HdvBmbPjhoF18Idd8=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=EZ9RhjAjw7c0UYQ25FLfil8TMzOwIAEwjQwyNxFusKtwAhSaEH5Es/txQ9ISrVEcH X0qmpb2QvmzJYJZocgSwRwazBE5tD94iCHBtPSNe8PbstyDkwi21B7zs57IR/9aazP nbFTj8lXoBlteA1xQoH7qGptvc7+xXS1gcdy0XkVbPv7wYlheeJpXMOW+02ZaeRems V4YZ31HJMPSdNg7H718U0zXWX9SA9MGYDHAPDPnsn5tDcxsllBwEsU2D14rfin4drw 80GL0itP2yaai6gCvRxyJS6G6eSUxwxavohegYTv3aa7KTG466nivjInHpjfMKv3bx ldc2OU2FH5tPA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CAFCE69A99 for ; Wed, 11 Feb 2026 17:14:48 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id I5LQp051fY67 for ; Wed, 11 Feb 2026 17:14:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855288; bh=XUH72L7yc4l4LOCEbnBmOj2cm9HdvBmbPjhoF18Idd8=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=EZ9RhjAjw7c0UYQ25FLfil8TMzOwIAEwjQwyNxFusKtwAhSaEH5Es/txQ9ISrVEcH X0qmpb2QvmzJYJZocgSwRwazBE5tD94iCHBtPSNe8PbstyDkwi21B7zs57IR/9aazP nbFTj8lXoBlteA1xQoH7qGptvc7+xXS1gcdy0XkVbPv7wYlheeJpXMOW+02ZaeRems V4YZ31HJMPSdNg7H718U0zXWX9SA9MGYDHAPDPnsn5tDcxsllBwEsU2D14rfin4drw 80GL0itP2yaai6gCvRxyJS6G6eSUxwxavohegYTv3aa7KTG466nivjInHpjfMKv3bx ldc2OU2FH5tPA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BB10169A90 for ; Wed, 11 Feb 2026 17:14:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855287; bh=KZY7bEKTFf7SOEgogDXb2ffMaJ0IyY23KXdEb41t8IQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQqmxKprZTZ92mlGn+04QQTdpaGzjfqWyU45xQkBFfHYJqaqB9YVT+vcL6qPDq02l BYZubdnO6qjyM9LFj8lzgLyBJNaOT1wqXpUzdcF4tWtjT4UfTZC/cIkMR/WX41bTYF 9gKf9lRwZviQmAhlYBx1rH+v5BEQZQIn98WbCQYR+8gv6YAyuT6HMW32ALhjS3JKSi qatm+YID+Y2COaM33usvUsUi9VwL93DG4Z3KwrtG3pWd5cq1IRX3BReYc36u2e2P3G 4pIB0GEMrYm8tHENtzqCvGbE1EWh0qsaxtuQkWcVcLDX7hL+OelA97L81UqCAFPcMs rTVxXlwLpvPuA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6BED569A90; Wed, 11 Feb 2026 17:14:47 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id vwL2SNM1zafb; Wed, 11 Feb 2026 17:14:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855282; bh=MLIDfFqGjAa1s9wUEQuisKv/iLmuKI3TQX6AXPWzuMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9Qm9PPk/v4mjcnqTc+4awd22m6Q5bGOHSte5Ij2wfcrbJEIaz2d8p6I7dSb6AQJT d3GDGZO2Ps4FTAD2sOtf46mToSqWzjuNujzCW2VJfPfQGscjuUYEc+McJJ4NyCra9g NvWbJpCAUjOa0+lFLKAM590+19u5EKu1AP89RHf0p8SjehVxZfjDBi0O48f60+zWVn nKCMHb04KeYYApzePYNCt8NaJ1PBrPp0fS1mH3ULgsle0I/pGgcOYwWSE+qNFQkV6L UKaZgAKIoaWc8o8EqSCkgcgikIHUK3/44/h1GvfF5FV2XwX95pgVZsF0fHSDfGzwja 4/m1wjH27mAeg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id DDB7C69AAD; Wed, 11 Feb 2026 17:14:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:58 -0700 Message-ID: <20260212001410.1919749-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: IG7UA7ZUTZJK3SDBV7R4VBCH27237YFX X-Message-ID-Hash: IG7UA7ZUTZJK3SDBV7R4VBCH27237YFX X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/15] riscv: Add EFI application build flags List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add the build machinery for RISC-V EFI applications in config.mk: - OBJCOPYFLAGS_EFI for the EFI stub binary sections - LDFLAGS_FINAL with -shared -Bsymbolic for the shared-object link - LDSCRIPT pointing to the EFI app linker script - Separate OBJCOPYFLAGS_EFI for the app, which uses a different set of sections since the linker script groups data contiguously Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/config.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk index 123b5d24cca..1d98c015357 100644 --- a/arch/riscv/config.mk +++ b/arch/riscv/config.mk @@ -33,3 +33,20 @@ endif EFI_CRT0 := crt0_riscv_efi.o EFI_RELOC := reloc_riscv_efi.o + +OBJCOPYFLAGS_EFI += -j .text -j .rodata -j .data -j .sdata -j .dynamic \ + -j .dynsym -j .rela -j .reloc -j .got -j .got.plt \ + -j __u_boot_list -j .embedded_dtb -O binary + +ifeq ($(CONFIG_EFI_APP),y) + +LDFLAGS_FINAL += -znocombreloc -shared -Bsymbolic --gc-sections +LDSCRIPT := $(srctree)/arch/riscv/lib/elf_riscv64_efi_app.lds + +# The EFI app linker script places all data sections contiguously +# between _data and _edata so the PE .data section covers them. +OBJCOPYFLAGS_EFI := -j .text -j .rela.dyn \ + -j .dynsym -j .dynstr -j .embedded_dtb -j .data \ + -O binary + +endif From patchwork Thu Feb 12 00:13:59 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1831 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855289; bh=ANFZkXFpvbfPzA0IxSPhtdzdD0Giy9gMOsalDZnw1ig=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=skk52+zcMOCcR7XHSZWLth2AnoTzqtI7nDD4JhSc1byeR9Xm2QJqEe1lknl2FLYFv TQja1KuQlP1kpkvgScL8IuE8U08SRMoum2xoVJzh29kYkl2yuf6H+VsBKF9soCLWYL Hs8jk1bhswN0LnZtwzq4EHGjH+KTh9OtUjMOzfBRQJyoKi79mBcd5Zor7AZ507IZRV ipFzRCTqtvzrquTQpaGgza1Pf7e052ebaCn5VYtq9MQh7B2+mni7XF++fUjnoa3NKP oNAfuNI00aWsPXEAL5O8aA3fwJBdHhXmBpLFcYmNSBm/vD6jzTMvzmHcSPZkagWYqD LrIoTSaOsCefA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3841169AB0 for ; Wed, 11 Feb 2026 17:14:49 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id oarCiRYj0vnD for ; Wed, 11 Feb 2026 17:14:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855289; bh=ANFZkXFpvbfPzA0IxSPhtdzdD0Giy9gMOsalDZnw1ig=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=skk52+zcMOCcR7XHSZWLth2AnoTzqtI7nDD4JhSc1byeR9Xm2QJqEe1lknl2FLYFv TQja1KuQlP1kpkvgScL8IuE8U08SRMoum2xoVJzh29kYkl2yuf6H+VsBKF9soCLWYL Hs8jk1bhswN0LnZtwzq4EHGjH+KTh9OtUjMOzfBRQJyoKi79mBcd5Zor7AZ507IZRV ipFzRCTqtvzrquTQpaGgza1Pf7e052ebaCn5VYtq9MQh7B2+mni7XF++fUjnoa3NKP oNAfuNI00aWsPXEAL5O8aA3fwJBdHhXmBpLFcYmNSBm/vD6jzTMvzmHcSPZkagWYqD LrIoTSaOsCefA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 26F7169AAD for ; Wed, 11 Feb 2026 17:14:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855287; bh=nv88Sahdq+IRDaw5UWXnFzVnlY52j3oiuStrI1+ig4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ut+TYLL8V05OhQVI3PMbAl5sjfr+HQX+YjOk2DbM/baccf00ibbuyon7KprJtDa8K YhUWTiGH3+Wi67niWlbNW4d5m+eewE0KCldsDf8wG1WkoS56r1dCiuJ9nyTpkwTq3m weO0WL0k0C7wNiEFnSiw7GRDxE/DzZrP/P0oLK4VEtrUZTkW1PBNWneDMStk95P+O5 hVyggneVv1mmJtwj07tZbJUSXWx4eOAktpxDYiQ7gyaybie9P7y17SmEwzLccBECP7 wYX5Lqqrd9+VB4sSDGANX+Ld+RAgChAR49/3NF1HasdheYyqFXVdaePwA6YbjJ//Wq 0NbAMzjnXXrDg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 74B5B69A99; Wed, 11 Feb 2026 17:14:47 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 17ZWqurcY8lP; Wed, 11 Feb 2026 17:14:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855287; bh=7dv0Ed0HgP1E1pREUrwZOaSSVFRjRTQIKEIhx5yoBQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BRk5PGnUr9xmz7BOGaOFNw7mAjyhbpuggmEyj+90StMb2vRwgZffp2ZHr+Whb1RBK ayxpPRETNTiLcqWXPdwDrz3n91SYUHl4HjtY2HZzK7WBcKN1LEuH4p/ZlTJ6kRrFi7 UZw9X+FvW/CLqwDJksSKRDPu+/xvmP2yodQzWNRzYVja/Ylf+UaQ2DvQGZV2poJBH/ n/iNrSGC67SpWtMKKfRYiNuayMq+ROCNI9JZkhm2EIxpwBQz/65vsQgLZWGtHPilKa WN0Y44tDEN5Bew5e4ZDgshb/aAw1ovyY/jUr6V7dKI4KQDhVh/ykUfEJ4atVyy5s7o KSRJo8+TkPvcA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B8E55699C6; Wed, 11 Feb 2026 17:14:46 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:59 -0700 Message-ID: <20260212001410.1919749-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JQ7ZZY2UELYJZLDZR7JQLZ7TJKQDSBWB X-Message-ID-Hash: JQ7ZZY2UELYJZLDZR7JQLZ7TJKQDSBWB X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/15] riscv: efi: Exclude PLT relocations from the reloc loop List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass GNU ld includes DT_PLTRELSZ in DT_RELASZ, so the EFI self-relocation code processes R_RISCV_JUMP_SLOT entries from .rela.plt alongside the expected R_RISCV_RELATIVE entries from .rela.dyn. JUMP_SLOT entries have a different format and cause incorrect fixups. Subtract DT_PLTRELSZ from the total relocation size so that only R_RISCV_RELATIVE entries are processed. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/lib/reloc_riscv_efi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/riscv/lib/reloc_riscv_efi.c b/arch/riscv/lib/reloc_riscv_efi.c index c1039dd165d..da448bfdf96 100644 --- a/arch/riscv/lib/reloc_riscv_efi.c +++ b/arch/riscv/lib/reloc_riscv_efi.c @@ -52,7 +52,7 @@ efi_status_t EFIAPI _relocate(long ldbase, Elf_Dyn *dyn) { - long relsz = 0, relent = 0; + long relsz = 0, relent = 0, pltrelsz = 0; Elf_Rela *rel = 0; unsigned long *addr; int i; @@ -68,11 +68,21 @@ efi_status_t EFIAPI _relocate(long ldbase, Elf_Dyn *dyn) case DT_RELAENT: relent = dyn[i].d_un.d_val; break; + case DT_PLTRELSZ: + pltrelsz = dyn[i].d_un.d_val; + break; default: break; } } + /* + * GNU ld includes DT_PLTRELSZ in DT_RELASZ. Subtract it so + * we only process R_RISCV_RELATIVE entries from .rela.dyn and + * do not run into R_RISCV_JUMP_SLOT entries from .rela.plt. + */ + relsz -= pltrelsz; + if (!rel && relent == 0) return EFI_SUCCESS; From patchwork Thu Feb 12 00:14:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1832 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855295; bh=VhCQegqNA1sEeR28D7JWfqkRxCr3qXaNuKTPIL7S13s=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=fvW19x0blLrCLra16fXVmhHv/9xuYTsdmJozztpDMtdRelwC4Ml2znL6NTF4gGZI3 U9ce4aHYQ+yDjM5sOMbRYIfTC/Xn4E3jSQ1+4TsEJE+A88V19PefzKc7LCeEcBFrU4 TFtf6Te/2Rp4DU82mw7rThGqPptdsVY2VDBoQ39KFRu/5maA4ADl/UlR5BgQGuz8rB oWieyjLT2QmrHH0jJDRORUzxnJz0orMlqkjivbJXvGNcmMxhoURHivU12ZPsHaH62j rh/P4nz2b3K28j7voRjm2zZ2Pbf0U0fhJNlRt+s41SvCpCNoOu+LjqPQzKTm9haJic jCRcB6r2peGbg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4C4D1699C6 for ; Wed, 11 Feb 2026 17:14:55 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 9_fXNCejW3xz for ; Wed, 11 Feb 2026 17:14:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855295; bh=VhCQegqNA1sEeR28D7JWfqkRxCr3qXaNuKTPIL7S13s=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=fvW19x0blLrCLra16fXVmhHv/9xuYTsdmJozztpDMtdRelwC4Ml2znL6NTF4gGZI3 U9ce4aHYQ+yDjM5sOMbRYIfTC/Xn4E3jSQ1+4TsEJE+A88V19PefzKc7LCeEcBFrU4 TFtf6Te/2Rp4DU82mw7rThGqPptdsVY2VDBoQ39KFRu/5maA4ADl/UlR5BgQGuz8rB oWieyjLT2QmrHH0jJDRORUzxnJz0orMlqkjivbJXvGNcmMxhoURHivU12ZPsHaH62j rh/P4nz2b3K28j7voRjm2zZ2Pbf0U0fhJNlRt+s41SvCpCNoOu+LjqPQzKTm9haJic jCRcB6r2peGbg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3B03769A99 for ; Wed, 11 Feb 2026 17:14:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855293; bh=AubdEcWNZYfCzyWmQl/sFZdpXUHmUukP93MsW9DfyKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qYfOwv6s3GDQt9r4k04E5qvY8vNfbv3S3P/4yhcbfwgoQdECYR7w5VR2J2YkLZlfN 2FTNo5KlOE+RZOv4vW0+15eo+G9OFNpAHUzQWAXHoVph9j/LyNrRIJyuEjiHnhqVzD n5ZsGWs7zxHnin9inXAsWbZkAu7Tfs6ZLbvriRZvGSQrJbncuO9uOBmPB+68Re3qdJ 4HX05Do/2hvEJHtRKbd5ZpxFKLD/D/7Jmp0mxxtOtHn713+IlUe71xZTy9tE0tl1RW M0Zwe1qnn4mCSWGQEv07sKLbRc0OM+7/YESX7I98t2bcg7qM4tyZgwxHx9rK1Xjkk3 H2fS+o9CCD3LA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 87B6F69A99; Wed, 11 Feb 2026 17:14:53 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 8X6CAma5KiDo; Wed, 11 Feb 2026 17:14:53 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855288; bh=GdBJ/EHBZUe36fDn7oWo0wOMkCGXf24pFSkZteykTMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JjHVFjmnRs/fwU5SR7VB0q7am5oc8A5wrW2om3uKpGbbxVd3a+LXvLrMCGzK6y49s 8jZfwPEVCsbS28+d6YyLUbH20tYIMmwASa0hZs6eUJYWeBTu4P8ONECbVF9lXO3LKh ss/kSZdgIejD82bPOzFj0k10+wCd/7TmSIPbhPCBH3FvHFV/eDfufWgUuGDkCLkYAI CGcP6C+dW4WmrZzYBl0FgEVaAMqhpjD+m4r8uQMiJFxm6EWKz2Tm9Pq3y+atbfa81A 4rbvLtFhopHZTBdSIw8aCmG5qh2wiwLcVOgg8hYIExi7qTcX9hxYyWY0CFwqtls7kU dSW1UYc1CQVyw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CC3CB699C6; Wed, 11 Feb 2026 17:14:47 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:14:00 -0700 Message-ID: <20260212001410.1919749-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: M3JWJNLHKOOKDA6MH6QWKGH7GTK2UN27 X-Message-ID-Hash: M3JWJNLHKOOKDA6MH6QWKGH7GTK2UN27 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/15] riscv: Add EFI app linker script and build CRT objects List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a linker script for building U-Boot as a RISC-V EFI application. This defines the PE/COFF .text and .data sections, the .reloc section for PE base relocations and the .embedded_dtb section (16-byte aligned) for the devicetree blob. Also add the EFI CRT0 and relocation objects to the build for EFI_APP so they are linked into the final binary. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/lib/Makefile | 2 + arch/riscv/lib/elf_riscv64_efi_app.lds | 136 +++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 arch/riscv/lib/elf_riscv64_efi_app.lds diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile index 36712cbb5c9..b0b1cabf903 100644 --- a/arch/riscv/lib/Makefile +++ b/arch/riscv/lib/Makefile @@ -38,6 +38,8 @@ CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI) CFLAGS_$(EFI_RELOC) := $(CFLAGS_EFI) CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI) +obj-$(CONFIG_EFI_APP) += $(EFI_CRT0) $(EFI_RELOC) + obj-$(CONFIG_$(PHASE_)USE_ARCH_MEMSET) += memset.o obj-$(CONFIG_$(PHASE_)USE_ARCH_MEMMOVE) += memmove.o obj-$(CONFIG_$(PHASE_)USE_ARCH_MEMCPY) += memcpy.o diff --git a/arch/riscv/lib/elf_riscv64_efi_app.lds b/arch/riscv/lib/elf_riscv64_efi_app.lds new file mode 100644 index 00000000000..6374433cdb3 --- /dev/null +++ b/arch/riscv/lib/elf_riscv64_efi_app.lds @@ -0,0 +1,136 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * U-Boot riscv64 EFI application linker script + * + * Modified from lib/efi_loader/elf_efi.ldsi and + * arch/arm/lib/elf_aarch64_efi.lds + */ + +OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv") +OUTPUT_ARCH(riscv) +ENTRY(_start) +SECTIONS +{ + /* + * The .text section must come first at VMA 0 so that the PE/COFF + * header in .text.head is at the start of the binary. The CRT0 + * defines image_base at the very beginning of .text.head. + */ + .text 0x0 : { + _text = .; + *(.text.head) + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + *(.srodata) + *(.rodata*) + . = ALIGN(16); + *(.dynamic); + . = ALIGN(512); + } + . = ALIGN(4096); + _etext = .; + _text_size = . - _text; + + /* + * .hash and .gnu.hash are needed in the ELF for dynamic linking + * during the link step, but are not extracted into the PE binary. + */ + .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } + .eh_frame : { *(.eh_frame) } + + . = ALIGN(65536); + .reloc : { + KEEP (*(.reloc)) + } + + /* + * Everything from _data to _edata makes up the PE .data section. + * The CRT0 PE header uses _edata for both VirtualSize and + * SizeOfRawData, so BSS must be included (as zero-filled file + * data) rather than in a separate section. + */ + . = ALIGN(4096); + _data = .; + + /* + * Dynamic relocations in .rela.dyn so the linker sets DT_RELA + * to point here. All relocation input sections are gathered + * into this single output section. + */ + .rela.dyn : { + *(.rela.dyn) + *(.rela.text*) + *(.rela.data*) + *(.rela.got) + *(.rela.stab) + *(.rela.init_array*) + *(.rela.fini_array*) + *(.rela.ctors*) + *(.rela.dtors*) + *(.rela__u_boot_list*) + } + + /* Dynamic symbol table and strings */ + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + + /* Embedded device tree (must be separate for embeddtb command) */ + . = ALIGN(16); + .embedded_dtb : { + *(.embedded_dtb) + } + + /* + * Regular data and BSS live together in one output section. + * Mixing PROGBITS (.data) and NOBITS (.bss) input sections in + * the same output section forces the linker to emit file content + * for the entire section, so BSS gets zero-filled in the file. + * This avoids a VMA gap that would bloat the PE binary. + */ + .data : { + *(.sdata) + *(.data) + *(.data1) + *(.data.*) + *(.got.plt) + *(.got) + + /* U-Boot lists */ + . = ALIGN(8); + KEEP(*(SORT(__u_boot_list*))); + . = ALIGN(8); + + /* BSS merged into data to get file content */ + . = ALIGN(16); + _bss = .; + *(.sbss) + *(.scommon) + *(.dynbss) + *(.bss) + *(.bss.*) + *(COMMON) + . = ALIGN(512); + _bss_end = .; + _edata = .; + _end = .; + } + _data_size = _edata - _data; + + /* + * PLT relocations are placed after _edata so they do not fall + * within the DT_RELA range. _relocate() only handles + * R_RISCV_RELATIVE and would panic on R_RISCV_JUMP_SLOT entries. + */ + .rela.plt : { *(.rela.plt) } + + . = ALIGN(4096); + .note.gnu.build-id : { *(.note.gnu.build-id) } + /DISCARD/ : { + *(.rel.reloc) + *(.eh_frame) + *(.note.GNU-stack) + } + .comment 0 : { *(.comment) } +} From patchwork Thu Feb 12 00:14:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1833 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855300; bh=3/QM/amUKoaKPs+QucJzdSPV4TpKh82m8b4FjP7i9jo=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=t6nFAUop/DSX63KLVh0xLcbmLXdkTb2xh8pQEjyC+cWuvj4WT/MadfST30OFVax5P qpEV03eUXwlpWL6tvmBFvTElcv0oQ0yG1hMsoaY5wgTRnygkNeqS2VZxdTLCA52ZD3 7MA78HuSB7yhYRpCZcz6qdYR74TY+9Mr2fRTpZZKMQlT0T4ezfQsQMxBkPM6gkp2h3 QFbq1o7bNOQqiqtjBhwOuRd7z5oz0oY9ytOJT4/LdkbTz5Ssj6E0hDbuAmWLWtFIxJ 9q25a3satO9fcxa/brChWpQDKg4OhskFoixOHyqhg6mSrHvXgZYcZROmIZzGv4vrQp CzmEQvVp5Fx5Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CFF7369A90 for ; Wed, 11 Feb 2026 17:15:00 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 4VWJffx41k78 for ; Wed, 11 Feb 2026 17:15:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855300; bh=3/QM/amUKoaKPs+QucJzdSPV4TpKh82m8b4FjP7i9jo=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=t6nFAUop/DSX63KLVh0xLcbmLXdkTb2xh8pQEjyC+cWuvj4WT/MadfST30OFVax5P qpEV03eUXwlpWL6tvmBFvTElcv0oQ0yG1hMsoaY5wgTRnygkNeqS2VZxdTLCA52ZD3 7MA78HuSB7yhYRpCZcz6qdYR74TY+9Mr2fRTpZZKMQlT0T4ezfQsQMxBkPM6gkp2h3 QFbq1o7bNOQqiqtjBhwOuRd7z5oz0oY9ytOJT4/LdkbTz5Ssj6E0hDbuAmWLWtFIxJ 9q25a3satO9fcxa/brChWpQDKg4OhskFoixOHyqhg6mSrHvXgZYcZROmIZzGv4vrQp CzmEQvVp5Fx5Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BEF1C69A99 for ; Wed, 11 Feb 2026 17:15:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855297; bh=SWlUFOwstvWcz5RCHQJ4RYmUrWqbcVPF+WjtK6Ury9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FvN07oPRb6+KNzcx+oYASl0MSuV/kQnstVH6FAEEeQBVIetSUxq0Kg/QcNt2WKWjr oyOFZ3YbQUQfBV4JPrn2KmenLI6Q2rhwIz2A20S5Gr592ps2pNq9nQ4s6a8LS2kYZJ I2Kb9QsCsfgTGLnbQaRVd8Rw64ocSs/dTOlBO7NlU4OXQVcxQ63B8ASgMTuoBrZt/W E6aV7jOzSyrEkw9ToG3ub938M52SOLu9LlpCmkLCMAYQtBtu3GTdCtmxrres3UY/SK uzrL8EpetX2QfRjAAynZwa8oUmrg/q8jVQGUoN/JGJmzM1wAmIDeaagUQ9hMHTBoUS bFHdoa8fUrWWA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B879569A99; Wed, 11 Feb 2026 17:14:57 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id ovDAerFhO3uI; Wed, 11 Feb 2026 17:14:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855292; bh=CgzjjKZ3B8w0W79QeNnTU2BPUZUGA7rr3JKcnZuw3Mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oHzhyqhEkDmn7hrvsjpCfB4U/3Wq+sNrMxpY+1khBFexO8HlK+GTKGrLksQolXJ4h leqmnsnAPTlLPUgx72bhdone0uZ3GziKGDV5LhZS9HgunmkOmq7uNU6Y9XWtVoOpws +bVpKISLdaEc5Jgyzi8K5pgls39bjqWJXiN76pzd1mglY5R9LSLmAzcHKSFGl43g71 //pyFueKuLPwPKJj7Xc91+fk92+GPoc6VC0M5iknIx1XCGvSyCSGLAVF7M7zWUQPVU ro6X4Dvq/vqRVxpZrHo7LcJhiUdJEc3Gavfhx/ZjQBaZDlC2LV9NLKI5piLXnX2uEp GFjjwEMnZh+wg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7A12469A90; Wed, 11 Feb 2026 17:14:52 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:14:01 -0700 Message-ID: <20260212001410.1919749-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: T6F5OV55MO3FKR7QSOIQB36CWEMSY7BD X-Message-ID-Hash: T6F5OV55MO3FKR7QSOIQB36CWEMSY7BD X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/15] riscv: Exclude start.o, mtrap.o, dram.o for EFI apps List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass EFI applications use their own entry point (CRT0) and run on top of UEFI firmware, so the bare-metal startup code (start.o), machine-mode trap handler (mtrap.o) and generic DRAM init (dram.o) are not needed and cause link conflicts. Skip these objects when CONFIG_EFI_APP is set. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/cpu/Makefile | 7 ++++++- arch/riscv/cpu/generic/Makefile | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/riscv/cpu/Makefile b/arch/riscv/cpu/Makefile index 6bf6f911c67..331810b819d 100644 --- a/arch/riscv/cpu/Makefile +++ b/arch/riscv/cpu/Makefile @@ -2,6 +2,11 @@ # # Copyright (C) 2018, Bin Meng +ifndef CONFIG_EFI_APP extra-y = start.o +endif -obj-y += cpu.o mtrap.o +obj-y += cpu.o +ifndef CONFIG_EFI_APP +obj-y += mtrap.o +endif diff --git a/arch/riscv/cpu/generic/Makefile b/arch/riscv/cpu/generic/Makefile index a9be44ec387..7eda97d2f55 100644 --- a/arch/riscv/cpu/generic/Makefile +++ b/arch/riscv/cpu/generic/Makefile @@ -2,4 +2,6 @@ # # Copyright (C) 2018, Bin Meng +ifndef CONFIG_EFI_APP obj-y += dram.o +endif From patchwork Thu Feb 12 00:14:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1834 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855305; bh=e/SC/zhI9m33FdSt9W9FIW1mL0WdCzpXQ463lHifW48=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XXPw2PaDk0B9oJpTg6oSMMkKsX7YW1JFW1aKgWGfU0ZaZrVufrIEywuKA4/0JrxTL JxmN4tlKo67s0qcAzypyVxjEW+FVVLsSugbNyCcc08blGI2tGKl8HnQCQEilSUjPv7 2c1TfIs3M8Zwo6vfWcSd+Yw4AlUApA+xP37498ktCwnVlZozTHdcmhhXZYVLoUbbHa lbX3ta2Nd35C4yxEUeYEZHmcKTZ4yuCu8+BXOBqM9dErQnyeJJNep/xy7Ojo5iMchR c+dLn13zOVPC4mYneEj8jjtdttw2Ny+pbG4MmZxj17lLuKzcCE7vZiANWZ0gnAvN6i s07I7FkvfOkeA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7882769AB2 for ; Wed, 11 Feb 2026 17:15:05 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id dxMV-77NjnhO for ; Wed, 11 Feb 2026 17:15:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855304; bh=e/SC/zhI9m33FdSt9W9FIW1mL0WdCzpXQ463lHifW48=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=V086kV5gJXIcxVSi7Zmd8zg0IAHDENHiNCra/EsQRcRChbDKAicunzgty4ukeL5m+ P/uGHRykaLCZv1yY7DbZ/IjqSVI7lK4DQmbpiXUpDAivO4HZZGPMiuyWKcZuWPiSvn 4XGVpjRObVFrE6I2kULdr5aDWIAMAFC3Krf0rlkllvkl2fIcSRb2wk2v5mbCqQYUch NAWbZDv56ibvB2DhwzKbKvuvYAHCL4FQfXI6F65/Z0U58U/3UAuzB1rgT9Xck/hqGj m1gJqj2deKz9LU+6KZN182POqQ4KjkIrEASgeseW6ljoxmnURnW1MdyLgcfsaFvVqe UBbV9G72YyBFw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 49C7B69A99 for ; Wed, 11 Feb 2026 17:15:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855303; bh=WSE6hvIl47cmW0Ld7OKKMOEY+omRKPW2ehssrnYd464=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ItPwVyJaIB5CvNGf2U4YHnChNekqhGigZ2EirnX4Xi9rBi3jc+ng7xyuzeyA6mD6P FydFMHroQMAO9zLmkCtTrBdR6gQixhCNuw6VNWlJRln9HQWtV7VjKKJWdpzplJjX4L IeUZJw6cIPoU/TXK5bvMc3CCPGJhjw2Qz6oznc2/C3idpeSDY8g+3xT3vPPI4Jqz6K 7Ghcc6jN7a6bQky/W2HM1BSA8yhyArENbmUUrIqSy/pMtN/e8f9iykbj8wz5vLQXCF fxGFYmdA/I3SSMz8UKEzPq7pgstrz1TartFbGsfeWPmtV1W2AHm2nKHVK/nvKgAMGW I+3y6tmSNde0g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4D2C269AAB; Wed, 11 Feb 2026 17:15:03 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id FWw17x3Lu5sQ; Wed, 11 Feb 2026 17:15:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855297; bh=0I9CE9X0PYFH4Md9rfM+bvjAGEO/h+RrRcVHFY+aBH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WlMvmCBq0zCslkUTeuuvC27UOonUP0NoZqFd1oisDkkQgSt+J95GXRaAkeTuxoFct brlfTJH51UMJmhNtfzQ79dg2PAz9G9SZM2Bttuq7YItQyzXvbJhSwo6rJI796KgajH vBKEOhGIh8/iXL6MrU5BKzYRIo+SEFdtyqbVnFxWOA5sssBFGNTNpqtfEdzJ12Soc5 08a2gAN2hi9nvP+8CN6isH/UHArIhpe7THAVg7fVljHS5+Qol0l5Y1Xmu971fLryii MFkcVxZmM17NP1KSk6H3GdgNl0Ep8Dlzj72qOzGOC5hY8KbXNcQS99+PrO5eBvI+LZ NEtfU/yL5xRnA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1ECAF699C6; Wed, 11 Feb 2026 17:14:57 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:14:02 -0700 Message-ID: <20260212001410.1919749-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: YS3PB5IQCNCSHFIZU3NC2VYPYW2XJ65W X-Message-ID-Hash: YS3PB5IQCNCSHFIZU3NC2VYPYW2XJ65W X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/15] riscv: Skip prelink-riscv for EFI application builds List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass prelink-riscv processes static-PIE relocations in the U-Boot binary, but EFI applications are built as shared objects with dynamic relocations handled by the EFI CRT0. Running prelink-riscv on an EFI app binary fails. Skip the prelink-riscv step when CONFIG_EFI_APP is set. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index ee5b54c4c51..a446e634a7f 100644 --- a/Makefile +++ b/Makefile @@ -1864,8 +1864,10 @@ ifeq ($(CONFIG_KALLSYMS),y) endif $(call cmd,llcheck,u-boot) ifeq ($(CONFIG_RISCV),y) +ifneq ($(CONFIG_EFI_APP),y) @tools/prelink-riscv $@ endif +endif # Common step: create archive and prepare modified object files quiet_cmd_ulib-objs = OBJS $@ From patchwork Thu Feb 12 00:14:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1835 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855310; bh=DkmEaC+/DFh8UyeW0eBqESCppO9bhhHJtI1e+YZKsjQ=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=I7DBkAEJfdlzrNQdhz4touv4rIk+nSEdQ7mScrvgGI1JbsDguwCRqPXKXqOL5iZxr P+eyCxjvkx7P9HOUoLtCbbytV6nyfRK1d8akTZuNvIFWB9uDZLuJdAspahxz7XTa4x /cSdKb6ovPUieqTo0fdOMNBz+ibY+cQhhcmC+prv71IY6sw0oOWLyn9LkLZiEOnlud QMDqPG+ZfxwM+nu+feV69Bdtzz80wGD/tObQAJFDFdO0rucZlYMueMtNqG8WCvEUFU pyNiMOyswlPWNIwpvHkcpwNO2pG2jocnmi8EdITNcxIvP7I7omYzponFasBJJlwYdc h/p7sou+Xhy0A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4D8EA69A9B for ; Wed, 11 Feb 2026 17:15:10 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id q5NUBAsLTrM6 for ; Wed, 11 Feb 2026 17:15:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855310; bh=DkmEaC+/DFh8UyeW0eBqESCppO9bhhHJtI1e+YZKsjQ=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=I7DBkAEJfdlzrNQdhz4touv4rIk+nSEdQ7mScrvgGI1JbsDguwCRqPXKXqOL5iZxr P+eyCxjvkx7P9HOUoLtCbbytV6nyfRK1d8akTZuNvIFWB9uDZLuJdAspahxz7XTa4x /cSdKb6ovPUieqTo0fdOMNBz+ibY+cQhhcmC+prv71IY6sw0oOWLyn9LkLZiEOnlud QMDqPG+ZfxwM+nu+feV69Bdtzz80wGD/tObQAJFDFdO0rucZlYMueMtNqG8WCvEUFU pyNiMOyswlPWNIwpvHkcpwNO2pG2jocnmi8EdITNcxIvP7I7omYzponFasBJJlwYdc h/p7sou+Xhy0A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3B2E2699C6 for ; Wed, 11 Feb 2026 17:15:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855307; bh=4/+ikzUBejTDPixwNIa+Oh0/3OLy7A4BExmlVr/nxPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=er3b78bNEc1UKtjH+NrsPSg25f/9TlvupVJJS/qQFGylOiNgR1L5eG1J6bTApmDhb ARe4cPEMrCLecuokPc+wbBoTjicYsH3fBQz7gazdIennHU+N4fEPne8bfnh0FXbXMB kVnXtHhWcSgqEBohem5b7c5zM8DgiISAa4bPgUEvbPMeZxLLDlsWhlac+A6h8zVPCJ L3TrVZjTeiWKCRL6/Hm9fwshE45CIs1cAjZkMo555sDq4xPXUAAntRvFtPkJmgfFiV KPEZEZCsHhmy/SHLSkoNZ+rSEMf85Z/agI8YmB2bBFJ8grdOhkO5tyXGCK8A9mAJyn 2VnZI7PLwszcQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C60EC699DD; Wed, 11 Feb 2026 17:15:07 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id qf8Ughi7Dy6L; Wed, 11 Feb 2026 17:15:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855302; bh=doBz2j5nu2i7pVSCy+34ChKvdqbYdiFx9Ugsc/G6GGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W2pKp3M1EFv5kKUX06wkU6QNgcNaOoMlziJ/9FrsVR7/21bojY3XJRufDRL4WstEf d85iRQWxyVlvdS3I1m4b7ZHgXPLhrSjuaxhnsJig58cKClxxnGYo3J2/pdjyzKDCxb GjkLRLYAxMJsPnNxLoGFcnnElN/iCIvJgAO0BW+zoC2fbx11LV5A2SHojzObDxc5mP HkXblkym/UFpVOnyKXNAzwr1+ilA9ZoApcP9cacnwqIvg3SEWwfryLT5Ixl2ZaTBqw sTGSrx4MPpzfWOjH8aOXhiS0O3XaKFT1IWGKJCI4iLTw7EMH5ZHWU/KngBoLV1T3zD AVoaCUiO/iNnA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0B4B869A90; Wed, 11 Feb 2026 17:15:01 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:14:03 -0700 Message-ID: <20260212001410.1919749-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: WQT4VH3IQSH7VTWIL7RTO32OQBLYMIK6 X-Message-ID-Hash: WQT4VH3IQSH7VTWIL7RTO32OQBLYMIK6 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 12/15] riscv: Exclude unwanted startup code for EFI app builds List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The EFI application uses its own CRT0 entry point instead of the bare-metal start.o file. Exclude it so it is not linked as the entry point to the binary. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 6f80f4a7108..aaa5a02e17c 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -55,7 +55,9 @@ endif PLATFORM_CPPFLAGS += $(ARCH_FLAGS) CFLAGS_EFI += $(ARCH_FLAGS) +ifndef CONFIG_EFI_APP head-y := arch/riscv/cpu/start.o +endif libs-y += arch/riscv/cpu/ libs-y += arch/riscv/cpu/$(CPU)/ From patchwork Thu Feb 12 00:14:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1836 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855311; bh=hkANWSZ8706hR+ytSED8H0cgwamM1pG3uMfd+nvnR5c=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=hxIIKGZ3LuCYW6FA+bYroLebxEUV02dr6lPkT+Ap/QC8pbtMjFpyAF/ObWxiKembh /tkHCVciT2jpujmxPvUoxy6HEjkdh2qEqoLhhOj3ACkfPMyrGao8Xevc2ZK2RbsOSm TNY6pydZXbchAwBwrpVJg5m+8PK4tRWQN6H71RHoUEZ0IvF14BHVFDJfXTnDmRDal8 Y8A+TEXnnC3x51xrMduH8KqCAs4ahkN4D/+zYvmqjzm9+z2PCePfofdyrtd3kr1KFk 6WSO+BcMnPiOYkXMcGUiui+YvUD5fuLNC4QW9r65jaS5zZQ65Tgicv9CF6OrABm7Ia bEL6gsqDTQIiA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1783E69AB5 for ; Wed, 11 Feb 2026 17:15:11 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id twoT7lSIcT0d for ; Wed, 11 Feb 2026 17:15:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855310; bh=hkANWSZ8706hR+ytSED8H0cgwamM1pG3uMfd+nvnR5c=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=mXu9LkvreDNN6L22MQlK6bqraCWqyNx8QfNEEz+HuFpH2GboTzgdbq0zN1LcyHMoZ TL8OBRiJgkoyIB5ZzOiZsfLvc9jB01WJ+X5QQEsjvABar3diwa2uSzf9c++WyBUnC4 GEMhY1PsegGkMp3LLMf/k7u0uLK5akXdLyB9/y/qwn7EVkxgCBxjvAXmGR7/fqqgIk TsHUI89n/hOaHtNQwqcPaMGt0HijonwBLyx0sYKwnC0TzuH68iuduNFcGDNzGkJIHY Ds4ZCjTO54CQhP7MV0Fm5tW6KTIWlJgTkJy54nhy2VJ7rOC1vrg6tz70HvbZfHrxYD HkCjpiPDZwfaA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E5C1C699C6 for ; Wed, 11 Feb 2026 17:15:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855307; bh=jHgZy50VAPS/P+hvCu+K1nCNcXWReVRh1/I9lE8BIC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mqqm4pmBDysX2Mw8nO4mlxRg4f1gW0I49OKaCO2AFvJaViFmxeuavAK0e1hCgo3ci awd7mdbjG48j5AAinkNeJArtefiy/zcLSbWlzkvUTodKgJQmikI2qOMED0sKTrX5Bd WgCxJeg56lHpPOMqImqfxtdlgGOGh4xTWTd5NvNmCl6I91LxoRhiarUdntfJymtAnM YaxyG/cpQWx51aVMs8rP5qmpdqIWNaPRLkyQBWsBprZ8fS6bfNlV7CRk95FQezknVP RIquzTi1tzwKdrYP3+dOYA6a75ef8HOA2nRq/U2CnrWtfAc1/h0Re+neF8ZMqLpqPT ogkPxg0jZZ/1w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CF66E69A90; Wed, 11 Feb 2026 17:15:07 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id tkkhhO_KXS8e; Wed, 11 Feb 2026 17:15:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855307; bh=GnZ9zuSl4p+xv1ZvxKXVPtBnOkI7gfYQi9Buz1eMSj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NzB5LBPedQ/KTbG4Rnh7gIjF0FmTqfq85f6xnR0VyxPc1cISU/GQqqFDwfw28bf9r FDYliHTMKW4OP95SOHBxW3odkinLQ1Ui2nEUrqeN33/n4+P8ULVBiYYHt2T0t9E73p 5cN37tnonKdSTT8z1rFA3zEYo9Rq7UYscPznfQtEWRLIyTUApcmmn2Rkn6hYXEXHoC gjokND6XnrjTuawWx4QiIQcnEeO2QjbLj/am6IC4dhVSNvo/bA8nXgAGx0uFMSYSF/ xPfbZkP5bVXSjlmROVnyjLpj+2g0mKIn/uEckrt13l3H9Y0LmteIu2BTBTOIG/q0VQ +zCh0Ls5HMm8g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B5938699C6; Wed, 11 Feb 2026 17:15:06 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:14:04 -0700 Message-ID: <20260212001410.1919749-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QKTRZ7JCY4BGOZIXDDI4SE22WDC7MRDI X-Message-ID-Hash: QKTRZ7JCY4BGOZIXDDI4SE22WDC7MRDI X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 13/15] efi: client: Build sync_dt for RISC-V EFI applications List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Theis file handles syncing the EFI memory map to the device tree reserved-memory nodes. It is needed for 64-bit architectures (ARM64 and RISC-V) but is only built for ARM64. Add RISC-V to the build condition. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- lib/efi_client/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/efi_client/Makefile b/lib/efi_client/Makefile index 9d53ff3c924..685f0a5abfd 100644 --- a/lib/efi_client/Makefile +++ b/lib/efi_client/Makefile @@ -10,6 +10,8 @@ obj-$(CONFIG_EFI_STUB) += efi_info.o ifeq ($(CONFIG_ARM64),y) stub_obj := stub_arm64.o obj-$(CONFIG_EFI_APP) += sync_dt.o +else ifeq ($(CONFIG_RISCV),y) +obj-$(CONFIG_EFI_APP) += sync_dt.o else stub_obj := stub_x86.o From patchwork Thu Feb 12 00:14:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1837 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855314; bh=1tQky1hk3GWHO4PXprBoUspdWRRjjFtoy2CaQsQfZOI=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=fIrR33krzd+mqM6kK/uQ4iNnrixZcFU8Q5JXhif0wUSUF8DSzYW4qubZcO59H0f/4 8bKD5s9pQtm17bUVgTqwvtYY3/fwIp6ub9Qj+HvdxglOev+A0wZH3BRiNj44rdR5Xq m1cNeHtXsoLqDsqyX2o60UvYxtcrC3SPTsB+4SUCL2mhRcogODrdywrWAX4BGlMkIA 2fmJHgdEJJU+e5bGBl2uc8NzUoEr/F/9ZEm52ArUD0Be8xqOv0A1+G65dK13xJxsaf EINGMZVWOEk033AXUYBZYDwtWxUQRDKOEL+jBG79ZbDmCms9U0WptwA2WaVdnkAAz7 v4hXhLJELpcmw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AE63F69AA4 for ; Wed, 11 Feb 2026 17:15:14 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 48uxCS1SiLDI for ; Wed, 11 Feb 2026 17:15:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855314; bh=1tQky1hk3GWHO4PXprBoUspdWRRjjFtoy2CaQsQfZOI=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=fIrR33krzd+mqM6kK/uQ4iNnrixZcFU8Q5JXhif0wUSUF8DSzYW4qubZcO59H0f/4 8bKD5s9pQtm17bUVgTqwvtYY3/fwIp6ub9Qj+HvdxglOev+A0wZH3BRiNj44rdR5Xq m1cNeHtXsoLqDsqyX2o60UvYxtcrC3SPTsB+4SUCL2mhRcogODrdywrWAX4BGlMkIA 2fmJHgdEJJU+e5bGBl2uc8NzUoEr/F/9ZEm52ArUD0Be8xqOv0A1+G65dK13xJxsaf EINGMZVWOEk033AXUYBZYDwtWxUQRDKOEL+jBG79ZbDmCms9U0WptwA2WaVdnkAAz7 v4hXhLJELpcmw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 970F669A99 for ; Wed, 11 Feb 2026 17:15:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855313; bh=ix/mwwY4Pwxcir4BVQ88n3PIrp7C5BKv8XYyQzgb294=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vhgvpAbHF+YEeTI07QdsHeoRzp5+Cepbl7fteJ++eLANh6G9LQOfqBvhEulnvboVO A+mHm1v8hs9dpudSkcXAKeAZ7i1DXtxDgDhrKBFr/Ha5r+p+KJUOrLLgGAHL2ksFMf 5C/gim8jJNDUQkIxjQu8PNzHX56PWJ13iHvrc+VyDMwB6W+dHqzlk0yn7Tw8JpBZoo IaLFuJBL8AaTLiJd3GxEzlFitfm+6mBV02u8aQE1HWyRCknKGQaM/q9p1TpRJemxca dJogJG1suV0JT/ym7rxmc7dHAbw1b63/OCn5dgdDcyJd/8Qi6J8L06wxhOK0A7MTBV deVxiy38riUUA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 66C5E69AB0; Wed, 11 Feb 2026 17:15:13 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id EFXM07yhzW7o; Wed, 11 Feb 2026 17:15:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855307; bh=BR4PoZLkCIF533U208bhfzJhCv5ZS+AaALFkU/Ymb9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FAX5oOSPfm3MXSvBkHW5cZcmYXGD+/jBhFRAd/HiZc5XmWeb7cuGoprVb+K8bsiEn lwI7JA0c+kpdTSEG2t5fOcfnwklEH6sHnu6yPrI38k8FpYBv0uj1YmaKy/8Zp9TY+e QASDSDduqgAXTYGwCZYrU5PKcqu5z/NFhkiBgDb6olW7LTj52kTz9uBDALR3snEhKL PDqWkp97BMPR5R+07IYG+C370MTG5DsJD7L4/lFlKYX5C1E2KewEacHEsZNUMF1Gai nUAKnI66aeXUxTSwJUgJsX8gavcgGz77oyhN4NnrSbLR+3YKDM9eGnjaqpxCo8z2we hEAuNQ5zNC9zA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9713F69A99; Wed, 11 Feb 2026 17:15:07 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:14:05 -0700 Message-ID: <20260212001410.1919749-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JKPUN3IOLNCGYATF4J62GFHOI2QU6RYW X-Message-ID-Hash: JKPUN3IOLNCGYATF4J62GFHOI2QU6RYW X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 14/15] riscv: Add RISC-V EFI application board and defconfig List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add support for building U-Boot as a 64-bit RISC-V EFI application. This allows U-Boot to run on top of UEFI firmware (e.g. EDK2) on RISC-V platforms. Follow the same pattern as the existing ARM and x86 EFI application boards. Merge the Kconfig choice block into a single block with per-entry arch dependencies, replacing the previous separate per-arch choice blocks. Include a timer node for the RISC-V architectural timer and a /cpus node with timebase-frequency for QEMU virt (10 MHz) in the device tree. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/Kconfig | 8 ++++ arch/riscv/dts/efi-riscv_app.dts | 49 ++++++++++++++++++++ board/efi/Kconfig | 42 ++++++++++------- board/efi/efi-riscv_app/Kconfig | 26 +++++++++++ board/efi/efi-riscv_app/MAINTAINERS | 7 +++ board/efi/efi-riscv_app/Makefile | 5 +++ board/efi/efi-riscv_app/board.c | 51 +++++++++++++++++++++ board/efi/efi-riscv_app/config.mk | 6 +++ board/efi/efi-riscv_app/efi-riscv_app.env | 12 +++++ configs/efi-riscv_app64_defconfig | 55 +++++++++++++++++++++++ lib/efi_client/Kconfig | 6 +-- 11 files changed, 248 insertions(+), 19 deletions(-) create mode 100644 arch/riscv/dts/efi-riscv_app.dts create mode 100644 board/efi/efi-riscv_app/Kconfig create mode 100644 board/efi/efi-riscv_app/MAINTAINERS create mode 100644 board/efi/efi-riscv_app/Makefile create mode 100644 board/efi/efi-riscv_app/board.c create mode 100644 board/efi/efi-riscv_app/config.mk create mode 100644 board/efi/efi-riscv_app/efi-riscv_app.env create mode 100644 configs/efi-riscv_app64_defconfig diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 378a974f06c..24b264933bb 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -55,6 +55,14 @@ config TARGET_XILINX_MBV config TARGET_ASPEED_AST2700_IBEX bool "Support Ibex RISC-V cores on Aspeed AST2700 SoC" +config ARCH_EFI_RISCV + bool "efi" + select ARCH_EFI + help + Indicates that this board uses EFI as its underlying base, i.e. + that it does not have bare-metal code and can only run as an EFI + application. + endchoice config SYS_ICACHE_OFF diff --git a/arch/riscv/dts/efi-riscv_app.dts b/arch/riscv/dts/efi-riscv_app.dts new file mode 100644 index 00000000000..092aec90087 --- /dev/null +++ b/arch/riscv/dts/efi-riscv_app.dts @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2026 Canonical Ltd + * Written by Simon Glass + */ + +/dts-v1/; + +/ { + #address-cells = <2>; + #size-cells = <2>; + model = "EFI RISC-V Application"; + compatible = "efi,riscv-app"; + + chosen { + stdout-path = &serial; + }; + + serial: serial { + compatible = "efi,uart"; + }; + + reset { + compatible = "efi,reset"; + bootph-all; + }; + + efi-fb { + compatible = "efi-fb"; + bootph-some-ram; + }; + + keyboard { + compatible = "efi-keyboard"; + }; + + mouse { + compatible = "efi,mouse"; + }; + + cpus { + timebase-frequency = <10000000>; + }; + + timer { + compatible = "riscv,timer"; + }; + +}; diff --git a/board/efi/Kconfig b/board/efi/Kconfig index 5237f58093e..d27baa4ccbb 100644 --- a/board/efi/Kconfig +++ b/board/efi/Kconfig @@ -5,14 +5,13 @@ config ARCH_EFI if ARCH_EFI -if X86 - choice prompt "Mainboard model" optional config TARGET_EFI_X86_APP32 bool "32-bit efi application" + depends on X86 select EFI_APP help This target is used for running U-Boot on top of EFI. In @@ -22,6 +21,7 @@ config TARGET_EFI_X86_APP32 config TARGET_EFI_X86_APP64 bool "64-bit efi application" + depends on X86 select EFI_APP select X86_64 if X86 help @@ -32,27 +32,16 @@ config TARGET_EFI_X86_APP64 config TARGET_EFI_X86_PAYLOAD bool "efi payload" + depends on X86 help This target is used for running U-Boot on top of EFI. In this case EFI does the early initialisation, and U-Boot takes over once the RAM, video and CPU are fully running. U-Boot is loaded as a payload from EFI. -endchoice - -source "board/efi/efi-x86_app/Kconfig" -source "board/efi/efi-x86_payload/Kconfig" - -endif # X86 - -if ARM - -choice - prompt "Mainboard model" - optional - config TARGET_EFI_ARM_APP64 bool "64-bit efi application" + depends on ARM select EFI_APP select SYS_CUSTOM_LDSCRIPT select ARM64 @@ -62,10 +51,31 @@ config TARGET_EFI_ARM_APP64 starts once the RAM, video and CPU are fully running. U-Boot is loaded as an application from EFI. +config TARGET_EFI_RISCV_APP64 + bool "64-bit efi application" + depends on RISCV + select EFI_APP + select SYS_CUSTOM_LDSCRIPT + select ARCH_RV64I + help + This target is used for running U-Boot on top of EFI in 64-bit mode. + In this case EFI does the early initialisation, and U-Boot + starts once the RAM, video and CPU are fully running. + U-Boot is loaded as an application from EFI. + endchoice +if X86 +source "board/efi/efi-x86_app/Kconfig" +source "board/efi/efi-x86_payload/Kconfig" +endif + +if ARM source "board/efi/efi-arm_app/Kconfig" +endif -endif # ARM +if RISCV +source "board/efi/efi-riscv_app/Kconfig" +endif endif # ARCH_EFI diff --git a/board/efi/efi-riscv_app/Kconfig b/board/efi/efi-riscv_app/Kconfig new file mode 100644 index 00000000000..dba7789b7fa --- /dev/null +++ b/board/efi/efi-riscv_app/Kconfig @@ -0,0 +1,26 @@ +# Copyright 2026 Canonical Ltd +# Written by Simon Glass + +if EFI_APP + +config SYS_BOARD + default "efi-riscv_app" + +config SYS_VENDOR + default "efi" + +config SYS_SOC + default "efi" + +config SYS_CPU + default "generic" + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + select GENERIC_RISCV + imply VIDEO_EFI + +config SYS_LDSCRIPT + default "arch/riscv/lib/elf_riscv64_efi_app.lds" + +endif diff --git a/board/efi/efi-riscv_app/MAINTAINERS b/board/efi/efi-riscv_app/MAINTAINERS new file mode 100644 index 00000000000..09babeeb811 --- /dev/null +++ b/board/efi/efi-riscv_app/MAINTAINERS @@ -0,0 +1,7 @@ +EFI-RISCV_APP64 BOARD +M: Simon Glass +M: Simon Glass +S: Maintained +F: board/efi/Kconfig +F: board/efi/efi-riscv_app/ +F: configs/efi-riscv_app64_defconfig diff --git a/board/efi/efi-riscv_app/Makefile b/board/efi/efi-riscv_app/Makefile new file mode 100644 index 00000000000..8864bcdd0cf --- /dev/null +++ b/board/efi/efi-riscv_app/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright 2026 Canonical Ltd +# Written by Simon Glass + +obj-y += board.o diff --git a/board/efi/efi-riscv_app/board.c b/board/efi/efi-riscv_app/board.c new file mode 100644 index 00000000000..9efed36c7d2 --- /dev/null +++ b/board/efi/efi-riscv_app/board.c @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2026 Canonical Ltd + * Written by Simon Glass + */ + +#include +#include +#include +#include + +int print_cpuinfo(void) +{ + return 0; +} + +int board_init(void) +{ + return 0; +} + +int board_exit_boot_services(void *ctx, struct event *evt) +{ + struct efi_priv *priv = efi_get_priv(); + struct efi_mem_desc *desc; + int desc_size; + uint version; + int size; + uint key; + int ret; + + if (evt->data.bootm_final.flags & BOOTM_FINAL_FAKE) { + printf("Not exiting EFI (fake go)\n"); + return 0; + } + printf("Exiting EFI\n"); + ret = efi_get_mmap(&desc, &size, &key, &desc_size, &version); + if (ret) { + printf("efi: Failed to get memory map\n"); + return -EFAULT; + } + + ret = efi_app_exit_boot_services(priv, key); + if (ret) + return ret; + + /* no console output after here as there are no EFI drivers! */ + + return 0; +} +EVENT_SPY_FULL(EVT_BOOTM_FINAL, board_exit_boot_services); diff --git a/board/efi/efi-riscv_app/config.mk b/board/efi/efi-riscv_app/config.mk new file mode 100644 index 00000000000..07262dad634 --- /dev/null +++ b/board/efi/efi-riscv_app/config.mk @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright 2026 Canonical Ltd +# Written by Simon Glass + +BUILD_CFLAGS += -shared +PLATFORM_CPPFLAGS += $(CFLAGS_EFI) diff --git a/board/efi/efi-riscv_app/efi-riscv_app.env b/board/efi/efi-riscv_app/efi-riscv_app.env new file mode 100644 index 00000000000..57c05d6ee51 --- /dev/null +++ b/board/efi/efi-riscv_app/efi-riscv_app.env @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Environment file for RISC-V EFI app + * Copyright 2026 Canonical Ltd + * Written by Simon Glass + */ + +/* common console settings */ +fdt_addr=40000000 +stdin=serial +stdout=serial,vidconsole +stderr=serial,vidconsole diff --git a/configs/efi-riscv_app64_defconfig b/configs/efi-riscv_app64_defconfig new file mode 100644 index 00000000000..f18bfb653ad --- /dev/null +++ b/configs/efi-riscv_app64_defconfig @@ -0,0 +1,55 @@ +CONFIG_RISCV=y +CONFIG_NR_DRAM_BANKS=8 +CONFIG_ENV_SIZE=0x1000 +CONFIG_DEFAULT_DEVICE_TREE="efi-riscv_app" +CONFIG_DEBUG_UART_BASE=0x0 +CONFIG_DEBUG_UART_CLOCK=0 +CONFIG_ARCH_EFI_RISCV=y +CONFIG_ARCH_RV64I=y +CONFIG_RISCV_SMODE=y +CONFIG_TARGET_EFI_RISCV_APP64=y +CONFIG_EFI_CLIENT=y +CONFIG_EFI_APP_64BIT=y +CONFIG_EFI_RAM_SIZE=0x20000000 +CONFIG_FIT=y +CONFIG_BOOTSTD_FULL=y +CONFIG_SHOW_BOOT_PROGRESS=y +CONFIG_OF_SYSTEM_SETUP=y +CONFIG_FDT_SIMPLEFB=y +CONFIG_USE_BOOTARGS=y +CONFIG_BOOTCOMMAND="bootflow scan -lbp" +CONFIG_SYS_PBSIZE=532 +CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_LOG=y +CONFIG_LOGF_FUNC=y +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_CYCLIC_MAX_CPU_TIME_US=50000 +CONFIG_BOARD_EARLY_INIT_R=y +CONFIG_CMD_SMBIOS=y +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_MEMINFO_MAP=y +CONFIG_CMD_LSBLK=y +CONFIG_CMD_CAT=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_TIME=y +CONFIG_CMD_KASLRSEED=y +CONFIG_CMD_HASH=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_MAC_PARTITION=y +CONFIG_OF_LIVE=y +CONFIG_ENV_OVERWRITE=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_USE_BOOTFILE=y +CONFIG_BOOTFILE="Image" +CONFIG_NO_NET=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y +CONFIG_DM_RNG=y +CONFIG_DEBUG_EFI_CONSOLE=y +CONFIG_SYSRESET=y +CONFIG_VIDEO=y +CONFIG_CONSOLE_TRUETYPE=y +CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_CONSOLE_SCROLL_LINES=5 +CONFIG_FAT_WRITE=y +CONFIG_CMD_DHRYSTONE=y diff --git a/lib/efi_client/Kconfig b/lib/efi_client/Kconfig index d1b4b3bfd8e..f00eea8e8ca 100644 --- a/lib/efi_client/Kconfig +++ b/lib/efi_client/Kconfig @@ -1,9 +1,9 @@ menu "U-Boot as UEFI application" - depends on X86 || ARM + depends on X86 || ARM || RISCV config EFI_CLIENT bool "Support running U-Boot from EFI" - depends on X86 || ARM + depends on X86 || ARM || RISCV imply DISPLAY_BOARDINFO imply X86_TSC_READ_BASE select EFI @@ -19,7 +19,7 @@ choice config EFI_APP bool "Support running as an EFI application" - depends on X86 || ARM + depends on X86 || ARM || RISCV select CHARSET select EVENT imply CONSOLE_MUX From patchwork Thu Feb 12 00:14:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1838 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855318; bh=eKJ54wyWX2+bpAV9SN3Zy7cjIeU3p+/TBa6XKVTv3a0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UiKWXQOkUF3oXWQVsuXJSWN+GDp293f2jNec7ViC5BONK181eyvTqUAZdgaVBYZcz 0FqoXlBxP5Jk8bkIZegqZ1tUmDof/HcyOqHw1V1tXn3f2wYqw0thOlzD+9/6fQ8TGd 0q+PuS0TxeHudH7VxmUBhVoTkpnL7C3wj5e2AoI4/V76dQ6Gi4fydd63cJ+RlCaCXs k9ZzEJeH4C/+wDTgHH9xu07WN6A2VAADRBV2DaoQ4YNO5BRdTOEzdiIg3qb8WtD1De /+3aByVkfbFCXQZxBN6/QXCnkT+VI9j/YZNlJZr++mGa70caWQKwdGwuTuOzChYWKU JuSTnFS7Gcjcg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 264C8699C6 for ; Wed, 11 Feb 2026 17:15:18 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id PJnAtf4TjNa6 for ; Wed, 11 Feb 2026 17:15:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855318; bh=eKJ54wyWX2+bpAV9SN3Zy7cjIeU3p+/TBa6XKVTv3a0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UiKWXQOkUF3oXWQVsuXJSWN+GDp293f2jNec7ViC5BONK181eyvTqUAZdgaVBYZcz 0FqoXlBxP5Jk8bkIZegqZ1tUmDof/HcyOqHw1V1tXn3f2wYqw0thOlzD+9/6fQ8TGd 0q+PuS0TxeHudH7VxmUBhVoTkpnL7C3wj5e2AoI4/V76dQ6Gi4fydd63cJ+RlCaCXs k9ZzEJeH4C/+wDTgHH9xu07WN6A2VAADRBV2DaoQ4YNO5BRdTOEzdiIg3qb8WtD1De /+3aByVkfbFCXQZxBN6/QXCnkT+VI9j/YZNlJZr++mGa70caWQKwdGwuTuOzChYWKU JuSTnFS7Gcjcg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 13EBC69A90 for ; Wed, 11 Feb 2026 17:15:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855316; bh=GUJprwIxVTdgwaAH0H5hLvVNbA9Y+YJCihwENmWOjC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ci23tmZDBwqjzvzcvfp+XhxE1O508JyPOcMVAORtP4KRmHE87jB/Kr65JMMj7iqjh RCJ+1SRTxL/AdarWq4W9deXrz01HDicOiE3emZLNZ544xNaiukIX4j6Ss2ahjEwr13 aeBPR2qRyUnkWEfMujMzgkIoHRW5GP+j3EYN2bebRi5tj+5K6EUjofQ6KLpL0lSKPL z4BQ5lNOWdw+U5AWqEUwUjojcFCXSZABjvf8Hq8bfV4MabaJAlNB3024kBbwGjbtGW B8BwRAOJSMlS3EGIjyLFdknMUc+Wiv3wBeLuKhax6by1RhIhIYRMlzG8lSURs/S61I VC2tNWah/jpJg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DF9BA699DD; Wed, 11 Feb 2026 17:15:16 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id eaqQYZLHB3OH; Wed, 11 Feb 2026 17:15:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855312; bh=8MCWdpi2lbRE0KxpbSbYhytJJu0oxexKFI5c5CZCByo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wSdEuv2u0HLIWt80psVFuLl/gfKfhLP/p+JrITAIkd9tLAsnfjhjbRKLCC9WfRWKc 16sw2xJQhUV6nhAOy/ZYdMWAkiYlz4OadYA1rMYzK2gUQXU1/Or/lzD7VymU1oNeqm UblRwh161x2wACOGFf69ahecAoEEGZwZLL8WeZSbX29I1oukQsh5l4JIaw5YHVGCsc Qyw5Gb+/3J3W3Tu/FJNFDGc3tO2FkSiS7SLGEOsLuKwmfoHJT96REwTAS/mzG714FO qW+c38qONaX0+qnsnYmFA/thV8di9bPlCW+ICGBwEO2SnWfMnJiGoWTqH2VBUFfCiu u5c2bbYj3CxEQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 80B51699C6; Wed, 11 Feb 2026 17:15:12 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:14:06 -0700 Message-ID: <20260212001410.1919749-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: R7JHJA5VRAYDPW4PM2GCZQJ7BEBTFRIZ X-Message-ID-Hash: R7JHJA5VRAYDPW4PM2GCZQJ7BEBTFRIZ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 15/15] scripts: build-efi: Add RISC-V architecture support List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add RISC-V as a supported architecture for the build-efi script. This configures QEMU with the riscv-virt machine, EDK2 firmware (RISCV_VIRT pflash images) and a virtio disk. The RISCV_VIRT_VARS.fd file is copied from the system directory on first use since QEMU needs it to be writable. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- scripts/build-efi | 25 +++++++++++++++++++++++-- scripts/build_helper.py | 7 +++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/scripts/build-efi b/scripts/build-efi index e23d81bd9b1..a6c8614562b 100755 --- a/scripts/build-efi +++ b/scripts/build-efi @@ -101,6 +101,22 @@ class BuildEfi: ] extra += ['-drive', f'if=virtio,file={self.img},format=raw,id=hd0'] + elif self.args.arch == 'riscv': + qemu_arch = 'riscv64' + extra += ['--machine', 'virt'] + bios = os.path.join(efi_dir, 'RISCV_VIRT_CODE.fd') + if not os.path.exists(bios): + bios = '/usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd' + var_store = os.path.join(efi_dir, 'RISCV_VIRT_VARS.fd') + if not os.path.exists(var_store): + sys_var = '/usr/share/qemu-efi-riscv64/RISCV_VIRT_VARS.fd' + shutil.copy(sys_var, var_store) + extra += [ + '-drive', f'if=pflash,format=raw,file={bios},readonly=on', + '-drive', f'if=pflash,format=raw,file={var_store}' + ] + extra += ['-drive', + f'if=virtio,file={self.img},format=raw,id=hd0'] else: # x86 if self.helper.bitness == 64: qemu_arch = 'x86_64' @@ -122,7 +138,7 @@ class BuildEfi: extra += ['-display', 'none', '-serial', 'mon:stdio'] serial_msg = ' (Ctrl-a x to quit)' else: - if self.args.arch == 'arm': + if self.args.arch in ('arm', 'riscv'): extra += ['-device', 'virtio-gpu-pci'] extra += ['-device', 'qemu-xhci', '-device', 'usb-kbd', '-device', 'usb-tablet'] @@ -239,7 +255,12 @@ class BuildEfi: def start(self): """This does all the work""" args = self.args - arch = 'arm' if self.args.arch == 'arm' else 'x86' + if self.args.arch == 'arm': + arch = 'arm' + elif self.args.arch == 'riscv': + arch = 'riscv' + else: + arch = 'x86' build_type = 'payload' if args.payload else 'app' build = f'efi-{arch}_{build_type}{self.helper.bitness}' diff --git a/scripts/build_helper.py b/scripts/build_helper.py index d3e951fc220..bb55daaf84b 100644 --- a/scripts/build_helper.py +++ b/scripts/build_helper.py @@ -45,6 +45,8 @@ class Helper: self.os_arch = 'arm64' else: self.os_arch = 'arm' + elif self.args.arch == 'riscv': + self.os_arch = 'riscv64' else: # x86 if self.bitness == 64: self.os_arch = 'amd64' @@ -288,8 +290,9 @@ def add_common_args(parser): Args: parser (argparse.ArgumentParser): Parser to modify """ - parser.add_argument('-a', '--arch', default='arm', choices=['arm', 'x86'], - help='Select architecture (arm, x86) Default: arm') + parser.add_argument('-a', '--arch', default='arm', + choices=['arm', 'riscv', 'x86'], + help='Select architecture (arm, riscv, x86) Default: arm') parser.add_argument('-b', '--bootcmd', type=str, help='U-Boot bootcmd to pass via fw_cfg') parser.add_argument('-B', '--no-build', action='store_true',