summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-08-14 01:32:29 -0700
committerAdam Joseph <adam@westernsemico.com>2023-08-14 01:34:07 -0700
commita0c77aecaaf24a32600b88d05406dfd57e1b8639 (patch)
treed2b9e26bb2794b61d34d1868b2d06e172fcaeb9f /lib
parentf4c11b80885cbb150f98056d68c813179ca0d31b (diff)
downloadnixpkgs-a0c77aecaaf24a32600b88d05406dfd57e1b8639.tar
nixpkgs-a0c77aecaaf24a32600b88d05406dfd57e1b8639.tar.gz
nixpkgs-a0c77aecaaf24a32600b88d05406dfd57e1b8639.tar.bz2
nixpkgs-a0c77aecaaf24a32600b88d05406dfd57e1b8639.tar.lz
nixpkgs-a0c77aecaaf24a32600b88d05406dfd57e1b8639.tar.xz
nixpkgs-a0c77aecaaf24a32600b88d05406dfd57e1b8639.tar.zst
nixpkgs-a0c77aecaaf24a32600b88d05406dfd57e1b8639.zip
lib.systems: add ubootArch
u-boot has its own rosetta stone, almost but not exactly the same as
the Linux kernel's.  This commit adds it and the two cases where it
diverges.
Diffstat (limited to 'lib')
-rw-r--r--lib/systems/default.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index 40a2c88f32b..09024d587c5 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -178,6 +178,12 @@ rec {
         else if final.isLoongArch64 then "loongarch"
         else final.parsed.cpu.name;
 
+      # https://source.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106
+      ubootArch =
+        if      final.isx86_32 then "x86"    # not i386
+        else if final.isMips64 then "mips64" # uboot *does* distinguish between mips32/mips64
+        else final.linuxArch;                # other cases appear to agree with linuxArch
+
       qemuArch =
         if final.isAarch32 then "arm"
         else if final.isS390 && !final.isS390x then null