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

[tracking] aarch64 build on Packet Type 2A #31606

Closed
vielmetti opened this issue Nov 13, 2017 · 14 comments
Closed

[tracking] aarch64 build on Packet Type 2A #31606

vielmetti opened this issue Nov 13, 2017 · 14 comments

Comments

@vielmetti
Copy link

vielmetti commented Nov 13, 2017

Issue description

A tracking issue to work on a release of NixOS to the Packet "Type 2A" Cavium ThunderX servers.

Steps to reproduce

Log in to Packet, http://packet.net . Try to provision a Type 2A server with NixOS, notice that NixOS is missing as an operating system choice.

Technical details

See also

Packet Community Slack #worksonarm channel

The issue on the Packet Trello board is https://trello.com/c/Rv5YQb7T/127-support-nixos-on-armv8

@dezgeg
Copy link
Contributor

dezgeg commented Nov 13, 2017

As for image building, here's my recollection of what needs to be done:

  • Figure out how to run KVM virtual machines on those servers
  • Figure out whether to use make-disk-image.nix or my sd-image.nix image building infra
    • make-disk-image.nix (I expect this is the better solution):
      • depends on KVM
      • also depends on lkl which has bunch of arch-specific stuff
      • can already build images that do legacy booting with GRUB on x86, presumably easy to convert to EFI grub
    • sd-image.nix
      • doesn't need KVM
      • doesn't do GRUB (currently)
      • grub-install (even for EFI) might not like being run without root
      • the GRUB config generator probably doesn't like being run in Nix builder context without major surgery
        - in theory could just hand-write an initial grub.cfg, but sounds like maintenance disaster
  • Figure out what options to make the GRUB output its menu over the serial console for recovering (IIRC it didn't with what NixOS currently writes to grub.cfg)

@copumpkin
Copy link
Member

copumpkin commented Nov 14, 2017

We could probably kill the KVM dependency in make-disk-image.nix with a bit more effort. I think the OpenWRT project figured out how to convince grub to install to an image, and if necessary we could also submit a patch upstream. See here and here.

@copumpkin
Copy link
Member

grub-install (even for EFI) might not like being run without root

TBC, grub-install is the only reason make-disk-image uses KVM. It's the only thing I wasn't able to do in a pure builder.

@dezgeg
Copy link
Contributor

dezgeg commented Nov 14, 2017

Note that I expect EFI GRUB installation to be easier as non-root than legacy GRUB installation, given how much 'simpler' it is. There you just write the files to a filesystem and you are done. In legacy mode, you write some stuff to the MBR, some raw sectors to the unpartitioned space between the MBR and the first filesystem, then some files to the filesystem again... with all those three parts somehow co-operating, which sounds like it would require determining whether the /boot filesystem is on the same device that you run grub-install on...

With that said, wow https://dev.openwrt.org/browser/trunk/target/linux/x86/image/Makefile?rev=49407#L69 indeed does look promising.

@bjornfor
Copy link
Contributor

Another alternative is genimage. Buildroot uses it to create MBR and EFI bookable disk images. No root or VM needed.

@dezgeg
Copy link
Contributor

dezgeg commented Nov 20, 2017

Hmm, crap. LKL gives:

make: Entering directory '/tmp/nix-build-lkl-2017-08-09.drv-0/linux-083cdeece0577635d523244dcf0da86074e23e4e-src/tools/lkl'
Makefile:82: *** Unrecognized platform: elf64-littleaarch64.  Stop.

Edit: Ignore that, I tried to build and old lkl as I failed to upgrade nixpkgs. Latest LKL builds fine.

@grahamc
Copy link
Member

grahamc commented Nov 26, 2017

PR here incorporates some netboot patches I've had kicking around: #32031

After that PR merges, we should recycle the branch for further testing, as https://hydra.nixos.org/jobset/nixos/unstable-aarch64 is setup already.

@dezgeg
Copy link
Contributor

dezgeg commented Dec 6, 2017

It's somehow related to the GIC virtualization options that need to be set on that hardware: https://bugzilla.redhat.com/show_bug.cgi?id=1375571.

@dezgeg
Copy link
Contributor

dezgeg commented Dec 6, 2017

Yep. And with gic-version=host it also works on machines with GICv2 (such as the Jetson TX1). I wonder who decided the default value for that option... Anyway, done in b2e315f

dezgeg pushed a commit that referenced this issue Dec 19, 2017
 * $out/bin/qemu-kvm should point to qemu-system-aarch64 on aarch64, libvirt expect it
 * makeWrapper codes are separated as some architectures might require additional command flags (#31606 (comment))
 * x86_64-on-i686 is not a native emulation and not supported by KVM, so it is removed from the list
@dezgeg dezgeg mentioned this issue Jan 11, 2018
5 tasks
@grahamc
Copy link
Member

grahamc commented Jul 24, 2019

Long done =)

@grahamc grahamc closed this as completed Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@copumpkin @vielmetti @grahamc @bjornfor @dezgeg and others