-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and Run support for a Dfci Enabled Device Under Test (#489)
## Description Fixes #470. PRE-REQ. This PR requires the following PR's before this one will work correctly: #473 #471 microsoft/mu_feature_dfci#84 This PR will have to bump DfciPkg to include PR 84 above before it is completed. This change adds the prereqs for DFCI - that is, platform specific libraries required to interface between DFCI and a particular platform. The required DFCI libraries are in PR 471. A convenience PR for booting to FrontPage or with certain USB device mounted is also require (PR 473). - [x] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [x] Includes documentation? ## How This Was Tested With all of the prerequisites included, a Q35 Virtual System was used to run the Dfci End to End UnitTest with satisfactory results. That is, all of the test cases ran will full success except Dfci_IntuneSettings - which exhibits some know errors. This is not fixed due to another pending change. ## Integration Instructions N/A
- Loading branch information
1 parent
3c7273a
commit a5f312d
Showing
4 changed files
with
160 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## | ||
# This command make it easier to build with DFCI enabled and match the parameters with RunDfci.py. | ||
# | ||
# See the ReadMe.md file in this directory on how to use the BuildDfci script. | ||
# | ||
# Copyright (c) Microsoft Corporation | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
## | ||
|
||
if __name__ == "__main__": | ||
import os | ||
from pathlib import Path | ||
|
||
dfci_directory = Path(__file__).parent.absolute() | ||
build_directory = dfci_directory.parent.absolute() | ||
platformbuild = os.path.join(build_directory, "Platforms", "QemuQ35Pkg", "PlatformBuild.py") | ||
|
||
args = " BLD_*_GUI_FRONT_PAGE=TRUE" | ||
args += " BLD_*_NETWORK_ALLOW_HTTP_CONNECTIONS=TRUE" | ||
args += " BLD_*_QEMU_CORE_NUM=4" | ||
args += " BLD_*_SMM_ENABLED=TRUE" | ||
args += " --clean" | ||
|
||
cmd = platformbuild + args | ||
os.system(cmd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
## | ||
# This command make it easier to boot to a Windows device under test. | ||
# | ||
# See the ReadMe.md file in this directory on how to use the RunDfci script. | ||
# | ||
# Copyright (c) Microsoft Corporation | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
## | ||
|
||
if __name__ == "__main__": | ||
import os | ||
import argparse | ||
from pathlib import Path | ||
|
||
parser = argparse.ArgumentParser(description='Start Qemu with DFCI Options') | ||
|
||
# Add a usb drive with OS Install Files, or Dfci Setup files | ||
parse_group = parser.add_mutually_exclusive_group() | ||
parse_group.add_argument("-f", "--frontpage", dest="frontpage", action='store_true', help="Boot to FrontPage") | ||
parse_group.add_argument("-a", "--alt_boot", dest="alt_boot", action='store_true', help="Boot to Alternate source (USB/Network)") | ||
|
||
# Choose to boot to front page, or a usb/network device. | ||
parse_group2 = parser.add_mutually_exclusive_group() | ||
parse_group2.add_argument("-i", "--install", dest="install", action='store_true', help="Add drive with install files") | ||
parse_group2.add_argument("-d", "--dfcisetup", dest="dfcisetup", action='store_true', help="Add DfciSetup directory") | ||
|
||
options = parser.parse_args() | ||
|
||
dfci_directory = Path(__file__).parent.absolute() | ||
build_directory = dfci_directory.parent.absolute() | ||
|
||
platformbuild = os.path.join(build_directory, "Platforms", "QemuQ35Pkg", "PlatformBuild.py") | ||
|
||
dfci_var_store = os.path.join(dfci_directory, "DFCI_DUT_VARS.fd") | ||
|
||
args = " --FlashOnly" | ||
args += " DFCI_VAR_STORE=" + "\"" + dfci_var_store + "\"" | ||
|
||
dfci_files = None | ||
install_files = None | ||
if options.install: | ||
install_files = os.path.join(dfci_directory, "OsInstallFiles.vhd") | ||
args += " INSTALL_FILES=" + "\"" + install_files + "\"" | ||
|
||
if options.dfcisetup: | ||
dfci_files = os.path.join(dfci_directory, "DfciSetup") | ||
args += " DFCI_FILES=" + "\"" + dfci_files + "\"" | ||
|
||
dfci_os_disk = os.path.join(dfci_directory, "Windows.vhd") | ||
|
||
if not os.path.exists(dfci_os_disk): | ||
raise Exception("The Windows.vhd file must exist") | ||
|
||
args += " PATH_TO_OS=" + "\"" + dfci_os_disk + "\"" | ||
|
||
if options.frontpage: | ||
args += " BOOT_TO_FRONT_PAGE=TRUE" | ||
|
||
if options.alt_boot: | ||
args += " ALT_BOOT_ENABLE=TRUE" | ||
|
||
args += " BLD_*_QEMU_CORE_NUM=4" | ||
args += " BLD_*_SMM_ENABLED=TRUE" | ||
|
||
cmd = platformbuild + args | ||
os.system(cmd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters