Skip to content

Commit 7e69b81

Browse files
authored
QemuSbsaPkg: Add toggle for Windows support (#223) (#1388)
1 parent 9584ad3 commit 7e69b81

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

Platforms/QemuSbsaPkg/PlatformBuild.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131

3232
cached_enivron = os.environ.copy()
3333

34+
# This constant is used to indicate if the prebuilt HAF / TF-A binaries are in sync with the source code.
35+
# When the TF-A source code is updated in a way that is not compatible with the existing prebuilts, this should be set
36+
# to False, which ensures that HAF / TF-A will be build from source if supported. On Windows, TF-A cannot be built from
37+
# source, so the platform build will be skipped with a warning.
38+
HAF_TFA_EXTDEP_BINS_CURRENT = True
39+
3440
# Declare test whose failure will not return a non-zero exit code
3541
FAILURE_EXEMPT_TESTS = {
3642
# example "PiValueTestApp.efi": datetime.datetime(3141, 5, 9, 2, 6, 53, 589793),
@@ -323,7 +329,22 @@ def SetPlatformEnv(self):
323329
self.env.SetValue("CONF_AUTOGEN_INCLUDE_PATH", self.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath("QemuSbsaPkg", "Include"), "Platform Defined")
324330
self.env.SetValue("MU_SCHEMA_DIR", self.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath("QemuSbsaPkg", "CfgData"), "Platform Defined")
325331
self.env.SetValue("MU_SCHEMA_FILE_NAME", "QemuSbsaPkgCfgData.xml", "Platform Hardcoded")
326-
self.env.SetValue("HAF_TFA_BUILD", "FALSE", "Platform Hardcoded")
332+
self.env.SetValue("HAF_TFA_BUILD", "FALSE", "Platform Hardcoded", overridable=True)
333+
334+
# If HAF/TF-A binaries are not in sync, and we are on Windows, exit without building the platform because we
335+
# cannot compile TF-A on Windows. Otherwise, (if on Linux) we force the build of TF-A to ensure the binaries
336+
# are in sync.
337+
if not HAF_TFA_EXTDEP_BINS_CURRENT:
338+
if GetHostInfo().os == "Windows":
339+
logging.warning("Prebuilt TF-A binaries are no longer in sync with source code and cannot be built on Windows.")
340+
logging.warning("Only linux hosts are currently supported until the prebuilts can be updated.")
341+
logging.warning("Skipping build.")
342+
self.SkipPreBuild = True
343+
self.SkipBuild = True
344+
self.SkipPostBuild = True
345+
self.FlashImage = False
346+
else:
347+
self.env.SetValue("HAF_TFA_BUILD", "TRUE", "Hardcoded due to TF-A prebuilts being out of date.")
327348

328349
if self.Helper.generate_secureboot_pcds(self) != 0:
329350
logging.error("Failed to generate include PCDs")

0 commit comments

Comments
 (0)