mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 21:50:55 +00:00
89 lines
2.5 KiB
Nix
89 lines
2.5 KiB
Nix
{ stdenv, fetchFromGitHub, pkgsCross, buildPackages }:
|
|
|
|
let
|
|
buildArmTrustedFirmware = { filesToInstall
|
|
, installDir ? "$out"
|
|
, platform
|
|
, extraMakeFlags ? []
|
|
, extraMeta ? {}
|
|
, version ? "2.1"
|
|
, ... } @ args:
|
|
stdenv.mkDerivation ({
|
|
|
|
name = "arm-trusted-firmware-${platform}-${version}";
|
|
inherit version;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "ARM-software";
|
|
repo = "arm-trusted-firmware";
|
|
rev = "refs/tags/v${version}";
|
|
sha256 = "1gy5qskrjy8n3kxdcm1dx8b45l5b75n0pm8pq80wl6xic1ycy24r";
|
|
};
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
# For Cortex-M0 firmware in RK3399
|
|
nativeBuildInputs = [ pkgsCross.arm-embedded.stdenv.cc ];
|
|
|
|
makeFlags = [
|
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
|
"PLAT=${platform}"
|
|
] ++ extraMakeFlags;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p ${installDir}
|
|
cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
hardeningDisable = [ "all" ];
|
|
dontStrip = true;
|
|
|
|
# Fatal error: can't create build/sun50iw1p1/release/bl31/sunxi_clocks.o: No such file or directory
|
|
enableParallelBuilding = false;
|
|
|
|
meta = with stdenv.lib; {
|
|
homepage = https://github.com/ARM-software/arm-trusted-firmware;
|
|
description = "A reference implementation of secure world software for ARMv8-A";
|
|
license = licenses.bsd3;
|
|
maintainers = [ maintainers.lopsided98 ];
|
|
} // extraMeta;
|
|
} // builtins.removeAttrs args [ "extraMeta" ]);
|
|
|
|
in {
|
|
inherit buildArmTrustedFirmware;
|
|
|
|
armTrustedFirmwareAllwinner = buildArmTrustedFirmware rec {
|
|
platform = "sun50i_a64";
|
|
extraMeta.platforms = ["aarch64-linux"];
|
|
filesToInstall = ["build/${platform}/release/bl31.bin"];
|
|
};
|
|
|
|
armTrustedFirmwareQemu = buildArmTrustedFirmware rec {
|
|
platform = "qemu";
|
|
extraMeta.platforms = ["aarch64-linux"];
|
|
filesToInstall = [
|
|
"build/${platform}/release/bl1.bin"
|
|
"build/${platform}/release/bl2.bin"
|
|
"build/${platform}/release/bl31.bin"
|
|
];
|
|
};
|
|
|
|
armTrustedFirmwareRK3328 = buildArmTrustedFirmware rec {
|
|
extraMakeFlags = [ "bl31" ];
|
|
platform = "rk3328";
|
|
extraMeta.platforms = ["aarch64-linux"];
|
|
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf"];
|
|
};
|
|
|
|
armTrustedFirmwareRK3399 = buildArmTrustedFirmware rec {
|
|
extraMakeFlags = [ "bl31" ];
|
|
platform = "rk3399";
|
|
extraMeta.platforms = ["aarch64-linux"];
|
|
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf"];
|
|
};
|
|
}
|