[Nix-dev] Trying to build L4Linux kernel on NixOS: how to cross-compile?
Mateusz Czaplinski
czapkofan at gmail.com
Mon Apr 3 21:13:36 CEST 2017
I'm testing my luck trying to get L4Linux kernel running on NixOS. I tried
to get the L4Linux kernel to build (it uses the regular kernel
infrastructure) with an expression like below (full contents at:
https://github.com/akavel/l4.nix/blob/9fb900a88619eb4830710e531cd3f076d74b584d/l4linux.nix
):
[...]
kernel =
pkgs.callPackage "${nixpkgs}/pkgs/os-specific/linux/kernel/generic.nix"
(rec {
version = "4.7.0-l4-2016082114"; # TODO(akavel): ok or not?
modDirVersion = "4.7.0-l4"; # see: nixpkgs issue #17801 and
linux-mptcp.nix
src = l4re;
kernelPatches = [];
});
in
kernel
But then I found out [1], that this actually builds a *vanilla* (non-L4)
kernel, because of nonempty argument ARCH passed to make by
<nixpkgs>/.../kernel/generic.nix. To fix this, I believe I need to use the
cross-compilation infrastructure of Nix, so that generic.nix would see
stdenv.cross.platform.kernelArch == "l4", and thus pass it as ARCH="l4" to
make. Now, based on some rudimentary info in The Nixpkgs Manual + linked
wiki, I tried changing the final line to read "kernel.crossDrv", then
putting various variants of:
crossSystem = { platform = { kernelArch = "l4"; }; };
in various places (including the {} just after `import <nixpkgs>`, or the
{} just after pkgs.callPackage), also supplemented with more fields stolen
from <nixpkgs>/.../platforms.nix's pcBase or from some random snippets
found on The Internets. But whatever I tried to do, nix-build always seemed
to reject my courting with a blunt:
error: attribute `crossDrv' missing, at <path>/l4linux.nix:<line>:<column>
What should I do to make it happy?
Also, as a somewhat related question: what exactly triggers appearance of a
.crossDrv attribute in a derivation? (Is there some place in nixpkgs where
I can find the code for that?)
Thanks & Best Regards,
/Mateusz.
[1]: http://os.inf.tu-dresden.de/pipermail/l4-hackers/2017/007995.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170403/be81b7f1/attachment.html>
More information about the nix-dev
mailing list