Gentoo Archives: gentoo-commits

From: Mikle Kolyada <zlogene@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-boot/grub/files/, sys-boot/grub/
Date: Fri, 08 Feb 2019 15:20:20
Message-Id: 1549639167.65be92768fab88a84a8cc05eea53fc9b67384c8b.zlogene@gentoo
1 commit: 65be92768fab88a84a8cc05eea53fc9b67384c8b
2 Author: Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 8 15:19:27 2019 +0000
4 Commit: Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 8 15:19:27 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65be9276
7
8 sys-boot/grub: Drop grub:0
9
10 Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
11 Package-Manager: Portage-2.3.51, Repoman-2.3.11
12
13 sys-boot/grub/Manifest | 4 -
14 ...97-Add-esp-to-list-of-clobbered-registers.patch | 53 ----
15 .../grub/files/grub-0.97-ncurses-pkgconfig.patch | 18 --
16 sys-boot/grub/grub-0.97-r16.ebuild | 293 -------------------
17 sys-boot/grub/grub-0.97-r18.ebuild | 309 ---------------------
18 sys-boot/grub/metadata.xml | 1 -
19 6 files changed, 678 deletions(-)
20
21 diff --git a/sys-boot/grub/Manifest b/sys-boot/grub/Manifest
22 index 23837461cb9..106fa33c0a5 100644
23 --- a/sys-boot/grub/Manifest
24 +++ b/sys-boot/grub/Manifest
25 @@ -1,7 +1,3 @@
26 DIST dejavu-sans-ttf-2.37.zip 417746 BLAKE2B c8904f3cd5a49370a7dc10e456684c88aeae998a99090bf4d0a5baa4f36cc8fb8f70586cf6d610a5ffeee97261d28c80f55bbe9dcfc3ed796d5c2d60e79adb58 SHA512 ede5899daa1984c5aa8cacb1c850eb53f189dddef3d9bb78bf9774d8976b7c0d6eb0bcf86237cd7d11f5b36cf5b5058d42cd94d3bd76f2bd0931c7ceb1271fae
27 -DIST grub-0.97-patches-1.14.tar.bz2 52916 BLAKE2B 49000402cbdc52bf2bfe31ccc36d0ebc8ba53a58e17bc3a798d3afe5ecec3cc79fb0bb7e786667b96993a7632484b3162e035c358e0fade20ddc2a1ec8e1b073 SHA512 d9a8d420fd5a36f181ca608f9b70be90f9d82cee66c8484636fda5085290586071b5d9379d917e8141b993ffc4777859cd02971c916d6167dca6f50d83282c26
28 -DIST grub-0.97-patches-1.15.tar.bz2 52887 BLAKE2B a571fe3b918cad590880a277df6ef1bdf094fbc11fd25b2dfb0d790a6b1b37839460475aebc3d6e4f09f59f969ab42dfd8e2b7472aba31c296ed5e03ba3f1030 SHA512 729a4b62bd04aca5b15b83e87b799e1c7e592a5a0265ec6b7a4f4d4ebde05e3e57b62fb6eed6ee1b7692d5dc43dd9ad65898332ff806557b62a7174a797c251a
29 -DIST grub-0.97.tar.gz 971783 BLAKE2B a7b6feb6dddb6eeb20e027071091b2d37930e5b40687f8c8ff860839db208f832713db61389014d21842e1e152cad0466dc9722a79cbb81bfa1566a30b6b82cc SHA512 c2bc9ffc8583aeae71cee9ddcc4418969768d4e3764d47307da54f93981c0109fb07d84b061b3a3628bd00ba4d14a54742bc04848110eb3ae8ca25dbfbaabadb
30 DIST grub-2.02.tar.xz 6113260 BLAKE2B 7c5ec61a8dc5a00e9cdc91c489f0d2ee37cd7e673eef8e8e26bbc18c5ec28829f563b9298874fb96d45a5d523ce366e936649c21ebda7462afda0cc328b970ce SHA512 cc6eb0a42b5c8df2f671cc128ff725afb3ff1f8832a196022e433cf0d3b75decfca2316d0aa5fabea75747d55e88f3d021dd93508563f8ca80fd7b9e7fe1f088
31 -DIST splash.xpm.gz 33856 BLAKE2B e8d0ee91a87ed45f47fa58b07a6476b19ddb3f98ffee41adce46fe9bc4926bbefcac5cd01efc41794049b1c905502b18e69b5f0546bcf3cea79bf351e1817574 SHA512 5ae1f786f7d46a95a7061068d5b2b3ad64607c7b190d6f28379508c5dce67e26308325bfd637542a84855dfcf1ea3d143947326fdb189a6a8972208d3ead23da
32 DIST unifont-9.0.06.pcf.gz 1360354 BLAKE2B 09b96e1711c729ef159d62e3ea7b289ca2d01dc0ea417e35a18b73dc02a23f62ce7821d9761bceee4002d9eeaabd91cfb69bbacc6fbdfdfa00445d18fe8f1d66 SHA512 dd0a1afa72f5204c62055d83f22750c74af38ffafdb8eda8e1f1cf7292e572a14969b8a9a6a2cb336d5bed4ab633f6b5a962c59117a590e4238788959cb82774
33
34 diff --git a/sys-boot/grub/files/grub-0.97-Add-esp-to-list-of-clobbered-registers.patch b/sys-boot/grub/files/grub-0.97-Add-esp-to-list-of-clobbered-registers.patch
35 deleted file mode 100644
36 index c550aabd616..00000000000
37 --- a/sys-boot/grub/files/grub-0.97-Add-esp-to-list-of-clobbered-registers.patch
38 +++ /dev/null
39 @@ -1,53 +0,0 @@
40 -From 5a52ee4b5cd152fa4ccd1c1f938ce2eba652af52 Mon Sep 17 00:00:00 2001
41 -From: Sergei Trofimovich <slyfox@g.o>
42 -Date: Mon, 14 Dec 2015 23:59:17 +0000
43 -Subject: [PATCH] Add %esp to list of clobbered registers
44 -
45 -GCC assumes that it can combine stacks from
46 -outer
47 - grub_stage2()
48 -and inner
49 - trampoline doit()
50 -functions (optimisation -fcombine-stack-adjustments).
51 -
52 -But doit() function clobbers %esp in inline
53 -assebly statement as:
54 -
55 - asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n"
56 - : "=&r" (realstack) : "r" (simstack));
57 -
58 -which tricks gcc into computing invalid local variable
59 -offsets from current %esp value.
60 -
61 -Fix by hinting gcc about %esp change in clobber list.
62 -
63 -Signed-off-by: Sergei Trofimovich <slyfox@g.o>
64 ----
65 - grub/asmstub.c | 4 ++--
66 - 1 file changed, 2 insertions(+), 2 deletions(-)
67 -
68 -diff --git a/grub/asmstub.c b/grub/asmstub.c
69 -index 6354806..44b056f 100644
70 ---- a/grub/asmstub.c
71 -+++ b/grub/asmstub.c
72 -@@ -174,7 +174,7 @@ grub_stage2 (void)
73 - {
74 - /* Make sure our stack lives in the simulated memory area. */
75 - asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n"
76 -- : "=&r" (realstack) : "r" (simstack));
77 -+ : "=&r" (realstack) : "r" (simstack) : "%esp");
78 -
79 - /* Do a setjmp here for the stop command. */
80 - if (! setjmp (env_for_exit))
81 -@@ -191,7 +191,7 @@ grub_stage2 (void)
82 - }
83 -
84 - /* Replace our stack before we use any local variables. */
85 -- asm volatile ("movl %0, %%esp\n" : : "r" (realstack));
86 -+ asm volatile ("movl %0, %%esp\n" : : "r" (realstack) : "%esp");
87 - }
88 -
89 - assert (grub_scratch_mem == 0);
90 ---
91 -2.6.3
92 -
93
94 diff --git a/sys-boot/grub/files/grub-0.97-ncurses-pkgconfig.patch b/sys-boot/grub/files/grub-0.97-ncurses-pkgconfig.patch
95 deleted file mode 100644
96 index d62e4346c33..00000000000
97 --- a/sys-boot/grub/files/grub-0.97-ncurses-pkgconfig.patch
98 +++ /dev/null
99 @@ -1,18 +0,0 @@
100 ---- a/configure.ac 2015-12-17 11:09:56.807893315 -0500
101 -+++ b/configure.ac 2015-12-17 11:11:06.697570856 -0500
102 -@@ -234,10 +234,14 @@
103 -
104 - # Unless the user specify --without-curses, check for curses.
105 - if test "x$with_curses" != "xno"; then
106 -+ PKG_CHECK_MODULES([NCURSES],[ncurses],[
107 -+ AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])
108 -+ GRUB_LIBS="$GRUB_LIBS $NCURSES_LIBS"
109 -+ ],[
110 - AC_CHECK_LIB(ncurses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lncurses"
111 - AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])],
112 - [AC_CHECK_LIB(curses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lcurses"
113 -- AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])])])
114 -+ AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])])])])
115 - fi
116 -
117 - AC_SUBST(GRUB_LIBS)
118
119 diff --git a/sys-boot/grub/grub-0.97-r16.ebuild b/sys-boot/grub/grub-0.97-r16.ebuild
120 deleted file mode 100644
121 index 22793c03ab0..00000000000
122 --- a/sys-boot/grub/grub-0.97-r16.ebuild
123 +++ /dev/null
124 @@ -1,293 +0,0 @@
125 -# Copyright 1999-2016 Gentoo Foundation
126 -# Distributed under the terms of the GNU General Public License v2
127 -
128 -# XXX: we need to review menu.lst vs grub.conf handling. We've been converting
129 -# all systems to grub.conf (and symlinking menu.lst to grub.conf), but
130 -# we never updated any of the source code (it still all wants menu.lst),
131 -# and there is no indication that upstream is making the transition.
132 -
133 -# If you need to roll a new grub-static distfile, here is how.
134 -# - Robin H. Johnson <robbat2@g.o> - 29 Nov 2010
135 -# FEATURES='-noauto -noinfo -nodoc -noman -splitdebug nostrip' \
136 -# USE='static -ncurses -netboot -custom-cflags' \
137 -# PORTAGE_COMPRESS=true GRUB_STATIC_PACKAGE_BUILDING=1 ebuild \
138 -# grub-${PVR}.ebuild clean package && \
139 -# qtbz2 -s -j ${PKGDIR}/${CAT}/${PF}.tbz2 && \
140 -# mv ${PF}.tar.bz2 ${DISTDIR}/grub-static-${PVR}.tar.bz2
141 -
142 -EAPI="5"
143 -
144 -inherit eutils mount-boot toolchain-funcs linux-info flag-o-matic autotools pax-utils
145 -
146 -PATCHVER="1.14" # Should match the revision ideally
147 -DESCRIPTION="GNU GRUB Legacy boot loader"
148 -HOMEPAGE="https://www.gnu.org/software/grub/"
149 -SRC_URI="mirror://gentoo/${P}.tar.gz
150 - mirror://gnu-alpha/${PN}/${P}.tar.gz
151 - mirror://gentoo/splash.xpm.gz
152 - mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2"
153 -
154 -LICENSE="GPL-2"
155 -SLOT="0"
156 -KEYWORDS="amd64 x86 ~x86-fbsd"
157 -IUSE="custom-cflags ncurses netboot static"
158 -
159 -LIB_DEPEND="ncurses? ( >=sys-libs/ncurses-5.9-r3:0[static-libs(+),abi_x86_32(-)] )"
160 -RDEPEND="!static? ( ${LIB_DEPEND//[static-libs(+),/=[} )"
161 -DEPEND="${RDEPEND}
162 - static? ( ${LIB_DEPEND} )"
163 -RDEPEND+=" !sys-boot/grub:2[-multislot]"
164 -
165 -pkg_setup() {
166 - case $(tc-arch) in
167 - amd64) CONFIG_CHECK='~IA32_EMULATION' check_extra_config ;;
168 - esac
169 -}
170 -
171 -src_prepare() {
172 - # Grub will not handle a kernel larger than EXTENDED_MEMSIZE Mb as
173 - # discovered in bug 160801. We can change this, however, using larger values
174 - # for this variable means that Grub needs more memory to run and boot. For a
175 - # kernel of size N, Grub needs (N+1)*2. Advanced users should set a custom
176 - # value in make.conf, it is possible to make kernels ~16Mb in size, but it
177 - # needs the kitchen sink built-in.
178 - local t="custom"
179 - if [[ -z ${GRUB_MAX_KERNEL_SIZE} ]] ; then
180 - case $(tc-arch) in
181 - amd64) GRUB_MAX_KERNEL_SIZE=9 ;;
182 - x86) GRUB_MAX_KERNEL_SIZE=5 ;;
183 - esac
184 - t="default"
185 - fi
186 - einfo "Grub will support the ${t} maximum kernel size of ${GRUB_MAX_KERNEL_SIZE} Mb (GRUB_MAX_KERNEL_SIZE)"
187 -
188 - sed -i \
189 - -e "/^#define.*EXTENDED_MEMSIZE/s,3,${GRUB_MAX_KERNEL_SIZE},g" \
190 - "${S}"/grub/asmstub.c \
191 - || die
192 -
193 - EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
194 -
195 - # Work around issue where the default CFLAGS fail with gcc-4.9.3 (possibly newer), force -O0 instead
196 - # bug 564890, 566638
197 - if [[ $(gcc-major-version) -ge 5 || $(gcc-major-version) -eq 4 && $(gcc-minor-version) -ge 9 ]]; then
198 - if use custom-cflags; then
199 - ewarn "You are using custom cflags with gcc-4.9 or newer."
200 - ewarn "Be aware the result may segfault at runtime due to unknown optimization"
201 - ewarn "incompatibilities."
202 - else
203 - einfo "Forcing -O0 to get around optimization issue caused by gcc-4.9 and newer with -O2"
204 - sed -i -e "/CFLAGS/s/-O2/-O0/" \
205 - "${S}"/configure.ac || die
206 - fi
207 - fi
208 -
209 - rm -f "${S}"/aclocal.m4 # seems to keep bug 418287 away
210 - eautoreconf
211 -}
212 -
213 -src_configure() {
214 - filter-flags -fPIE #168834
215 -
216 - use amd64 && multilib_toolchain_setup x86
217 -
218 - unset BLOCK_SIZE #73499
219 -
220 - ### i686-specific code in the boot loader is a bad idea; disabling to ensure
221 - ### at least some compatibility if the hard drive is moved to an older or
222 - ### incompatible system.
223 -
224 - # grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
225 - # but the objcopy's (faulty) test fails if -fstack-protector is default.
226 - # create a cache telling configure that objcopy is ok, and add -C to econf
227 - # to make use of the cache.
228 - #
229 - # CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
230 - # STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
231 - # -fno-stack-protector detected by configure, removed from netboot's emake.
232 - use custom-cflags || unset CFLAGS
233 -
234 - tc-ld-disable-gold #439082 #466536 #526348
235 -
236 - export grub_cv_prog_objcopy_absolute=yes #79734
237 - use static && append-ldflags -static
238 -
239 - if use amd64 && use static ; then
240 - if [[ -n ${GRUB_STATIC_PACKAGE_BUILDING} ]] ; then
241 - eerror "You have set GRUB_STATIC_PACKAGE_BUILDING. This"
242 - eerror "is specifically intended for building the tarballs for the"
243 - eerror "grub-static package via USE='static -ncurses'."
244 - eerror "All bets are now off."
245 - fi
246 - fi
247 -
248 - # build the net-bootable grub first, but only if "netboot" is set
249 - if use netboot ; then
250 - mkdir -p "${WORKDIR}"/netboot
251 - pushd "${WORKDIR}"/netboot >/dev/null
252 - ECONF_SOURCE=${S} \
253 - econf \
254 - --libdir=/lib \
255 - --datadir=/usr/lib/grub \
256 - --exec-prefix=/ \
257 - --disable-auto-linux-mem-opt \
258 - --enable-diskless \
259 - --enable-{3c{5{03,07,09,29,95},90x},cs89x0,davicom,depca,eepro{,100}} \
260 - --enable-{epic100,exos205,ni5210,lance,ne2100,ni{50,65}10,natsemi} \
261 - --enable-{ne,ns8390,wd,otulip,rtl8139,sis900,sk-g16,smc9000,tiara} \
262 - --enable-{tulip,via-rhine,w89c840}
263 - popd >/dev/null
264 - fi
265 -
266 - # Now build the regular grub
267 - # Note that FFS and UFS2 support are broken for now - stage1_5 files too big
268 - econf \
269 - --libdir=/lib \
270 - --datadir=/usr/lib/grub \
271 - --exec-prefix=/ \
272 - --disable-auto-linux-mem-opt \
273 - $(use_with ncurses curses)
274 -
275 - # sanity check due to common failure
276 - use ncurses && ! grep -qs "HAVE_LIBCURSES.*1" config.h && die "USE=ncurses but curses not found"
277 -}
278 -
279 -src_compile() {
280 - use netboot && emake -C "${WORKDIR}"/netboot w89c840_o_CFLAGS="-O"
281 - emake
282 -}
283 -
284 -src_test() {
285 - # non-default block size also give false pass/fails.
286 - unset BLOCK_SIZE
287 - emake -j1 check
288 -}
289 -
290 -src_install() {
291 - default
292 - if use netboot ; then
293 - exeinto /usr/lib/grub/${CHOST}
294 - doexe "${WORKDIR}"/netboot/stage2/{nbgrub,pxegrub}
295 - newexe "${WORKDIR}"/netboot/stage2/stage2 stage2.netboot
296 - fi
297 -
298 - pax-mark -m "${D}"/sbin/grub #330745
299 -
300 - newdoc docs/menu.lst grub.conf.sample
301 - dodoc "${FILESDIR}"/grub.conf.gentoo
302 -
303 - [[ -n ${GRUB_STATIC_PACKAGE_BUILDING} ]] && \
304 - mv "${D}"/usr/share/doc/{${PF},grub-static-${PF/grub-}}
305 -
306 - insinto /usr/share/grub
307 - doins "${DISTDIR}"/splash.xpm.gz
308 -}
309 -
310 -setup_boot_dir() {
311 - local boot_dir=$1
312 - local dir=${boot_dir}
313 -
314 - mkdir -p "${dir}"
315 - [[ ! -L ${dir}/boot ]] && ln -s . "${dir}/boot"
316 - dir="${dir}/grub"
317 - if [[ ! -e ${dir} ]] ; then
318 - mkdir "${dir}" || die
319 - fi
320 -
321 - # change menu.lst to grub.conf
322 - if [[ ! -e ${dir}/grub.conf ]] && [[ -e ${dir}/menu.lst ]] ; then
323 - mv -f "${dir}"/menu.lst "${dir}"/grub.conf
324 - ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
325 - echo
326 - fi
327 -
328 - if [[ ! -e ${dir}/menu.lst ]]; then
329 - einfo "Linking from new grub.conf name to menu.lst"
330 - ln -snf grub.conf "${dir}"/menu.lst
331 - fi
332 -
333 - if [[ -e ${dir}/stage2 ]] ; then
334 - mv "${dir}"/stage2{,.old}
335 - ewarn "*** IMPORTANT NOTE: you must run grub and install"
336 - ewarn "the new version's stage1 to your MBR. Until you do,"
337 - ewarn "stage1 and stage2 will still be the old version, but"
338 - ewarn "later stages will be the new version, which could"
339 - ewarn "cause problems such as an unbootable system."
340 - ewarn
341 - ewarn "This means you must use either grub-install or perform"
342 - ewarn "root/setup manually."
343 - ewarn
344 - ewarn "For more help, see the wiki:"
345 - ewarn "https://wiki.gentoo.org/wiki/GRUB"
346 - echo
347 - fi
348 -
349 - einfo "Copying files from /lib/grub and /usr/share/grub to ${dir}"
350 - for x in \
351 - "${ROOT}"/lib*/grub/*/* \
352 - "${ROOT}"/usr/share/grub/* ; do
353 - [[ -f ${x} ]] && cp -p "${x}" "${dir}"/
354 - done
355 -
356 - if [[ ! -e ${dir}/grub.conf ]] ; then
357 - s="${ROOT}/usr/share/doc/${PF}/grub.conf.gentoo"
358 - [[ -e "${s}" ]] && cat "${s}" >${dir}/grub.conf
359 - [[ -e "${s}.gz" ]] && zcat "${s}.gz" >${dir}/grub.conf
360 - [[ -e "${s}.bz2" ]] && bzcat "${s}.bz2" >${dir}/grub.conf
361 - fi
362 -
363 - # Per bug 218599, we support grub.conf.install for users that want to run a
364 - # specific set of Grub setup commands rather than the default ones.
365 - grub_config=${dir}/grub.conf.install
366 - [[ -e ${grub_config} ]] || grub_config=${dir}/grub.conf
367 - if [[ -e ${grub_config} ]] ; then
368 - egrep \
369 - -v '^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)' \
370 - "${grub_config}" | \
371 - /sbin/grub --batch \
372 - --device-map="${dir}"/device.map \
373 - > /dev/null
374 - fi
375 -
376 - # the grub default commands silently piss themselves if
377 - # the default file does not exist ahead of time
378 - if [[ ! -e ${dir}/default ]] ; then
379 - grub-set-default --root-directory="${boot_dir}" default
380 - fi
381 - einfo "Grub has been installed to ${boot_dir} successfully."
382 -}
383 -
384 -pkg_postinst() {
385 - mount-boot_mount_boot_partition
386 -
387 - if [[ -n ${DONT_MOUNT_BOOT} ]]; then
388 - elog "WARNING: you have DONT_MOUNT_BOOT in effect, so you must apply"
389 - elog "the following instructions for your /boot!"
390 - elog "Neglecting to do so may cause your system to fail to boot!"
391 - elog
392 - else
393 - setup_boot_dir "${ROOT}"/boot
394 - # Trailing output because if this is run from pkg_postinst, it gets mixed into
395 - # the other output.
396 - einfo ""
397 - fi
398 - elog "To interactively install grub files to another device such as a USB"
399 - elog "stick, just run the following and specify the directory as prompted:"
400 - elog " emerge --config =${PF}"
401 - elog "Alternately, you can export GRUB_ALT_INSTALLDIR=/path/to/use to tell"
402 - elog "grub where to install in a non-interactive way."
403 -
404 - # needs to be after we call setup_boot_dir
405 - mount-boot_pkg_postinst
406 -}
407 -
408 -pkg_config() {
409 - local dir
410 - if [ ! -d "${GRUB_ALT_INSTALLDIR}" ]; then
411 - einfo "Enter the directory where you want to setup grub:"
412 - read dir
413 - else
414 - dir="${GRUB_ALT_INSTALLDIR}"
415 - fi
416 - setup_boot_dir "${dir}"
417 -}
418
419 diff --git a/sys-boot/grub/grub-0.97-r18.ebuild b/sys-boot/grub/grub-0.97-r18.ebuild
420 deleted file mode 100644
421 index 695b074e304..00000000000
422 --- a/sys-boot/grub/grub-0.97-r18.ebuild
423 +++ /dev/null
424 @@ -1,309 +0,0 @@
425 -# Copyright 1999-2018 Gentoo Foundation
426 -# Distributed under the terms of the GNU General Public License v2
427 -
428 -# XXX: we need to review menu.lst vs grub.conf handling. We've been converting
429 -# all systems to grub.conf (and symlinking menu.lst to grub.conf), but
430 -# we never updated any of the source code (it still all wants menu.lst),
431 -# and there is no indication that upstream is making the transition.
432 -
433 -# If you need to roll a new grub-static distfile, here is how.
434 -# - Robin H. Johnson <robbat2@g.o> - 29 Nov 2010
435 -# FEATURES='-noauto -noinfo -nodoc -noman -splitdebug nostrip' \
436 -# USE='static -ncurses -netboot -custom-cflags' \
437 -# PORTAGE_COMPRESS=true GRUB_STATIC_PACKAGE_BUILDING=1 ebuild \
438 -# grub-${PVR}.ebuild clean package && \
439 -# qtbz2 -s -j ${PKGDIR}/${CAT}/${PF}.tbz2 && \
440 -# mv ${PF}.tar.bz2 ${DISTDIR}/grub-static-${PVR}.tar.bz2
441 -
442 -EAPI="6"
443 -
444 -inherit eutils mount-boot toolchain-funcs linux-info flag-o-matic autotools pax-utils
445 -
446 -PATCHVER="1.15" # Should match the revision ideally
447 -DESCRIPTION="GNU GRUB Legacy boot loader"
448 -HOMEPAGE="https://www.gnu.org/software/grub/"
449 -SRC_URI="mirror://gentoo/${P}.tar.gz
450 - mirror://gnu-alpha/${PN}/${P}.tar.gz
451 - mirror://gentoo/splash.xpm.gz
452 - mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2
453 - https://dev.gentoo.org/~whissi/dist/${PN}/${P}-patches-${PATCHVER}.tar.bz2"
454 -
455 -LICENSE="GPL-2"
456 -SLOT="0"
457 -KEYWORDS="amd64 x86 ~x86-fbsd"
458 -IUSE="custom-cflags ncurses netboot static"
459 -
460 -LIB_DEPEND="ncurses? ( >=sys-libs/ncurses-5.9-r3:0[static-libs(+),abi_x86_32(-)] )"
461 -RDEPEND="!static? ( ${LIB_DEPEND//[static-libs(+),/=[} )"
462 -DEPEND="${RDEPEND}
463 - virtual/pkgconfig
464 - static? ( ${LIB_DEPEND} )"
465 -RDEPEND+=" !sys-boot/grub:2[-multislot]"
466 -
467 -pkg_setup() {
468 - case $(tc-arch) in
469 - amd64) CONFIG_CHECK='~IA32_EMULATION' check_extra_config ;;
470 - esac
471 -}
472 -
473 -src_prepare() {
474 - # Grub will not handle a kernel larger than EXTENDED_MEMSIZE Mb as
475 - # discovered in bug 160801. We can change this, however, using larger values
476 - # for this variable means that Grub needs more memory to run and boot. For a
477 - # kernel of size N, Grub needs (N+1)*2. Advanced users should set a custom
478 - # value in make.conf, it is possible to make kernels ~16Mb in size, but it
479 - # needs the kitchen sink built-in.
480 - local t="custom"
481 - if [[ -z ${GRUB_MAX_KERNEL_SIZE} ]] ; then
482 - case $(tc-arch) in
483 - amd64) GRUB_MAX_KERNEL_SIZE=9 ;;
484 - x86) GRUB_MAX_KERNEL_SIZE=5 ;;
485 - esac
486 - t="default"
487 - fi
488 - einfo "Grub will support the ${t} maximum kernel size of ${GRUB_MAX_KERNEL_SIZE} Mb (GRUB_MAX_KERNEL_SIZE)"
489 -
490 - sed -i \
491 - -e "/^#define.*EXTENDED_MEMSIZE/s,3,${GRUB_MAX_KERNEL_SIZE},g" \
492 - "${S}"/grub/asmstub.c \
493 - || die
494 -
495 - # gcc-6 and above doesnt have a '-nopie' option patched in, use upstream's -fno-pie
496 - if [[ tc-is-gcc && $(gcc-major-version) -gt 5 ]]; then
497 - sed -i 's/-nopie/-fno-pie/' \
498 - "${WORKDIR}"/patch/860_all_grub-0.97-pie-r1.patch \
499 - || die
500 - fi
501 -
502 - EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
503 - # bug 564890, 566638
504 - epatch "${FILESDIR}"/grub-0.97-Add-esp-to-list-of-clobbered-registers.patch
505 - epatch "${FILESDIR}"/grub-0.97-ncurses-pkgconfig.patch
506 -
507 - eapply_user
508 -
509 - rm -f "${S}"/aclocal.m4 # seems to keep bug 418287 away
510 - eautoreconf
511 -}
512 -
513 -src_configure() {
514 - filter-flags -fPIE #168834
515 -
516 - use amd64 && multilib_toolchain_setup x86
517 -
518 - unset BLOCK_SIZE #73499
519 -
520 - ### i686-specific code in the boot loader is a bad idea; disabling to ensure
521 - ### at least some compatibility if the hard drive is moved to an older or
522 - ### incompatible system.
523 -
524 - # grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
525 - # but the objcopy's (faulty) test fails if -fstack-protector is default.
526 - # create a cache telling configure that objcopy is ok, and add -C to econf
527 - # to make use of the cache.
528 - #
529 - # CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
530 - # STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
531 - # -fno-stack-protector detected by configure, removed from netboot's emake.
532 - use custom-cflags || unset CFLAGS
533 -
534 - tc-ld-disable-gold #439082 #466536 #526348
535 -
536 - export grub_cv_prog_objcopy_absolute=yes #79734
537 - use static && append-ldflags -static
538 -
539 - if use amd64 && use static ; then
540 - if [[ -n ${GRUB_STATIC_PACKAGE_BUILDING} ]] ; then
541 - eerror "You have set GRUB_STATIC_PACKAGE_BUILDING. This"
542 - eerror "is specifically intended for building the tarballs for the"
543 - eerror "grub-static package via USE='static -ncurses'."
544 - eerror "All bets are now off."
545 - fi
546 - fi
547 -
548 - # build the net-bootable grub first, but only if "netboot" is set
549 - if use netboot ; then
550 - mkdir -p "${WORKDIR}"/netboot
551 - pushd "${WORKDIR}"/netboot >/dev/null
552 - ECONF_SOURCE=${S} \
553 - econf \
554 - --libdir=/lib \
555 - --datadir=/usr/lib/grub \
556 - --exec-prefix=/ \
557 - --disable-auto-linux-mem-opt \
558 - --enable-diskless \
559 - --enable-{3c{5{03,07,09,29,95},90x},cs89x0,davicom,depca,eepro{,100}} \
560 - --enable-{epic100,exos205,ni5210,lance,ne2100,ni{50,65}10,natsemi} \
561 - --enable-{ne,ns8390,wd,otulip,rtl8139,sis900,sk-g16,smc9000,tiara} \
562 - --enable-{tulip,via-rhine,w89c840}
563 - popd >/dev/null
564 - fi
565 -
566 - # Now build the regular grub
567 - # Note that FFS and UFS2 support are broken for now - stage1_5 files too big
568 - econf \
569 - --libdir=/lib \
570 - --datadir=/usr/lib/grub \
571 - --exec-prefix=/ \
572 - --disable-auto-linux-mem-opt \
573 - $(use_with ncurses curses)
574 -
575 - # sanity check due to common failure
576 - use ncurses && ! grep -qs "HAVE_LIBCURSES.*1" config.h && die "USE=ncurses but curses not found"
577 -}
578 -
579 -src_compile() {
580 - use netboot && emake -C "${WORKDIR}"/netboot w89c840_o_CFLAGS="-O"
581 - emake
582 -}
583 -
584 -src_test() {
585 - # non-default block size also give false pass/fails.
586 - unset BLOCK_SIZE
587 - emake -j1 check
588 -}
589 -
590 -src_install() {
591 - local _stage2_file="${S}/stage2/stage2"
592 - if [[ -f "${_stage2_file}" ]]; then
593 - local _stage2_filesize=$(stat -c '%s' "${_stage2_file}" 2>/dev/null)
594 - if [[ -z "${_stage2_filesize}" ]]; then
595 - ewarn "Sanity check skipped -- 'stat' returned nothing"
596 - elif [[ "${_stage2_filesize}" -gt 1000000 ]]; then
597 - eerror "Sanity check failed: stage2 (${_stage2_file}) is larger than 1MB (${_stage2_filesize} bytes)!"
598 - eerror "Please check your CFLAGS and/or file a bug report at https://bugs.gentoo.org."
599 - die "stage2 sanity check failed"
600 - else
601 - einfo "stage2 sanity check passed"
602 - fi
603 - else
604 - ewarn "Sanity check skipped -- no stage2 found"
605 - fi
606 -
607 - default
608 - if use netboot ; then
609 - exeinto /usr/lib/grub/${CHOST}
610 - doexe "${WORKDIR}"/netboot/stage2/{nbgrub,pxegrub}
611 - newexe "${WORKDIR}"/netboot/stage2/stage2 stage2.netboot
612 - fi
613 -
614 - pax-mark -m "${D}"/sbin/grub #330745
615 -
616 - newdoc docs/menu.lst grub.conf.sample
617 - dodoc "${FILESDIR}"/grub.conf.gentoo
618 -
619 - [[ -n ${GRUB_STATIC_PACKAGE_BUILDING} ]] && \
620 - mv "${D}"/usr/share/doc/{${PF},grub-static-${PF/grub-}}
621 -
622 - insinto /usr/share/grub
623 - doins "${DISTDIR}"/splash.xpm.gz
624 -}
625 -
626 -setup_boot_dir() {
627 - local boot_dir=$1
628 - local dir=${boot_dir}
629 -
630 - mkdir -p "${dir}"
631 - [[ ! -L ${dir}/boot ]] && ln -s . "${dir}/boot"
632 - dir="${dir}/grub"
633 - if [[ ! -e ${dir} ]] ; then
634 - mkdir "${dir}" || die
635 - fi
636 -
637 - # change menu.lst to grub.conf
638 - if [[ ! -e ${dir}/grub.conf ]] && [[ -e ${dir}/menu.lst ]] ; then
639 - mv -f "${dir}"/menu.lst "${dir}"/grub.conf
640 - ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
641 - echo
642 - fi
643 -
644 - if [[ ! -e ${dir}/menu.lst ]]; then
645 - einfo "Linking from new grub.conf name to menu.lst"
646 - ln -snf grub.conf "${dir}"/menu.lst
647 - fi
648 -
649 - if [[ -e ${dir}/stage2 ]] ; then
650 - mv "${dir}"/stage2{,.old}
651 - ewarn "*** IMPORTANT NOTE: you must run grub and install"
652 - ewarn "the new version's stage1 to your MBR. Until you do,"
653 - ewarn "stage1 and stage2 will still be the old version, but"
654 - ewarn "later stages will be the new version, which could"
655 - ewarn "cause problems such as an unbootable system."
656 - ewarn
657 - ewarn "This means you must use either grub-install or perform"
658 - ewarn "root/setup manually."
659 - ewarn
660 - ewarn "For more help, see the wiki:"
661 - ewarn "https://wiki.gentoo.org/wiki/GRUB"
662 - echo
663 - fi
664 -
665 - einfo "Copying files from /lib/grub and /usr/share/grub to ${dir}"
666 - for x in \
667 - "${ROOT}"/lib*/grub/*/* \
668 - "${ROOT}"/usr/share/grub/* ; do
669 - [[ -f ${x} ]] && cp -p "${x}" "${dir}"/
670 - done
671 -
672 - if [[ ! -e ${dir}/grub.conf ]] ; then
673 - s="${ROOT}/usr/share/doc/${PF}/grub.conf.gentoo"
674 - [[ -e "${s}" ]] && cat "${s}" >${dir}/grub.conf
675 - [[ -e "${s}.gz" ]] && zcat "${s}.gz" >${dir}/grub.conf
676 - [[ -e "${s}.bz2" ]] && bzcat "${s}.bz2" >${dir}/grub.conf
677 - fi
678 -
679 - # Per bug 218599, we support grub.conf.install for users that want to run a
680 - # specific set of Grub setup commands rather than the default ones.
681 - grub_config=${dir}/grub.conf.install
682 - [[ -e ${grub_config} ]] || grub_config=${dir}/grub.conf
683 - if [[ -e ${grub_config} ]] ; then
684 - egrep \
685 - -v '^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)' \
686 - "${grub_config}" | \
687 - /sbin/grub --batch \
688 - --device-map="${dir}"/device.map \
689 - > /dev/null
690 - fi
691 -
692 - # the grub default commands silently piss themselves if
693 - # the default file does not exist ahead of time
694 - if [[ ! -e ${dir}/default ]] ; then
695 - grub-set-default --root-directory="${boot_dir}" default
696 - fi
697 - einfo "Grub has been installed to ${boot_dir} successfully."
698 -}
699 -
700 -pkg_postinst() {
701 - mount-boot_mount_boot_partition
702 -
703 - if [[ -n ${DONT_MOUNT_BOOT} ]]; then
704 - elog "WARNING: you have DONT_MOUNT_BOOT in effect, so you must apply"
705 - elog "the following instructions for your /boot!"
706 - elog "Neglecting to do so may cause your system to fail to boot!"
707 - elog
708 - else
709 - setup_boot_dir "${ROOT}"/boot
710 - # Trailing output because if this is run from pkg_postinst, it gets mixed into
711 - # the other output.
712 - einfo ""
713 - fi
714 - elog "To interactively install grub files to another device such as a USB"
715 - elog "stick, just run the following and specify the directory as prompted:"
716 - elog " emerge --config =${PF}"
717 - elog "Alternately, you can export GRUB_ALT_INSTALLDIR=/path/to/use to tell"
718 - elog "grub where to install in a non-interactive way."
719 -
720 - # needs to be after we call setup_boot_dir
721 - mount-boot_pkg_postinst
722 -}
723 -
724 -pkg_config() {
725 - local dir
726 - if [ ! -d "${GRUB_ALT_INSTALLDIR}" ]; then
727 - einfo "Enter the directory where you want to setup grub:"
728 - read dir
729 - else
730 - dir="${GRUB_ALT_INSTALLDIR}"
731 - fi
732 - setup_boot_dir "${dir}"
733 -}
734
735 diff --git a/sys-boot/grub/metadata.xml b/sys-boot/grub/metadata.xml
736 index b6247282548..9070bcc5502 100644
737 --- a/sys-boot/grub/metadata.xml
738 +++ b/sys-boot/grub/metadata.xml
739 @@ -33,7 +33,6 @@
740 Allow concurrent installation of <pkg>sys-boot/grub</pkg> SLOT 0 and
741 <pkg>sys-boot/grub</pkg> SLOT 2 by renaming all programs.
742 </flag>
743 - <flag name="netboot">Enable network booting</flag>
744 <flag name="themes">Build and install GRUB themes (starfield)</flag>
745 <flag name="truetype">Build and install grub-mkfont conversion utility</flag>
746 </use>