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