kernel: allows to be less strict on modDirVersion #41262
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
nixos requires the nix package modDirVersion to match exactly the kernel
version else it aborts build. It might be best to leave some room for error (on minor version
for example).
Motivation for this change
I tweak/compile a few kernels and everytime I have to make sure that modDirVersion exactly matches. For instance compiling a kernel from the same source will need different modDirVersion depending on if they are compiled within nix-shell (a "+" will be appended https://unix.stackexchange.com/questions/370392/prevent-a-plus-sign-from-being-appended-to-linux-build) or from a nix-build.
Another example is that I run tests on a kernel via
qemu -kernel <custom_kernel>
and some BPF scripts. BPF scripts will look for files into an $(uname -r) but I don't want to rebuild from scratch the kernel I am testing just for nixos so I configure bcc to use a stable kernel from a few commits before (with same symbols) but this doesn't work if modDir versions differ.To summarize, current configuration of nix is good but it might be good to allow for relaxing the modDirVersion check (like ignore the suffix LOCALVERSION/EXTRAVERSION or have a fakeModDirVersion setting to warn instead of aborting build ).
For now I remove the exit in this check
https://github.com/teto/nixpkgs/blob/013dbc4d37be2e816b71f7f471d9d48c26084679/pkgs/os-specific/linux/kernel/manual-config.nix#L133
but it won't work without the current patch which doesn't change a thing for other users
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)