"more-uarches" kernelPatch fails to apply on `linux_xanmod` kernel sources

Hello there,

this might be a total noob question.
I currently try to apply the more-uarches patch I know from the linux-clear (exact build script lines the patch is applied there) Arch User Repository package on my former distro. However, I fail to proceed on applying this patch to my overlay for linux_xandmod_latest

Here’s how I’m currently trying (overlays/packages.nix):

{ pkgs, lib, ... }:

{
  patched-linux = final: prev: {
    linux_xanmod_latest_patched = pkgs.linuxPackagesFor (
      pkgs.linux_xanmod_latest.override (old: {
        kernelPatches = [ {
            # https://nixos.org/manual/nixpkgs/stable/#fetchpatch
            patch = (prev.fetchpatch {
              name = "patch-linux-kernel-more-uarches";
              url = "https://raw.githubusercontent.com/graysky2/kernel_compiler_patch/master/more-uarches-for-kernel-5.17%2B.patch";
              hash = "sha256-HPaB0/vh5uIkBLGZqTVcFMbm87rc9GVb5q+L1cHAE/o=";
            });
            extraConfig = "MALDERLAKE y "; #GENERIC_CPU3 MRAPTORLAKE
          } ];
        structuredExtraConfig = with lib.kernel; {
          # https://github.com/NixOS/nixpkgs/blob/39a2e4c20a20e983b7f1b0ac434bd87dde2eecc2/pkgs/os-specific/linux/kernel/xanmod-kernels.nix
          # https://github.com/NixOS/nixpkgs/blob/39a2e4c20a20e983b7f1b0ac434bd87dde2eecc2/pkgs/os-specific/linux/kernel/common-config.nix
          DEBUG_KERNEL = lib.mkDefault no;

          NUMA = lib.mkDefault no;

          WINESYNC = no;
        };
        ignoreConfigErrors = true;
      })
    );
  };
}

The error I’m encountering:

error: builder for '/nix/store/pp7cn82a2ggqb2h9iz9jr6cbx3pnkgxm-cpupower-6.6.5.drv' failed with exit code 1;
       last 10 log lines:
       > Skipping patch.
       > 10 out of 10 hunks ignored -- saving rejects to file arch/x86/Kconfig.cpu.rej
       > patching file arch/x86/Makefile
       > Hunk #1 FAILED at 151.
       > 1 out of 1 hunk FAILED -- saving rejects to file arch/x86/Makefile.rej
       > patching file arch/x86/include/asm/vermagic.h
       > Reversed (or previously applied) patch detected!  Assume -R? [n]
       > Apply anyway? [n]
       > Skipping patch.
       > 2 out of 2 hunks ignored -- saving rejects to file arch/x86/include/asm/vermagic.h.rej
       For full logs, run 'nix log /nix/store/pp7cn82a2ggqb2h9iz9jr6cbx3pnkgxm-cpupower-6.6.5.drv'.
error: 1 dependencies of derivation '/nix/store/nmwqmxk6jc313ay2v3xgqn0pi4iskqk2-kernel-modules.drv' failed to build
error: 1 dependencies of derivation '/nix/store/6bq9szhzqw1dzdngm9d565jsd5g5s5cy-linux-6.6.5-modules.drv' failed to build
error: 1 dependencies of derivation '/nix/store/clxlw0c59cnklb4g3g4hv1jdn2xzykzj-nixos-system-dnix-23.11.20231212.cf28ee2.drv' failed to build
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/3wfp1j08hgvlc7lbfcznd8sgk5221b1s-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
applying patch /nix/store/pdl5yd6gmq8p9iv3rz1sgn46qqc7a147-patch-linux-kernel-more-uarches
patching file arch/x86/Kconfig.cpu
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
10 out of 10 hunks ignored -- saving rejects to file arch/x86/Kconfig.cpu.rej
patching file arch/x86/Makefile
Hunk #1 FAILED at 151.
1 out of 1 hunk FAILED -- saving rejects to file arch/x86/Makefile.rej
patching file arch/x86/include/asm/vermagic.h
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file arch/x86/include/asm/vermagic.h.rej

Help is very much appreciated!

iirc, xanmod is based on zen which should already have this particular patch applied upstream, so you do not need to apply it manually

1 Like