[Boot] Add energy model support in kernel (if enabled)

Also fix syscall.x32 being on cmdline needlessly if not built into the kernel.
This commit is contained in:
Antoine Viallon 2022-10-12 18:41:15 +02:00
parent 805124cee7
commit 7fe3bbba5f
Signed by: aviallon
GPG key ID: 186FC35EDEB25716

View file

@ -16,6 +16,12 @@ let
RT_GROUP_SCHED y RT_GROUP_SCHED y
''; '';
}; };
enableEnergyModel = {
name = "enable-energy-model";
patch = null; extraConfig = ''
ENERGY_MODEL y
'';
};
optimizeForCPUArch = arch: let optimizeForCPUArch = arch: let
archConfigMap = { archConfigMap = {
"k8" = "K8"; "opteron" = "K8"; "athlon64" = "K8"; "athlon-fx" = "K8"; "k8" = "K8"; "opteron" = "K8"; "athlon64" = "K8"; "athlon-fx" = "K8";
@ -96,6 +102,8 @@ in
}; };
kvdo.enable = mkEnableOption "dm-kvdo kernel module"; kvdo.enable = mkEnableOption "dm-kvdo kernel module";
rtGroupSched.enable = mkEnableOption "RT cgroups"; rtGroupSched.enable = mkEnableOption "RT cgroups";
energyModel.enable = mkEnableOption "Energy Model";
efi = mkOption rec { efi = mkOption rec {
description = "Use EFI bootloader"; description = "Use EFI bootloader";
default = builtins.pathExists "/sys/firmware/efi"; default = builtins.pathExists "/sys/firmware/efi";
@ -133,7 +141,7 @@ in
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
aviallon.boot.cmdline = { aviallon.boot.cmdline = {
"syscall.x32" = cfg.x32abi.enable; "syscall.x32" = mkIf cfg.x32abi.enable true;
# Reboot after 5 seconds on panic (prevent system lockup) # Reboot after 5 seconds on panic (prevent system lockup)
"panic" = 5; "panic" = 5;
@ -153,6 +161,7 @@ in
kernelPatches = [] kernelPatches = []
++ optional cfg.x32abi.enable customKernelPatches.enableX32ABI ++ optional cfg.x32abi.enable customKernelPatches.enableX32ABI
++ optional cfg.rtGroupSched.enable customKernelPatches.enableRTGroupSched ++ optional cfg.rtGroupSched.enable customKernelPatches.enableRTGroupSched
++ optional cfg.energyModel.enable customKernelPatches.enableEnergyModel
++ optional config.aviallon.optimizations.enable (customKernelPatches.optimizeForCPUArch config.aviallon.general.cpuArch) ++ optional config.aviallon.optimizations.enable (customKernelPatches.optimizeForCPUArch config.aviallon.general.cpuArch)
; ;