From 9f605ca95e5738db1ad3d353ccd4892f536769a7 Mon Sep 17 00:00:00 2001 From: Theo Paris Date: Tue, 6 Jan 2026 19:24:30 -0800 Subject: [PATCH] lib.systems: add uefi support Signed-off-by: Theo Paris Change-Id: I51ce15449fc83f0ff39277d7cde7b34a6a6a6964 lib.systems: remove i686-uefi --- lib/systems/doubles.nix | 5 +++++ lib/systems/examples.nix | 18 ++++++++++++++++++ lib/systems/inspect.nix | 4 ++++ lib/systems/parse.nix | 5 +++++ lib/tests/systems.nix | 2 ++ 5 files changed, 34 insertions(+) diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 4c80300b01c4..75ba17347efa 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -109,6 +109,10 @@ let "aarch64-windows" "x86_64-windows" "i686-windows" + + # UEFI + "aarch64-uefi" + "x86_64-uefi" ]; allParsed = map parse.mkSystemFromString all; @@ -189,6 +193,7 @@ in redox = filterDoubles predicates.isRedox; windows = filterDoubles predicates.isWindows; genode = filterDoubles predicates.isGenode; + uefi = filterDoubles predicates.isUefi; embedded = filterDoubles predicates.isNone; } diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 64f329f2a3db..3f426b6b2bfe 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -337,6 +337,24 @@ rec { platform = { }; }; + # + # UEFI + # + + x86_64-unknown-uefi = { + config = "x86_64-unknown-uefi"; + libc = null; + useLLVM = true; + linker = "lld"; + }; + + aarch64-unknown-uefi = { + config = "aarch64-unknown-uefi"; + libc = null; + useLLVM = true; + linker = "lld"; + }; + # # Windows # diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index 0a8e1ac8e702..c5f328b0eaaa 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -431,6 +431,10 @@ rec { } ]; + isUefi = [ + { kernel = kernels.uefi; } + ]; + isElf = { kernel.execFormat = execFormats.elf; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 86f8c169d901..7774c16500d9 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -634,6 +634,10 @@ rec { execFormat = unknown; families = { }; }; + uefi = { + execFormat = pe; + families = { }; + }; } // { # aliases @@ -849,6 +853,7 @@ rec { "mmixware" "ghcjs" "mingw32" + "uefi" ] || hasPrefix "freebsd" (elemAt l 2) || hasPrefix "netbsd" (elemAt l 2) diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index 872523d47b4a..30ecc876539e 100644 --- a/lib/tests/systems.nix +++ b/lib/tests/systems.nix @@ -55,6 +55,7 @@ lib.runTests ( ++ js ++ genode ++ redox + ++ uefi ); testarm = mseteq arm [ @@ -136,6 +137,7 @@ lib.runTests ( "x86_64-solaris" "x86_64-windows" "x86_64-none" + "x86_64-uefi" ]; testcygwin = mseteq cygwin [