-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
kernelTarget
attr is ignored in buildKernel
(linux)
#234084
Comments
1. Use `buildKernel` with an override of the `kernelTarget` via `overrideAttrs`
There's no such attribute in the kernel derivation. The only mention of
kernelTarget in Nixpkgs is an attribute of the *kernel config file*. It
deosn't seem to do anything and can probably be removed.
If you want to build a kernel with a custom target, that's a property of
the platform being built for, so you should set linux-kernel.target in
localSystem or crossSystem appropriately when you import Nixpkgs.
|
As far as I can tell this is unused since f95d214. Fixes: f95d214 ("Implement generic kernel build via manual-config") Fixes: NixOS#234084
Right, that's what I meant, it is just declared inline within the definition of If you can confirm it doesn't do anything, I'd send a PR to remove it, as it surely is confusing.
Got it! This is a bit more complicated than I expected as it seems I have rewire how the nixpkgs are used in my setup. My understanding is that I'll have to import a second instance of nixpkgs with a cross-build (even though it's not really a cross-build in a usual sense) and set the target settings on that. This seems like it would work, as long as nixpkgs itself is really pure, and doesn't pollute the global environment. Thank you for the tip! |
Got it! This is a bit more complicated than I expected as it seems I have rewire how the nixpkgs are used in my setup. My understanding is that I'll have to import a second instance of nixpkgs with a cross-build (even though it's not really a cross-build in a usual sense) and set the target settings on that. This seems like it would work, as long as nixpkgs itself is really pure, and doesn't pollute the global environment.
Unless you want to build multiple different kernels with different
targets, you can just override localSystem on the Nixpkgs you're already
importing, avoiding both cross compilation and multiple Nixpkgs instances.
|
Well, I'm currently focusing on just one, but eventually, I want to build two "standalone" kernels - one for the host os and one for the guest os - "standalone" in the sense that they won't be used as part of a nixos installation, but a custom one. So, ultimately I think what would make sense would be to have the "default" nixpkgs import what I use in the |
this
I wish I knew this earlier. Been fucking around with the buildKernel drvs wondering where it sources that stuff from. I didn't |
Describe the bug
kernelTarget
attribute exists in thebuildKernel
derivation code, but it is never used. This is confusing to me as newcomer, and is probably a leftover from an unclean past refactoring.Steps To Reproduce
Steps to reproduce the behavior:
buildKernel
with an override of thekernelTarget
viaoverrideAttrs
Expected behavior
Ethier:
kernelTarget
(i.e. from thebzImage
tovmlinuz
) changes the actual build output tovmlinuz
, orkernelTarget
does not existAdditional context
Ultimately, I need a way to build a kernel via nix but not for a nixos, so I can't understand how to override the
stdenv.hostPlatform.linux-kernel.target
properly without it affecting the rest of the system (i.e. I want to build the nixos kernel to use with my system, and this other kernel for use in my other system that I want a different target on). A similar issue is present atlinuxKernel.manualConfig
(which I actually use now, since I also need a custom config).Notify maintainers
@alyssais, @ncfavier (not sure if you are the right people to ping, sorry if I'm mistaken)
Metadata
This shouldn't really matter, but:
I'm also in a flake currently, but this needs to be portable for other environments...
The text was updated successfully, but these errors were encountered: