2017-12-16 03:07:05 +00:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, libuuid, python2, iasl }:
|
2012-03-14 04:18:52 +00:00
|
|
|
|
|
|
|
let
|
2016-10-18 08:10:27 +01:00
|
|
|
pythonEnv = python2.withPackages(ps: [ps.tkinter]);
|
2012-03-14 04:18:52 +00:00
|
|
|
|
2012-03-14 06:57:58 +00:00
|
|
|
targetArch = if stdenv.isi686 then
|
|
|
|
"IA32"
|
|
|
|
else if stdenv.isx86_64 then
|
|
|
|
"X64"
|
2018-03-14 15:37:49 +00:00
|
|
|
else if stdenv.isAarch64 then
|
|
|
|
"AARCH64"
|
2012-03-14 06:57:58 +00:00
|
|
|
else
|
|
|
|
throw "Unsupported architecture";
|
2012-03-14 04:18:52 +00:00
|
|
|
|
2012-03-14 06:57:58 +00:00
|
|
|
edk2 = stdenv.mkDerivation {
|
2017-12-15 22:28:45 +00:00
|
|
|
name = "edk2-2017-12-05";
|
2016-02-08 23:07:09 +00:00
|
|
|
|
2017-08-27 19:41:10 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tianocore";
|
|
|
|
repo = "edk2";
|
2017-12-15 22:28:45 +00:00
|
|
|
rev = "f71a70e7a4c93a6143d7bad8ab0220a947679697";
|
|
|
|
sha256 = "0k48xfwxcgcim1bhkggc19hilvsxsf5axvvcpmld0ng1fcfg0cr6";
|
2012-03-14 04:18:52 +00:00
|
|
|
};
|
|
|
|
|
2017-12-16 03:07:05 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "short-circuit-the-transfer-of-an-empty-S3_CONTEXT.patch";
|
2018-08-01 09:15:17 +01:00
|
|
|
url = "https://github.com/tianocore/edk2/commit/9e2a8e928995c3b1bb664b73fd59785055c6b5f6.diff";
|
|
|
|
sha256 = "0x24npijhgpjpsn3n74wayf8qcbaj97vi4z2iyf4almavqq8qaz4";
|
2017-12-16 03:07:05 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [ libuuid pythonEnv ];
|
2012-03-14 04:18:52 +00:00
|
|
|
|
2016-02-08 23:07:09 +00:00
|
|
|
makeFlags = "-C BaseTools";
|
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "format" "fortify" ];
|
2012-03-14 04:18:52 +00:00
|
|
|
|
2012-03-14 06:57:58 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -vp $out
|
|
|
|
mv -v BaseTools $out
|
|
|
|
mv -v EdkCompatibilityPkg $out
|
|
|
|
mv -v edksetup.sh $out
|
|
|
|
'';
|
2012-03-14 04:18:52 +00:00
|
|
|
|
2017-12-16 03:07:05 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2012-03-14 04:18:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "Intel EFI development kit";
|
2017-08-02 22:50:51 +01:00
|
|
|
homepage = https://sourceforge.net/projects/edk2/;
|
2014-12-20 23:00:35 +00:00
|
|
|
license = stdenv.lib.licenses.bsd2;
|
2017-12-15 22:28:45 +00:00
|
|
|
branch = "UDK2017";
|
2018-03-14 15:37:49 +00:00
|
|
|
platforms = ["x86_64-linux" "i686-linux" "aarch64-linux"];
|
2012-03-14 04:18:52 +00:00
|
|
|
};
|
2012-03-14 06:57:58 +00:00
|
|
|
|
|
|
|
passthru = {
|
|
|
|
setup = projectDscPath: attrs: {
|
2016-10-13 09:47:07 +01:00
|
|
|
buildInputs = [ pythonEnv ] ++
|
2012-03-14 06:57:58 +00:00
|
|
|
stdenv.lib.optionals (attrs ? buildInputs) attrs.buildInputs;
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
mkdir -v Conf
|
2018-03-14 13:47:09 +00:00
|
|
|
|
|
|
|
cp ${edk2}/BaseTools/Conf/target.template Conf/target.txt
|
|
|
|
sed -i Conf/target.txt \
|
|
|
|
-e 's|Nt32Pkg/Nt32Pkg.dsc|${projectDscPath}|' \
|
|
|
|
-e 's|MYTOOLS|GCC49|' \
|
|
|
|
-e 's|IA32|${targetArch}|' \
|
|
|
|
-e 's|DEBUG|RELEASE|'\
|
|
|
|
|
|
|
|
cp ${edk2}/BaseTools/Conf/tools_def.template Conf/tools_def.txt
|
|
|
|
sed -i Conf/tools_def.txt \
|
|
|
|
-e 's|DEFINE GCC48_IA32_PREFIX = /usr/bin/|DEFINE GCC48_IA32_PREFIX = ""|' \
|
2014-02-03 23:32:21 +00:00
|
|
|
-e 's|DEFINE GCC48_X64_PREFIX = /usr/bin/|DEFINE GCC48_X64_PREFIX = ""|' \
|
2018-03-14 13:47:09 +00:00
|
|
|
-e 's|DEFINE UNIX_IASL_BIN = /usr/bin/iasl|DEFINE UNIX_IASL_BIN = ${iasl}/bin/iasl|'
|
|
|
|
|
2012-03-14 06:57:58 +00:00
|
|
|
export WORKSPACE="$PWD"
|
|
|
|
export EFI_SOURCE="$PWD/EdkCompatibilityPkg"
|
|
|
|
ln -sv ${edk2}/BaseTools BaseTools
|
|
|
|
ln -sv ${edk2}/EdkCompatibilityPkg EdkCompatibilityPkg
|
|
|
|
. ${edk2}/edksetup.sh BaseTools
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = "
|
|
|
|
build
|
|
|
|
";
|
|
|
|
|
2012-03-14 22:43:07 +00:00
|
|
|
installPhase = "mv -v Build/*/* $out";
|
2012-03-14 06:57:58 +00:00
|
|
|
} // (removeAttrs attrs [ "buildInputs" ] );
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
edk2
|