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.
66 lines
1.5 KiB
Nix
66 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
fetchgit,
|
|
fetchpatch,
|
|
stdenv,
|
|
buildPackages,
|
|
pkgsCross,
|
|
openssl,
|
|
}:
|
|
|
|
let
|
|
target-board = "imx93";
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
pname = "imx93-atf";
|
|
version = "2.10.0";
|
|
platform = target-board;
|
|
enableParallelBuilding = true;
|
|
|
|
src = fetchgit {
|
|
url = "https://github.com/nxp-imx/imx-atf.git";
|
|
rev = "28affcae957cb8194917b5246276630f9e6343e1";
|
|
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-K1JECateo4mUrOaV41PUmCXHn7DfmgRQXx4KdcIALqE=";
|
|
})
|
|
];
|
|
|
|
# Compiler dependencies
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
nativeBuildInputs = [ pkgsCross.aarch64-embedded.stdenv.cc ];
|
|
|
|
buildInputs = [ openssl ];
|
|
|
|
makeFlags = [
|
|
"HOSTCC=$(CC_FOR_BUILD)"
|
|
"CROSS_COMPILE=${pkgsCross.aarch64-embedded.stdenv.cc.targetPrefix}"
|
|
"PLAT=${platform}"
|
|
"SPD=opteed"
|
|
"bl31"
|
|
"LDFLAGS=-no-warn-rwx-segments"
|
|
];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out
|
|
cp build/${target-board}/release/bl31.bin $out
|
|
runHook postInstall
|
|
'';
|
|
|
|
hardeningDisable = [ "all" ];
|
|
dontStrip = true;
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/nxp-imx/imx-atf";
|
|
description = "Reference implementation of secure world software for ARMv8-A";
|
|
license = [ licenses.bsd3 ];
|
|
maintainers = with maintainers; [ govindsi ];
|
|
platforms = [ "aarch64-linux" ];
|
|
};
|
|
}
|