Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-firmware/seabios/, sys-firmware/seabios/files/seabios/
Date: Sat, 01 May 2021 22:32:40
Message-Id: 1619908353.d2dac934e9aa05af7d567f88028a14939c2ae7b0.slyfox@gentoo
1 commit: d2dac934e9aa05af7d567f88028a14939c2ae7b0
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 1 22:32:13 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sat May 1 22:32:33 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2dac934
7
8 sys-firmware/seabios: restore bios.bin
9
10 Gentoo was not able to build bios.bin (of 128k size)
11 for a while. This change disables modern ACPI_PARSE (mmio),
12 AHCI and NVME drivers to fit into 128K.
13
14 Newer bios is unchanged and is still 256K with all the features.
15
16 Reported-by: Bernd
17 Closes: https://bugs.gentoo.org/780399
18 Package-Manager: Portage-3.0.18, Repoman-3.0.3
19 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
20
21 sys-firmware/seabios/Manifest | 1 +
22 .../seabios/files/seabios/config.seabios-128k | 6 +-
23 sys-firmware/seabios/seabios-1.14.0-r2.ebuild | 183 +++++++++++++++++++++
24 3 files changed, 189 insertions(+), 1 deletion(-)
25
26 diff --git a/sys-firmware/seabios/Manifest b/sys-firmware/seabios/Manifest
27 index 0381c39c4ff..1f37057de6a 100644
28 --- a/sys-firmware/seabios/Manifest
29 +++ b/sys-firmware/seabios/Manifest
30 @@ -1,4 +1,5 @@
31 DIST seabios-1.12.0-bin.tar.xz 162492 BLAKE2B 9a5a349226ed7efbed328493dc057e232203b251677a23f1f09c133743ff0ca6b05270c9d27460be1d8897888fe23ff7bdfa122023fa8ddb23af03d5b9b6f8dd SHA512 f7a0395d621245093bb9a278d95ecc3d4e8d23f620058cd4fddaf885c8b86256f6258f3fd8173c1d24c03306f44d180e768bf8005ee123bc4b699b9f0ca371be
32 DIST seabios-1.12.0.tar.gz 613542 BLAKE2B f145c2db716996bfa9e5c014086ccfaa8ae96ebc158f34303b122b7bf209408c567665d8691364df8d8e886f63e0e72a3f3cd319dfa86ef581023201b5d94e53 SHA512 e52c5363e5bb37b5286e55545aa06bd126218f9d0e3a06ac2e189de68fe3de3256c11ca1bb13357a9c384d7e3af6284083ff3aa587688b5de04ef11b97bdfa27
33 DIST seabios-1.14.0-bin.tar.xz 170160 BLAKE2B 1ab471ce0c6e27633ec42a66e3069496be84de713baab5de4f297821bd0da26404f7f70abc82e223ec5aa317a878889ae92b019988c72d24f77e7dcc5865f916 SHA512 7964e9bb7dff4fd6593f5d6d64efc4b1460750461b86635dbe5255d2086d619f51711d7a35e4dc20e556f705091c0950afabeddcd2e8876f05ce14f9ca73ed71
34 +DIST seabios-1.14.0-r2-bin.tar.xz 132256 BLAKE2B 7d38949de254d6e3699d463a66c363156aa36bfe16c18bea48c55a61bdc423184175fd5427d3246a78d9c6335e61e5baa982f67e7406c5525e405b4383530d41 SHA512 5ce0e407b97e878842fbd7ad2f9e8a65f2565a5aa43d08e01cff024352780f55f8669958c58d20770db7f90e87cc52c860af831cefe3846227e7b45cd9dc33ee
35 DIST seabios-1.14.0.tar.gz 628985 BLAKE2B cc1126925dab1551a655680d20d06ebf28c12c386500d1ee4df9e1a99403b4c5bc6a66c2cc5ef58b4c3d6d7226f35007506a6a1855c2cf2742469dcb7aba05bb SHA512 215c42f59425f8abd062be7b11fc0e39c977cee5001a2381551b0f851ac337d0dd53c065267e6dee0e710ffd700fa635f9007b89da8dfce0f47122c984ee8146
36
37 diff --git a/sys-firmware/seabios/files/seabios/config.seabios-128k b/sys-firmware/seabios/files/seabios/config.seabios-128k
38 index 93203af0ded..50dd75d5f30 100644
39 --- a/sys-firmware/seabios/files/seabios/config.seabios-128k
40 +++ b/sys-firmware/seabios/files/seabios/config.seabios-128k
41 @@ -1,5 +1,5 @@
42 # for qemu machine types 1.7 + older
43 -# need to turn off features (xhci,uas) to make it fit into 128k
44 +# need to turn off features (xhci,uas,achi,nvme,acpi_parse) to make it fit into 128k
45 CONFIG_QEMU=y
46 CONFIG_ROM_SIZE=128
47 CONFIG_BOOTSPLASH=n
48 @@ -10,3 +10,7 @@ CONFIG_USB_UAS=n
49 CONFIG_SDCARD=n
50 CONFIG_TCGBIOS=n
51 CONFIG_MPT_SCSI=n
52 +CONFIG_ACPI_PARSE=n
53 +CONFIG_NVME=n
54 +CONFIG_AHCI=n
55 +CONFIG_THREADS=n
56
57 diff --git a/sys-firmware/seabios/seabios-1.14.0-r2.ebuild b/sys-firmware/seabios/seabios-1.14.0-r2.ebuild
58 new file mode 100644
59 index 00000000000..1e33e9260a5
60 --- /dev/null
61 +++ b/sys-firmware/seabios/seabios-1.14.0-r2.ebuild
62 @@ -0,0 +1,183 @@
63 +# Copyright 1999-2021 Gentoo Authors
64 +# Distributed under the terms of the GNU General Public License v2
65 +
66 +EAPI="7"
67 +
68 +PYTHON_COMPAT=( python3_{7..9} )
69 +
70 +inherit toolchain-funcs python-any-r1
71 +
72 +# SeaBIOS maintainers sometimes don't release stable tarballs or stable
73 +# binaries to generate the stable tarball the following is necessary:
74 +# git clone git://git.seabios.org/seabios.git && cd seabios
75 +# git archive --output seabios-${PV}.tar.gz --prefix seabios-${PV}/ rel-${PV}
76 +
77 +# To generate binary tarball you can run the following from fork tree:
78 +# cd .../seabios-1.14.0-r2/image/usr/share
79 +# $ tar cJf seabios-1.14.0-r2-bin.tar.xz *.bin
80 +
81 +if [[ ${PV} == *9999* || -n "${EGIT_COMMIT}" ]] ; then
82 + EGIT_REPO_URI="git://git.seabios.org/seabios.git"
83 + inherit git-r3
84 +else
85 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
86 +
87 + SRC_URI="
88 + !binary? ( https://www.seabios.org/downloads/${P}.tar.gz )
89 + binary? ( https://dev.gentoo.org/~slyfox/distfiles/${P}-r2-bin.tar.xz )"
90 +fi
91 +
92 +DESCRIPTION="Open Source implementation of a 16-bit x86 BIOS"
93 +HOMEPAGE="https://www.seabios.org/"
94 +
95 +LICENSE="LGPL-3 GPL-3"
96 +SLOT="0"
97 +IUSE="+binary debug +seavgabios"
98 +
99 +REQUIRED_USE="debug? ( !binary )"
100 +
101 +SOURCE_DEPEND="
102 + >=sys-power/iasl-20060912
103 + ${PYTHON_DEPS}"
104 +DEPEND="
105 + !binary? (
106 + ${SOURCE_DEPEND}
107 + )"
108 +RDEPEND=""
109 +
110 +choose_target_chost() {
111 + if [[ -n "${CC}" ]]; then
112 + ${CC} -dumpmachine
113 + return
114 + fi
115 +
116 + if use amd64 || use x86; then
117 + # Use the native compiler
118 + echo "${CHOST}"
119 + return
120 + fi
121 +
122 + local i
123 + for i in x86_64 i686 i586 i486 i386 ; do
124 + i=${i}-pc-linux-gnu
125 + type -P ${i}-gcc > /dev/null && echo ${i} && return
126 + done
127 +}
128 +
129 +pkg_pretend() {
130 + if ! use binary; then
131 + ewarn "You have decided to compile your own SeaBIOS. This is not"
132 + ewarn "supported by upstream unless you use their recommended"
133 + ewarn "toolchain (which you are not)."
134 + elog
135 + ewarn "If you are intending to use this build with QEMU, realize"
136 + ewarn "you will not receive any support if you have compiled your"
137 + ewarn "own SeaBIOS. Virtual machines subtly fail based on changes"
138 + ewarn "in SeaBIOS."
139 + if [[ -z "$(choose_target_chost)" ]]; then
140 + elog
141 + eerror "Before you can compile ${PN}[-binary], you need to install a x86 cross-compiler"
142 + eerror "Run the following commands:"
143 + eerror " emerge crossdev"
144 + eerror " crossdev --stable -t x86_64-pc-linux-gnu"
145 + die "cross-compiler is needed"
146 + fi
147 + fi
148 +}
149 +
150 +pkg_setup() {
151 + use binary || python-any-r1_pkg_setup
152 +}
153 +
154 +src_unpack() {
155 + default
156 +
157 + # This simplifies the logic between binary & source builds.
158 + mkdir -p "${S}"
159 +}
160 +
161 +src_prepare() {
162 + default
163 +
164 + if ! use binary; then
165 + eapply "${FILESDIR}"/${PN}-1.14.0-binutils-2.36.patch
166 + fi
167 +
168 + # Ensure precompiled iasl files are never used
169 + find "${WORKDIR}" -name '*.hex' -delete || die
170 +}
171 +
172 +src_configure() {
173 + use binary && return
174 +
175 + tc-ld-disable-gold #438058
176 +
177 + if use debug ; then
178 + echo "CONFIG_DEBUG_LEVEL=8" >.config
179 + fi
180 + _emake config
181 +}
182 +
183 +_emake() {
184 + LANG=C \
185 + emake V=1 \
186 + CPP="$(tc-getPROG CPP cpp)" \
187 + CC="$(tc-getCC)" \
188 + LD="$(tc-getLD)" \
189 + AR="$(tc-getAR)" \
190 + AS="$(tc-getAS)" \
191 + OBJCOPY="$(tc-getOBJCOPY)" \
192 + RANLIB="$(tc-getRANLIB)" \
193 + OBJDUMP="$(tc-getOBJDUMP)" \
194 + STRIP="$(tc-getSTRIP)" \
195 + HOST_CC="$(tc-getBUILD_CC)" \
196 + VERSION="Gentoo/${EGIT_COMMIT:-${PVR}}" \
197 + "$@"
198 +}
199 +
200 +src_compile() {
201 + use binary && return
202 +
203 + local TARGET_CHOST=$(choose_target_chost)
204 +
205 + cp "${FILESDIR}/seabios/config.seabios-128k" .config || die
206 + _emake oldnoconfig
207 + CHOST="${TARGET_CHOST}" _emake iasl
208 + CHOST="${TARGET_CHOST}" _emake out/bios.bin
209 + mv out/bios.bin ../bios.bin || die
210 +
211 + cp "${FILESDIR}/seabios/config.seabios-256k" .config || die
212 + _emake oldnoconfig
213 + CHOST="${TARGET_CHOST}" _emake iasl
214 + CHOST="${TARGET_CHOST}" _emake out/bios.bin
215 + mv out/bios.bin ../bios-256k.bin || die
216 +
217 + if use seavgabios ; then
218 + local config t targets=(
219 + cirrus
220 + isavga
221 + qxl
222 + stdvga
223 + virtio
224 + vmware
225 + )
226 + for t in "${targets[@]}" ; do
227 + _emake clean distclean
228 + cp "${FILESDIR}/seavgabios/config.vga-${t}" .config || die
229 + _emake oldnoconfig
230 + CHOST="${TARGET_CHOST}" _emake out/vgabios.bin
231 + cp out/vgabios.bin ../vgabios-${t}.bin || die
232 + done
233 + fi
234 +}
235 +
236 +src_install() {
237 + insinto /usr/share/seabios
238 + doins ../bios.bin
239 + doins ../bios-256k.bin
240 +
241 + if use seavgabios ; then
242 + insinto /usr/share/seavgabios
243 + doins ../vgabios*.bin
244 + fi
245 +}