Skip to content

Commit 26aac44

Browse files
committed
[add] : Added edk2 PKGBUILD
1 parent 3c77b57 commit 26aac44

File tree

12 files changed

+581
-3
lines changed

12 files changed

+581
-3
lines changed

build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,10 @@ make_pacman_conf() {
556556
if [[ "${nosigcheck}" = true ]]; then
557557
sed -ir "s|^s*SigLevel.+|SigLevel = Never|g" "${build_pacman_conf}"
558558
fi
559+
560+
if [[ -n "$(find "${cache_dir}" -maxdepth 1 -name '*.pkg.tar.*' 2> /dev/null)" ]]; then
561+
msg_info "Use cached package files in ${cache_dir}"
562+
fi
559563
}
560564

561565
# Base installation (airootfs)
@@ -581,6 +585,9 @@ make_packages_repo() {
581585

582586
# Install packages on airootfs
583587
_pacman "${_pkglist[@]}"
588+
589+
# Upgrade cached package
590+
_chroot_run pacman -Syy --noconfirm --config "/etc/alteriso-pacman.conf"
584591
}
585592

586593
make_packages_aur() {

modules/share/packages.i486/base.i486

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ amd-ucode
1818
mkinitcpio-nfs-utils
1919
nbd
2020

21-
edk2-shell
21+
#edk2-shell

modules/share/packages.i686/base.i686

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ amd-ucode
1818
mkinitcpio-nfs-utils
1919
nbd
2020

21-
edk2-shell
21+
#edk2-shell

modules/share/packages.x86_64/base.x86_64

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ amd-ucode
1818
mkinitcpio-nfs-utils
1919
nbd
2020
vi
21-
edk2-shell
21+
22+
#edk2-shell
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"description": "UEFI firmware for i386, with Secure Boot and SMM",
3+
"interface-types": [
4+
"uefi"
5+
],
6+
"mapping": {
7+
"device": "flash",
8+
"executable": {
9+
"filename": "/usr/share/edk2-ovmf/ia32/OVMF_CODE.secboot.fd",
10+
"format": "raw"
11+
},
12+
"nvram-template": {
13+
"filename": "/usr/share/edk2-ovmf/ia32/OVMF_VARS.fd",
14+
"format": "raw"
15+
}
16+
},
17+
"targets": [
18+
{
19+
"architecture": "i386",
20+
"machines": [
21+
"pc-q35-*"
22+
]
23+
}
24+
],
25+
"features": [
26+
"acpi-s3",
27+
"requires-smm",
28+
"secure-boot",
29+
"verbose-dynamic"
30+
],
31+
"tags": [
32+
33+
]
34+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"description": "UEFI firmware for x86_64, with Secure Boot and SMM",
3+
"interface-types": [
4+
"uefi"
5+
],
6+
"mapping": {
7+
"device": "flash",
8+
"executable": {
9+
"filename": "/usr/share/edk2-ovmf/x64/OVMF_CODE.secboot.fd",
10+
"format": "raw"
11+
},
12+
"nvram-template": {
13+
"filename": "/usr/share/edk2-ovmf/x64/OVMF_VARS.fd",
14+
"format": "raw"
15+
}
16+
},
17+
"targets": [
18+
{
19+
"architecture": "x86_64",
20+
"machines": [
21+
"pc-q35-*"
22+
]
23+
}
24+
],
25+
"features": [
26+
"acpi-s3",
27+
"amd-sev",
28+
"requires-smm",
29+
"secure-boot",
30+
"verbose-dynamic"
31+
],
32+
"tags": [
33+
34+
]
35+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"description": "UEFI firmware for i386",
3+
"interface-types": [
4+
"uefi"
5+
],
6+
"mapping": {
7+
"device": "flash",
8+
"executable": {
9+
"filename": "/usr/share/edk2-ovmf/ia32/OVMF_CODE.fd",
10+
"format": "raw"
11+
},
12+
"nvram-template": {
13+
"filename": "/usr/share/edk2-ovmf/ia32/OVMF_VARS.fd",
14+
"format": "raw"
15+
}
16+
},
17+
"targets": [
18+
{
19+
"architecture": "i386",
20+
"machines": [
21+
"pc-i440fx-*",
22+
"pc-q35-*"
23+
]
24+
}
25+
],
26+
"features": [
27+
"acpi-s3",
28+
"verbose-dynamic"
29+
],
30+
"tags": [
31+
32+
]
33+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"description": "UEFI firmware for x86_64",
3+
"interface-types": [
4+
"uefi"
5+
],
6+
"mapping": {
7+
"device": "flash",
8+
"executable": {
9+
"filename": "/usr/share/edk2-ovmf/x64/OVMF_CODE.fd",
10+
"format": "raw"
11+
},
12+
"nvram-template": {
13+
"filename": "/usr/share/edk2-ovmf/x64/OVMF_VARS.fd",
14+
"format": "raw"
15+
}
16+
},
17+
"targets": [
18+
{
19+
"architecture": "x86_64",
20+
"machines": [
21+
"pc-i440fx-*",
22+
"pc-q35-*"
23+
]
24+
}
25+
],
26+
"features": [
27+
"acpi-s3",
28+
"amd-sev",
29+
"verbose-dynamic"
30+
],
31+
"tags": [
32+
33+
]
34+
}
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Maintainer: David Runge <[email protected]>
2+
3+
_brotli_ver=1.0.7
4+
_openssl_ver=1.1.1g
5+
pkgbase=edk2
6+
pkgname=('edk2-shell' 'edk2-ovmf')
7+
pkgver=202005
8+
pkgrel=3
9+
pkgdesc="Modern, feature-rich firmware development environment for the UEFI specifications"
10+
arch=('any')
11+
url="https://github.com/tianocore/edk2"
12+
license=('BSD')
13+
makedepends=('acpica' 'iasl' 'util-linux-libs' 'nasm' 'python')
14+
options=(!makeflags)
15+
source=("$pkgbase-$pkgver.tar.gz::https://github.com/tianocore/${pkgbase}/archive/${pkgbase}-stable${pkgver}.tar.gz"
16+
"https://www.openssl.org/source/openssl-${_openssl_ver}.tar.gz"{,.asc}
17+
"brotli-${_brotli_ver}.tar.gz::https://github.com/google/brotli/archive/v${_brotli_ver}.tar.gz"
18+
"${pkgbase}-202005-openssl-1.1.1g.patch"
19+
"50-edk2-ovmf-i386-secure.json"
20+
"50-edk2-ovmf-x86_64-secure.json"
21+
"60-edk2-ovmf-i386.json"
22+
"60-edk2-ovmf-x86_64.json")
23+
sha512sums=('864e5b8babb28eea05f59e17581209c853c004993842a7a6b104e96bd1fd29d9dd3a1545fb44639f2442acc51b078c4996621e1f927fbf449dc1b86421b432ac'
24+
'01e3d0b1bceeed8fb066f542ef5480862001556e0f612e017442330bbd7e5faee228b2de3513d7fc347446b7f217e27de1003dc9d7214d5833b97593f3ec25ab'
25+
'SKIP'
26+
'a82362aa36d2f2094bca0b2808d9de0d57291fb3a4c29d7c0ca0a37e73087ec5ac4df299c8c363e61106fccf2fe7f58b5cf76eb97729e2696058ef43b1d3930a'
27+
'3605c67d9c8870562086f63e96ffe8039cb394266298b382df61e12c777b6c37a2d2eb3fd5147cb3f00fabddc6dba139ba53da42ea81b1cbeb8f587c6d4cc251'
28+
'55e4187b11b27737f61e528c02ff43b9381c0cb09140e803531616766f9cb9401115d88d946b56171784cc028f9571279640eb39b6a9fa8e02ec0c8d1b036a3e'
29+
'a1236585b30d720540de2e9527d8c90ff2d428e800b3da545b23461dc698dc91fe441b62bb8cbca76e08f4ec1eb485619e9ab26157deb06e7fb33e7f5f9dd8b6'
30+
'c81e072aabfb01d29cf5194111524e2c4c8684979de6b6793db10299c95bb94f7b1d0a98b057df0664d7a894a2b40e9b4c3576112fae400a95eaf5fe5fc9369b'
31+
'2030dc1d49d56fce8af56c5777fd40f04041e39ff806dd8c021e161227bdd646982024db6758230b8332dc68f16bc6918e1d54ad3c022e21e148d6b65ea778b3')
32+
validpgpkeys=('8657ABB260F056B1E5190839D9C4D26D0E604491') # Matt Caswell <[email protected]>
33+
_arch_list=('IA32' 'X64')
34+
_build_type='RELEASE'
35+
_build_plugin='GCC5'
36+
37+
prepare() {
38+
mv -v "$pkgbase-$pkgbase-stable$pkgver" "$pkgbase-$pkgver"
39+
cd "$pkgbase-$pkgver"
40+
41+
# applying fixes to build against openssl-1.1.1g
42+
patch -Np1 -i "../${pkgbase}-202005-openssl-1.1.1g.patch"
43+
# symlinking openssl into place
44+
rm -rfv CryptoPkg/Library/OpensslLib/openssl
45+
ln -sfv "${srcdir}/openssl-$_openssl_ver" CryptoPkg/Library/OpensslLib/openssl
46+
# copying required pre-generated header into place (to not also have to patch openssl)
47+
cp -v CryptoPkg/Library/Include/internal/dso_conf.h CryptoPkg/Library/OpensslLib/openssl/include/crypto/
48+
49+
# symlinking brotli into place
50+
rm -rfv BaseTools/Source/C/BrotliCompress/brotli MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
51+
ln -sfv "${srcdir}/brotli-${_brotli_ver}" BaseTools/Source/C/BrotliCompress/brotli
52+
ln -sfv "${srcdir}/brotli-${_brotli_ver}" MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
53+
54+
# -Werror, not even once
55+
sed -e 's/ -Werror//g' \
56+
-i BaseTools/Conf/*.template BaseTools/Source/C/Makefiles/*.makefile
57+
}
58+
59+
build() {
60+
cd "$pkgbase-$pkgver"
61+
local _arch
62+
make -C BaseTools
63+
. edksetup.sh
64+
for _arch in ${_arch_list[@]}; do
65+
# shell
66+
echo "Building shell (${_arch})."
67+
BaseTools/BinWrappers/PosixLike/build -p ShellPkg/ShellPkg.dsc \
68+
-a "${_arch}" \
69+
-b "${_build_type}" \
70+
-n "$(nproc)" \
71+
-t "${_build_plugin}"
72+
# ovmf
73+
if [[ "${_arch}" == 'IA32' ]]; then
74+
echo "Building ovmf (${_arch}) with secure boot"
75+
OvmfPkg/build.sh -p OvmfPkg/OvmfPkgIa32.dsc \
76+
-a "${_arch}" \
77+
-b "${_build_type}" \
78+
-n "$(nproc)" \
79+
-t "${_build_plugin}" \
80+
-D LOAD_X64_ON_IA32_ENABLE \
81+
-D NETWORK_IP6_ENABLE \
82+
-D TPM_ENABLE \
83+
-D HTTP_BOOT_ENABLE \
84+
-D TLS_ENABLE \
85+
-D FD_SIZE_2MB \
86+
-D SECURE_BOOT_ENABLE \
87+
-D SMM_REQUIRE \
88+
-D EXCLUDE_SHELL_FROM_FD
89+
mv -v Build/Ovmf{Ia32,IA32-secure}
90+
echo "Building ovmf (${_arch}) without secure boot"
91+
OvmfPkg/build.sh -p OvmfPkg/OvmfPkgIa32.dsc \
92+
-a "${_arch}" \
93+
-b "${_build_type}" \
94+
-n "$(nproc)" \
95+
-t "${_build_plugin}" \
96+
-D LOAD_X64_ON_IA32_ENABLE \
97+
-D NETWORK_IP6_ENABLE \
98+
-D TPM_ENABLE \
99+
-D HTTP_BOOT_ENABLE \
100+
-D TLS_ENABLE \
101+
-D FD_SIZE_2MB
102+
mv -v Build/Ovmf{Ia32,IA32}
103+
fi
104+
if [[ "${_arch}" == 'X64' ]]; then
105+
echo "Building ovmf (${_arch}) with secure boot"
106+
OvmfPkg/build.sh -p "OvmfPkg/OvmfPkg${_arch}.dsc" \
107+
-a "${_arch}" \
108+
-b "${_build_type}" \
109+
-n "$(nproc)" \
110+
-t "${_build_plugin}" \
111+
-D NETWORK_IP6_ENABLE \
112+
-D TPM_ENABLE \
113+
-D FD_SIZE_2MB \
114+
-D TLS_ENABLE \
115+
-D HTTP_BOOT_ENABLE \
116+
-D SECURE_BOOT_ENABLE \
117+
-D SMM_REQUIRE \
118+
-D EXCLUDE_SHELL_FROM_FD
119+
mv -v Build/OvmfX64{,-secure}
120+
echo "Building ovmf (${_arch}) without secure boot"
121+
OvmfPkg/build.sh -p "OvmfPkg/OvmfPkg${_arch}.dsc" \
122+
-a "${_arch}" \
123+
-b "${_build_type}" \
124+
-n "$(nproc)" \
125+
-t "${_build_plugin}" \
126+
-D NETWORK_IP6_ENABLE \
127+
-D TPM_ENABLE \
128+
-D FD_SIZE_2MB \
129+
-D TLS_ENABLE \
130+
-D HTTP_BOOT_ENABLE
131+
fi
132+
done
133+
}
134+
135+
package_edk2-shell() {
136+
pkgdesc="EDK2 UEFI Shell"
137+
provides=('uefi-shell')
138+
cd "$pkgbase-$pkgver"
139+
local _arch
140+
# minimal UEFI shell, as defined in ShellPkg/Application/Shell/ShellPkg.inf
141+
local _min='7C04A583-9E3E-4f1c-AD65-E05268D0B4D1'
142+
# full UEFI shell, as defined in ShellPkg/ShellPkg.dsc
143+
local _full='EA4BB293-2D7F-4456-A681-1F22F42CD0BC'
144+
for _arch in ${_arch_list[@]}; do
145+
install -vDm 644 "Build/Shell/${_build_type}_${_build_plugin}/${_arch}/Shell_${_min}.efi" \
146+
"${pkgdir}/usr/share/${pkgname}/${_arch,,}/Shell.efi"
147+
install -vDm 644 "Build/Shell/${_build_type}_${_build_plugin}/${_arch}/Shell_${_full}.efi" \
148+
"${pkgdir}/usr/share/${pkgname}/${_arch,,}/Shell_Full.efi"
149+
done
150+
# license
151+
install -vDm 644 License.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
152+
# docs
153+
install -vDm 644 {ReadMe.rst,Maintainers.txt} \
154+
-t "${pkgdir}/usr/share/doc/${pkgname}"
155+
}
156+
157+
package_edk2-ovmf() {
158+
pkgdesc="Open Virtual Machine Firmware to support firmware for Virtual Machines"
159+
provides=('ovmf')
160+
conflicts=('ovmf')
161+
replaces=('ovmf')
162+
license+=('MIT')
163+
install="${pkgname}.install"
164+
cd "$pkgbase-$pkgver"
165+
local _arch
166+
# installing the various firmwares
167+
for _arch in ${_arch_list[@]}; do
168+
# installing OVMF.fd for xen: https://bugs.archlinux.org/task/58635
169+
install -vDm 644 "Build/Ovmf${_arch}/${_build_type}_${_build_plugin}/FV/OVMF.fd" \
170+
-t "${pkgdir}/usr/share/${pkgname}/${_arch,,}"
171+
install -vDm 644 "Build/Ovmf${_arch}/${_build_type}_${_build_plugin}/FV/OVMF_CODE.fd" \
172+
-t "${pkgdir}/usr/share/${pkgname}/${_arch,,}"
173+
install -vDm 644 "Build/Ovmf${_arch}/${_build_type}_${_build_plugin}/FV/OVMF_VARS.fd" \
174+
-t "${pkgdir}/usr/share/${pkgname}/${_arch,,}"
175+
install -vDm 644 "Build/Ovmf${_arch}-secure/${_build_type}_${_build_plugin}/FV/OVMF_CODE.fd" \
176+
"${pkgdir}/usr/share/${pkgname}/${_arch,,}/OVMF_CODE.secboot.fd"
177+
done
178+
# installing qemu descriptors in accordance with qemu:
179+
# https://git.qemu.org/?p=qemu.git;a=tree;f=pc-bios/descriptors
180+
# https://bugs.archlinux.org/task/64206
181+
install -vDm 644 ../*"${pkgname}"*.json -t "${pkgdir}/usr/share/qemu/firmware"
182+
# adding symlink for previous ovmf location
183+
# https://bugs.archlinux.org/task/66528
184+
ln -svf "/usr/share/${pkgname}" "${pkgdir}/usr/share/ovmf"
185+
# adding a symlink for applications with questionable heuristics (such as lxd)
186+
ln -svf "/usr/share/${pkgname}" "${pkgdir}/usr/share/OVMF"
187+
# licenses
188+
install -vDm 644 License.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
189+
install -vDm 644 OvmfPkg/License.txt \
190+
"${pkgdir}/usr/share/licenses/${pkgname}/OvmfPkg.License.txt"
191+
# docs
192+
install -vDm 644 {OvmfPkg/README,ReadMe.rst,Maintainers.txt} \
193+
-t "${pkgdir}/usr/share/doc/${pkgname}"
194+
}

0 commit comments

Comments
 (0)