From dd584d8eeb8c76d82cbac50ace0f7a08586a31e9 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 10 Apr 2019 18:38:20 -0400 Subject: [PATCH] stdenv/linux: use isCompatible to find bootstrap tools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids part of the issue where things like armv7a don’t work because the system doesn’t realize it can use the armv7l bootstrap tools. --- pkgs/stdenv/default.nix | 6 ++++++ pkgs/stdenv/linux/default.nix | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index 4313a617f784..1f752f021524 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -43,8 +43,14 @@ in "x86_64-linux" = stagesLinux; "armv5tel-linux" = stagesLinux; "armv6l-linux" = stagesLinux; + "armv6m-linux" = stagesLinux; "armv7a-linux" = stagesLinux; "armv7l-linux" = stagesLinux; + "armv7r-linux" = stagesLinux; + "armv7m-linux" = stagesLinux; + "armv8a-linux" = stagesLinux; + "armv8r-linux" = stagesLinux; + "armv8m-linux" = stagesLinux; "aarch64-linux" = stagesLinux; "mipsel-linux" = stagesLinux; "powerpc-linux" = /* stagesLinux */ stagesNative; diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 457e1671e260..2bccd620436a 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -13,7 +13,6 @@ "x86_64-linux" = import ./bootstrap-files/x86_64.nix; "armv5tel-linux" = import ./bootstrap-files/armv5tel.nix; "armv6l-linux" = import ./bootstrap-files/armv6l.nix; - "armv7a-linux" = import ./bootstrap-files/armv7l.nix; "armv7l-linux" = import ./bootstrap-files/armv7l.nix; "aarch64-linux" = import ./bootstrap-files/aarch64.nix; "mipsel-linux" = import ./bootstrap-files/loongson2f.nix; @@ -26,10 +25,19 @@ "powerpc64le-linux" = import ./bootstrap-files/ppc64le-musl.nix; }; }; + + # Try to find an architecture compatible with our current system. We + # just try every bootstrap we’ve got and test to see if it is + # compatible with or current architecture. + getCompatibleTools = lib.foldl (v: system: + if v != null then v + else if localSystem.isCompatible (lib.systems.elaborate { inherit system; }) then archLookupTable.${system} + else null) null (lib.attrNames archLookupTable); + archLookupTable = table.${localSystem.libc} or (abort "unsupported libc for the pure Linux stdenv"); - files = archLookupTable.${localSystem.system} - or (abort "unsupported platform for the pure Linux stdenv"); + files = archLookupTable.${localSystem.system} or (if getCompatibleTools != null then getCompatibleTools + else (abort "unsupported platform for the pure Linux stdenv")); in files }: