Kernel hacking?

Hi,

I want to test some linux kernel changes and need a way to “rapidly” test changes, i.e. not do a full compile everytime.

But ideally I would like to keep the different variants as system generations.

So I have the fuzzy idea of doing the compilation manually and then have a derivation that takes the kernel and module binaries and wrangles them into a format such that they can act as a kernel package.

If that’s not possible I would be happy to just sidestep the nixos generations and just boot the current generation with the new kernel “sideloaded”.

Do you have any pointers on how to achieve either of these two goals?

Thanks!

Why not just use an impure ccache stdenv and reuse ccache byproducts?

Alternatively, why not just compile outside of the Nix sandbox and reuse the products in a Nix derivation for the rest of your chain?

3 Likes

IIRC using ccache with the kernel drvs was a bit more complicated and ccacheStdenv is semi-broken anyways due to some sort of id randomisation that needs ccache to be specifically configured for it.

I haven’t done so myself but the second idea is basically that you copy the impurely-built products (kernel image, module dir) into the Nix store via a path literal and replace the respective attrs of the kernelPackages using the extend function.

1 Like

Thanks! Will take a look at the extend function.