From patchwork Thu Feb 12 00:13:51 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 118 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=1770855264; bh=STLkZq/eZe+bznolHaSD8F56BkeftEGVwxEE2qbomcU=; h=From:To:Date:CC:Subject:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=bJxqHQFccw87kgxF7xqBacKG94Z9um8Miq+aSI9V4Y4RYQ6XZEA38NkKf2Ad3g/op 2i4BQiCJLeGdOfBlaVEX4DJ1X87zBcZl+Cx3aHOxQ6swgbLOgxki934F8TUr7+67hC zKSsIwSLowWcvoMSUyIAXcbkCb0zYE3R1rlYi2EufOpttBnateCma2p2Uuic4Rno0w Te+219Aw8obqxkIwH7+onZg/Wn0C4nVeEih/ywOPoEqT82c3uh7ZChdAjXlMPqNg8s BpOy1OfttzjatphfnvPTBXMzGbKtsFB+0MBVbeptstsx7YkgfHAsPdZ3a5ITyxRsz0 7hJkxpop9UjIQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EC3DE69A9B for ; Wed, 11 Feb 2026 17:14:24 -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 ebRk18rgv_qn for ; Wed, 11 Feb 2026 17:14:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855264; bh=STLkZq/eZe+bznolHaSD8F56BkeftEGVwxEE2qbomcU=; h=From:To:Date:CC:Subject:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=bJxqHQFccw87kgxF7xqBacKG94Z9um8Miq+aSI9V4Y4RYQ6XZEA38NkKf2Ad3g/op 2i4BQiCJLeGdOfBlaVEX4DJ1X87zBcZl+Cx3aHOxQ6swgbLOgxki934F8TUr7+67hC zKSsIwSLowWcvoMSUyIAXcbkCb0zYE3R1rlYi2EufOpttBnateCma2p2Uuic4Rno0w Te+219Aw8obqxkIwH7+onZg/Wn0C4nVeEih/ywOPoEqT82c3uh7ZChdAjXlMPqNg8s BpOy1OfttzjatphfnvPTBXMzGbKtsFB+0MBVbeptstsx7YkgfHAsPdZ3a5ITyxRsz0 7hJkxpop9UjIQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D84F469A93 for ; Wed, 11 Feb 2026 17:14:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855263; bh=aBpPoTu1+OYxlFnGQyUp98BygeyuAXC7w7+RD8ESpnQ=; h=From:To:Cc:Subject:Date:From; b=cfih9qhicA8xSz52GVlu9q0eoH0Ou1FJ6X+NbjnXWGqnUUBOaAn8ivUgqpEMIeZI5 Ch07j6W78mkNe5SdpkHshvYAACYcrrh2plgM+MkfK12Qe834rOJKvv3ySUXoRp1toA 77se2YMqQx744Yz+UKBvnZty1qBuja+QetfkaKmgrIxp+Zao2I0WmXs4HgDuANhtkd XjG09dBDqrD+PFMKQes7AxhVVAkJRsvGouoMdfrWiPAy+k0ib7N1QqTfkIDqPTzwjH txEtmLurR/BENDyiROX3m6G2cTV1CZos9IW/9oOs4t9PZLqN7a58aDqzZTna8haClK fevjT2tkQkr+Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1C7AA69A90; Wed, 11 Feb 2026 17:14:23 -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 XBWZsiR1xVT6; Wed, 11 Feb 2026 17:14:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855258; bh=+WogRfu3flhgB8GeQw+RWq8tkUpCBUZPAUuioYL9nW0=; h=From:To:Cc:Subject:Date:From; b=C+GyJLJZW0Grfyf3emiNR9/x5lwiPEurM8ZB3fdbRMv9OqCRrtWMrYwbcAPluZKns COLfiUbwiwauujaDkV8fi8TaNqyC7yI5SPZLWZ84Mk39VmOehgvoN5ba7i7zzp21Q7 6stFR1QY0TJB3ya3TABXEYgRt8BHZ7pNsRRH3nAgERqruzWNtCEbIlHXsUqGST+9I5 niFiuupVL+vDk+8M/l/Ee5dgIxiuC9SmjhIrNcaS2RyWjrwAxY1NOCiSe5BfvRPYML EMjw9HHPzuNvI1DE4+HWiC1cEuK8+IUIH/YSVo5rIJFx7T2RVlq1wF5wlHmg4fTPPn 3zbDXUh3Qp6Ag== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 70471699C6; Wed, 11 Feb 2026 17:14:18 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:51 -0700 Message-ID: <20260212001410.1919749-1-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Message-ID-Hash: 7YDFCE5SF5GWCNRWQYF5FK3YSPLSVMMW X-Message-ID-Hash: 7YDFCE5SF5GWCNRWQYF5FK3YSPLSVMMW 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 00/15] riscv: Add EFI-application 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 support for building and running U-Boot as a 64-bit RISC-V EFI application on top of UEFI firmware such as EDK2. This includes build system changes (linker script, build flags, object exclusions), runtime fixes (FDT relocation skip, global data pointer handling, OF_BOARD_FIXUP disable), timer support via the firmware FDT, board files and defconfig It also provides QEMU integration in the build-efi script so it is easy to try out. Tested on QEMU riscv-virt with EDK2 firmware, boots to the U-Boot prompt. Simon Glass (15): board_f: Skip the FDT relocation when not relocating board_r: Skip set_gd() for RISC-V EFI applications riscv: Disable OF_BOARD_FIXUP for EFI applications riscv: timer: Read timebase frequency from the firmware FDT riscv: Add the EFI table field to arch_global_data riscv: Exclude -static -pie from LDFLAGS for EFI apps riscv: Add EFI application build flags riscv: efi: Exclude PLT relocations from the reloc loop riscv: Add EFI app linker script and build CRT objects riscv: Exclude start.o, mtrap.o, dram.o for EFI apps riscv: Skip prelink-riscv for EFI application builds riscv: Exclude unwanted startup code for EFI app builds efi: client: Build sync_dt for RISC-V EFI applications riscv: Add RISC-V EFI application board and defconfig scripts: build-efi: Add RISC-V architecture support Makefile | 2 + arch/riscv/Kconfig | 10 +- arch/riscv/Makefile | 2 + arch/riscv/config.mk | 19 +++ arch/riscv/cpu/Makefile | 7 +- arch/riscv/cpu/generic/Makefile | 2 + arch/riscv/dts/efi-riscv_app.dts | 49 ++++++++ arch/riscv/include/asm/global_data.h | 3 + arch/riscv/lib/Makefile | 2 + arch/riscv/lib/elf_riscv64_efi_app.lds | 136 ++++++++++++++++++++++ arch/riscv/lib/reloc_riscv_efi.c | 12 +- 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 ++ common/board_f.c | 3 +- common/board_r.c | 3 +- configs/efi-riscv_app64_defconfig | 55 +++++++++ drivers/timer/riscv_timer.c | 13 +++ include/asm-generic/global_data.h | 8 ++ lib/efi_client/Kconfig | 6 +- lib/efi_client/Makefile | 2 + lib/efi_client/efi_app.c | 3 + scripts/build-efi | 25 +++- scripts/build_helper.py | 7 +- 28 files changed, 490 insertions(+), 28 deletions(-) create mode 100644 arch/riscv/dts/efi-riscv_app.dts create mode 100644 arch/riscv/lib/elf_riscv64_efi_app.lds 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