about summary refs log tree commit diff
path: root/pkgs/misc
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2023-11-04 11:21:51 +0300
committerK900 <me@0upti.me>2023-11-04 11:21:51 +0300
commit1d7a287b1763a672e4a77935edc741284abf2c7d (patch)
tree405b0148a3e34e0fd1c7703d26b30e1c74ee0056 /pkgs/misc
parentc423f8f656196f9b955f506ce91199e24b180bfa (diff)
ubootTools: fix cross properly this time
When we're building a ubootTools, we want to produce a set of tools that runs
on the host, so we want their dependencies to be built for hostPlatform.

When we're building an uboot, the tools will run on the builder as part
of the build, so we want their dependencies to be built for buildPlatform.
Diffstat (limited to 'pkgs/misc')
-rw-r--r--pkgs/misc/uboot/default.nix25
1 files changed, 16 insertions, 9 deletions
diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix
index 1569528313469..79e8fb53bcb61 100644
--- a/pkgs/misc/uboot/default.nix
+++ b/pkgs/misc/uboot/default.nix
@@ -30,6 +30,16 @@ let
     url = "https://ftp.denx.de/pub/u-boot/u-boot-${defaultVersion}.tar.bz2";
     hash = "sha256-a2pIWBwUq7D5W9h8GvTXQJIkBte4AQAqn5Ryf93gIdU=";
   };
+
+  # Dependencies for the tools need to be included as either native or cross,
+  # depending on which we're building
+  toolsDeps = [
+    ncurses # tools/kwboot
+    libuuid # tools/mkeficapsule
+    gnutls # tools/mkeficapsule
+    openssl # tools/mkimage
+  ];
+
   buildUBoot = lib.makeOverridable ({
     version ? null
   , src ? null
@@ -40,6 +50,7 @@ let
   , extraPatches ? []
   , extraMakeFlags ? []
   , extraMeta ? {}
+  , crossTools ? false
   , ... } @ args: stdenv.mkDerivation ({
     pname = "uboot-${defconfig}";
 
@@ -70,15 +81,9 @@ let
       ]))
       swig
       which # for scripts/dtc-version.sh
-    ];
+    ] ++ lib.optionals (!crossTools) toolsDeps;
     depsBuildBuild = [ buildPackages.stdenv.cc ];
-
-    buildInputs = [
-      ncurses # tools/kwboot
-      libuuid # tools/mkeficapsule
-      gnutls # tools/mkeficapsule
-      openssl # tools
-    ];
+    buildInputs = lib.optionals crossTools toolsDeps;
 
     hardeningDisable = [ "all" ];
 
@@ -133,7 +138,9 @@ in {
     hardeningDisable = [];
     dontStrip = false;
     extraMeta.platforms = lib.platforms.linux;
-    extraMakeFlags = [ "HOST_TOOLS_ALL=y" "CROSS_BUILD_TOOLS=1" "NO_SDL=1" "tools" ];
+
+    crossTools = true;
+    extraMakeFlags = [ "HOST_TOOLS_ALL=y" "NO_SDL=1" "cross_tools" ];
 
     outputs = [ "out" "man" ];