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

linux kernel generic: use passAsFile for kernelConfig #38626

Merged
merged 1 commit into from Apr 9, 2018

Conversation

martinetd
Copy link
Member

Otherwise get the error 'Argument list too long' when running builder
with a very long kernelConfig

Motivation for this change

I have a Very Big kernelConfig, because I want DEBUG_INFO so need to rebuild but don't want to spend too long rebuilding (so doing a minimalistic kernel with thousands of 'foo n' options) and that seemed simpler than manual-config.nix at the time.

Also, hi! Nix looks great except for building a custom kernel :P
I couldn't find any "proper" test for this but I think that won't cause too many side effect out of the building the kernel config itself, which appears to work for me (still fiddling with the config itself but it finds the file etc)
The only arguable point is that I make a hardlink (cp -l), not sure what's recommended there but it should work on all platforms nix targets, probably?

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/)
  • (probably) Fits CONTRIBUTING.md.

@teto
Copy link
Member

teto commented Apr 9, 2018

looks good, why the hardlink instead of symlink ?

@martinetd
Copy link
Member Author

Years of bad habits, happy to change that if there is any preference.
(also, is there anywhere that explains what the labels mean? Just that the expressions changed and it would need a rebuild, or were there actual failures?)

@Mic92
Copy link
Member

Mic92 commented Apr 9, 2018

Just means that it rebuilds all kernels times all kernel modules. That's why it builds > 500 packages.

@@ -104,7 +105,7 @@ let

# Create the config file.
echo "generating kernel configuration..."
echo "$kernelConfig" > "$buildRoot/kernel-config"
cp -l "$kernelConfigPath" "$buildRoot/kernel-config"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Symlinks are less surprising because it is clear, where they came from.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. Repushed with ln -s instead, and retested with sandbox.

lrwxrwxrwx 1 nixbld1 nixbld 49 Apr  9 18:30 /tmp/nix-build-linux-config-4.14.32.drv-0/linux-4.14.32/build/kernel-config -> /tmp/nix-build-linux-config-4.14.32.drv-0/.attr-0

Otherwise get the error 'Argument list too long' when running builder
with a very long kernelConfig
@Mic92 Mic92 merged commit 3458776 into NixOS:master Apr 9, 2018
@shlevy
Copy link
Member

shlevy commented Apr 9, 2018

FYI, there's also linuxManualConfig already designed for building a manually configured kernel 😄

@martinetd
Copy link
Member Author

Aye, I found that file/function/derivation(?) but I haven't the faintest idea of how to use it.
I found a lot of deprecated examples (stuff that no longer work with generic build trying to override the stdenv.platform.kernelExtraConfig, one that finally worked with that but forced me to set a specific kernel version, someone that pointed me to boot.kernelPatches instead... a 404 wiki page about kernel configuration in nix.. But really not much about manual config)

I'm somewhat new to nix but had no problem whatsoever tweaking other packages or the config in general, partly because I've been doing what nix does with my /opt manually for ages so it feels great to have this automated, but I've really been struggling with the kernel these past few days.
Even this ultimately isn't working well enough for me - nix is trying to build two kernels with both the default config and with the config + kernelPatches' config merged in, and I have no idea why, but since my reason for doing this was that I can't rebuild the default config easily (doesn't fit in my tmpfs /tmp) I'm a bit screwed.

Anyway, I'm just mostly venting out at this point but it's been quite frustrating, these kernel packages could use some documentation love eventually and I'll get back to it .... later.

@Mic92
Copy link
Member

Mic92 commented Apr 9, 2018

The kernel configuration in nixpkgs is a mess...

@martinetd martinetd deleted the kernelConfigAsFile branch June 14, 2022 20:46
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

6 participants