1 | # ArmVirtPkg - Platform CI
|
---|
2 |
|
---|
3 | This Readme.md describes the Azure DevOps based Platform CI for ArmVirtPkg and how
|
---|
4 | to use the same Pytools based build infrastructure locally.
|
---|
5 |
|
---|
6 | ## Supported Configuration Details
|
---|
7 |
|
---|
8 | This solution for building and running ArmVirtPkg has been validated with Fedora
|
---|
9 | 37 Linux and the GCC5 toolchain. The following different firmware builds are
|
---|
10 | supported.
|
---|
11 |
|
---|
12 | | Configuration name | Architecture | DSC File | Additional Flags |
|
---|
13 | | :---------- | :----- | :----- | :---- |
|
---|
14 | | AARCH64 - KVM Cloud HV | AARCH64 | ArmVirtCloudHv.dsc | None |
|
---|
15 | | ARM - KVM Cloud HV | ARM | ArmVirtCloudHv.dsc | None |
|
---|
16 | | AARCH64 - kvmtool | AARCH64 | ArmVirtKvmTool.dsc | None |
|
---|
17 | | ARM - kvmtool | ARM | ArmVirtKvmTool.dsc | None |
|
---|
18 | | AARCH64 - QEMU | AARCH64 | ArmVirtQemu.dsc | None |
|
---|
19 | | ARM - QEMU | ARM | ArmVirtQemu.dsc | None |
|
---|
20 | | AARCH64 - QEMU Kernel | AARCH64 | ArmVirtQemuKernel.dsc | None |
|
---|
21 | | ARM - QEMU Kernel | ARM | ArmVirtQemuKernel.dsc | None |
|
---|
22 | | AARCH64 - Xen HV | AARCH64 | ArmVirtXen.dsc | None |
|
---|
23 | | ARM - Xen HV | ARM | ArmVirtXen.dsc | None |
|
---|
24 |
|
---|
25 | ## EDK2 Developer environment
|
---|
26 |
|
---|
27 | - [Python 3.12.x - Download & Install](https://www.python.org/downloads/)
|
---|
28 | - [GIT - Download & Install](https://git-scm.com/download/)
|
---|
29 | - [QEMU - Download, Install, and add to your path](https://www.qemu.org/download/)
|
---|
30 | - [Edk2 Source](https://github.com/tianocore/edk2)
|
---|
31 | - Additional packages found necessary for Fedora Linux 37
|
---|
32 | - dnf install gcc g++ make libuuid-devel
|
---|
33 |
|
---|
34 | Note: edksetup, Submodule initialization and manual installation of NASM, iASL, or
|
---|
35 | the required cross-compiler toolchains are **not** required, this is handled by the
|
---|
36 | Pytools build system.
|
---|
37 |
|
---|
38 | The code is built in CI using a container. The latest Fedora Linux 37 container is
|
---|
39 | available in this GitHub container registry feed
|
---|
40 | [fedora-37-test](https://github.com/tianocore/containers/pkgs/container/containers%2Ffedora-37-test).
|
---|
41 |
|
---|
42 | The exact container version tested in CI is maintained in this file
|
---|
43 | [edk2/.azurepipelines/templates/default.yml](https://github.com/tianocore/edk2/blob/HEAD/.azurepipelines/templates/defaults.yml).
|
---|
44 |
|
---|
45 | ## Building with Pytools for ArmVirtPkg
|
---|
46 |
|
---|
47 | If you are unfamiliar with Pytools, it is recommended to first read through
|
---|
48 | the generic set of edk2 [Build Instructions](https://github.com/tianocore/tianocore.github.io/wiki/Build-Instructions).
|
---|
49 |
|
---|
50 | 1. [Optional] Create a Python Virtual Environment - generally once per workspace
|
---|
51 |
|
---|
52 | ``` bash
|
---|
53 | python -m venv <name of virtual environment>
|
---|
54 | ```
|
---|
55 |
|
---|
56 | 2. [Optional] Activate Virtual Environment - each time new shell opened
|
---|
57 | - Windows
|
---|
58 |
|
---|
59 | ``` bash
|
---|
60 | <name of virtual environment>/Scripts/activate.bat
|
---|
61 | ```
|
---|
62 |
|
---|
63 | - Linux
|
---|
64 |
|
---|
65 | ```bash
|
---|
66 | source <name of virtual environment>/bin/activate
|
---|
67 | ```
|
---|
68 |
|
---|
69 | 3. Install Pytools - generally once per virtual env or whenever pip-requirements.txt changes
|
---|
70 |
|
---|
71 | ``` bash
|
---|
72 | pip install --upgrade -r pip-requirements.txt
|
---|
73 | ```
|
---|
74 |
|
---|
75 | 4. Initialize & Update Submodules - only when submodules updated (QEMU build example)
|
---|
76 |
|
---|
77 | ``` bash
|
---|
78 | stuart_setup -c ArmVirtPkg/PlatformCI/QemuBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
|
---|
79 | ```
|
---|
80 |
|
---|
81 | 5. Initialize & Update Dependencies - only as needed when ext_deps change (QEMU build example)
|
---|
82 |
|
---|
83 | ``` bash
|
---|
84 | stuart_update -c ArmVirtPkg/PlatformCI/QemuBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
|
---|
85 | ```
|
---|
86 |
|
---|
87 | 6. Compile the basetools if necessary - only when basetools C source files change
|
---|
88 |
|
---|
89 | ``` bash
|
---|
90 | python BaseTools/Edk2ToolsBuild.py -t <ToolChainTag>
|
---|
91 | ```
|
---|
92 |
|
---|
93 | 7. Compile Firmware (QEMU build example)
|
---|
94 |
|
---|
95 | ``` bash
|
---|
96 | stuart_build -c ArmVirtPkg/PlatformCI/QemuBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>
|
---|
97 | ```
|
---|
98 |
|
---|
99 | - use `stuart_build -c ArmVirtPkg/PlatformCI/QemuBuild.py -h` option to see additional
|
---|
100 | options like `--clean`
|
---|
101 |
|
---|
102 | 8. Running Emulator
|
---|
103 | - You can add `--FlashRom` to the end of your build command and the emulator will run after the
|
---|
104 | build is complete.
|
---|
105 | - or use the `--FlashOnly` feature to just run the emulator.
|
---|
106 |
|
---|
107 | ``` bash
|
---|
108 | stuart_build -c ArmVirtPkg/PlatformCI/QemuBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH> --FlashOnly
|
---|
109 | ```
|
---|
110 |
|
---|
111 | ### Notes
|
---|
112 |
|
---|
113 | 1. Including the expected build architecture and toolchain to the _stuart_update_ command is critical.
|
---|
114 | This is because there are extra scopes and tools that will be resolved during the update step that
|
---|
115 | need to match your build step.
|
---|
116 | 2. Configuring *ACTIVE_PLATFORM* and *TARGET_ARCH* in Conf/target.txt is **not** required. This
|
---|
117 | environment is set by PlatformBuild.py based upon the `[-a <TARGET_ARCH>]` parameter.
|
---|
118 | 3. QEMU must be on your path. On Windows this is a manual process and not part of the QEMU installer.
|
---|
119 |
|
---|
120 | **NOTE:** Logging the execution output will be in the normal stuart log as well as to your console.
|
---|
121 |
|
---|
122 | ### Custom Build Options
|
---|
123 |
|
---|
124 | **MAKE_STARTUP_NSH=TRUE** will output a *startup.nsh* file to the location mapped as fs0. This is
|
---|
125 | used in CI in combination with the `--FlashOnly` feature to run QEMU to the UEFI shell and then execute
|
---|
126 | the contents of *startup.nsh*.
|
---|
127 |
|
---|
128 | **QEMU_HEADLESS=TRUE** Since CI servers run headless QEMU must be told to run with no display otherwise
|
---|
129 | an error occurs. Locally you don't need to set this.
|
---|
130 |
|
---|
131 | ### Passing Build Defines
|
---|
132 |
|
---|
133 | To pass build defines through _stuart_build_, prepend `BLD_*_`to the define name and pass it on the
|
---|
134 | command-line. _stuart_build_ currently requires values to be assigned, so add an`=1` suffix for bare defines.
|
---|
135 | For example, to enable the TPM2 support, instead of the traditional "-D TPM2_ENABLE=TRUE", the stuart_build
|
---|
136 | command-line would be:
|
---|
137 |
|
---|
138 | `stuart_build -c ArmVirtPkg/PlatformCI/QemuBuild.py BLD_*_TPM2_ENABLE=TRUE`
|
---|
139 |
|
---|
140 | ## References
|
---|
141 |
|
---|
142 | - [Installing and using Pytools](https://github.com/tianocore/edk2-pytool-extensions/blob/master/docs/using.md#installing)
|
---|
143 | - More on [python virtual environments](https://docs.python.org/3/library/venv.html)
|
---|