From e678820fd53559ce8aeede509c61068474ffc224 Mon Sep 17 00:00:00 2001 From: Govind Singh Date: Thu, 4 Jun 2026 21:48:03 +0400 Subject: [PATCH 1/3] nxp: imx93-atf: fix GCC header-guard build failure GCC 14+ treats the mismatched TRDC header guard in imx-atf as a hard error (-Werror=header-guard), so bl31.bin does not build on our pinned revision. Fetch the upstream fix (e194a14) as a patch without bumping the ATF revision. --- nxp/imx93-evk/bsp/imx93-atf.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nxp/imx93-evk/bsp/imx93-atf.nix b/nxp/imx93-evk/bsp/imx93-atf.nix index 634cca19..aff26c85 100644 --- a/nxp/imx93-evk/bsp/imx93-atf.nix +++ b/nxp/imx93-evk/bsp/imx93-atf.nix @@ -1,6 +1,7 @@ { lib, fetchgit, + fetchpatch, stdenv, buildPackages, pkgsCross, @@ -22,6 +23,14 @@ stdenv.mkDerivation rec { sha256 = "sha256-a8F+Lf8pwML+tCwawS0N/mrSXWPmFhlUeOg0MCRK3VE="; }; + patches = [ + (fetchpatch { + name = "imx93-trdc-header-guard.patch"; + url = "https://github.com/nxp-imx/imx-atf/commit/e194a14ec55f13386babc80c90098874367ab3d6.patch"; + sha256 = "sha256-uXRgeyFmxDww93nJe04aoOLml2R7IbABZLhywyYmePk="; + }) + ]; + # Compiler dependencies depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ pkgsCross.aarch64-embedded.stdenv.cc ]; From d66213a72e9ff9db04ebc0aaad4e33ea3d371b04 Mon Sep 17 00:00:00 2001 From: Govind Singh Date: Fri, 5 Jun 2026 08:20:07 +0400 Subject: [PATCH 2/3] 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 = '' From 307a84fc96911cb54dc8d7b55356a17fb880cb00 Mon Sep 17 00:00:00 2001 From: Govind Singh Date: Fri, 5 Jun 2026 15:20:26 +0400 Subject: [PATCH 3/3] compulab: ucm-imx95: fix cross-build of mkimage host tools imx-mkimage runs on the build machine, but ucm-imx95-boot used target stdenv and forced clang. Cross-building the SD image from x86_64 then failed building mkimage_imx8 with "stdio.h not found", blocking flash.bin. Build mkimage with buildPackages; keep firmware blobs from target pkgs. --- compulab/ucm-imx95/bsp/ucm-imx95-boot.nix | 53 +++++++++-------------- compulab/ucm-imx95/overlay.nix | 2 +- nxp/imx93-evk/bsp/imx93-atf.nix | 2 +- 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/compulab/ucm-imx95/bsp/ucm-imx95-boot.nix b/compulab/ucm-imx95/bsp/ucm-imx95-boot.nix index e49ff90e..83a9a28c 100644 --- a/compulab/ucm-imx95/bsp/ucm-imx95-boot.nix +++ b/compulab/ucm-imx95/bsp/ucm-imx95-boot.nix @@ -1,24 +1,17 @@ { - callPackage, - fetchFromGitHub, - stdenv, - clang, - git, - dtc, - glibc, - zlib, - vim, + pkgs, }: let + bp = pkgs.buildPackages; - imx95-atf = callPackage ./ucm-imx95-atf.nix { }; - imx95-firmware = callPackage ./ucm-imx95-firmware.nix { }; - imx95-uboot = callPackage ./ucm-imx95-uboot.nix { }; - imx95-optee-os = callPackage ./ucm-imx95-optee-os.nix { }; - imx95-sm-fw = callPackage ./ucm-imx95-sm-fw.nix { }; - imx95-oei-ddr = callPackage ./ucm-imx95-oei-ddr.nix { }; - imx95-oei-tcm = callPackage ./ucm-imx95-oei-tcm.nix { }; - src = fetchFromGitHub { + imx95-atf = pkgs.callPackage ./ucm-imx95-atf.nix { }; + imx95-firmware = pkgs.callPackage ./ucm-imx95-firmware.nix { }; + imx95-uboot = pkgs.callPackage ./ucm-imx95-uboot.nix { }; + imx95-optee-os = pkgs.callPackage ./ucm-imx95-optee-os.nix { }; + imx95-sm-fw = pkgs.callPackage ./ucm-imx95-sm-fw.nix { }; + imx95-oei-ddr = pkgs.callPackage ./ucm-imx95-oei-ddr.nix { }; + imx95-oei-tcm = pkgs.callPackage ./ucm-imx95-oei-tcm.nix { }; + src = pkgs.fetchFromGitHub { owner = "nxp-imx"; repo = "imx-mkimage"; #tag: lf-6.6.52-2.2.1 @@ -28,7 +21,8 @@ let shortRev = builtins.substring 0 8 src.rev; in { - imx95-boot = stdenv.mkDerivation rec { + # mkimage runs on the build machine; use buildPackages when cross-compiling. + imx95-boot = bp.stdenv.mkDerivation { inherit src; name = "imx95-mkimage"; version = "lf-6.6.52-2.2.1"; @@ -36,27 +30,22 @@ in postPatch = '' substituteInPlace Makefile \ --replace-fail 'git rev-parse --short=8 HEAD' 'echo ${shortRev}' - substituteInPlace Makefile \ - --replace-fail 'CC = gcc' 'CC = clang' substituteInPlace iMX95/soc.mak \ - --replace-fail 'xxd' "${vim.xxd}/bin/xxd" + --replace-fail 'xxd' "${bp.vim.xxd}/bin/xxd" substituteInPlace scripts/fspi_fcb_gen.sh \ - --replace-fail 'xxd' "${vim.xxd}/bin/xxd" + --replace-fail 'xxd' "${bp.vim.xxd}/bin/xxd" substituteInPlace scripts/fspi_packer.sh \ - --replace-fail 'xxd' "${vim.xxd}/bin/xxd" + --replace-fail 'xxd' "${bp.vim.xxd}/bin/xxd" patchShebangs scripts ''; nativeBuildInputs = [ - clang - git - dtc - ]; - - buildInputs = [ - glibc.static - zlib - zlib.static + bp.stdenv.cc + bp.git + bp.dtc + bp.glibc.static + bp.zlib + bp.zlib.static ]; buildPhase = '' diff --git a/compulab/ucm-imx95/overlay.nix b/compulab/ucm-imx95/overlay.nix index 516f9e79..942a3711 100644 --- a/compulab/ucm-imx95/overlay.nix +++ b/compulab/ucm-imx95/overlay.nix @@ -1,3 +1,3 @@ final: _prev: { - inherit (final.callPackage ./bsp/ucm-imx95-boot.nix { }) imx95-boot; + inherit (final.callPackage ./bsp/ucm-imx95-boot.nix { pkgs = final; }) imx95-boot; } diff --git a/nxp/imx93-evk/bsp/imx93-atf.nix b/nxp/imx93-evk/bsp/imx93-atf.nix index aff26c85..7caaaa7b 100644 --- a/nxp/imx93-evk/bsp/imx93-atf.nix +++ b/nxp/imx93-evk/bsp/imx93-atf.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { (fetchpatch { name = "imx93-trdc-header-guard.patch"; url = "https://github.com/nxp-imx/imx-atf/commit/e194a14ec55f13386babc80c90098874367ab3d6.patch"; - sha256 = "sha256-uXRgeyFmxDww93nJe04aoOLml2R7IbABZLhywyYmePk="; + sha256 = "sha256-K1JECateo4mUrOaV41PUmCXHn7DfmgRQXx4KdcIALqE="; }) ];