From 9ced079f552d2e2284954d94131a1cc8bd528ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Thu, 11 Sep 2025 08:03:50 +0800 Subject: [PATCH] vanadium: kernel customization --- nix/configurations/vanadium.nix | 1 + .../vanadium/kernel-overlay.nix | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 nix/configurations/vanadium/kernel-overlay.nix diff --git a/nix/configurations/vanadium.nix b/nix/configurations/vanadium.nix index 864c0802..4a3075a3 100644 --- a/nix/configurations/vanadium.nix +++ b/nix/configurations/vanadium.nix @@ -58,6 +58,7 @@ in ../packages/overlay.nix ./vanadium/overlay.nix + ./vanadium/kernel-overlay.nix # removed, but I need it for PLFA! ../overlays/pin-emacs28.nix diff --git a/nix/configurations/vanadium/kernel-overlay.nix b/nix/configurations/vanadium/kernel-overlay.nix new file mode 100644 index 00000000..7702acad --- /dev/null +++ b/nix/configurations/vanadium/kernel-overlay.nix @@ -0,0 +1,57 @@ +final: prev: let + inherit (final) lib; +in { + linuxPackages = final.linuxPackagesFor ( + prev.linuxPackages.kernel.override { + ignoreConfigErrors = true; + structuredExtraConfig = with lib.kernel; { + # optimisation for ryzen 7 + # https://wiki.gentoo.org/wiki/Ryzen + SMP = yes; + X86_X2APIC = yes; + X86_AMD_PLATFORM_DEVICE = yes; + PROCESSOR_SELECT = yes; + CPU_SUP_AMD = yes; + SCHED_MC = yes; + X86_MCE = yes; + X86_MCE_AMD = yes; + PERF_EVENTS_INTEL_RAPL = yes; + # # unused option + # CPU_FREQ_DEFAULT_GOV_ONDEMAND = yes; + # # no such option + # MICROCODE_AMD = yes; + # # <5.17 + # X86_ACPI_CPUFREQ = yes; + X86_AMD_PSTATE = yes; + X86_POWERNOW_K8 = no; + # # FIXME: crashes the build, seems to answer the question twice + # X86_AMD_FREQ_SENSITIVITY = yes; + # skipping firmware loading since it's handled by other parts of nix + SENSORS_K10TEMP = yes; + IOMMU_SUPPORT = yes; + AMD_IOMMU = yes; + # # no such option + # AMD_IOMMU_2 = yes; + + # additional chipset drivers + I2C_PIIX4 = yes; + PINCTRL = yes; + PINCTRL_AMD = yes; + CRYPTO = yes; + CRYPTO_HW = yes; + CRYPTO_DEV_CCP = yes; + CRYPTO_DEV_SP_CCP = yes; + CRYPTO_DEV_CCP_CRYPTO = yes; + CRYPTO_DEV_CCP_DD = yes; + CRYPTO_DEV_SP_PSP = yes; + + # Power management controller + X86_PLATFORM_DEVICES = yes; + AMD_PMC = yes; + + # My config + DRM_AMDGPU = yes; # Recent AMD GPU + }; + } + ); +}