uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
146
pkgs/misc/arm-trusted-firmware/default.nix
Normal file
146
pkgs/misc/arm-trusted-firmware/default.nix
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
{ lib, stdenv, fetchFromGitHub, openssl, pkgsCross, buildPackages
|
||||
|
||||
# Warning: this blob (hdcp.bin) runs on the main CPU (not the GPU) at
|
||||
# privilege level EL3, which is above both the kernel and the
|
||||
# hypervisor.
|
||||
#
|
||||
# This parameter applies only to platforms which are believed to use
|
||||
# hdcp.bin. On all other platforms, or if unfreeIncludeHDCPBlob=false,
|
||||
# hdcp.bin will be deleted before building.
|
||||
, unfreeIncludeHDCPBlob ? true
|
||||
}:
|
||||
|
||||
let
|
||||
buildArmTrustedFirmware = { filesToInstall
|
||||
, installDir ? "$out"
|
||||
, platform ? null
|
||||
, platformCanUseHDCPBlob ? false # set this to true if the platform is able to use hdcp.bin
|
||||
, extraMakeFlags ? []
|
||||
, extraMeta ? {}
|
||||
, version ? "2.6"
|
||||
, ... } @ args:
|
||||
|
||||
# delete hdcp.bin if either: the platform is thought to
|
||||
# not need it or unfreeIncludeHDCPBlob is false
|
||||
let deleteHDCPBlobBeforeBuild = !platformCanUseHDCPBlob || !unfreeIncludeHDCPBlob; in
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
|
||||
pname = "arm-trusted-firmware${lib.optionalString (platform != null) "-${platform}"}";
|
||||
inherit version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ARM-software";
|
||||
repo = "arm-trusted-firmware";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-qT9DdTvMcUrvRzgmVf2qmKB+Rb1WOB4p1rM+fsewGcg=";
|
||||
};
|
||||
|
||||
patches = lib.optionals deleteHDCPBlobBeforeBuild [
|
||||
# this is a rebased version of https://gitlab.com/vicencb/kevinboot/-/blob/master/atf.patch
|
||||
./remove-hdcp-blob.patch
|
||||
];
|
||||
|
||||
postPatch = lib.optionalString deleteHDCPBlobBeforeBuild ''
|
||||
rm plat/rockchip/rk3399/drivers/dp/hdcp.bin
|
||||
'';
|
||||
|
||||
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||
|
||||
# For Cortex-M0 firmware in RK3399
|
||||
nativeBuildInputs = [ pkgsCross.arm-embedded.stdenv.cc ];
|
||||
|
||||
buildInputs = [ openssl ];
|
||||
|
||||
makeFlags = [
|
||||
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||
] ++ (lib.optional (platform != null) "PLAT=${platform}")
|
||||
++ extraMakeFlags;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p ${installDir}
|
||||
cp ${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 lib; {
|
||||
homepage = "https://github.com/ARM-software/arm-trusted-firmware";
|
||||
description = "A reference implementation of secure world software for ARMv8-A";
|
||||
license = [ licenses.bsd3 ] ++ lib.optionals (!deleteHDCPBlobBeforeBuild) [ licenses.unfreeRedistributable ];
|
||||
maintainers = with maintainers; [ lopsided98 ];
|
||||
} // extraMeta;
|
||||
} // builtins.removeAttrs args [ "extraMeta" ]);
|
||||
|
||||
in {
|
||||
inherit buildArmTrustedFirmware;
|
||||
|
||||
armTrustedFirmwareTools = buildArmTrustedFirmware rec {
|
||||
extraMakeFlags = [
|
||||
"HOSTCC=${stdenv.cc.targetPrefix}gcc"
|
||||
"fiptool" "certtool" "sptool"
|
||||
];
|
||||
filesToInstall = [
|
||||
"tools/fiptool/fiptool"
|
||||
"tools/cert_create/cert_create"
|
||||
"tools/sptool/sptool"
|
||||
];
|
||||
postInstall = ''
|
||||
mkdir -p "$out/bin"
|
||||
find "$out" -type f -executable -exec mv -t "$out/bin" {} +
|
||||
'';
|
||||
};
|
||||
|
||||
armTrustedFirmwareAllwinner = buildArmTrustedFirmware rec {
|
||||
platform = "sun50i_a64";
|
||||
extraMeta.platforms = ["aarch64-linux"];
|
||||
filesToInstall = ["build/${platform}/release/bl31.bin"];
|
||||
};
|
||||
|
||||
armTrustedFirmwareAllwinnerH616 = buildArmTrustedFirmware rec {
|
||||
platform = "sun50i_h616";
|
||||
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"];
|
||||
platformCanUseHDCPBlob = true;
|
||||
};
|
||||
|
||||
armTrustedFirmwareRK3399 = buildArmTrustedFirmware rec {
|
||||
extraMakeFlags = [ "bl31" ];
|
||||
platform = "rk3399";
|
||||
extraMeta.platforms = ["aarch64-linux"];
|
||||
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf"];
|
||||
platformCanUseHDCPBlob = true;
|
||||
};
|
||||
|
||||
armTrustedFirmwareS905 = buildArmTrustedFirmware rec {
|
||||
extraMakeFlags = [ "bl31" ];
|
||||
platform = "gxbb";
|
||||
extraMeta.platforms = ["aarch64-linux"];
|
||||
filesToInstall = [ "build/${platform}/release/bl31.bin"];
|
||||
};
|
||||
}
|
||||
47
pkgs/misc/arm-trusted-firmware/remove-hdcp-blob.patch
Normal file
47
pkgs/misc/arm-trusted-firmware/remove-hdcp-blob.patch
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
diff --git a/plat/rockchip/rk3399/drivers/dp/cdn_dp.c b/plat/rockchip/rk3399/drivers/dp/cdn_dp.c
|
||||
index a8773f4f6..8e28c4830 100644
|
||||
--- a/plat/rockchip/rk3399/drivers/dp/cdn_dp.c
|
||||
+++ b/plat/rockchip/rk3399/drivers/dp/cdn_dp.c
|
||||
@@ -13,17 +13,6 @@
|
||||
|
||||
#include <cdn_dp.h>
|
||||
|
||||
-__asm__(
|
||||
- ".pushsection .text.hdcp_handler, \"ax\", %progbits\n"
|
||||
- ".global hdcp_handler\n"
|
||||
- ".balign 4\n"
|
||||
- "hdcp_handler:\n"
|
||||
- ".incbin \"" HDCPFW "\"\n"
|
||||
- ".type hdcp_handler, %function\n"
|
||||
- ".size hdcp_handler, .- hdcp_handler\n"
|
||||
- ".popsection\n"
|
||||
-);
|
||||
-
|
||||
static uint64_t *hdcp_key_pdata;
|
||||
static struct cdn_dp_hdcp_key_1x key;
|
||||
|
||||
@@ -38,7 +27,7 @@ uint64_t dp_hdcp_ctrl(uint64_t type)
|
||||
return 0;
|
||||
case HDCP_KEY_DATA_START_DECRYPT:
|
||||
if (hdcp_key_pdata == (uint64_t *)(&key + 1))
|
||||
- return hdcp_handler(&key);
|
||||
+ return PSCI_E_DISABLED;
|
||||
else
|
||||
return PSCI_E_INVALID_PARAMS;
|
||||
assert(0); /* Unreachable */
|
||||
diff --git a/plat/rockchip/rk3399/platform.mk b/plat/rockchip/rk3399/platform.mk
|
||||
index a658fb286..5edb6a25b 100644
|
||||
--- a/plat/rockchip/rk3399/platform.mk
|
||||
+++ b/plat/rockchip/rk3399/platform.mk
|
||||
@@ -88,11 +88,6 @@ $(eval $(call add_define_val,RK3399M0PMUFW,\"$(RK3399M0PMUFW)\"))
|
||||
ifdef PLAT_RK_DP_HDCP
|
||||
BL31_SOURCES += ${RK_PLAT_SOC}/drivers/dp/cdn_dp.c
|
||||
|
||||
-HDCPFW=${RK_PLAT_SOC}/drivers/dp/hdcp.bin
|
||||
-$(eval $(call add_define_val,HDCPFW,\"$(HDCPFW)\"))
|
||||
-
|
||||
-${BUILD_PLAT}/bl31/cdn_dp.o: CCACHE_EXTRAFILES=$(HDCPFW)
|
||||
-${RK_PLAT_SOC}/drivers/dp/cdn_dp.c: $(HDCPFW)
|
||||
endif
|
||||
|
||||
# CCACHE_EXTRAFILES is needed because ccache doesn't handle .incbin
|
||||
Loading…
Add table
Add a link
Reference in a new issue