How to change my platform's kernelTarget?


#1

Hello!

I’m looking to build a NixOS system for a regular system, except I can’t use a bzImage. Instead, I’d like to create a vmlinux. I’ve tried fiddling with nixpkgs.localSystem and a custom platform definition based on https://github.com/NixOS/nixpkgs/blob/32e9296244a697d12cfd7f56bae784f0d71e3624/lib/systems/platforms.nix#L3-L11 but it seemed to result in a mass rebuild starting from bootstrapping.

Does anyone know how to change the platform’s kernelTarget without causing such a big rebuild? In the meantime, I’ve just patched nixpkgs:

$ git diff
diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix
index 03bfce25610..b6c1988ad8e 100644
--- a/lib/systems/platforms.nix
+++ b/lib/systems/platforms.nix
@@ -5,7 +5,7 @@ rec {
     kernelBaseConfig = "defconfig";
     # Build whatever possible as a module, if not stated in the extra config.
     kernelAutoModules = true;
-    kernelTarget = "bzImage";
+    kernelTarget = "vmlinux";
   };
 
   pc64 = pcBase // { kernelArch = "x86_64"; };

Thank you,
Graham


#2

I think you’re on the right track with localSystem. This is how I am trying it right now:

nix-build '<nixpkgs>' -A linux --arg localSystem '{ system = "x86_64-linux"; platform = { name = "pc"; kernelArch = "x86_64"; kernelBaseConfig = "defconfig"; kernelAutoModules = true; kernelTarget = "vmlinux"; }; }'