continuation/reformatting of: How to create .config for linux source code build in nixos
How do you enable Kconfig Symbols (kernel configuration options) when building the linux kernel in nixos
I particularly want to enable CONFIG_KVM=y and CONFIG_KVM_AMD=m
Here’s an example of how I set CONFIG_HZ_100=y and CONFIG_ARM64_64K_PAGES=y on my desktop. As you can see, it uses boot.kernelPatches which takes a list of sets. It’s pretty easy to configure the kernel this way.
1 Like
finding # CONFIG_HZ_100 is not set in .config was helpful
nixos-rebuild has been running appearingly successfully for a little while (still completing insanely long nixos kernel build) after setting, for CONFIG_KVM and CONFIG_KVM_AMD:
extraConfig = "KVM y
KVM_AMD m";
so I believe the main problem besides several syntax errors while adapting to boot.kernelPatches.extraStructuredConfig was that I had to set KVM_AMD to either "KVM_AMD m" in boot.kernelPatches.extraConfig or {KVM_AMD = lib.kernel.module;} in boot.kernelPatches.structuredExtraConfig.
So it had to be lib.kernel.module or m instead of yes or y.
edit: still building so I’ll have to test to ensure svm.c actually got built
Would boot.kernelPackages = pkgs.linuxPackages_latest; get in the way of boot.kernelPatches for this?
edit: I don’t think so; I just found CONFIG_KVM=y and CONFIG_KVM_AMD=m in my /proc/config.gz which is probably good
No, it’s smart enough to not mess up when changing it.