Linux kernel: Difference between revisions

imported>Mic92
out-of-tree kernel modules
imported>Samueldr
m Adds note about the kernelPatches extraConfig trick.
Line 37: Line 37:
[nix-shell] $ make menuconfig
[nix-shell] $ make menuconfig
</syntaxHighlight> (thanks to sphalerite)
</syntaxHighlight> (thanks to sphalerite)
== Adding <code>extraConfig</code> ==
It is sometimes desirable to change the configuration of your kernel, while keeping the kernel version itself managed through nixpkgs. To do so, you can add the configuration to a dummy {{nixos:option|boot.kernelPatches}}<ref>[https://logs.nix.samueldr.com/nixos/2018-05-09#1525898458-1525898534; #nixos 2018-05-09]</ref><ref>[https://github.com/NixOS/nixpkgs/blob/03d4694e6110fa9c16e88ee74085ea2068c27494/nixos/modules/misc/crashdump.nix#L63-L73 <tt>nixos/modules/misc/crashdump.nix#L63-L73</tt>]</ref>, which will then be merged and applied to the current kernel. As with kernel configuration with NixOS, drop the <tt>CONFIG_</tt> from the kernel configuration names.
This example is from the {{nixos:option|boot.crashDump.enable}} option:
<syntaxhighlight lang=nix>
{
      boot.kernelPatches = [ {
        name = "crashdump-config";
        patch = null;
        extraConfig = ''
                CRASH_DUMP y
                DEBUG_INFO y
                PROC_VMCORE y
                LOCKUP_DETECTOR y
                HARDLOCKUP_DETECTOR y
              '';
        } ];
}
</syntaxhighlight>