archrelease: copy trunk to extra-x86_64
[arch-packages.git] / edk2 / repos / extra-any / PKGBUILD
blobf1d42cdee1d72fa64fb9e00b657ba5619cb564d6
1 # Maintainer: David Runge <dvzrv@archlinux.org>
2 # Contributor: Alexander Epaneshnikov <alex19ep@archlinux.org>
4 _brotli_ver=1.0.9
5 _openssl_ver=1.1.1s
6 pkgbase=edk2
7 pkgname=(edk2-arm edk2-aarch64 edk2-shell edk2-ovmf)
8 pkgver=202302
9 _commit=f80f052277c88a67c55e107b550f504eeea947d3  # refs/tags/edk2-stable202302
10 pkgrel=1
11 pkgdesc="Modern, feature-rich firmware development environment for the UEFI specifications"
12 arch=(any)
13 url="https://github.com/tianocore/edk2"
14 license=(BSD)
15 makedepends=(
16   aarch64-linux-gnu-gcc
17   arm-none-eabi-gcc
18   acpica
19   git
20   iasl
21   util-linux-libs
22   nasm
23   python
24   seabios
26 options=(!makeflags)
27 source=(
28   git+$url#tag=$_commit
29   $pkgbase-softfloat::git+https://github.com/ucb-bar/berkeley-softfloat-3.git
30   https://www.openssl.org/source/openssl-$_openssl_ver.tar.gz{,.asc}
31   https://github.com/google/brotli/archive/v$_brotli_ver/brotli-$_brotli_ver.tar.gz
32   50-edk2-ovmf-i386-secure.json
33   50-edk2-ovmf-i386-secure-4m.json
34   50-edk2-ovmf-x86_64-secure.json
35   50-edk2-ovmf-x86_64-secure-4m.json
36   60-edk2-ovmf-i386.json
37   60-edk2-ovmf-i386-4m.json
38   60-edk2-ovmf-x86_64.json
39   60-edk2-ovmf-x86_64-4m.json
40   60-edk2-ovmf-microvm.json
41   60-edk2-ovmf-microvm-4m.json
42   60-edk2-aarch64.json
43   60-edk2-arm.json
44   70-edk2-ovmf-i386-csm.json
45   70-edk2-ovmf-i386-csm-4m.json
46   70-edk2-ovmf-x86_64-csm.json
47   70-edk2-ovmf-x86_64-csm-4m.json
48   80-edk2-ovmf-ia32-on-x86_64-secure.json
49   80-edk2-ovmf-ia32-on-x86_64-secure-4m.json
50   81-edk2-ovmf-ia32-on-x86_64.json
51   81-edk2-ovmf-ia32-on-x86_64-4m.json
52   82-edk2-ovmf-ia32-on-x86_64-csm.json
53   82-edk2-ovmf-ia32-on-x86_64-csm-4m.json
54   $pkgbase-202202-brotli.patch
56 sha512sums=('SKIP'
57             'SKIP'
58             '2ef983f166b5e1bf456ca37938e7e39d58d4cd85e9fc4b5174a05f5c37cc5ad89c3a9af97a6919bcaab128a8a92e4bdc8a045e5d9156d90768da8f73ac67c5b9'
59             'SKIP'
60             'b8e2df955e8796ac1f022eb4ebad29532cb7e3aa6a4b6aee91dbd2c7d637eee84d9a144d3e878895bb5e62800875c2c01c8f737a1261020c54feacf9f676b5f5'
61             '9182615c6f89e4f3c19f1b0f4434aa0a3293f982cf3ed783a2c140c2555d824b417c7c3c7a00ad10616188507f5068226c720b20ffd41d44449605ba0844bad2'
62             '53604279dea69000cb036062d9617f1c7dc5ce3d83fbcb066b9087e4f412c2ea24ae3a37436ab17d5bf9dd6b2da380933c48400163d4b9fde65ea42d37956d5e'
63             'e2e5f3eabb3ced681385ed9d57a3aa83e2155415ea6fd2c16eb15c5a1e685f92e90f1c6f270c1c8da23dde3a0e4a085399f65038b799430c713d1628eb44ac07'
64             'c1f83b3c5f5c43803d4bb1084f6ebdd1987364cab59945a8226a8cf1229daba79c83f638c0a1395ea56acffbd4349b94459659705743a397ff03369b7794a1c6'
65             '25df19b698081c7a21e4c5f37321150ab2f144f4888d887513c3ed926a844909cee390d3e5d80b02c084510074c874b21db3b3d119330342cf8877197ef0a425'
66             'c886b3d6e5f23833c2dc9f8c9f3b21523c680dd2c6bfebbb488f54619d31e53d4019b05b4e1a3dc91abd6e0cab4540d750a2db1b9b4dcf8257e4ba9a2b9b487a'
67             '99f5dcdbc54824976f51c45b939e8bcb4971a70dc2d50b24233d3125ce6cf687f92b8d3896d72280470a2c001637920da8d6e33d576c489beb7f0e898bfb22ab'
68             '9da9de6717b610a181be8f7b34b379a56a1fa31f945f78198eec52359abd178bdf77fda4426157992e64329f53a204af042d5145cb5d3b4b1203915a48815449'
69             'a86e294e5904f52441b86da220f37cc693d7066f7fcb75dafc472a3a72516e865c213be6d0ce245ec5dd680ca9272429d39dca4db4f3e6434b12c479227bc4b0'
70             'b17d3ff5c9230c394ca4ee8229842c801b0cab3d88b546f2094dd0b42f2bc535f5bda3f9faee4b5418482185887648f906daaf0b7307c4c19747f5f0ab504f9a'
71             '126822ef6198e87fb38014a5ba21969c9a163b41df3cdef6825317971ecc8df4a63099113e687634b88648acc93f24917d729e1c44295d2df7012288740307d3'
72             'bbf663d539a985504d5fbc95552a2a60ac860a6bce4a62ecc551292d838b41cba3b5203f580a76a05e9f862ef98e7a3e5da39505c1f39d8ef48c08778fac584a'
73             'b5829aaf5ebae0073de26695eddbda61d117fbfb5e3c9f169fade31127ceb9bbc332af760bf6033d90a277d44c095fc30fe0d69defd81fb1aaf82cba0cf6fb90'
74             '2e03935b57fabbbac4493ba6d54ac5b68abfd75775a56c95f5ba8c4627ba38260a3691a335e597c65096c50ce5038389efbb41ef5822a1ff49a8f312d8e37f75'
75             '6e91029d451c9d43c1488ce0e252e6abc18fb1da48b6938d6ae3644fce58c97da6fff6addc60740b1b9ed5e6b86e9d7e94ee0dd55ea73833a82401b4c6f8c936'
76             '69ec9e9288aad64b585bbffa8566a96a43791c4f899b9e9ba4858645ffe667423cd875ec8d6bed742cc1b1a9e96c8dd81609ff0f48da86b415ecf8cf8089cac2'
77             'cebf9c2cfe8ea7007c68112b4e64d61a98a1637d4b51bceefa22a205e57bb947c757cea8dcc2d01961d8b72b4f289f692d4034d3c38f062e06941b2cc4586377'
78             '95661c2182112a76652507de84b7d0f9bb0d21f6b3b62134952bd7aada8df5cfc727658d11b71a7780a22049d9cafc4361d9a1d515b68d1463e7082465fd4f7e'
79             '8ed6d1d749c3471421a02c41e0e8c3e1ceb62ca6bc09cf2bc85055e2b2661bc149a77b83f480af1aec2f9a948971c6b5aebc92fbc112508fc6293cc6edc7a8a7'
80             'c9dbe7b2b6b8c18b7b8fdfef5bc329d9142c442f2f3dbae3ca4919255dcaf2ab576cd305648228d5dd48040ca3b14f44ee33b05cb6ca13b49e2836947b78ea53'
81             '692e5bdefb61ae7b8d6e2063f163e2b68136b2522d606806766186f10c5fae1f7583fd83cda52c235d0d8eb0651e5a711f505021a8d8d949d8dccfce7f0c82ac'
82             'c699ad500f24569643a4581f4bb5be0e4a90d160f0b3ae7728cf8e27b39665983b80439ca7b853b1bd9a174c8c123cbaf7ed3cd4a17d6460f4fec670c62a1183'
83             'd074c794796d17d77eed7c34201d93d7ef3f1322fe1ea4a2ddd7137fae884d49f94f465ee39cfd8346b026142668a41f5a8671e521409505dd6d002f71c0eebc')
84 b2sums=('SKIP'
85         'SKIP'
86         'ecd19eaf84dbc80448b51651abe52a89cc0052f024537959c4ebe61528988f235d661244fce6967159a876dd038c817bad19df742e828ca1cbae97ce6a4124bb'
87         'SKIP'
88         '8b9939d5224396ef33b43e019250ba4bc8949903583615e8dc02c85340fc0a1e2d1632161e00b0ee7355d77f05529ac772f482e05d2089afd71a0bf71e803904'
89         '98742b83c2d605772a1bfa64ee434430413516db13d80235f0bc0be3a0e930aa17d737a6d2c95ce3d60f33de9f93679e09f421632d9e3fc9575d662fcf198f4b'
90         'ee28940a8d13a7badf94bcceebd4371c79cd0194ca9f984f39cd75ee64f1ba53059d81f5826c6b5a564d50dce7b9fb5fe8d63ee8d38d38462bc070249124a16b'
91         '8dfd44f35d35d699bb12eef771b08b978cf38ba64494b0eb8c153c72493d47c2d71445869c8d9115c29b28cd206f31be27b43024bd8796a50c8c41a67f87a859'
92         'b9a488c2a6295f3d8eab80150dbfa7acea94720b08928d4e6a4613189fe24922f6c40e1ae8c9856ebb1bc31586ecfb1e02e099a11f7abde575d1f9aa78cc732d'
93         '0a30e819e63b09207c664beca8845f73fb43482d19e831c7f915755594eeafcfc8dccb842f819fb7d20215d87452da31943488e201b9690b733db8169870afcc'
94         'd5d3dc38bf8a09473075a2dd8ab4adcd3af80be30c0ae49fbf55f478b8e0d9a1fde90abceda7099ed3136ee9cadee406bef949a17a070be1b92250adb14c1a7c'
95         'aa1144f31bd391e09d2bf0f55d6cb7a50fab38eca5967989463d58f2931267f7499414709c9692335376f8834b513d69249d995fdc9e90429eadd287348d57e8'
96         '56562116024236f6bb5590fff241d47568a9c1755faa25a62011e8fa3f14b7d74014651b421f5a0c6fb269fb6c05f23b97a5b1ed13929e8141e1c3839f784a5b'
97         'f55e220c6d6a8733bd9233115453e9aca10af91e4cd93be438b4951049198228bdd1b6765b2eae2a781cf3e90beab9b14540c9165ab76af38b9db35b09dde947'
98         '01dbc4cad102535504eace2d9da225a481b62785d37365f1dea2d1210990ca6177485aa0134a074c09d253b539f12ae810706a77a46779ddb7dd4f1b9b934011'
99         'f84ff505702e4b2a38b6fd23fbb732c25d3102a04bb6918b0cc3b3d7528a92626324199cea4ed91955aade98f308f1d1037255f26cc9ee21ace75fc6376e7df6'
100         '04a7eb373d6ea1415d7cd6e8dea0d16b75cbb1fb88572a30b8ce9960dd0404adc7f25fce2ccfb103eb09405411dc4d4e0084236e4c814916d81e957dc6aedfd4'
101         'b4fcc2351b2d77b85cdce35180353aef06900af1554479853bf915d27a756d4bbed50a50e85b72e2e7f4868e6dec3b9c5b27f743d7c112e24e4e0c50cd103a33'
102         '1783b83c6e39c99feb59043c3cff48b24bef55d43949cd9a3097dfbee73a6cf511c180d610a52de876ccea9833fec46d7a88ebce8114e54620b9988232fb9bcc'
103         '1d76eda20067c1bb9928b0304244ab5770a9c4e1f401a74d51da31a47f3a5d6e1e64b5394768cdae6a5bc396b68b6a32eb1a407e1c6377461dd2d5f2f5a2538d'
104         '1debba4546e7cc7d758302a1b5aa3d0a874f39b046beac60e36ecf8aaf8a7690c97508f81fd40eaea807bdd8f4d6c8284e72d6bd61b0791db144a6adcc13ccbf'
105         'c54eb05090280af70ceb44b601752ec38ca80d2af232385cf5ddd6f95ea0504d00a2dd2c82828aa07c41fb456fbb6f174b8bf89b851061206328ae66e589dd2a'
106         'b53bbe532f9a7583bfbcc9436f2172f2dcaa75177c1480753a2a60d97a2fbd5bfb86b97b3f7c27d82e88eb2035c6607abb7e35d39a42e6a2d40c0b54d7c430ef'
107         'dc9a98b8b6d6d8cc2f3aa2b314ba521a2fa8110abf199ca2a6c612ba53df3adad89e5ae0e4cfbe8f5ebf2cefd3cda1716d19f90304a138630f0b8d6e36cd4d10'
108         '0c1e145109de9a25339633b563e47f6c09ea314f636023d09a58559a499dd0bd283a45e050fc99fe34c4d712bd00a035064fa8406734d57029c67b9adb4b11ce'
109         '0ad956e3e662909abafd0b9a2b7ef12e35a8832183cb41e17dcafaa4f5db1e47ef20b3040268644daebb24f66c18b99de07f41e7d62089691c07de688a08f05a'
110         'a44b5ffc35d78925ac7362ec2cf75475d02e05ed0b9e8771c909d090187aaff7436e8d856d58b8a56827990006b813c63318b60a8a7780844c829a2b13a502cf'
111         '644c071dc4fbbccaa64b0b1babcad60395ffce1a7a317a6f5380eff44cbb886be5f29156a8e967ab02b508a33954fcf5602606b43362cc3bb1936a8cfc3a3c07')
112 validpgpkeys=(
113   8657ABB260F056B1E5190839D9C4D26D0E604491  # Matt Caswell <matt@openssl.org>
114   7953AC1FBC3DC8B3B292393ED5E9E43F7DF9EE8C  # Richard Levitte <richard@levitte.org>
115   A21FAB74B0088AA361152586B8EF1A6BA9DA2D5C  # Tomáš Mráz <tm@t8m.info>
117 _arch_list=(ARM AARCH64 IA32 X64)
118 _build_type=RELEASE
119 _build_plugin=GCC5
121 pkgver() {
122   cd $pkgbase
123   git describe --tags --abbrev=7 | sed 's/^edk2-stable//;s/\([^-]*-g\)/r\1/;s/-/./g'
126 prepare() {
127   # patch to be able to use brotli 1.0.9
128   patch -Np1 -d $pkgbase -i ../$pkgbase-202202-brotli.patch
130   cd $pkgbase
132   # revert commit which breaks microvm blobs: https://github.com/tianocore/edk2/commit/173a7a7daaad560cd69e1000faca1d2b91774c46
133   git revert -n 173a7a7daaad560cd69e1000faca1d2b91774c46
135   git submodule init
136   git submodule deinit BaseTools/Source/C/BrotliCompress/brotli
137   git submodule deinit CryptoPkg/Library/OpensslLib/openssl
138   git submodule deinit MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
139   git submodule deinit MdeModulePkg/Universal/RegularExpressionDxe/oniguruma
140   git submodule deinit RedfishPkg/Library/JsonLib/jansson
141   git submodule deinit UnitTestFrameworkPkg/Library/CmockaLib/cmocka
142   git submodule deinit UnitTestFrameworkPkg/Library/GoogleTestLib/googletest
143   git config submodule.SoftFloat "$srcdir/$pkgbase-softfloat"
144   git -c protocol.file.allow=always submodule update
146   # symlinking openssl into place
147   rm -rfv CryptoPkg/Library/OpensslLib/openssl
148   ln -sfv "$srcdir/openssl-$_openssl_ver" CryptoPkg/Library/OpensslLib/openssl
150   # symlinking brotli into place
151   rm -rfv BaseTools/Source/C/BrotliCompress/brotli MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
152   ln -sfv "$srcdir/brotli-$_brotli_ver" BaseTools/Source/C/BrotliCompress/brotli
153   ln -sfv "$srcdir/brotli-$_brotli_ver" MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
155   # -Werror, not even once
156   sed -e 's/ -Werror//g' -i BaseTools/Conf/*.template BaseTools/Source/C/Makefiles/*.makefile
158   # copy seabios's CSM binary into place, so that it can be included in the binaries:
159   cp -v /usr/share/qemu/bios-csm.bin OvmfPkg/Csm/Csm16/Csm16.bin
162 # TODO: check TPM_ENABLE/TPM2_ENABLE
163 build() {
164   local _arch
165   local _build_options=()
166   # shared targets for all
167   local _common_args=(
168     -b "$_build_type"
169     -n "$(nproc)"
170     -t "$_build_plugin"
171   )
172   # shared targets for all EFI binaries
173   local _efi_args=(
174     -D NETWORK_IP6_ENABLE
175     -D TPM_CONFIG_ENABLE
176     -D TPM1_ENABLE
177     -D TPM2_ENABLE
178   )
179   # shared targets x86_64 and i686
180   local _x86_args=(
181     -D FD_SIZE_2MB
182     -D HTTP_BOOT_ENABLE
183     -D TLS_ENABLE
184   )
185   # 4MB FD size variant
186   local _4mb_args=(
187     -D FD_SIZE_4MB
188     -D FD_SIZE_IN_KB=4096
189     -D HTTP_BOOT_ENABLE
190     -D TLS_ENABLE
191   )
193   cd $pkgbase
194   export GCC5_IA32_PREFIX="x86_64-linux-gnu-"
195   export GCC5_X64_PREFIX="x86_64-linux-gnu-"
196   export GCC5_AARCH64_PREFIX="aarch64-linux-gnu-"
197   export GCC5_ARM_PREFIX="arm-none-eabi-"
198   echo "Building base tools (AARCH64)"
199   ARCH=AARCH64 make -C BaseTools
200   echo "Building base tools (ARM)"
201   ARCH=ARM make -C BaseTools
202   echo "Building base tools"
203   make -C BaseTools
204   . edksetup.sh
206   for _arch in ${_arch_list[@]}; do
207     # shell
208     echo "Building shell ($_arch)."
209     BaseTools/BinWrappers/PosixLike/build -p ShellPkg/ShellPkg.dsc -a "$_arch" "${_common_args[@]}"
210     # ovmf
211     case "$_arch" in
212       IA32)
213       echo "Building ovmf ($_arch) with secure boot support"
214       OvmfPkg/build.sh -p OvmfPkg/OvmfPkgIa32.dsc \
215                        -a "$_arch" \
216                        "${_common_args[@]}" \
217                        "${_efi_args[@]}" \
218                        "${_x86_args[@]}" \
219                        -D EXCLUDE_SHELL_FROM_FD \
220                        -D LOAD_X64_ON_IA32_ENABLE \
221                        -D SECURE_BOOT_ENABLE \
222                        -D SMM_REQUIRE
223       mv -v Build/Ovmf{Ia32,IA32-secure}
224       echo "Building ovmf ($_arch) with secure boot support (4MB FD)"
225       OvmfPkg/build.sh -p OvmfPkg/OvmfPkgIa32.dsc \
226                        -a "$_arch" \
227                        "${_common_args[@]}" \
228                        "${_efi_args[@]}" \
229                        "${_4mb_args[@]}" \
230                        -D EXCLUDE_SHELL_FROM_FD \
231                        -D LOAD_X64_ON_IA32_ENABLE \
232                        -D SECURE_BOOT_ENABLE \
233                        -D SMM_REQUIRE
234       mv -v Build/Ovmf{Ia32,IA32-secure-4mb}
235       echo "Building ovmf ($_arch) with CSM support"
236       OvmfPkg/build.sh -p OvmfPkg/OvmfPkgIa32.dsc \
237                        -a "${_arch}" \
238                        "${_common_args[@]}" \
239                        "${_efi_args[@]}" \
240                        "${_x86_args[@]}" \
241                        -D CSM_ENABLE \
242                        -D LOAD_X64_ON_IA32_ENABLE
243       mv -v Build/Ovmf{Ia32,IA32-csm}
244       echo "Building ovmf ($_arch) with CSM support (4MB FD)"
245       OvmfPkg/build.sh -p OvmfPkg/OvmfPkgIa32.dsc \
246                        -a "${_arch}" \
247                        "${_common_args[@]}" \
248                        "${_efi_args[@]}" \
249                        "${_4mb_args[@]}" \
250                        -D CSM_ENABLE \
251                        -D LOAD_X64_ON_IA32_ENABLE
252       mv -v Build/Ovmf{Ia32,IA32-csm-4mb}
253       echo "Building ovmf ($_arch) default"
254       OvmfPkg/build.sh -p OvmfPkg/OvmfPkgIa32.dsc \
255                        -a "$_arch" \
256                        "${_common_args[@]}" \
257                        "${_efi_args[@]}" \
258                        "${_x86_args[@]}" \
259                        -D LOAD_X64_ON_IA32_ENABLE
260       mv -v Build/Ovmf{Ia32,IA32}
261       echo "Building ovmf ($_arch) default (4MB FD)"
262       OvmfPkg/build.sh -p OvmfPkg/OvmfPkgIa32.dsc \
263                        -a "$_arch" \
264                        "${_common_args[@]}" \
265                        "${_efi_args[@]}" \
266                        "${_4mb_args[@]}" \
267                        -D LOAD_X64_ON_IA32_ENABLE
268       mv -v Build/Ovmf{Ia32,IA32-4mb}
269       ;;
270       X64)
271       echo "Building ovmf ($_arch) with microvm support (4MB FD)"
272       OvmfPkg/build.sh -p OvmfPkg/Microvm/Microvm$_arch.dsc \
273                        -a "$_arch" \
274                        "${_common_args[@]}" \
275                        "${_efi_args[@]}" \
276                        "${_4mb_args[@]}"
277       mv -v Build/MicrovmX64{,-4mb}
278       echo "Building ovmf ($_arch) with microvm support"
279       OvmfPkg/build.sh -p OvmfPkg/Microvm/Microvm$_arch.dsc \
280                        -a "$_arch" \
281                        "${_common_args[@]}" \
282                        "${_efi_args[@]}" \
283                        "${_x86_args[@]}"
284       echo "Building ovmf ($_arch) with secure boot support"
285       OvmfPkg/build.sh -p OvmfPkg/OvmfPkgIa32X64.dsc \
286                        -a IA32 -a "$_arch" \
287                        "${_common_args[@]}" \
288                        "${_efi_args[@]}" \
289                        "${_x86_args[@]}" \
290                        -D SECURE_BOOT_ENABLE \
291                        -D SMM_REQUIRE \
292                        -D EXCLUDE_SHELL_FROM_FD
293       mv -v Build/Ovmf3264{,-secure}
294       echo "Building ovmf ($_arch) with secure boot support (4MB FD)"
295       OvmfPkg/build.sh -p OvmfPkg/OvmfPkgIa32X64.dsc \
296                        -a IA32 -a "$_arch" \
297                        "${_common_args[@]}" \
298                        "${_efi_args[@]}" \
299                        "${_4mb_args[@]}" \
300                        -D SECURE_BOOT_ENABLE \
301                        -D SMM_REQUIRE \
302                        -D EXCLUDE_SHELL_FROM_FD
303       mv -v Build/Ovmf3264{,-secure-4mb}
304       echo "Building ovmf ($_arch) with CSM support"
305       OvmfPkg/build.sh -p OvmfPkg/OvmfPkg$_arch.dsc \
306                        -a "${_arch}" \
307                        "${_common_args[@]}" \
308                        "${_efi_args[@]}" \
309                        "${_x86_args[@]}" \
310                        -D CSM_ENABLE
311       mv -v Build/OvmfX64{,-csm}
312       echo "Building ovmf ($_arch) with CSM support (4MB FD)"
313       OvmfPkg/build.sh -p OvmfPkg/OvmfPkg$_arch.dsc \
314                        -a "${_arch}" \
315                        "${_common_args[@]}" \
316                        "${_efi_args[@]}" \
317                        "${_4mb_args[@]}" \
318                        -D CSM_ENABLE
319       mv -v Build/OvmfX64{,-csm-4mb}
320       echo "Building ovmf (${_arch}) without secure boot (4MB FD)"
321       OvmfPkg/build.sh -p OvmfPkg/OvmfPkg$_arch.dsc \
322                        -a "$_arch" \
323                        "${_common_args[@]}" \
324                        "${_efi_args[@]}" \
325                        "${_4mb_args[@]}"
326       mv -v Build/OvmfX64{,-4mb}
327       echo "Building ovmf (${_arch}) without secure boot"
328       OvmfPkg/build.sh -p OvmfPkg/OvmfPkg$_arch.dsc \
329                        -a "$_arch" \
330                        "${_common_args[@]}" \
331                        "${_efi_args[@]}" \
332                        "${_x86_args[@]}"
333       ;;
334       AARCH64)
335       echo "Building ArmVirtPkg ($_arch) with secure boot"
336       local _build_options=(
337         -p ArmVirtPkg/ArmVirtQemu.dsc
338         -a "$_arch"
339         "${_common_args[@]}"
340         "${_efi_args[@]}"
341         -D NETWORK_HTTP_BOOT_ENABLE
342         -D NETWORK_TLS_ENABLE
343         -D SECURE_BOOT_ENABLE
344       )
345       BaseTools/BinWrappers/PosixLike/build "${_build_options[@]}"
346       dd if=/dev/zero of=Build/ArmVirtQemu-$_arch/${_build_type}_${_build_plugin}/FV/QEMU_CODE.fd bs=1M count=64
347       dd if=Build/ArmVirtQemu-$_arch/${_build_type}_${_build_plugin}/FV/QEMU_EFI.fd of=Build/ArmVirtQemu-$_arch/${_build_type}_${_build_plugin}/FV/QEMU_CODE.fd conv=notrunc
348       dd if=/dev/zero of=Build/ArmVirtQemu-$_arch/${_build_type}_${_build_plugin}/FV/QEMU_VARS.fd bs=1M count=64
349       ;;
350       ARM)
351       echo "Building ovmf (${_arch}) with secure boot"
352       local _build_options=(
353         -p ArmVirtPkg/ArmVirtQemu.dsc
354         -a "${_arch}"
355         "${_common_args[@]}"
356         "${_efi_args[@]}"
357         -D NETWORK_HTTP_BOOT_ENABLE
358         -D NETWORK_TLS_ENABLE
359         -D SECURE_BOOT_ENABLE
360         -D TPM_ENABLE
361         -D TPM_CONFIG_ENABLE
362       )
363       BaseTools/BinWrappers/PosixLike/build "${_build_options[@]}"
364       dd if=/dev/zero of=Build/ArmVirtQemu-$_arch/${_build_type}_$_build_plugin/FV/QEMU_CODE.fd bs=1M count=64
365       dd if=Build/ArmVirtQemu-$_arch/${_build_type}_$_build_plugin/FV/QEMU_EFI.fd of=Build/ArmVirtQemu-$_arch/${_build_type}_$_build_plugin/FV/QEMU_CODE.fd conv=notrunc
366       dd if=/dev/zero of=Build/ArmVirtQemu-$_arch/${_build_type}_$_build_plugin/FV/QEMU_VARS.fd bs=1M count=64
367       ;;
368     esac
369   done
372 package_edk2-aarch64() {
373   local _arch=AARCH64
375   pkgdesc="Firmware for Virtual Machines (aarch64)"
376   url="https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg"
377   conflicts=('edk2-armvirt<202211')
378   provides=(edk2-armvirt)
379   replaces=('edk2-armvirt<202211')
381   cd $pkgbase
382   install -vDm 644 Build/ArmVirtQemu-$_arch/${_build_type}_${_build_plugin}/FV/*.fd -t "$pkgdir/usr/share/$pkgbase/${_arch,,}/"
383   # add libvirt compatibility (which hardcodes the following paths)
384   install -vdm 755 "$pkgdir/usr/share/AAVMF"
385   ln -svf /usr/share/$pkgbase/${_arch,,}/QEMU_CODE.fd "$pkgdir/usr/share/AAVMF/AAVMF_CODE.fd"
386   ln -svf /usr/share/$pkgbase/${_arch,,}/QEMU_VARS.fd "$pkgdir/usr/share/AAVMF/AAVMF_VARS.fd"
387   # install qemu descriptors in accordance with qemu:
388   # https://git.qemu.org/?p=qemu.git;a=tree;f=pc-bios/descriptors
389   install -vDm 644 ../*$pkgname.json -t "$pkgdir/usr/share/qemu/firmware/"
390   # license
391   install -vDm 644 License.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
393   # add symlink for previous aarch64 location
394   ln -svf /usr/share/$pkgbase "$pkgdir/usr/share/$pkgbase-armvirt"
397 package_edk2-arm() {
398   local _arch=ARM
400   pkgdesc="Firmware for Virtual Machines (armv7)"
401   url="https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg"
403   cd $pkgbase
404   install -vDm 644 Build/ArmVirtQemu-$_arch/${_build_type}_$_build_plugin/FV/*.fd -t "$pkgdir/usr/share/$pkgbase/${_arch,,}/"
405   # add libvirt compatibility (which hardcodes the following paths)
406   install -vdm 755 "$pkgdir/usr/share/AAVMF"
407   ln -svf /usr/share/$pkgbase/${_arch,,}/QEMU_CODE.fd "$pkgdir/usr/share/AAVMF/AAVMF32_CODE.fd"
408   ln -svf /usr/share/$pkgbase/${_arch,,}/QEMU_VARS.fd "$pkgdir/usr/share/AAVMF/AAVMF32_VARS.fd"
410   # install qemu descriptors in accordance with qemu:
411   # https://git.qemu.org/?p=qemu.git;a=tree;f=pc-bios/descriptors
412   install -vDm 644 ../*$pkgname.json -t "$pkgdir/usr/share/qemu/firmware/"
413   # license
414   install -vDm 644 License.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
417 package_edk2-shell() {
418   local _arch
419   # minimal UEFI shell, as defined in ShellPkg/Application/Shell/ShellPkg.inf
420   local _min='7C04A583-9E3E-4f1c-AD65-E05268D0B4D1'
421   # full UEFI shell, as defined in ShellPkg/ShellPkg.dsc
422   local _full='EA4BB293-2D7F-4456-A681-1F22F42CD0BC'
424   pkgdesc="EDK2 UEFI Shell"
425   provides=(uefi-shell)
427   cd $pkgbase
428   for _arch in ${_arch_list[@]}; do
429     install -vDm 644 Build/Shell/${_build_type}_${_build_plugin}/$_arch/Shell_$_min.efi "$pkgdir/usr/share/$pkgname/${_arch,,}/Shell.efi"
430     install -vDm 644 Build/Shell/${_build_type}_${_build_plugin}/$_arch/Shell_$_full.efi "$pkgdir/usr/share/$pkgname/${_arch,,}/Shell_Full.efi"
431   done
432   # license
433   install -vDm 644 License.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
434   # docs
435   install -vDm 644 {ReadMe.rst,Maintainers.txt} -t "$pkgdir/usr/share/doc/$pkgname/"
438 package_edk2-ovmf() {
439   local _arch
441   pkgdesc="Firmware for Virtual Machines (x86_64, i686)"
442   url="https://github.com/tianocore/tianocore.github.io/wiki/OVMF"
443   license+=(MIT)
444   provides=(ovmf)
445   conflicts=(ovmf)
446   replaces=(ovmf)
447   install=$pkgname.install
449   cd $pkgbase
450   # installing the various firmwares
451   for _arch in IA32 X64; do
452     # installing OVMF.fd for xen: https://bugs.archlinux.org/task/58635
453     install -vDm 644 Build/Ovmf$_arch/${_build_type}_${_build_plugin}/FV/OVMF.fd -t "$pkgdir/usr/share/$pkgbase/${_arch,,}/"
454     install -vDm 644 Build/Ovmf$_arch/${_build_type}_${_build_plugin}/FV/OVMF_CODE.fd -t "$pkgdir/usr/share/$pkgbase/${_arch,,}/"
455     install -vDm 644 Build/Ovmf$_arch/${_build_type}_${_build_plugin}/FV/OVMF_VARS.fd -t "$pkgdir/usr/share/$pkgbase/${_arch,,}/"
456     install -vDm 644 Build/Ovmf$_arch-4mb/${_build_type}_${_build_plugin}/FV/OVMF.fd "$pkgdir/usr/share/$pkgbase/${_arch,,}/OVMF.4m.fd"
457     install -vDm 644 Build/Ovmf$_arch-4mb/${_build_type}_${_build_plugin}/FV/OVMF_CODE.fd "$pkgdir/usr/share/$pkgbase/${_arch,,}/OVMF_CODE.4m.fd"
458     install -vDm 644 Build/Ovmf$_arch-4mb/${_build_type}_${_build_plugin}/FV/OVMF_VARS.fd "$pkgdir/usr/share/$pkgbase/${_arch,,}/OVMF_VARS.4m.fd"
459     install -vDm 644 Build/Ovmf$_arch-csm/${_build_type}_${_build_plugin}/FV/OVMF_CODE.fd "$pkgdir/usr/share/$pkgbase/${_arch,,}/OVMF_CODE.csm.fd"
460     install -vDm 644 Build/Ovmf$_arch-csm-4mb/${_build_type}_${_build_plugin}/FV/OVMF_CODE.fd "$pkgdir/usr/share/$pkgbase/${_arch,,}/OVMF_CODE.csm.4m.fd"
461     if [[ "${_arch}" == 'X64' ]]; then
462       install -vDm 644 Build/Ovmf3264-secure/${_build_type}_${_build_plugin}/FV/OVMF_CODE.fd "$pkgdir/usr/share/$pkgbase/${_arch,,}/OVMF_CODE.secboot.fd"
463       install -vDm 644 Build/Ovmf3264-secure-4mb/${_build_type}_${_build_plugin}/FV/OVMF_CODE.fd "$pkgdir/usr/share/$pkgbase/${_arch,,}/OVMF_CODE.secboot.4m.fd"
464       install -vDm 644 Build/MicrovmX64/${_build_type}_${_build_plugin}/FV/MICROVM.fd -t "$pkgdir/usr/share/$pkgbase/${_arch,,}/"
465       install -vDm 644 Build/MicrovmX64-4mb/${_build_type}_${_build_plugin}/FV/MICROVM.fd "$pkgdir/usr/share/$pkgbase/${_arch,,}/MICROVM.4m.fd"
466     else
467       install -vDm 644 Build/Ovmf$_arch-secure/${_build_type}_${_build_plugin}/FV/OVMF_CODE.fd "$pkgdir/usr/share/$pkgbase/${_arch,,}/OVMF_CODE.secboot.fd"
468       install -vDm 644 Build/Ovmf$_arch-secure-4mb/${_build_type}_${_build_plugin}/FV/OVMF_CODE.fd "$pkgdir/usr/share/$pkgbase/${_arch,,}/OVMF_CODE.secboot.4m.fd"
469     fi
470   done
471   # installing qemu descriptors in accordance with qemu:
472   # https://git.qemu.org/?p=qemu.git;a=tree;f=pc-bios/descriptors
473   # https://bugs.archlinux.org/task/64206
474   install -vDm 644 ../*$pkgname*.json -t "$pkgdir/usr/share/qemu/firmware/"
475   # add symlink for previous ovmf locations
476   # https://bugs.archlinux.org/task/66528
477   ln -svf /usr/share/$pkgbase "$pkgdir/usr/share/ovmf"
478   ln -svf /usr/share/$pkgbase "$pkgdir/usr/share/$pkgbase-ovmf"
479   # adding a symlink for applications with questionable heuristics (such as lxd)
480   ln -svf /usr/share/$pkgbase "$pkgdir/usr/share/OVMF"
481   # licenses
482   install -vDm 644 License.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
483   install -vDm 644 OvmfPkg/License.txt "$pkgdir/usr/share/licenses/$pkgname/OvmfPkg.License.txt"
484   # docs
485   install -vDm 644 {OvmfPkg/README,ReadMe.rst,Maintainers.txt} -t "$pkgdir/usr/share/doc/$pkgname/"