From a0c77aecaaf24a32600b88d05406dfd57e1b8639 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Mon, 14 Aug 2023 01:32:29 -0700 Subject: [PATCH 1/2] 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. --- lib/systems/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 40a2c88f32b8..09024d587c56 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 From a97e8fc272782d69d94053bc434b9b6fef399a7b Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Mon, 14 Aug 2023 01:33:06 -0700 Subject: [PATCH 2/2] make-initrd-ng: use hostPlatform.ubootArch for uinitrdArch This allows make-initrd-ng to pick up the few cases where Linux and u-boot disagree. --- pkgs/build-support/kernel/make-initrd-ng.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/kernel/make-initrd-ng.nix b/pkgs/build-support/kernel/make-initrd-ng.nix index 2418838176ef..f2f7aaa6d1b6 100644 --- a/pkgs/build-support/kernel/make-initrd-ng.nix +++ b/pkgs/build-support/kernel/make-initrd-ng.nix @@ -54,7 +54,7 @@ in # guess may not align with u-boot's nomenclature correctly, so it can # be overridden. # See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106 for a list. -, uInitrdArch ? stdenvNoCC.hostPlatform.linuxArch +, uInitrdArch ? stdenvNoCC.hostPlatform.ubootArch # The name of the compression, as recognised by u-boot. # See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L195-204 for a list.