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