From d66213a72e9ff9db04ebc0aaad4e33ea3d371b04 Mon Sep 17 00:00:00 2001 From: Govind Singh Date: Fri, 5 Jun 2026 08:20:07 +0400 Subject: [PATCH] nxp: imx93-evk: fix cross-build of mkimage host tools When building the imx93 SD image from x86_64, imx93-boot used target pkgs for the imx-mkimage derivation and its native tools (git, dtc, xxd). mkimage runs on the build machine, but Nix tried to cross-compile git for aarch64 and failed with "linker `cc` not found" while building libgitcore, blocking flash.bin and the SD image. Build mkimage with buildPackages (host tools) while keeping firmware inputs (ATF, U-Boot, OP-TEE, etc.) from target pkgs. --- nxp/imx93-evk/bsp/imx93-boot.nix | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/nxp/imx93-evk/bsp/imx93-boot.nix b/nxp/imx93-evk/bsp/imx93-boot.nix index c11f31d5..c328a6da 100644 --- a/nxp/imx93-evk/bsp/imx93-boot.nix +++ b/nxp/imx93-evk/bsp/imx93-boot.nix @@ -1,8 +1,8 @@ { pkgs, }: -with pkgs; let + bp = pkgs.buildPackages; imx93-atf = pkgs.callPackage ./imx93-atf.nix { }; imx93-firmware = pkgs.callPackage ./imx93-firmware.nix { }; @@ -17,7 +17,8 @@ let shortRev = builtins.substring 0 8 src.rev; in { - imx93-boot = pkgs.stdenv.mkDerivation rec { + # mkimage runs on the build machine; use buildPackages when cross-compiling. + imx93-boot = bp.stdenv.mkDerivation { inherit src; name = "imx93-mkimage"; version = "lf-6.12.3"; @@ -25,28 +26,22 @@ in postPatch = '' substituteInPlace Makefile \ --replace 'git rev-parse --short=8 HEAD' 'echo ${shortRev}' - substituteInPlace Makefile \ - --replace 'CC = gcc' 'CC = clang' substituteInPlace iMX93/soc.mak \ - --replace 'xxd' "${pkgs.vim.xxd}/bin/xxd" + --replace 'xxd' "${bp.vim.xxd}/bin/xxd" substituteInPlace scripts/fspi_fcb_gen.sh \ - --replace 'xxd' "${pkgs.vim.xxd}/bin/xxd" + --replace 'xxd' "${bp.vim.xxd}/bin/xxd" substituteInPlace scripts/fspi_packer.sh \ - --replace 'xxd' "${pkgs.vim.xxd}/bin/xxd" + --replace 'xxd' "${bp.vim.xxd}/bin/xxd" patchShebangs scripts ''; nativeBuildInputs = [ - clang - git - dtc - ]; - - buildInputs = [ - git - glibc.static - zlib - zlib.static + bp.stdenv.cc + bp.git + bp.dtc + bp.glibc.static + bp.zlib + bp.zlib.static ]; buildPhase = ''