git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #22117 from dezgeg/aarch64-for-merge

Aarch64 (ARM64) support

commite2a2f6d595d7df5ddeecbfed830692fd8ee68697 authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi> dateThu 26 Jan 2017, 17:52 (10 years ago) parentbca9bcb32643dc
30 files changed+305−27
lib/platforms.nix+1−1 nixos/modules/installer/cd-dvd/sd-image-aarch64.nix+63 nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix+3−1 nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix+2 pkgs/build-support/cc-wrapper/default.nix+1 pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh+12 pkgs/development/interpreters/spidermonkey/17.nix+2 pkgs/development/interpreters/spidermonkey/aarch64-double-conversion.patch+13 pkgs/development/libraries/glibc/common.nix+1−1 pkgs/development/libraries/gnu-config/default.nix+39 pkgs/development/libraries/gnu-efi/aarch64-fix-discarded-qualifier.patch+13 pkgs/development/libraries/gnu-efi/default.nix+3−1 pkgs/development/libraries/libsigsegv/aarch64.patch+12 pkgs/development/libraries/libsigsegv/default.nix+6 pkgs/development/libraries/libunwind/default.nix+7−2 pkgs/misc/uboot/default.nix+7−1 pkgs/os-specific/linux/busybox/busybox-in-store.patch+9 pkgs/os-specific/linux/firmware/raspberrypi/default.nix+1−1 pkgs/os-specific/linux/fuse/default.nix+6−1 pkgs/os-specific/linux/kernel/common-config.nix+1−1 pkgs/os-specific/linux/kernel/manual-config.nix+1−1 pkgs/stdenv/adapters.nix+1 pkgs/stdenv/default.nix+1 pkgs/stdenv/generic/default.nix+2 pkgs/stdenv/linux/bootstrap-files/aarch64.nix+11 pkgs/stdenv/linux/default.nix+11−4 pkgs/stdenv/linux/make-bootstrap-tools-cross.nix+15−1 pkgs/stdenv/linux/make-bootstrap-tools.nix+3−2 pkgs/top-level/all-packages.nix+8−1 pkgs/top-level/platforms.nix+50−8
lib/platforms.nix+1−1
@@ -15,7 +15,7 @@ rec {
1515 freebsd = ["i686-freebsd" "x86_64-freebsd"];
1616 gnu = linux; /* ++ hurd ++ kfreebsd ++ ... */
1717 illumos = ["x86_64-solaris"];
18− linux = ["i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "mips64el-linux"];
18+ linux = ["i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "mips64el-linux"];
1919 netbsd = ["i686-netbsd" "x86_64-netbsd"];
2020 openbsd = ["i686-openbsd" "x86_64-openbsd"];
2121 unix = linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos;
nixos/modules/installer/cd-dvd/sd-image-aarch64.nixnew file+63
@@ -0,0 +1,63 @@
1+# To build, use:
2+# nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-aarch64.nix -A config.system.build.sdImage
3+{ config, lib, pkgs, ... }:
4+
5+let
6+ extlinux-conf-builder =
7+ import ../../system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix {
8+ inherit pkgs;
9+ };
10+in
11+{
12+ imports = [
13+ ../../profiles/minimal.nix
14+ ../../profiles/installation-device.nix
15+ ./sd-image.nix
16+ ];
17+
18+ assertions = lib.singleton {
19+ assertion = pkgs.stdenv.system == "aarch64-linux";
20+ message = "sd-image-aarch64.nix can be only built natively on Aarch64 / ARM64; " +
21+ "it cannot be cross compiled";
22+ };
23+
24+ # Needed by RPi firmware
25+ nixpkgs.config.allowUnfree = true;
26+
27+ boot.loader.grub.enable = false;
28+ boot.loader.generic-extlinux-compatible.enable = true;
29+
30+ boot.kernelPackages = pkgs.linuxPackages_latest;
31+ boot.kernelParams = ["console=ttyS0,115200n8" "console=tty0"];
32+ boot.consoleLogLevel = 7;
33+
34+ # FIXME: this probably should be in installation-device.nix
35+ users.extraUsers.root.initialHashedPassword = "";
36+
37+ sdImage = {
38+ populateBootCommands = let
39+ # Contains a couple of fixes for booting a Linux kernel, will hopefully appear upstream soon.
40+ patchedUboot = pkgs.ubootRaspberryPi3_64bit.overrideAttrs (oldAttrs: {
41+ src = pkgs.fetchFromGitHub {
42+ owner = "dezgeg";
43+ repo = "u-boot";
44+ rev = "baab53ec244fe44def01948a0f10e67342d401e6";
45+ sha256 = "0r5j2pc42ws3w3im0a9c6bh01czz5kapqrqp0ik9ra823cw73lxr";
46+ };
47+ });
48+
49+ configTxt = pkgs.writeText "config.txt" ''
50+ kernel=u-boot-rpi3.bin
51+ arm_control=0x200
52+ enable_uart=1
53+ '';
54+ in ''
55+ for f in bootcode.bin fixup.dat start.elf; do
56+ cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/$f boot/
57+ done
58+ cp ${patchedUboot}/u-boot.bin boot/u-boot-rpi3.bin
59+ cp ${configTxt} boot/config.txt
60+ ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot
61+ '';
62+ };
63+}
nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix+3−1
@@ -1,3 +1,5 @@
1+# To build, use:
2+# nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix -A config.system.build.sdImage
13{ config, lib, pkgs, ... }:
24
35let
@@ -46,7 +48,7 @@ in
4648 cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/$f boot/
4749 done
4850 cp ${pkgs.ubootRaspberryPi2}/u-boot.bin boot/u-boot-rpi2.bin
49− cp ${pkgs.ubootRaspberryPi3}/u-boot.bin boot/u-boot-rpi3.bin
51+ cp ${pkgs.ubootRaspberryPi3_32bit}/u-boot.bin boot/u-boot-rpi3.bin
5052 cp ${configTxt} boot/config.txt
5153 ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot
5254 '';
nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix+2
@@ -1,3 +1,5 @@
1+# To build, use:
2+# nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix -A config.system.build.sdImage
13{ config, lib, pkgs, ... }:
24
35let
pkgs/build-support/cc-wrapper/default.nix+1
@@ -272,6 +272,7 @@ stdenv.mkDerivation {
272272 if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
273273 # ARM with a wildcard, which can be "" or "-armhf".
274274 if stdenv.isArm then "ld-linux*.so.3" else
275+ if stdenv.system == "aarch64-linux" then "ld-linux-aarch64.so.1" else
275276 if stdenv.system == "powerpc-linux" then "ld.so.1" else
276277 if stdenv.system == "mips64el-linux" then "ld.so.1" else
277278 if stdenv.system == "x86_64-darwin" then "/usr/lib/dyld" else
pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.shnew file+12
@@ -0,0 +1,12 @@
1+preConfigurePhases+=" updateAutotoolsGnuConfigScriptsPhase"
2+
3+updateAutotoolsGnuConfigScriptsPhase() {
4+ if [ -n "$dontUpdateAutotoolsGnuConfigScripts" ]; then return; fi
5+
6+ for script in config.sub config.guess; do
7+ for f in $(find . -name "$script"); do
8+ echo "Updating Autotools / GNU config script to a newer upstream version: $f"
9+ cp -f "@gnu_config@/$script" "$f"
10+ done
11+ done
12+}
pkgs/development/interpreters/spidermonkey/17.nix+2
@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
2020 postPatch = ''
2121 # Fixes an issue with version detection under perl 5.22.x
2222 sed -i 's/(defined\((@TEMPLATE_FILE)\))/\1/' config/milestone.pl
23+ '' + stdenv.lib.optionalString stdenv.isAarch64 ''
24+ patch -p1 -d ../.. < ${./aarch64-double-conversion.patch}
2325 '';
2426
2527 preConfigure = ''
pkgs/development/interpreters/spidermonkey/aarch64-double-conversion.patchnew file+13
@@ -0,0 +1,13 @@
1+diff -ru mozjs17.0.0-orig/mfbt/double-conversion/utils.h mozjs17.0.0/mfbt/double-conversion/utils.h
2+--- mozjs17.0.0-orig/mfbt/double-conversion/utils.h 2013-02-11 17:33:28.000000000 -0500
3++++ mozjs17.0.0/mfbt/double-conversion/utils.h 2016-12-03 20:39:07.915042988 -0500
4+@@ -58,7 +58,8 @@
5+ defined(__mips__) || defined(__powerpc__) || \
6+ defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
7+ defined(__SH4__) || defined(__alpha__) || \
8+- defined(_MIPS_ARCH_MIPS32R2)
9++ defined(_MIPS_ARCH_MIPS32R2) || \
10++ defined(__AARCH64EL__)
11+ #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
12+ #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
13+ #if defined(_WIN32)
pkgs/development/libraries/glibc/common.nix+1−1
@@ -93,7 +93,7 @@ stdenv.mkDerivation ({
9393 "--enable-kernel=2.6.32"
9494 ] ++ lib.optionals (cross != null) [
9595 (if cross.withTLS then "--with-tls" else "--without-tls")
96− (if cross.float == "soft" then "--without-fp" else "--with-fp")
96+ (if cross ? float && cross.float == "soft" then "--without-fp" else "--with-fp")
9797 ] ++ lib.optionals (cross != null
9898 && cross.platform ? kernelMajor
9999 && cross.platform.kernelMajor == "2.6") [
pkgs/development/libraries/gnu-config/default.nixnew file+39
@@ -0,0 +1,39 @@
1+{ stdenv, fetchurl }:
2+
3+let
4+ rev = "6a82322dd05cdc57b4cd9f7effdf1e2fd6f7482b";
5+
6+ # Don't use fetchgit as this is needed during Aarch64 bootstrapping
7+ configGuess = fetchurl {
8+ url = "http://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=${rev}";
9+ sha256 = "1yj9yi94h7z4z6jzickddv64ksz1aq5kj0c7krgzjn8xf8p3avmh";
10+ };
11+ configSub = fetchurl {
12+ url = "http://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=${rev}";
13+ sha256 = "1qsqdpla6icbzskkk7v3zxrpzlpqlc94ny9hyy5wh5lm5rwwfvb7";
14+ };
15+in
16+stdenv.mkDerivation rec {
17+ name = "gnu-config-${version}";
18+ version = "2016-12-31";
19+
20+ buildCommand = ''
21+ mkdir -p $out
22+ cp ${configGuess} $out/config.guess
23+ cp ${configSub} $out/config.sub
24+ '';
25+
26+ meta = with stdenv.lib; {
27+ description = "Attempt to guess a canonical system name";
28+ homepage = http://savannah.gnu.org/projects/config;
29+ license = licenses.gpl3;
30+ # In addition to GPLv3:
31+ # As a special exception to the GNU General Public License, if you
32+ # distribute this file as part of a program that contains a
33+ # configuration script generated by Autoconf, you may include it under
34+ # the same distribution terms that you use for the rest of that
35+ # program.
36+ maintainers = [ maintainers.dezgeg ];
37+ platforms = platforms.all;
38+ };
39+}
pkgs/development/libraries/gnu-efi/aarch64-fix-discarded-qualifier.patchnew file+13
@@ -0,0 +1,13 @@
1+diff -ru gnu-efi-3.0.4-orig/lib/aarch64/initplat.c gnu-efi-3.0.4/lib/aarch64/initplat.c
2+--- gnu-efi-3.0.4-orig/lib/aarch64/initplat.c 2016-03-17 09:53:14.000000000 -0400
3++++ gnu-efi-3.0.4/lib/aarch64/initplat.c 2016-12-03 17:53:57.166575974 -0500
4+@@ -41,7 +41,8 @@
5+
6+ void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n)
7+ {
8+- unsigned char *p = dest, *q = src;
9++ unsigned char *p = dest;
10++ const unsigned char *q = src;
11+
12+ while (n--)
13+ *p++ = *q++;
pkgs/development/libraries/gnu-efi/default.nix+3−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, pciutils }:
1+{ stdenv, fetchurl, pciutils }: with stdenv.lib;
22
33stdenv.mkDerivation rec {
44 name = "gnu-efi-${version}";
@@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
99 sha256 = "1bzq5czw5dxlvpgs9ij2iz7q6krwhja87vc982r6vffcqcl0982i";
1010 };
1111
12+ patches = optional stdenv.isAarch64 ./aarch64-fix-discarded-qualifier.patch;
13+
1214 buildInputs = [ pciutils ];
1315
1416 hardeningDisable = [ "stackprotector" ];
pkgs/development/libraries/libsigsegv/aarch64.patchnew file+12
@@ -0,0 +1,12 @@
1+diff --git a/configure b/configure
2+index 6c4e868..0298e19 100755
3+--- a/configure
4++++ b/configure
5+@@ -14501,6 +14501,7 @@ else
6+
7+ case "$host_cpu" in
8+ a29k | \
9++ aarch64* | \
10+ alpha* | \
11+ arc | \
12+ arm* | strongarm* | xscale* | \
pkgs/development/libraries/libsigsegv/default.nix+6
@@ -8,6 +8,12 @@ stdenv.mkDerivation rec {
88 sha256 = "16hrs8k3nmc7a8jam5j1fpspd6sdpkamskvsdpcw6m29vnis8q44";
99 };
1010
11+ # Based on https://github.com/davidgfnet/buildroot-Os/blob/69fe6065b9dd1cb4dcc0a4b554e42cc2e5bd0d60/package/libsigsegv/libsigsegv-0002-fix-aarch64-build.patch
12+ # but applied directly to configure since we can't use autoreconf while bootstrapping.
13+ patches = if stdenv.isAarch64 || stdenv.cross.arch or "" == "aarch64"
14+ then [ ./aarch64.patch ]
15+ else null; # TODO: change to lib.optional on next mass rebuild
16+
1117 # https://github.com/NixOS/nixpkgs/issues/6028
1218 doCheck = false;
1319
pkgs/development/libraries/libunwind/default.nix+7−2
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, fetchpatch, xz }:
1+{ stdenv, fetchurl, fetchpatch, autoreconfHook, xz }:
22
33stdenv.mkDerivation rec {
44 name = "libunwind-1.1";
@@ -8,13 +8,18 @@ stdenv.mkDerivation rec {
88 sha256 = "16nhx2pahh9d62mvszc88q226q5lwjankij276fxwrm8wb50zzlx";
99 };
1010
11+ buildInputs = stdenv.lib.optional stdenv.isAarch64 autoreconfHook;
12+
1113 patches = [ ./libunwind-1.1-lzma.patch ./cve-2015-3239.patch
1214 # https://lists.nongnu.org/archive/html/libunwind-devel/2014-04/msg00000.html
1315 (fetchpatch {
1416 url = "https://raw.githubusercontent.com/dropbox/pyston/1b2e676417b0f5f17526ece0ed840aa88c744145/libunwind_patches/0001-Change-the-RBP-validation-heuristic-to-allow-size-0-.patch";
1517 sha256 = "1a0fsgfxmgd218nscswx7pgyb7rcn2gh6566252xhfvzhgn5i4ha";
1618 })
17− ];
19+ ] ++ stdenv.lib.optional stdenv.isAarch64 (fetchpatch {
20+ url = "https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/77709d1c6d5c39e23c1535b1bd584be1455f2551/extra/libunwind/libunwind-aarch64.patch";
21+ sha256 = "1mpjs8izq9wxiaf5rl4gzaxrkz0s51f9qz5qc5dj72pr84mw50w8";
22+ });
1823
1924 postPatch = ''
2025 sed -i -e '/LIBLZMA/s:-lzma:-llzma:' configure
pkgs/misc/uboot/default.nix+7−1
@@ -100,12 +100,18 @@ in rec {
100100 filesToInstall = ["u-boot.bin"];
101101 };
102102
103− ubootRaspberryPi3 = buildUBoot rec {
103+ ubootRaspberryPi3_32bit = buildUBoot rec {
104104 defconfig = "rpi_3_32b_defconfig";
105105 targetPlatforms = ["armv7l-linux"];
106106 filesToInstall = ["u-boot.bin"];
107107 };
108108
109+ ubootRaspberryPi3_64bit = buildUBoot rec {
110+ defconfig = "rpi_3_defconfig";
111+ targetPlatforms = ["aarch64-linux"];
112+ filesToInstall = ["u-boot.bin"];
113+ };
114+
109115 ubootWandboard = buildUBoot rec {
110116 defconfig = "wandboard_defconfig";
111117 targetPlatforms = ["armv7l-linux"];
pkgs/os-specific/linux/busybox/busybox-in-store.patch+9
@@ -12,3 +12,12 @@ stdenv bootstrap.
1212 exit(busybox_main(argv));
1313 # endif
1414 # if NUM_APPLETS > 0
15+@@ -981,7 +981,7 @@ int main(int argc UNUSED_PARAM, char **argv)
16+
17+ lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv));
18+ # if !ENABLE_BUSYBOX
19+- if (argv[1] && is_prefixed_with(bb_basename(argv[0]), "busybox"))
20++ if (argv[1] && strstr(bb_basename(argv[0]), "busybox") != 0)
21+ argv++;
22+ # endif
23+ applet_name = argv[0];
pkgs/os-specific/linux/firmware/raspberrypi/default.nix+1−1
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
3131 description = "Firmware for the Raspberry Pi board";
3232 homepage = https://github.com/raspberrypi;
3333 license = licenses.unfree;
34− platforms = [ "armv6l-linux" "armv7l-linux" ];
34+ platforms = [ "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
3535 maintainers = with maintainers; [ viric tavyc ];
3636 };
3737}
pkgs/os-specific/linux/fuse/default.nix+6−1
@@ -1,4 +1,4 @@
1−{ stdenv, fetchFromGitHub, utillinux
1+{ stdenv, fetchFromGitHub, fetchpatch, utillinux
22, autoconf, automake, libtool, gettext }:
33
44stdenv.mkDerivation rec {
@@ -14,6 +14,11 @@ stdenv.mkDerivation rec {
1414
1515 buildInputs = [ utillinux autoconf automake libtool gettext ];
1616
17+ patches = stdenv.lib.optional stdenv.isAarch64 (fetchpatch {
18+ url = "https://github.com/libfuse/libfuse/commit/914871b20a901e3e1e981c92bc42b1c93b7ab81b.patch";
19+ sha256 = "1w4j6f1awjrycycpvmlv0x5v9gprllh4dnbjxl4dyl2jgbkaw6pa";
20+ });
21+
1722 preConfigure =
1823 ''
1924 export MOUNT_FUSE_PATH=$out/sbin
pkgs/os-specific/linux/kernel/common-config.nix+1−1
@@ -45,7 +45,7 @@ with stdenv.lib;
4545
4646 # Bump the maximum number of CPUs to support systems like EC2 x1.*
4747 # instances and Xeon Phi.
48− ${optionalString (stdenv.system == "x86_64-linux") ''
48+ ${optionalString (stdenv.system == "x86_64-linux" || stdenv.system == "aarch64-linux") ''
4949 NR_CPUS 384
5050 ''}
5151
pkgs/os-specific/linux/kernel/manual-config.nix+1−1
@@ -120,7 +120,7 @@ let
120120
121121 # Some image types need special install targets (e.g. uImage is installed with make uinstall)
122122 installTargets = [ (if platform.kernelTarget == "uImage" then "uinstall" else
123− if platform.kernelTarget == "zImage" then "zinstall" else
123+ if platform.kernelTarget == "zImage" || platform.kernelTarget == "Image.gz" then "zinstall" else
124124 "install") ];
125125
126126 postInstall = ''
pkgs/stdenv/adapters.nix+1
@@ -92,6 +92,7 @@ rec {
9292 # without proper `file` command, libtool sometimes fails
9393 # to recognize 64-bit DLLs
9494 ++ stdenv.lib.optional (cross.config == "x86_64-w64-mingw32") pkgs.file
95+ ++ stdenv.lib.optional (cross.config == "aarch64-linux-gnu") pkgs.updateAutotoolsGnuConfigScriptsHook
9596 ;
9697
9798 # Cross-linking dynamic libraries, every buildInput should
pkgs/stdenv/default.nix+1
@@ -44,6 +44,7 @@ in
4444 "armv5tel-linux" = stagesLinux;
4545 "armv6l-linux" = stagesLinux;
4646 "armv7l-linux" = stagesLinux;
47+ "aarch64-linux" = stagesLinux;
4748 "mips64el-linux" = stagesLinux;
4849 "powerpc-linux" = /* stagesLinux */ stagesNative;
4950 "x86_64-darwin" = stagesDarwin;
pkgs/stdenv/generic/default.nix+2
@@ -311,6 +311,7 @@ let
311311 || system == "armv5tel-linux"
312312 || system == "armv6l-linux"
313313 || system == "armv7l-linux"
314+ || system == "aarch64-linux"
314315 || system == "mips64el-linux";
315316 isGNU = system == "i686-gnu"; # GNU/Hurd
316317 isGlibc = isGNU # useful for `stdenvNative'
@@ -348,6 +349,7 @@ let
348349 isArm = system == "armv5tel-linux"
349350 || system == "armv6l-linux"
350351 || system == "armv7l-linux";
352+ isAarch64 = system == "aarch64-linux";
351353 isBigEndian = system == "powerpc-linux";
352354
353355 # Whether we should run paxctl to pax-mark binaries.
pkgs/stdenv/linux/bootstrap-files/aarch64.nixnew file+11
@@ -0,0 +1,11 @@
1+{
2+ busybox = import <nix/fetchurl.nix> {
3+ url = http://nixos-arm.dezgeg.me/bootstrap-aarch64-for-merge/busybox;
4+ sha256 = "12qcml1l67skpjhfjwy7gr10nc86gqcwjmz9ggp7knss8gq8pv7f";
5+ executable = true;
6+ };
7+ bootstrapTools = import <nix/fetchurl.nix> {
8+ url = http://nixos-arm.dezgeg.me/bootstrap-aarch64-for-merge/bootstrap-tools.tar.xz;
9+ sha256 = "10sqgh0dchp1906h06jznxh8gfflnzbpfy27hng2mmc1l0c7irjr";
10+ };
11+}
pkgs/stdenv/linux/default.nix+11−4
@@ -12,6 +12,7 @@
1212 "armv5tel-linux" = import ./bootstrap-files/armv5tel.nix;
1313 "armv6l-linux" = import ./bootstrap-files/armv6l.nix;
1414 "armv7l-linux" = import ./bootstrap-files/armv7l.nix;
15+ "aarch64-linux" = import ./bootstrap-files/aarch64.nix;
1516 "mips64el-linux" = import ./bootstrap-files/loongson2f.nix;
1617 }.${localSystem.system}
1718 or (abort "unsupported platform for the pure Linux stdenv")
@@ -213,7 +214,9 @@ in
213214 isl = isl_0_14;
214215 };
215216 };
216− extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ];
217+ extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
218+ # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
219+ lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
217220 })
218221
219222
@@ -240,7 +243,9 @@ in
240243 shell = self.bash + "/bin/bash";
241244 };
242245 };
243− extraBuildInputs = [ prevStage.patchelf prevStage.xz ];
246+ extraBuildInputs = [ prevStage.patchelf prevStage.xz ] ++
247+ # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
248+ lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
244249 })
245250
246251 # Construct the final stdenv. It uses the Glibc and GCC, and adds
@@ -268,7 +273,9 @@ in
268273 initialPath =
269274 ((import ../common-path.nix) {pkgs = prevStage;});
270275
271− extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ];
276+ extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
277+ # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
278+ lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
272279
273280 cc = prevStage.gcc;
274281
@@ -287,7 +294,7 @@ in
287294 [ gzip bzip2 xz bash binutils coreutils diffutils findutils gawk
288295 glibc gnumake gnused gnutar gnugrep gnupatch patchelf attr acl
289296 paxctl zlib pcre linuxHeaders ed gcc gcc.cc libsigsegv
290− ];
297+ ] ++ lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
291298 */
292299
293300 overrides = self: super: {
pkgs/stdenv/linux/make-bootstrap-tools-cross.nix+15−1
@@ -50,10 +50,23 @@ let
5050 };
5151 };
5252
53+ aarch64-multiplatform-crossSystem = {
54+ crossSystem = rec {
55+ config = "aarch64-linux-gnu";
56+ bigEndian = false;
57+ arch = "aarch64";
58+ withTLS = true;
59+ libc = "glibc";
60+ platform = pkgsNoParams.platforms.aarch64-multiplatform;
61+ inherit (platform) gcc;
62+ };
63+ };
64+
5365 selectedCrossSystem =
5466 if toolsArch == "armv5tel" then sheevaplugCrossSystem else
5567 if toolsArch == "armv6l" then raspberrypiCrossSystem else
56− if toolsArch == "armv7l" then armv7l-hf-multiplatform-crossSystem else null;
68+ if toolsArch == "armv7l" then armv7l-hf-multiplatform-crossSystem else
69+ if toolsArch == "aarch64" then aarch64-multiplatform-crossSystem else null;
5770
5871 pkgs = pkgsFun ({inherit system;} // selectedCrossSystem);
5972
@@ -264,4 +277,5 @@ rec {
264277 armv5tel = buildFor "armv5tel";
265278 armv6l = buildFor "armv6l";
266279 armv7l = buildFor "armv7l";
280+ aarch64 = buildFor "aarch64";
267281}
pkgs/stdenv/linux/make-bootstrap-tools.nix+3−2
@@ -170,8 +170,9 @@ rec {
170170 };
171171
172172 bootstrapFiles = {
173− busybox = "${build}/on-server/busybox";
174− bootstrapTools = "${build}/on-server/bootstrap-tools.tar.xz";
173+ # Make them their own store paths to test that busybox still works when the binary is named /nix/store/HASH-busybox
174+ busybox = runCommand "busybox" {} "cp ${build}/on-server/busybox $out";
175+ bootstrapTools = runCommand "bootstrap-tools.tar.xz" {} "cp ${build}/on-server/bootstrap-tools.tar.xz $out";
175176 };
176177
177178 bootstrapTools = import ./bootstrap-tools { inherit system bootstrapFiles; };
pkgs/top-level/all-packages.nix+8−1
@@ -79,6 +79,10 @@ with pkgs;
7979 }
8080 '');
8181
82+ updateAutotoolsGnuConfigScriptsHook = makeSetupHook
83+ { substitutions = { gnu_config = gnu-config;}; }
84+ ../build-support/setup-hooks/update-autotools-gnu-config-scripts.sh;
85+
8286 buildEnv = callPackage ../build-support/buildenv { }; # not actually a package
8387
8488 buildFHSUserEnv = callPackage ../build-support/build-fhs-userenv { };
@@ -7459,6 +7463,8 @@ with pkgs;
74597463
74607464 gnet = callPackage ../development/libraries/gnet { };
74617465
7466+ gnu-config = callPackage ../development/libraries/gnu-config { };
7467+
74627468 gnu-efi = callPackage ../development/libraries/gnu-efi { };
74637469
74647470 gnutls = gnutls34;
@@ -11799,7 +11805,8 @@ with pkgs;
1179911805 ubootPcduino3Nano
1180011806 ubootRaspberryPi
1180111807 ubootRaspberryPi2
11802− ubootRaspberryPi3
11808+ ubootRaspberryPi3_32bit
11809+ ubootRaspberryPi3_64bit
1180311810 ubootWandboard
1180411811 ;
1180511812
pkgs/top-level/platforms.nix+50−8
@@ -443,12 +443,54 @@ rec {
443443 };
444444 };
445445
446− selectPlatformBySystem = system:
447− if system == "armv6l-linux" then raspberrypi
448− else if system == "armv7l-linux" then armv7l-hf-multiplatform
449− else if system == "armv5tel-linux" then sheevaplug
450− else if system == "mips64el-linux" then fuloong2f_n32
451− else if system == "x86_64-linux" then pc64
452− else if system == "i686-linux" then pc32
453− else pcBase;
446+ aarch64-multiplatform = {
447+ name = "aarch64-multiplatform";
448+ kernelMajor = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc.
449+ kernelHeadersBaseConfig = "defconfig";
450+ kernelBaseConfig = "defconfig";
451+ kernelArch = "arm64";
452+ kernelDTB = true;
453+ kernelAutoModules = false;
454+ kernelExtraConfig = ''
455+ # Raspberry Pi 3 stuff. Not needed for kernels >= 4.10.
456+ ARCH_BCM2835 y
457+ BCM2835_MBOX y
458+ BCM2835_WDT y
459+ BRCMFMAC m
460+ DMA_BCM2835 m
461+ DRM_VC4 m
462+ I2C_BCM2835 m
463+ PWM_BCM2835 m
464+ RASPBERRYPI_FIRMWARE y
465+ RASPBERRYPI_POWER y
466+ SERIAL_8250_BCM2835AUX y
467+ SERIAL_8250_EXTENDED y
468+ SERIAL_8250_SHARE_IRQ y
469+ SND_BCM2835_SOC_I2S m
470+ SPI_BCM2835AUX m
471+ SPI_BCM2835 m
472+
473+ # Cavium ThunderX stuff.
474+ PCI_HOST_THUNDER_ECAM y
475+ THUNDER_NIC_RGX y
476+ THUNDER_NIC_BGX y
477+ THUNDER_NIC_PF y
478+ THUNDER_NIC_VF y
479+ '';
480+ uboot = null;
481+ kernelTarget = "Image";
482+ gcc = {
483+ arch = "armv8-a";
484+ };
485+ };
486+
487+ selectPlatformBySystem = system: {
488+ "i686-linux" = pc32;
489+ "x86_64-linux" = pc64;
490+ "armv5tel-linux" = sheevaplug;
491+ "armv6l-linux" = raspberrypi;
492+ "armv7l-linux" = armv7l-hf-multiplatform;
493+ "aarch64-linux" = aarch64-multiplatform;
494+ "mips64el-linux" = fuloong2f_n32;
495+ }.${system} or pcBase;
454496}