VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/PlatformCI/ReadMe.md@ 109019

Last change on this file since 109019 was 108794, checked in by vboxsync, 4 weeks ago

Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, bugref:4643

  • Property svn:eol-style set to native
File size: 5.6 KB
Line 
1# OvmfPkg - Platform CI
2
3This ReadMe.md describes the Azure DevOps based Platform CI for OvmfPkg and how
4to use the same Pytools based build infrastructure locally.
5
6## Supported Configuration Details
7
8This solution for building and running OvmfPkg has only been validated with Windows 10
9with VS2022 and Ubuntu 18.04 with GCC5 toolchain. Four different firmware builds are
10supported and are described below.
11
12| Configuration name | Architectures | DSC File |Additional Flags |
13| :---- | :----- | :---- | :---- |
14| IA32 | IA32 | OvmfPkgIa32.dsc | None |
15| X64 | X64 | OvmfPkgIa64.dsc | None |
16| IA32 X64 | PEI-IA32 DXE-X64 | OvmfPkgIa32X64.dsc | None |
17| IA32 X64 Full | PEI-IA32 DXE-X64 | OvmfPkgIa32X64.dsc | SECURE_BOOT_ENABLE=1 SMM_REQUIRE=1 TPM1_ENABLE=1 TPM2_ENABLE=1 NETWORK_TLS_ENABLE=1 NETWORK_IP6_ENABLE=1 NETWORK_HTTP_BOOT_ENABLE=1 |
18
19## EDK2 Developer environment
20
21![Minimum Python Version](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Ftianocore%2Fedk2-pytool-extensions%2Frefs%2Fheads%2Fmaster%2Fpyproject.toml&query=%24.%5B'requires-python'%5D&style=for-the-badge&logo=python&logoColor=ffd343&label=Minimum%20Python%20Version%20for%20CI&color=3776ab&link=https%3A%2F%2Fwww.python.org%2Fdownloads%2F)
22
23- [GIT - Download & Install](https://git-scm.com/download/)
24- [QEMU - Download, Install, and add to your path](https://www.qemu.org/download/)
25- [Edk2 Source](https://github.com/tianocore/edk2)
26- Additional packages found necessary for Ubuntu 18.04
27 - apt-get install gcc g++ make uuid-dev
28
29Note: edksetup, Submodule initialization and manual installation of NASM, iASL, or
30the required cross-compiler toolchains are **not** required, this is handled by the
31Pytools build system.
32
33## Building with Pytools for OvmfPkg
34
35If you are unfamiliar with Pytools, it is recommended to first read through
36the generic set of edk2 [Build Instructions](https://github.com/tianocore/tianocore.github.io/wiki/Build-Instructions).
37
381. [Optional] Create a Python Virtual Environment - generally once per workspace
39
40 ``` bash
41 python -m venv <name of virtual environment>
42 ```
43
442. [Optional] Activate Virtual Environment - each time new shell opened
45 - Linux
46
47 ```bash
48 source <name of virtual environment>/bin/activate
49 ```
50
51 - Windows
52
53 ``` bash
54 <name of virtual environment>/Scripts/activate.bat
55 ```
56
573. Install Pytools - generally once per virtual env or whenever pip-requirements.txt changes
58
59 ``` bash
60 pip install --upgrade -r pip-requirements.txt
61 ```
62
634. Initialize & Update Submodules - only when submodules updated
64
65 ``` bash
66 stuart_setup -c OvmfPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
67 ```
68
695. Initialize & Update Dependencies - only as needed when ext_deps change
70
71 ``` bash
72 stuart_update -c OvmfPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
73 ```
74
756. Compile the basetools if necessary - only when basetools C source files change
76
77 ``` bash
78 python BaseTools/Edk2ToolsBuild.py -t <ToolChainTag>
79 ```
80
817. Compile Firmware
82 - To build IA32
83
84 ``` bash
85 stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -a IA32 TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG>
86 ```
87
88 - To build X64
89
90 ``` bash
91 stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -a X64 TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG>
92 ```
93
94 - To build IA32 X64
95
96 ``` bash
97 stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -a IA32,X64 TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG>
98 ```
99
100 - use `stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py -h` option to see additional
101 options like `--clean`
102
1038. Running Emulator
104 - You can add `--FlashRom` to the end of your build command and the emulator will run after the
105 build is complete.
106 - or use the `--FlashOnly` feature to just run the emulator.
107
108 ``` bash
109 stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH> --FlashOnly
110 ```
111
112### Notes
113
1141. Configuring *ACTIVE_PLATFORM* and *TARGET_ARCH* in Conf/target.txt is **not** required. This
115 environment is set by PlatformBuild.py based upon the `[-a <TARGET_ARCH>]` parameter.
1162. QEMU must be on your path. On Windows this is a manual process and not part of the QEMU installer.
117
118**NOTE:** Logging the execution output will be in the normal stuart log as well as to your console.
119
120### Custom Build Options
121
122**MAKE_STARTUP_NSH=TRUE** will output a *startup.nsh* file to the location mapped as fs0. This is
123used in CI in combination with the `--FlashOnly` feature to run QEMU to the UEFI shell and then execute
124the contents of *startup.nsh*.
125
126**QEMU_HEADLESS=TRUE** Since CI servers run headless QEMU must be told to run with no display otherwise
127an error occurs. Locally you don't need to set this.
128
129### Passing Build Defines
130
131To pass build defines through _stuart_build_, prepend `BLD_*_`to the define name and pass it on the
132command-line. _stuart_build_ currently requires values to be assigned, so add an`=1` suffix for bare defines.
133For example, to enable the TPM2 support, instead of the traditional "-D E1000_ENABLE", the stuart_build
134command-line would be:
135
136`stuart_build -c OvmfPkg/PlatformCI/PlatformBuild.py BLD_*_E1000_ENABLE=1`
137
138## References
139
140- [Installing and using Pytools](https://github.com/tianocore/edk2-pytool-extensions/blob/master/docs/using.md#installing)
141- More on [python virtual environments](https://docs.python.org/3/library/venv.html)
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette