blob: 8d9c29dc53291ef611ef9bc29222b83d95cc6b07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
{ fetchFromGitHub, python2, stdenv, libuuid, bc, utillinux, nasm, iasl, seabios }:
# we can not override the source in edk2, so we had to copy the entire thing
let
src = fetchFromGitHub {
owner = "MrChromebox";
repo = "edk2";
rev = "860a8d95c2ee89c9916d6e11230f246afa1cd629";
sha256 = "1bykw3lzfjl6idca37i736mwpqv60haczp7davhgqlmlb3nw6y3s";
fetchSubmodules = true;
};
version = "unstable";
pythonEnv = python2.withPackages (ps: [ps.tkinter]);
toolchain = stdenv.mkDerivation {
pname = "edk2-coreboot";
inherit version src;
buildInputs = [ libuuid pythonEnv ];
makeFlags = [ "-C BaseTools" ];
NIX_CFLAGS_COMPILE = "-Wno-return-type -Wno-error=stringop-truncation";
hardeningDisable = [ "format" "fortify" ];
installPhase = ''
mkdir -vp $out
mv -v BaseTools $out
mv -v edksetup.sh $out
'';
enableParallelBuilding = true;
};
in
stdenv.mkDerivation {
pname = "coreboot-payload-tianocore";
inherit version src;
buildInputs = [ bc pythonEnv utillinux nasm iasl ];
prePatch = ''
rm -rf BaseTools
ln -sv ${toolchain}/BaseTools BaseTools
'';
configurePhase = ''
runHook preConfigure
export WORKSPACE="$PWD"
. ${toolchain}/edksetup.sh BaseTools
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
build -a X64 -a IA32 -b RELEASE -t GCC5 -p CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc -n $NIX_BUILD_CORES -D CSM_ENABLE
runHook postBuild
'';
installPhase = ''
runHook preInstall
mv -v Build/*/* $out
runHook postInstall
'';
hardeningDisable = [ "format" "stackprotector" "pic" "fortify" ];
postPatch = ''
cp ${seabios}/Csm16.bin OvmfPkg/Csm/Csm16/Csm16.bin
'';
dontPatchELF = true;
}
|