Files
mjallen18 70002a19e2 hmm
2026-04-07 18:39:42 -05:00

58 lines
1.2 KiB
Nix
Executable File

{
stdenv,
lib,
namespace,
pkgs,
MODEL ? "5",
DEBUG ? "0",
TFA_FLAGS ? "",
}:
let
inherit (lib.trivial) importJSON;
inherit (lib.${namespace}) selectVariant mkAllSources;
versionSpec = importJSON ./version.json;
selected = selectVariant versionSpec null null;
sources = mkAllSources pkgs selected;
fw = selected.sources.fw;
in
stdenv.mkDerivation {
pname = "arm-trusted-firmware";
version = fw.tag or fw.rev;
src = sources.fw;
# Add required host tools if needed:
nativeBuildInputs = [
# dtc python3 openssl etc.
];
buildPhase = ''
make \
CROSS_COMPILE=${stdenv.cc.targetPrefix} \
CC=${stdenv.cc.targetPrefix}cc \
AS=${stdenv.cc.targetPrefix}cc \
PLAT=rpi${MODEL} \
PRELOADED_BL33_BASE=0x20000 \
RPI3_PRELOADED_DTB_BASE=0x3E0000 \
SUPPORT_VFP=1 \
SMC_PCI_SUPPORT=1 \
ENABLE_FEAT_VHE=1 \
DEBUG=${DEBUG} \
all \
${TFA_FLAGS}
'';
installPhase = ''
mkdir -p $out
cp -r build/* $out/
'';
meta = with lib; {
description = "ARM Trusted Firmware-A for Raspberry Pi";
license = licenses.bsd3;
platforms = [ "aarch64-linux" ];
maintainers = with maintainers; [ kazenyuk ];
};
}