at 18.03-beta 86 lines 2.5 kB view raw
1{ stdenv, fetchFromGitHub, fetchpatch, libuuid, python2, iasl }: 2 3let 4 pythonEnv = python2.withPackages(ps: [ps.tkinter]); 5 6targetArch = if stdenv.isi686 then 7 "IA32" 8else if stdenv.isx86_64 then 9 "X64" 10else 11 throw "Unsupported architecture"; 12 13edk2 = stdenv.mkDerivation { 14 name = "edk2-2017-12-05"; 15 16 src = fetchFromGitHub { 17 owner = "tianocore"; 18 repo = "edk2"; 19 rev = "f71a70e7a4c93a6143d7bad8ab0220a947679697"; 20 sha256 = "0k48xfwxcgcim1bhkggc19hilvsxsf5axvvcpmld0ng1fcfg0cr6"; 21 }; 22 23 patches = [ 24 (fetchpatch { 25 name = "short-circuit-the-transfer-of-an-empty-S3_CONTEXT.patch"; 26 url = "https://github.com/tianocore/edk2/commit/9e2a8e928995c3b1bb664b73fd59785055c6b5f6"; 27 sha256 = "0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73"; 28 }) 29 ]; 30 31 buildInputs = [ libuuid pythonEnv ]; 32 33 makeFlags = "-C BaseTools"; 34 35 hardeningDisable = [ "format" "fortify" ]; 36 37 installPhase = '' 38 mkdir -vp $out 39 mv -v BaseTools $out 40 mv -v EdkCompatibilityPkg $out 41 mv -v edksetup.sh $out 42 ''; 43 44 enableParallelBuilding = true; 45 46 meta = { 47 description = "Intel EFI development kit"; 48 homepage = https://sourceforge.net/projects/edk2/; 49 license = stdenv.lib.licenses.bsd2; 50 branch = "UDK2017"; 51 platforms = ["x86_64-linux" "i686-linux"]; 52 }; 53 54 passthru = { 55 setup = projectDscPath: attrs: { 56 buildInputs = [ pythonEnv ] ++ 57 stdenv.lib.optionals (attrs ? buildInputs) attrs.buildInputs; 58 59 configurePhase = '' 60 mkdir -v Conf 61 sed -e 's|Nt32Pkg/Nt32Pkg.dsc|${projectDscPath}|' -e \ 62 's|MYTOOLS|GCC49|' -e 's|IA32|${targetArch}|' -e 's|DEBUG|RELEASE|'\ 63 < ${edk2}/BaseTools/Conf/target.template > Conf/target.txt 64 sed -e 's|DEFINE GCC48_IA32_PREFIX = /usr/bin/|DEFINE GCC48_IA32_PREFIX = ""|' \ 65 -e 's|DEFINE GCC48_X64_PREFIX = /usr/bin/|DEFINE GCC48_X64_PREFIX = ""|' \ 66 -e 's|DEFINE UNIX_IASL_BIN = /usr/bin/iasl|DEFINE UNIX_IASL_BIN = ${iasl}/bin/iasl|' \ 67 < ${edk2}/BaseTools/Conf/tools_def.template > Conf/tools_def.txt 68 export WORKSPACE="$PWD" 69 export EFI_SOURCE="$PWD/EdkCompatibilityPkg" 70 ln -sv ${edk2}/BaseTools BaseTools 71 ln -sv ${edk2}/EdkCompatibilityPkg EdkCompatibilityPkg 72 . ${edk2}/edksetup.sh BaseTools 73 ''; 74 75 buildPhase = " 76 build 77 "; 78 79 installPhase = "mv -v Build/*/* $out"; 80 } // (removeAttrs attrs [ "buildInputs" ] ); 81 }; 82}; 83 84in 85 86edk2