Trying to build L4 on NixOS

Adam Lackorzynski adam at os.inf.tu-dresden.de
Sun Mar 26 23:51:16 CEST 2017


Hi,

good that you figured all out yourself. Just comments.

On Sat Mar 25, 2017 at 00:12:31 +0100, Mateusz Czaplinski wrote:
> Hm; tried adding the following line:
> 
>   hardeningDisable = [ "stackprotector" "pic" ];
> 
> per https://github.com/NixOS/nixpkgs/issues/18895 and
> https://github.com/NixOS/nixpkgs/issues/18995. This now seems to get me
> through the bootstrap.elf linking phase! But it fails soon afterwards on
> bootstrap32.elf :-( with:
> 
>   ld: skipping incompatible
> /nix/store/...-gcc-5.4.0/lib/gcc/x86_64-unknown-linux-gnu/5.4.0/libgcc.a
> when searching for -lgcc
>   ld: cannot find -lgcc
> 
> Can I skip building bootstrap32.elf somehow? Or should I not?

For booting, you'll need a bit of 32bit code, thus the multilib parts
are indeed required.

> Do I even have to build l4, or do I only need fiasco for l4linux? (fiasco
> seems to build OK with the initial hardeningDisable = [ "all" ]; I tried.)
> Or none at all, just the sources?

You need to build l4 for L4Linux as L4Linux also requires L4Re.


Adam

> On Fri, Mar 24, 2017 at 10:06 PM, Mateusz Czaplinski <czapkofan at gmail.com>
> wrote:
> 
> > I'm trying to build L4 on NixOS in a VM (long term goal: try to learn how
> > to replace NixOS's kernel with L4Linux, then maybe Genode). I'm getting an
> > error like below:
> >
> >   undefined reference to `__stack_chk_fail'
> >
> > during linking of bootstrap.elf - in a GCC's error-barf just after:
> >
> >   [bootstrap] ==> Linking bootstrap.elf
> >
> > I've put up the precise Nix expression/script I'm using to build it on
> > github - at:
> >   https://github.com/akavel/l4.nix/blob/0108dfcf8d84780e1ba884c41ece0d
> > 2dbf4ddd84/l4re.nix
> > but what it generally boils down to is a sequence of commands like this:
> >
> >   $ wget http://os.inf.tu-dresden.de/download/snapshots/l4re-core-
> > 2016082114.tar.xz
> >   $ tar xf l4re-core-2016082114 <(201)%20608-2114>.tar.xz
> >   $ cd l4re-core-2016082114 <(201)%20608-2114>
> >   $ mkdir out
> >   $ cp src/l4/mk/defconfig/config.amd64 out/l4/.kconfig
> >   $ make -C src/l4 O=out/l4 olddefconfig
> >   $ make -C out/l4
> >
> > I've tried various additional changes, based on some snippets found here
> > and there on teh Internets, like:
> >   - adding V=0 to the last make (no idea what it does yet, just some cargo
> > culting)
> >   - adding NIX_CFLAGS_COMPILE = "-fno-stack-protector"; to the Nix
> > expression/script (also not really sure where it applies in the stack);
> > but none of the above helped.
> >
> > Any idea what I could try doing to push it further?
> >
> > Thanks,
> > /Mateusz.




More information about the l4-hackers mailing list