diff --git a/microsoft/surface/common/kernel/6.12/patches.nix b/microsoft/surface/common/kernel/6.12/patches.nix index fd48cb7ed..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 ## @@ -151,4 +156,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