2018-12-30 22:39:29 +00:00
|
|
|
{ stdenv, fetchFromGitHub, pkgsCross, buildPackages }:
|
2018-02-24 02:46:39 +00:00
|
|
|
|
|
|
|
let
|
2018-03-20 00:31:31 +00:00
|
|
|
buildArmTrustedFirmware = { filesToInstall
|
2018-02-24 02:46:39 +00:00
|
|
|
, installDir ? "$out"
|
|
|
|
, platform
|
|
|
|
, extraMakeFlags ? []
|
|
|
|
, extraMeta ? {}
|
2018-12-30 22:35:22 +00:00
|
|
|
, version ? "2.0"
|
2018-02-24 02:46:39 +00:00
|
|
|
, ... } @ args:
|
|
|
|
stdenv.mkDerivation (rec {
|
|
|
|
|
|
|
|
name = "arm-trusted-firmware-${platform}-${version}";
|
2018-11-04 23:44:40 +00:00
|
|
|
inherit version;
|
2018-02-24 02:46:39 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ARM-software";
|
|
|
|
repo = "arm-trusted-firmware";
|
2018-03-23 17:03:04 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2018-12-30 22:35:22 +00:00
|
|
|
sha256 = "087pkwa6slxff0aiz3v42gww007nww97bl1p96fvvs7rr1y14gjx";
|
2018-02-24 02:46:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
2018-12-30 22:39:29 +00:00
|
|
|
# For Cortex-M0 firmware in RK3399
|
|
|
|
nativeBuildInputs = [ pkgsCross.arm-embedded.stdenv.cc ];
|
|
|
|
|
2018-02-24 02:46:39 +00:00
|
|
|
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;
|
|
|
|
|
2018-03-23 17:03:26 +00:00
|
|
|
# Fatal error: can't create build/sun50iw1p1/release/bl31/sunxi_clocks.o: No such file or directory
|
|
|
|
enableParallelBuilding = false;
|
2018-02-24 02:46:39 +00:00
|
|
|
|
|
|
|
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 rec {
|
|
|
|
inherit buildArmTrustedFirmware;
|
|
|
|
|
2017-12-11 01:54:11 +00:00
|
|
|
armTrustedFirmwareAllwinner = buildArmTrustedFirmware rec {
|
|
|
|
version = "1.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "apritzel";
|
|
|
|
repo = "arm-trusted-firmware";
|
|
|
|
# Branch: `allwinner`
|
|
|
|
rev = "91f2402d941036a0db092d5375d0535c270b9121";
|
|
|
|
sha256 = "0lbipkxb01w97r6ah8wdbwxir3013rp249fcqhlzh2gjwhp5l1ys";
|
|
|
|
};
|
|
|
|
platform = "sun50iw1p1";
|
2018-03-20 00:31:31 +00:00
|
|
|
extraMeta.platforms = ["aarch64-linux"];
|
2017-12-11 01:54:11 +00:00
|
|
|
filesToInstall = ["build/${platform}/release/bl31.bin"];
|
|
|
|
};
|
|
|
|
|
|
|
|
armTrustedFirmwareQemu = buildArmTrustedFirmware rec {
|
|
|
|
platform = "qemu";
|
2018-03-20 00:31:31 +00:00
|
|
|
extraMeta.platforms = ["aarch64-linux"];
|
2017-12-11 01:54:11 +00:00
|
|
|
filesToInstall = [
|
|
|
|
"build/${platform}/release/bl1.bin"
|
|
|
|
"build/${platform}/release/bl2.bin"
|
|
|
|
"build/${platform}/release/bl31.bin"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2018-02-24 02:46:39 +00:00
|
|
|
armTrustedFirmwareRK3328 = buildArmTrustedFirmware rec {
|
|
|
|
extraMakeFlags = [ "bl31" ];
|
|
|
|
platform = "rk3328";
|
2018-03-20 00:31:31 +00:00
|
|
|
extraMeta.platforms = ["aarch64-linux"];
|
2018-02-24 02:46:39 +00:00
|
|
|
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf"];
|
|
|
|
};
|
2018-12-30 22:39:29 +00:00
|
|
|
|
|
|
|
armTrustedFirmwareRK3399 = buildArmTrustedFirmware rec {
|
|
|
|
extraMakeFlags = [ "bl31" ];
|
|
|
|
platform = "rk3399";
|
|
|
|
extraMeta.platforms = ["aarch64-linux"];
|
|
|
|
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf"];
|
|
|
|
};
|
2018-02-24 02:46:39 +00:00
|
|
|
}
|