From 19ea375ca73d4ccebd19998cdd4c9b915e0d648c Mon Sep 17 00:00:00 2001 From: Andre Date: Sat, 29 Nov 2025 13:10:51 -0500 Subject: [PATCH 1/4] microsoft/surface: add patch to handle newer rust versions --- .../surface/common/kernel/6.12/patches.nix | 4 +++ .../surface/common/kernel/6.15/patches.nix | 4 +++ .../surface/common/kernel/rust_1-91_fix.patch | 30 +++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 microsoft/surface/common/kernel/rust_1-91_fix.patch diff --git a/microsoft/surface/common/kernel/6.12/patches.nix b/microsoft/surface/common/kernel/6.12/patches.nix index fd48cb7ed..e92cd2e85 100644 --- a/microsoft/surface/common/kernel/6.12/patches.nix +++ b/microsoft/surface/common/kernel/6.12/patches.nix @@ -151,4 +151,8 @@ name = "ms-surface/0014-rtc"; patch = patchSrc + "/0014-rtc.patch"; } + { + name = "rust-1.91-fix"; + patch = ../rust_1-91_fix.patch; + } ] diff --git a/microsoft/surface/common/kernel/6.15/patches.nix b/microsoft/surface/common/kernel/6.15/patches.nix index e42450469..a0b08777b 100644 --- a/microsoft/surface/common/kernel/6.15/patches.nix +++ b/microsoft/surface/common/kernel/6.15/patches.nix @@ -156,4 +156,8 @@ name = "ms-surface/0015-rtc"; patch = patchSrc + "/0015-rtc.patch"; } + { + name = "rust-1.91-fix"; + patch = ../rust_1-91_fix.patch; + } ] diff --git a/microsoft/surface/common/kernel/rust_1-91_fix.patch b/microsoft/surface/common/kernel/rust_1-91_fix.patch new file mode 100644 index 000000000..c4f9548e7 --- /dev/null +++ b/microsoft/surface/common/kernel/rust_1-91_fix.patch @@ -0,0 +1,30 @@ +diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs +index 39c82908ff3a3f..38b3416bb9799e 100644 +--- a/scripts/generate_rust_target.rs ++++ b/scripts/generate_rust_target.rs +@@ -225,7 +225,11 @@ fn main() { + ts.push("features", features); + ts.push("llvm-target", "x86_64-linux-gnu"); + ts.push("supported-sanitizers", ["kcfi", "kernel-address"]); +- ts.push("target-pointer-width", "64"); ++ if cfg.rustc_version_atleast(1, 91, 0) { ++ ts.push("target-pointer-width", 64); ++ } else { ++ ts.push("target-pointer-width", "64"); ++ } + } else if cfg.has("X86_32") { + // This only works on UML, as i386 otherwise needs regparm support in rustc + if !cfg.has("UML") { +@@ -245,7 +249,11 @@ fn main() { + } + ts.push("features", features); + ts.push("llvm-target", "i386-unknown-linux-gnu"); +- ts.push("target-pointer-width", "32"); ++ if cfg.rustc_version_atleast(1, 91, 0) { ++ ts.push("target-pointer-width", 32); ++ } else { ++ ts.push("target-pointer-width", "32"); ++ } + } else if cfg.has("LOONGARCH") { + panic!("loongarch uses the builtin rustc loongarch64-unknown-none-softfloat target"); + } else { \ No newline at end of file From ff8720284e6520553b3cd5ebffdd7cf99a19fdbb Mon Sep 17 00:00:00 2001 From: Andre Date: Tue, 9 Dec 2025 17:41:19 -0500 Subject: [PATCH 2/4] microsoft/surface: remove rust patch for 6.12 kernel --- microsoft/surface/common/kernel/6.12/patches.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/microsoft/surface/common/kernel/6.12/patches.nix b/microsoft/surface/common/kernel/6.12/patches.nix index e92cd2e85..fd48cb7ed 100644 --- a/microsoft/surface/common/kernel/6.12/patches.nix +++ b/microsoft/surface/common/kernel/6.12/patches.nix @@ -151,8 +151,4 @@ name = "ms-surface/0014-rtc"; patch = patchSrc + "/0014-rtc.patch"; } - { - name = "rust-1.91-fix"; - patch = ../rust_1-91_fix.patch; - } ] From ee6518daa1da1d54d77732e1145629461517e68b Mon Sep 17 00:00:00 2001 From: Andre Date: Tue, 9 Dec 2025 17:46:51 -0500 Subject: [PATCH 3/4] Revert "microsoft/surface: remove rust patch for 6.12 kernel" This reverts commit ff8720284e6520553b3cd5ebffdd7cf99a19fdbb. --- microsoft/surface/common/kernel/6.12/patches.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/microsoft/surface/common/kernel/6.12/patches.nix b/microsoft/surface/common/kernel/6.12/patches.nix index fd48cb7ed..e92cd2e85 100644 --- a/microsoft/surface/common/kernel/6.12/patches.nix +++ b/microsoft/surface/common/kernel/6.12/patches.nix @@ -151,4 +151,8 @@ name = "ms-surface/0014-rtc"; patch = patchSrc + "/0014-rtc.patch"; } + { + name = "rust-1.91-fix"; + patch = ../rust_1-91_fix.patch; + } ] From e580e56dd238facc99dac095d570a3e7c507f45f Mon Sep 17 00:00:00 2001 From: Andre Date: Tue, 9 Dec 2025 18:27:49 -0500 Subject: [PATCH 4/4] microsoft/surface: remove rust entirely for 6.12 kernel --- microsoft/surface/common/kernel/6.12/patches.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/microsoft/surface/common/kernel/6.12/patches.nix b/microsoft/surface/common/kernel/6.12/patches.nix index e92cd2e85..37473c270 100644 --- a/microsoft/surface/common/kernel/6.12/patches.nix +++ b/microsoft/surface/common/kernel/6.12/patches.nix @@ -12,6 +12,11 @@ structuredExtraConfig = with kernel; { STAGING_MEDIA = yes; + # Disable Rust support due to conflict with 1.91 introduced in NixOS 25.11 + RUST = lib.mkForce no; + RUST_IS_AVAILABLE = lib.mkForce no; + HAVE_RUST = lib.mkForce no; + ## ## Surface Aggregator Module ##