idk man
This commit is contained in:
108
packages/edk2-basetools/default.nix
Normal file
108
packages/edk2-basetools/default.nix
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
{ stdenv
|
||||||
|
, fetchFromGitHub
|
||||||
|
, lib
|
||||||
|
, applyPatches
|
||||||
|
, fetchpatch
|
||||||
|
, MODEL ? "5"
|
||||||
|
, RELEASE_TYPE ? "RELEASE"
|
||||||
|
, EDK2_FLAGS ? ""
|
||||||
|
, python3
|
||||||
|
, git
|
||||||
|
, libuuid
|
||||||
|
, pkgs
|
||||||
|
, namespace
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
pythonEnv = python3.withPackages (ps: [ ps.tkinter ]);
|
||||||
|
pname = "edk2-basetools";
|
||||||
|
version = "stable202511";
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
inherit pname version;
|
||||||
|
|
||||||
|
edk2Src = fetchFromGitHub rec {
|
||||||
|
owner = "mjallen18";
|
||||||
|
repo = "edk2";
|
||||||
|
name = repo;
|
||||||
|
#tag = "edk2-${version}";
|
||||||
|
rev = "9765be56f1f816ef737153f5588b3294fcc69a63";
|
||||||
|
hash = "sha256-oqfJbNeOj2BVJqWE+snD6ri3lUO1aNcmPg+eJpjyr5E=";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
env = {
|
||||||
|
NIX_CFLAGS_COMPILE =
|
||||||
|
"-Wno-return-type"
|
||||||
|
+ lib.optionalString (stdenv.cc.isGNU) " -Wno-error=stringop-truncation"
|
||||||
|
+ lib.optionalString (stdenv.hostPlatform.isDarwin) " -Wno-error=macro-redefined";
|
||||||
|
PYTHON_COMMAND = lib.getExe pythonEnv;
|
||||||
|
# trick taken from https://src.fedoraproject.org/rpms/edk2/blob/08f2354cd280b4ce5a7888aa85cf520e042955c3/f/edk2.spec#_319
|
||||||
|
${"GCC5_AARCH64_PREFIX"} = stdenv.cc.targetPrefix;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
# Add required host tools if needed:
|
||||||
|
nativeBuildInputs = [
|
||||||
|
python3
|
||||||
|
git
|
||||||
|
libuuid
|
||||||
|
];
|
||||||
|
|
||||||
|
# Don’t force a single root; we keep both dirs side by side
|
||||||
|
sourceRoot = ".";
|
||||||
|
|
||||||
|
unpackPhase = ''
|
||||||
|
runHook preUnpack
|
||||||
|
|
||||||
|
unpackFile "$edk2Src"
|
||||||
|
|
||||||
|
chmod -R u+w .
|
||||||
|
|
||||||
|
patchShebangs ./edk2
|
||||||
|
|
||||||
|
runHook postUnpack
|
||||||
|
'';
|
||||||
|
|
||||||
|
# FIXME: unvendor OpenSSL again once upstream updates
|
||||||
|
# to a compatible version.
|
||||||
|
# Upstream PR: https://github.com/tianocore/edk2/pull/10946
|
||||||
|
postPatch = ''
|
||||||
|
# enable compilation using Clang
|
||||||
|
# https://bugzilla.tianocore.org/show_bug.cgi?id=4620
|
||||||
|
ls -alh
|
||||||
|
substituteInPlace edk2/BaseTools/Conf/tools_def.template --replace-fail \
|
||||||
|
'DEFINE CLANGPDB_WARNING_OVERRIDES = ' \
|
||||||
|
'DEFINE CLANGPDB_WARNING_OVERRIDES = -Wno-unneeded-internal-declaration '
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
export PYTHON_COMMAND=${python3}/bin/python
|
||||||
|
export WORKSPACE=$PWD
|
||||||
|
|
||||||
|
make -C ./edk2/BaseTools
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -vp $out
|
||||||
|
mv -v ./edk2/BaseTools $out
|
||||||
|
mv -v ./edk2/edksetup.sh $out
|
||||||
|
# patchShebangs fails to see these when cross compiling
|
||||||
|
for i in $out/BaseTools/BinWrappers/PosixLike/*; do
|
||||||
|
chmod +x "$i"
|
||||||
|
patchShebangs --build "$i"
|
||||||
|
done
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "ARM Trusted Firmware-A for Raspberry Pi";
|
||||||
|
license = licenses.bsd3;
|
||||||
|
platforms = [ "aarch64-linux" ];
|
||||||
|
maintainers = with maintainers; [ kazenyuk ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
{ stdenv
|
{ stdenv
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, lib
|
, lib
|
||||||
, MODEL ? "5"
|
, MODEL ? "4"
|
||||||
, RELEASE_TYPE ? "RELEASE"
|
, RELEASE_TYPE ? "RELEASE"
|
||||||
, EDK2_FLAGS ? ""
|
, EDK2_FLAGS ? ""
|
||||||
|
, nasm
|
||||||
|
, perl
|
||||||
, python3
|
, python3
|
||||||
|
, python3Packages
|
||||||
|
, openssl
|
||||||
, git
|
, git
|
||||||
, libuuid
|
, libuuid
|
||||||
, pkgs
|
, pkgs
|
||||||
@@ -28,7 +32,7 @@ let
|
|||||||
owner = "mjallen18";
|
owner = "mjallen18";
|
||||||
repo = "edk2-non-osi";
|
repo = "edk2-non-osi";
|
||||||
name = repo;
|
name = repo;
|
||||||
rev = "09ee44f07ded544d976be8a03dec3715719f638e";
|
rev = "09ee44f07ded544d976be8a03dec3715719homeassistant-apif638e";
|
||||||
hash = "sha256-k7nUb3WaRUIr9IlXdam2WGKPOzKjLNVFLfuD5h4veMc=";
|
hash = "sha256-k7nUb3WaRUIr9IlXdam2WGKPOzKjLNVFLfuD5h4veMc=";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -36,9 +40,17 @@ let
|
|||||||
owner = "mjallen18";
|
owner = "mjallen18";
|
||||||
repo = "edk2-platforms";
|
repo = "edk2-platforms";
|
||||||
name = repo;
|
name = repo;
|
||||||
rev = "3000448f1f239d7220c5650dce150dfa6eac5c0a";
|
rev = "933314d94a3d05f2f62b0f2148151d4a0f1e1183";
|
||||||
hash = "sha256-keB7pxoOUfNghjmL3LUqGHpRGKp3zHwjTsvDO9Gur24=";
|
hash = "sha256-Tnvrwk4g191LzfTkdoFw1BBN51EWhEQ7DRe9u5Mzc0w=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
baseTools = pkgs.${namespace}.edk2-basetools;
|
||||||
|
|
||||||
|
pythonEnv = python3.withPackages (
|
||||||
|
_ps: with python3Packages; [
|
||||||
|
libfdt
|
||||||
|
]
|
||||||
|
);
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
@@ -51,11 +63,26 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
# Add required host tools if needed:
|
# Add required host tools if needed:
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
python3
|
openssl
|
||||||
git
|
nasm
|
||||||
libuuid
|
perl
|
||||||
|
pythonEnv
|
||||||
|
git
|
||||||
|
libuuid
|
||||||
|
baseTools
|
||||||
];
|
];
|
||||||
|
|
||||||
|
env = {
|
||||||
|
NIX_CFLAGS_COMPILE =
|
||||||
|
"-Wno-return-type -Wno-error"
|
||||||
|
+ lib.optionalString (stdenv.cc.isGNU) " -Wno-error=stringop-truncation"
|
||||||
|
+ lib.optionalString (stdenv.hostPlatform.isDarwin) " -Wno-error=macro-redefined";
|
||||||
|
PYTHON_COMMAND = lib.getExe pythonEnv;
|
||||||
|
# trick taken from https://src.fedoraproject.org/rpms/edk2/blob/08f2354cd280b4ce5a7888aa85cf520e042955c3/f/edk2.spec#_319
|
||||||
|
${"GCC5_AARCH64_PREFIX"} = stdenv.cc.targetPrefix;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
# Don’t force a single root; we keep both dirs side by side
|
# Don’t force a single root; we keep both dirs side by side
|
||||||
sourceRoot = ".";
|
sourceRoot = ".";
|
||||||
|
|
||||||
@@ -73,18 +100,38 @@ stdenv.mkDerivation rec {
|
|||||||
runHook postUnpack
|
runHook postUnpack
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
prePatch = ''
|
||||||
export PYTHON_COMMAND=${python3}/bin/python
|
rm -rf ./edk2/BaseTools
|
||||||
|
ln -sv ${baseTools}/BaseTools ./edk2/BaseTools
|
||||||
|
'';
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
f=edk2/CryptoPkg/Library/OpensslLib/OpensslLib.inf
|
||||||
|
if grep -q '^\[BuildOptions\]' "$f"; then
|
||||||
|
# Add flag inside existing BuildOptions
|
||||||
|
sed -i '/^\[BuildOptions\]/a\ GCC:*_*_*_CC_FLAGS = -Wno-error' "$f"
|
||||||
|
else
|
||||||
|
# Append a new BuildOptions block
|
||||||
|
cat >> "$f" <<'EOF'
|
||||||
|
|
||||||
|
[BuildOptions]
|
||||||
|
GCC:*_*_*_CC_FLAGS = -Wno-error
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
configurePhase = ''
|
||||||
|
runHook preConfigure
|
||||||
export WORKSPACE=$PWD
|
export WORKSPACE=$PWD
|
||||||
export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-non-osi:$WORKSPACE/edk2-platforms
|
export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-non-osi:$WORKSPACE/edk2-platforms
|
||||||
export EDK_TOOLS_PATH=$WORKSPACE/edk2/BaseTools
|
export EDK_TOOLS_PATH=${baseTools}/BaseTools
|
||||||
|
|
||||||
make -C ./edk2/BaseTools
|
|
||||||
|
|
||||||
export ATF_BUILD_DIR="${pkgs.${namespace}.arm-trusted-firmware}/rpi${MODEL}/${RELEASE_TYPE}"
|
export ATF_BUILD_DIR="${pkgs.${namespace}.arm-trusted-firmware}/rpi${MODEL}/${RELEASE_TYPE}"
|
||||||
|
|
||||||
. ./edk2/edksetup.sh BaseTools
|
. ${baseTools}/edksetup.sh BaseTools
|
||||||
|
runHook postConfigure
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
build \
|
build \
|
||||||
-a AARCH64 \
|
-a AARCH64 \
|
||||||
-t GCC \
|
-t GCC \
|
||||||
|
|||||||
Reference in New Issue
Block a user