From 812f4976608b45f3cd2fef474e2cd76ac0cf42b1 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 11 Feb 2024 16:19:52 +0000 Subject: [PATCH] add kernel.version param to allow for version-specific patches default to 5.15.137 to avoid breaking the devices that don't declare it --- modules/kernel.nix | 4 +++- pkgs/kernel/default.nix | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/kernel.nix b/modules/kernel.nix index f10e3d7..8455daf 100644 --- a/modules/kernel.nix +++ b/modules/kernel.nix @@ -27,6 +27,7 @@ in { options = { kernel = { src = mkOption { type = types.path; } ; + version = mkOption { type = types.str; default = "5.15.137";} ; modular = mkOption { type = types.bool; default = true; @@ -79,7 +80,8 @@ in { config.kernel.conditionalConfig; k = liminix.builders.kernel.override { config = mergedConfig; - inherit (config.kernel) src extraPatchPhase; + version = builtins.trace config.kernel.version config.kernel.version; + inherit (config.kernel) src extraPatchPhase; targets = config.kernel.makeTargets; }; in { diff --git a/pkgs/kernel/default.nix b/pkgs/kernel/default.nix index 8ff2522..0a1b065 100644 --- a/pkgs/kernel/default.nix +++ b/pkgs/kernel/default.nix @@ -6,6 +6,7 @@ , config , src + , version ? "0" , extraPatchPhase ? "echo" , targets ? ["vmlinux"] } : @@ -51,9 +52,9 @@ stdenv.mkDerivation rec { patches = [ ./cmdline-cookie.patch - ./phram-allow-cached-mappings.patch ./mips-malta-fdt-from-bootloader.patch - ]; + ] ++ lib.optional (lib.versionOlder version "5.18.0") + ./phram-allow-cached-mappings.patch; # this is here to work around what I think is a bug in nixpkgs # packaging of ncurses: it installs pkg-config data files which