summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaito Bezarius <masterancpp@gmail.com>2023-04-26 18:31:57 +0200
committerRaito Bezarius <masterancpp@gmail.com>2023-04-26 18:31:57 +0200
commitc449133f880b756011f59e4f1a3e009510ba7be9 (patch)
tree82369ae9ba298d2bfafe0a3edd386f993967a48c
parentovmf: add TLS support (diff)
downloadnixpkgs-origin/ovmf-improvements.tar.gz
ovmf: support debuggingorigin/ovmf-improvements
-rw-r--r--pkgs/applications/virtualization/OVMF/default.nix5
-rw-r--r--pkgs/development/compilers/edk2/default.nix2
2 files changed, 6 insertions, 1 deletions
diff --git a/pkgs/applications/virtualization/OVMF/default.nix b/pkgs/applications/virtualization/OVMF/default.nix
index 06687c8c977a..6e3e9ba0d126 100644
--- a/pkgs/applications/virtualization/OVMF/default.nix
+++ b/pkgs/applications/virtualization/OVMF/default.nix
@@ -4,6 +4,8 @@
, httpSupport ? false
, tpmSupport ? false
, tlsSupport ? false
+, debug ? false
+, sourceDebug ? debug
}:
assert csmSupport -> seabios != null;
@@ -44,12 +46,15 @@ edk2.mkDerivation projectDscPath (finalAttrs: {
buildFlags =
# IPv6 has no reason to be disabled.
[ "-D NETWORK_IP6_ENABLE=TRUE" ]
+ ++ lib.optionals debug [ "-D DEBUG_ON_SERIAL_PORT=TRUE" ]
+ ++ lib.optionals sourceDebug [ "-D SOURCE_DEBUG_ENABLE=TRUE" ]
++ lib.optionals secureBoot [ "-D SECURE_BOOT_ENABLE=TRUE" ]
++ lib.optionals csmSupport [ "-D CSM_ENABLE" "-D FD_SIZE_2MB" ]
++ lib.optionals httpSupport [ "-D NETWORK_HTTP_ENABLE=TRUE" "-D NETWORK_HTTP_BOOT_ENABLE=TRUE" ]
++ lib.optionals tlsSupport [ "-D NETWORK_TLS_ENABLE=TRUE" ]
++ lib.optionals tpmSupport [ "-D TPM_ENABLE" "-D TPM2_ENABLE" "-D TPM2_CONFIG_ENABLE"];
+ buildConfig = if debug then "DEBUG" else "RELEASE";
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Qunused-arguments";
env.PYTHON_COMMAND = "python3";
diff --git a/pkgs/development/compilers/edk2/default.nix b/pkgs/development/compilers/edk2/default.nix
index 41189be5dbd2..878d3f756838 100644
--- a/pkgs/development/compilers/edk2/default.nix
+++ b/pkgs/development/compilers/edk2/default.nix
@@ -116,7 +116,7 @@ edk2 = buildStdenv.mkDerivation {
buildPhase = ''
runHook preBuild
- build -a ${targetArch} -b RELEASE -t ${buildType} -p ${projectDscPath} -n $NIX_BUILD_CORES $buildFlags
+ build -a ${targetArch} -b ${attrs.buildConfig or "RELEASE"} -t ${buildType} -p ${projectDscPath} -n $NIX_BUILD_CORES $buildFlags
runHook postBuild
'';