-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathedk2-vf2.nix
61 lines (53 loc) · 1.47 KB
/
edk2-vf2.nix
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
{ stdenv
, fetchFromGitHub
, python3
, dtc
, buildPackages
, buildTarget ? "RELEASE"
}:
let
version = "202306";
src = fetchFromGitHub {
owner = "starfive-tech";
repo = "edk2";
rev = "refs/tags/REL_VF2_JUN2023";
hash = "sha256-RVky5Sfm2Dj12YrLsTleuoYxl4gv5n9MjchWDC9Mp+8=";
fetchSubmodules = true;
};
platforms = fetchFromGitHub {
owner = "starfive-tech";
repo = "edk2-platforms";
rev = "ef35a2a2450275b9208f5c9ad5b60a405e33e45a";
hash = "sha256-o+vtzaAWSQRJVjGEktJKj0NSmoGE2IeQNrlnwf6EsB4=";
fetchSubmodules = true;
};
basetools = buildPackages.callPackage ./edk2-basetools.nix { inherit version src; };
in
stdenv.mkDerivation {
pname = "edk2";
inherit version src;
postPatch = ''
patchShebangs BaseTools/BinWrappers
ln -sv ${basetools}/bin BaseTools/Source/C/bin
'';
preConfigure = ''
export PACKAGES_PATH=.:${platforms}
source edksetup.sh BaseTools
'';
depsBuildBuild = [ buildPackages.stdenv.cc ]; # for cpp
nativeBuildInputs = [ python3 dtc ];
env = {
PYTHON_COMMAND = "python3";
GCC5_RISCV64_PREFIX = stdenv.cc.targetPrefix;
};
buildPhase = ''
runHook preBuild
build --arch=RISCV64 --platform=${platforms}/Platform/StarFive/JH7110SeriesPkg/JH7110Board/JH7110.dsc --tagname=GCC5 --buildtarget=${buildTarget}
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dm444 Build/JH7110/${buildTarget}_GCC5/FV/JH7110.fd $out/JH7110.fd
runHook postInstall
'';
}