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

Aarch64 (ARM64) support #22117

Merged
merged 19 commits into from Jan 26, 2017
Merged

Aarch64 (ARM64) support #22117

merged 19 commits into from Jan 26, 2017

Conversation

dezgeg
Copy link
Contributor

@dezgeg dezgeg commented Jan 24, 2017

This series adds support for the Aarch64 architecture, which is the 64-bit variant of ARM. I have tested this on a HiKey, Raspberry Pi 3 and some Cavium ThunderX server hardware. For RPi3, an expression for building an SD card image using U-Boot is provided (which should work out-of-the-box). For the rest, UEFI + GRUB is used, which still needs some more work to make GRUB work properly in a serial-only environment.

Most of the changes are quite straightforward except for one change to stdenv. This is needed because a lot of packages using tarballs containing autotools-generated stuff are built with obsolete versions of autotools and don't recognize aarch64. Fortunately, this is easy to work around by looking for files named config.sub and config.guess and replacing them with new versions. I have added a stdenv hook for that (updateAutotoolsGnuConfigScriptsHook), only enabled for aarch64. The current way of enabling that is slightly ugly, any suggestions on doing that in a cleaner way are welcome.

Thanks to @edef1c for testing and some of the patches here, and @grahamc for providing me access for the Cavium ThunderX box.

dezgeg and others added 15 commits January 24, 2017 22:13
Looks generally nicer and used recently in nixpkgs in e.g.
3e197f7 ("top-level: Normalize stdenv booting")
Because if we define it, then gcc compilation fails because it doesn't
support --with-float for aarch64.
This is required for Aarch64 since a lot of source tarballs ship with
outdated configure scripts that don't recognize aarch64. Simply
replacing the config.guess and config.sub with new versions from
upstream makes them build again.

This same approach is used by at least Buildroot and Fedora. In
principle this could be enabled for all architectures but
conditionalizing this on aarch64 avoids a mass rebuild on x86.
Our bootstrap tools are actually broken right now due to busybox not
working when invoked directly from a store path. (It says e.g.
"0qqqw19y4gmknajw8vg4fvhx9gxdqlhz-busybox: applet not found").
Make this test actually fail in such case, the next commit will fix the
problem with busybox.
This fixes the usage for stdenv bootstrap.

Additionally, dezgeg ported the patch from 1.25.1 to 1.26.1
These are temporary and will be switched to Hydra-build ones once all
the aarch4 changs are merged.
[dezgeg: note that we are currently using just 'Image' instead of
'Image.gz' as U-Boot doesn't support the latter yet. We might switch
once it does since the kernel images are quite big]
So that the boot blobs can be copied.

FIXME: This makes the dynamic linker of the ARM binaries point to a
aarch64 linker.
@mention-bot
Copy link

@dezgeg, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Phreedom, @edolstra and @Ericson2314 to be potential reviewers.

@edef1c
Copy link
Member

edef1c commented Jan 24, 2017

@dezgeg Cavium ThunderX, the Octeons are MIPS64.

This makes Raspberry Pi 3 and some Cavium ThunderX server hardware work.
And rename the old ubootRaspberryPi3 to ubootRaspberryPi3_32bit.
This one works on the Raspberry Pi 3 so far.
@dezgeg
Copy link
Contributor Author

dezgeg commented Jan 25, 2017

D'oh! Fixed...

Copy link
Contributor

@teh teh left a comment

Choose a reason for hiding this comment

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

This looks good to me though I'm not sure how to test without docs for how to build an image :)

assertions = lib.singleton {
assertion = pkgs.stdenv.system == "aarch64-linux";
message = "sd-image-aarch64.nix can be only built natively on Aarch64 / ARM64; " +
"it cannot be cross compiled";
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to have some instructions somewhere (here, or in the manual) for how to go about creating an image.

selectPlatformBySystem = system: {
"i686-linux" = pc32;
"x86_64-linux" = pc64;
"armv5tel-linux" = sheevaplug;
Copy link
Contributor

Choose a reason for hiding this comment

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

nice cleanup! (not actionable)

@dezgeg
Copy link
Contributor Author

dezgeg commented Jan 25, 2017

Documented now.

@Ericson2314
Copy link
Member

This is great! Can you look at pkgs/top-level/release-cross.nix and add some tests there? I am overhauling cross-compilation, and I'd love to have some more tests / tests that aren't ancient!

@dezgeg
Copy link
Contributor Author

dezgeg commented Jan 25, 2017

I think the code I added there some time ago will automatically pick up the bootstrap tools job (similar to http://hydra.nixos.org/build/46896671).

@Ericson2314
Copy link
Member

@dezgeg ah, that's right you did do that. Then it would just be a matter of those other per-pkg jobs, but sure the bootstrap job may subsume them.

@fpletz fpletz added this to the 17.03 milestone Jan 25, 2017
@dezgeg dezgeg mentioned this pull request Jan 25, 2017
@dezgeg dezgeg merged commit e2a2f6d into NixOS:master Jan 26, 2017
@vcunat
Copy link
Member

vcunat commented Sep 7, 2017

Perhaps I missed this information: is there interest in having aarch64 support in 17.09? (i.e. binaries + CI on Hydra) Currently the jobset is only for x86_64-linux, as we dropped i686-linux. /cc @globin, @fpletz.

I believe it wouldn't put additional significant strain on the build farm, as large rebuilds aren't frequent on stable branches, and aarch64-linux tend lately not to be the most over-queued platform on Hydra anyway. On the other hand, if there was no interest, it would be probably useless...

@dezgeg
Copy link
Contributor Author

dezgeg commented Sep 7, 2017

I wouldn't do it just yet given that it's a thousand or so Hydra jobs to fix. And it's easier to see what's specifically broken for aarch64 once the ZHF for 17.09 is done.

@vcunat
Copy link
Member

vcunat commented Sep 7, 2017

Right, better postpone that after ZHF #28643. I don't think we need to promise "zero failures" on all platforms, though the errors might be annoying if they are too many inside the same jobset.

EDIT: to be clear, I don't expect to use aarch64 soon myself. (I only plan some 32-bit ARM.)

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

Successfully merging this pull request may close these issues.

None yet

7 participants