Gentoo Archives: gentoo-commits

From: Matthias Maier <tamiko@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-firmware/edk2-ovmf/
Date: Sun, 28 Jul 2019 23:18:00
Message-Id: 1564355846.fff18dae2f07b0bf7b885912abfdc49fa283055e.tamiko@gentoo
1 commit: fff18dae2f07b0bf7b885912abfdc49fa283055e
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 28 21:11:51 2019 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 28 23:17:26 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fff18dae
7
8 sys-firmware/edk2-ovmf: update live ebuild
9
10 Package-Manager: Portage-2.3.69, Repoman-2.3.16
11 Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
12
13 ...k2-ovmf-9999.ebuild => edk2-ovmf-999999.ebuild} | 73 +++++++++++++++++-----
14 1 file changed, 57 insertions(+), 16 deletions(-)
15
16 diff --git a/sys-firmware/edk2-ovmf/edk2-ovmf-9999.ebuild b/sys-firmware/edk2-ovmf/edk2-ovmf-999999.ebuild
17 similarity index 50%
18 rename from sys-firmware/edk2-ovmf/edk2-ovmf-9999.ebuild
19 rename to sys-firmware/edk2-ovmf/edk2-ovmf-999999.ebuild
20 index a3779c68d3d..8bd303ef2cb 100644
21 --- a/sys-firmware/edk2-ovmf/edk2-ovmf-9999.ebuild
22 +++ b/sys-firmware/edk2-ovmf/edk2-ovmf-999999.ebuild
23 @@ -1,10 +1,10 @@
24 # Copyright 1999-2019 Gentoo Authors
25 # Distributed under the terms of the GNU General Public License v2
26
27 -EAPI=6
28 +EAPI=7
29
30 PYTHON_REQ_USE="sqlite"
31 -PYTHON_COMPAT=( python2_7 )
32 +PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} )
33
34 inherit eutils python-any-r1 readme.gentoo-r1
35
36 @@ -12,22 +12,21 @@ DESCRIPTION="UEFI firmware for 64-bit x86 virtual machines"
37 HOMEPAGE="https://github.com/tianocore/edk2"
38
39 NON_BINARY_DEPEND="
40 + app-emulation/qemu
41 >=dev-lang/nasm-2.0.7
42 >=sys-power/iasl-20160729
43 ${PYTHON_DEPS}
44 "
45 DEPEND=""
46 RDEPEND=""
47 -if [[ ${PV} == "9999" ]] ; then
48 +if [[ ${PV} == "999999" ]] ; then
49 inherit git-r3
50 EGIT_REPO_URI="https://github.com/tianocore/edk2"
51 DEPEND+="
52 ${NON_BINARY_DEPEND}
53 "
54 else
55 - SRC_URI="
56 - binary? ( https://dev.gentoo.org/~tamiko/distfiles/${P}-bin.tar.xz )
57 - !binary? ( https://dev.gentoo.org/~tamiko/distfiles/${P}.tar.xz )"
58 + SRC_URI=""
59 KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
60 IUSE="+binary"
61 REQUIRED_USE+="
62 @@ -40,7 +39,6 @@ else
63 )
64 )"
65 PATCHES=(
66 - "${FILESDIR}"/${P}-build_system_fixes.patch
67 )
68 fi
69
70 @@ -50,9 +48,20 @@ SLOT="0"
71 DISABLE_AUTOFORMATTING=true
72 DOC_CONTENTS="This package contains the tianocore edk2 UEFI firmware for 64-bit x86
73 virtual machines. The firmware is located under
74 - /usr/share/edk2-ovmf/OVMF.fd
75 /usr/share/edk2-ovmf/OVMF_CODE.fd
76 /usr/share/edk2-ovmf/OVMF_VARS.fd
77 + /usr/share/edk2-ovmf/OVMF_CODE.secboot.fd
78 +
79 +If USE=binary is enabled, we also install an OVMF variables file (coming from
80 +fedora) that contains secureboot default keys
81 +
82 + /usr/share/edk2-ovmf/OVMF_VARS.secboot.fd
83 +
84 +If you have compiled this package by hand, you need to either populate all
85 +necessary EFI variables by hand by booting
86 + /usr/share/edk2-ovmf/UefiShell.(iso|img)
87 +or creating OVMF_VARS.secboot.fd by hand:
88 + https://github.com/puiterwijk/qemu-ovmf-secureboot
89
90 The firmware does not support csm (due to no free csm implementation
91 available). If you need a firmware with csm support you have to download
92 @@ -68,14 +77,15 @@ In order to use the firmware you can run qemu the following way
93 You can register the firmware for use in libvirt by adding to /etc/libvirt/qemu.conf:
94 nvram = [
95 \"/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd\"
96 + \"/usr/share/edk2-ovmf/OVMF_CODE.secboot.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd\"
97 ]"
98
99 pkg_setup() {
100 - [[ ${PV} != "9999" ]] && use binary || python-any-r1_pkg_setup
101 + [[ ${PV} != "999999" ]] && use binary || python-any-r1_pkg_setup
102 }
103
104 src_prepare() {
105 - if [[ ${PV} != "9999" ]] && use binary; then
106 + if [[ ${PV} != "999999" ]] && use binary; then
107 eapply_user
108 return
109 fi
110 @@ -87,23 +97,54 @@ src_compile() {
111 TARGET_NAME=RELEASE
112 TARGET_TOOLS=GCC49
113
114 - [[ ${PV} != "9999" ]] && use binary && return
115 + BUILD_FLAGS="-D TLS_ENABLE \
116 + -D HTTP_BOOT_ENABLE \
117 + -D NETWORK_IP6_ENABLE \
118 + -D FD_SIZE_2MB"
119 +
120 + SECUREBOOT_BUILD_FLAGS="${BUILD_FLAGS} \
121 + -D SECURE_BOOT_ENABLE \
122 + -D SMM_REQUIRE \
123 + -D EXCLUDE_SHELL_FROM_FD"
124 +
125 + [[ ${PV} != "999999" ]] && use binary && return
126
127 emake ARCH=${TARGET_ARCH} -C BaseTools
128
129 . ./edksetup.sh
130
131 + # Build all EFI firmware blobs:
132 +
133 + mkdir -p ovmf
134 +
135 ./OvmfPkg/build.sh \
136 -a "${TARGET_ARCH}" -b "${TARGET_NAME}" -t "${TARGET_TOOLS}" \
137 - -D FD_SIZE_2MB \
138 - || die "OvmfPkg/build.sh failed"
139 + ${BUILD_FLAGS} || die "OvmfPkg/build.sh failed"
140 +
141 + cp Build/OvmfX64/*/FV/OVMF_*.fd ovmf/
142 + rm -rf Build/OvmfX64
143 +
144 + ./OvmfPkg/build.sh \
145 + -a "${TARGET_ARCH}" -b "${TARGET_NAME}" -t "${TARGET_TOOLS}" \
146 + ${SECUREBOOT_BUILD_FLAGS} || die "OvmfPkg/build.sh failed"
147 +
148 + cp Build/OvmfX64/*/FV/OVMF_CODE.fd ovmf/OVMF_CODE.secboot.fd || die "cp failed"
149 + cp Build/OvmfX64/*/X64/Shell.efi ovmf/ || die "cp failed"
150 + cp Build/OvmfX64/*/X64/EnrollDefaultKeys.efi ovmf || die "cp failed"
151 +
152 + # Build a convenience UefiShell.img:
153 +
154 + mkdir -p iso_image/efi/boot || die "mkdir failed"
155 + cp ovmf/Shell.efi iso_image/efi/boot/bootx64.efi || die "cp failed"
156 + cp ovmf/EnrollDefaultKeys.efi iso_image || die "cp failed"
157 + qemu-img convert --image-opts \
158 + driver=vvfat,floppy=on,fat-type=12,label=UEFI_SHELL,dir=iso_image \
159 + ovmf/UefiShell.img || die "qemu-img failed"
160 }
161
162 src_install() {
163 - local builddir="Build/OvmfX64/${TARGET_NAME}_${TARGET_TOOLS}/FV"
164 -
165 insinto /usr/share/${PN}
166 - doins "${builddir}"/OVMF{,_CODE,_VARS}.fd
167 + doins ovmf/*
168
169 readme.gentoo_create_doc
170 }