From 4c556e1bc0beb813aa5fb49469a878c29f8f1ad1 Mon Sep 17 00:00:00 2001 From: Lan Tian Date: Sun, 28 Dec 2025 02:55:05 -0800 Subject: [PATCH] Add latest kernel variants with processor specific tuning --- README.md | 10 ++++++ kernel-cachyos/cachySettings.nix | 32 +++++++++++++++++++ kernel-cachyos/default.nix | 55 ++++++++++++++++++++++++++++++++ kernel-cachyos/mkCachyKernel.nix | 2 ++ 4 files changed, 99 insertions(+) diff --git a/README.md b/README.md index 4488b11..a3403e6 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,18 @@ This repo provides the following kernel variants, consistent with the [upstream ```bash └───packages └───x86_64-linux + # Latest kernel, provide all LTO/CPU arch variants ├───linux-cachyos-latest + ├───linux-cachyos-latest-x86_64-v2 + ├───linux-cachyos-latest-x86_64-v3 + ├───linux-cachyos-latest-x86_64-v4 + ├───linux-cachyos-latest-zen4 ├───linux-cachyos-latest-lto + ├───linux-cachyos-latest-lto-x86_64-v2 + ├───linux-cachyos-latest-lto-x86_64-v3 + ├───linux-cachyos-latest-lto-x86_64-v4 + ├───linux-cachyos-latest-lto-zen4 + # LTS kernel, provide LTO variants ├───linux-cachyos-lts ├───linux-cachyos-lts-lto # Additional CachyOS kernel variants diff --git a/kernel-cachyos/cachySettings.nix b/kernel-cachyos/cachySettings.nix index 061386b..698c2ac 100644 --- a/kernel-cachyos/cachySettings.nix +++ b/kernel-cachyos/cachySettings.nix @@ -65,6 +65,38 @@ with lib.kernel; CPU_FREQ_DEFAULT_GOV_PERFORMANCE = yes; }; + processorOpt = { + x86_64-v1 = { + GENERIC_CPU = yes; + MZEN4 = no; + X86_NATIVE_CPU = no; + X86_64_VERSION = freeform "1"; + }; + x86_64-v2 = { + GENERIC_CPU = yes; + MZEN4 = no; + X86_NATIVE_CPU = no; + X86_64_VERSION = freeform "2"; + }; + x86_64-v3 = { + GENERIC_CPU = yes; + MZEN4 = no; + X86_NATIVE_CPU = no; + X86_64_VERSION = freeform "3"; + }; + x86_64-v4 = { + GENERIC_CPU = yes; + MZEN4 = no; + X86_NATIVE_CPU = no; + X86_64_VERSION = freeform "4"; + }; + zen4 = { + GENERIC_CPU = no; + MZEN4 = yes; + X86_NATIVE_CPU = no; + }; + }; + tickrate = { periodic = { NO_HZ_IDLE = no; diff --git a/kernel-cachyos/default.nix b/kernel-cachyos/default.nix index f5af9f8..523a006 100644 --- a/kernel-cachyos/default.nix +++ b/kernel-cachyos/default.nix @@ -12,17 +12,72 @@ let in builtins.listToAttrs ( builtins.map (v: lib.nameValuePair v.pname v) [ + # Latest kernel, provide all LTO/CPU arch variants (mkCachyKernel { pname = "linux-cachyos-latest"; inherit (linux_latest) version src; configVariant = "linux-cachyos"; }) + (mkCachyKernel { + pname = "linux-cachyos-latest-x86_64-v2"; + inherit (linux_latest) version src; + configVariant = "linux-cachyos"; + processorOpt = "x86_64-v2"; + }) + (mkCachyKernel { + pname = "linux-cachyos-latest-x86_64-v3"; + inherit (linux_latest) version src; + configVariant = "linux-cachyos"; + processorOpt = "x86_64-v3"; + }) + (mkCachyKernel { + pname = "linux-cachyos-latest-x86_64-v4"; + inherit (linux_latest) version src; + configVariant = "linux-cachyos"; + processorOpt = "x86_64-v4"; + }) + (mkCachyKernel { + pname = "linux-cachyos-latest-zen4"; + inherit (linux_latest) version src; + configVariant = "linux-cachyos"; + processorOpt = "zen4"; + }) (mkCachyKernel { pname = "linux-cachyos-latest-lto"; inherit (linux_latest) version src; configVariant = "linux-cachyos"; lto = "thin"; }) + (mkCachyKernel { + pname = "linux-cachyos-latest-lto-x86_64-v2"; + inherit (linux_latest) version src; + configVariant = "linux-cachyos"; + lto = "thin"; + processorOpt = "x86_64-v2"; + }) + (mkCachyKernel { + pname = "linux-cachyos-latest-lto-x86_64-v3"; + inherit (linux_latest) version src; + configVariant = "linux-cachyos"; + lto = "thin"; + processorOpt = "x86_64-v3"; + }) + (mkCachyKernel { + pname = "linux-cachyos-latest-lto-x86_64-v4"; + inherit (linux_latest) version src; + configVariant = "linux-cachyos"; + lto = "thin"; + processorOpt = "x86_64-v4"; + }) + (mkCachyKernel { + pname = "linux-cachyos-latest-lto-zen4"; + inherit (linux_latest) version src; + configVariant = "linux-cachyos"; + lto = "thin"; + processorOpt = "zen4"; + }) + + # LTS kernel (mkCachyKernel { pname = "linux-cachyos-lts"; inherit (linux) version src; diff --git a/kernel-cachyos/mkCachyKernel.nix b/kernel-cachyos/mkCachyKernel.nix index 1c3af5b..e0de013 100644 --- a/kernel-cachyos/mkCachyKernel.nix +++ b/kernel-cachyos/mkCachyKernel.nix @@ -39,6 +39,7 @@ lib.makeOverridable ( ccHarder ? true, bbr3 ? false, hugepage ? "always", + processorOpt ? "x86_64-v1", # CachyOS additional patch settings hardened ? false, @@ -126,6 +127,7 @@ lib.makeOverridable ( // (lib.optionalAttrs ccHarder cachySettings.ccHarder) // (lib.optionalAttrs bbr3 cachySettings.bbr3) // (lib.optionalAttrs (hugepage != null) cachySettings.hugepage."${hugepage}") + // (lib.optionalAttrs (processorOpt != null) cachySettings.processorOpt.${processorOpt}) )) # Apply user custom settings