From 7fcfe92450d8dc4db02bfeeda65ad31ca9afcf69 Mon Sep 17 00:00:00 2001 From: speak-agent <248744407+speak-agent@users.noreply.github.com> Date: Thu, 20 Aug 2026 16:10:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20openkal=20=E7=9A=84=E4=B8=A4=E4=B8=AA?= =?UTF-8?q?=E6=96=B0=E5=90=8E=E7=AB=AF=20=E2=80=94=E2=80=94=20OpenSBI=20?= =?UTF-8?q?=E4=B8=8E=20UEFI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## openkal-opensbi 0.1.0 ⭐ **可移植的那个 RISC-V 后端。** 板级后端往设备地址写,而那个地址是板级事实; SBI 的控制台是对已经知道机器是什么的固件的一次调用,因此同一个镜像在 QEMU virt 的 OpenSBI 下与真实板子上都能跑。 实测:QEMU -bios default(真实 OpenSBI)下打印并经 SRST 关机。 ## openkal-uefi 0.1.0 ⚠️ **推翻了「受阻」的判断。** 先前的分析认为 UEFI 需要一个新的 PE 形态裸机目标。 实测不需要:`x86_64-windows-gnu` + 三个链接 flag 产出的正是 IMAGE_SUBSYSTEM_EFI_APPLICATION 且不依赖任何 DLL,而该目标默认就是 MS x64 调用约定。 实测:OVMF 下作为 EFI/BOOT/BOOTX64.EFI 启动,打印后 kal_exit 交还固件。 两者都只实现 core 三件(abort/stream/memory);缺席的 interface 是缺席而非部分实现。 五个 tarball 的 GitHub 与 GitCode 镜像逐字节一致。 --- pkgs/o/openkal-opensbi.lua | 53 ++++++++++++++++++++++++++++++++++++++ pkgs/o/openkal-uefi.lua | 53 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 pkgs/o/openkal-opensbi.lua create mode 100644 pkgs/o/openkal-uefi.lua diff --git a/pkgs/o/openkal-opensbi.lua b/pkgs/o/openkal-opensbi.lua new file mode 100644 index 0000000..5b92ca6 --- /dev/null +++ b/pkgs/o/openkal-opensbi.lua @@ -0,0 +1,53 @@ +-- openkal-opensbi — openkal on the RISC-V Supervisor Binary Interface. +-- +-- ⭐ The PORTABLE RISC-V backend, as distinct from a board's own. A board +-- backend writes to a device address, and that address is a board fact: the +-- same binary on a second RISC-V machine writes to something that is not a +-- UART and prints nothing. SBI's console is a call into firmware that already +-- knows the machine, so one image runs under OpenSBI on QEMU's `virt` and on a +-- real board without being rebuilt. +-- +-- ⚠️ NO `deps`. The only mcpp dependency is the specification package, declared +-- in this package's own manifest; nothing needs installing. +package = { + spec = "1", + namespace = "mcpplibs", + name = "openkal-opensbi", + description = "An implementation of openkal on the RISC-V Supervisor Binary Interface, portable across every machine whose firmware provides one", + licenses = {"Apache-2.0"}, + repo = "https://github.com/mcpplibs/openkal-opensbi", + type = "package", + + xpm = { + linux = { + ["0.1.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-opensbi/archive/refs/tags/0.1.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-opensbi/releases/download/0.1.0/openkal-opensbi-0.1.0.tar.gz", + }, + sha256 = "6b5b81be59171f6f0d8e5d2e586a7f502479a2f309efb7fb1ab17c77a7579884", + }, + }, + macosx = { + ["0.1.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-opensbi/archive/refs/tags/0.1.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-opensbi/releases/download/0.1.0/openkal-opensbi-0.1.0.tar.gz", + }, + sha256 = "6b5b81be59171f6f0d8e5d2e586a7f502479a2f309efb7fb1ab17c77a7579884", + }, + }, + windows = { + ["0.1.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-opensbi/archive/refs/tags/0.1.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-opensbi/releases/download/0.1.0/openkal-opensbi-0.1.0.tar.gz", + }, + sha256 = "6b5b81be59171f6f0d8e5d2e586a7f502479a2f309efb7fb1ab17c77a7579884", + }, + }, + }, + + -- The package's own manifest, inside the tarball's wrap directory. + mcpp = "*/mcpp.toml", +} diff --git a/pkgs/o/openkal-uefi.lua b/pkgs/o/openkal-uefi.lua new file mode 100644 index 0000000..876809a --- /dev/null +++ b/pkgs/o/openkal-uefi.lua @@ -0,0 +1,53 @@ +-- openkal-uefi — openkal on UEFI Boot Services. +-- +-- ⚠️ The consuming project targets `x86_64-windows-gnu` with three link flags +-- (`-nostdlib`, `--subsystem,10`, `-e,efi_main`), which is not a workaround: a +-- UEFI application IS PE/COFF with subsystem 10, entered through the Microsoft +-- x64 calling convention, and that target already has both properties. +-- +-- An earlier analysis held that a new "PE freestanding" target would be needed +-- first. Measured otherwise — the flags above produce +-- IMAGE_SUBSYSTEM_EFI_APPLICATION with no DLL imports, verified booting under +-- OVMF. +package = { + spec = "1", + namespace = "mcpplibs", + name = "openkal-uefi", + description = "An implementation of openkal on UEFI Boot Services, for applications the firmware loads before an operating system exists", + licenses = {"Apache-2.0"}, + repo = "https://github.com/mcpplibs/openkal-uefi", + type = "package", + + xpm = { + linux = { + ["0.1.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-uefi/archive/refs/tags/0.1.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-uefi/releases/download/0.1.0/openkal-uefi-0.1.0.tar.gz", + }, + sha256 = "2b8a5035cd738e8b23d4ece7ea70cf6d2aba8c8b1150c613c8f1deb94092035a", + }, + }, + macosx = { + ["0.1.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-uefi/archive/refs/tags/0.1.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-uefi/releases/download/0.1.0/openkal-uefi-0.1.0.tar.gz", + }, + sha256 = "2b8a5035cd738e8b23d4ece7ea70cf6d2aba8c8b1150c613c8f1deb94092035a", + }, + }, + windows = { + ["0.1.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-uefi/archive/refs/tags/0.1.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-uefi/releases/download/0.1.0/openkal-uefi-0.1.0.tar.gz", + }, + sha256 = "2b8a5035cd738e8b23d4ece7ea70cf6d2aba8c8b1150c613c8f1deb94092035a", + }, + }, + }, + + -- The package's own manifest, inside the tarball's wrap directory. + mcpp = "*/mcpp.toml", +}