Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel: allows to be less strict on modDirVersion #41262

Closed
wants to merge 1 commit into from

Conversation

teto
Copy link
Member

@teto teto commented May 30, 2018

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
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@dezgeg
Copy link
Contributor

dezgeg commented May 30, 2018

Well, it has to match or all those external modules using it in paths (

"--with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
) will fail to build.

@teto
Copy link
Member Author

teto commented May 31, 2018

@dezgeg the kernel will still be installed in ${modDirVersion} but I propose to allow some leeway regarding $actualModDirVersion, like being able to ignore the EXTRAVERSION suffix of $actualModDirVersion when comparing to $modDirVersion

nixos requires the nix package modDirVersion to match exactly the kernel
version, it might be best to leave some room for error (on minor version
for example).
@teto teto closed this Jun 10, 2019
@teto teto deleted the relax_moddir branch September 5, 2021 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants