summaryrefslogtreecommitdiff
path: root/sys-boot/grub
diff options
context:
space:
mode:
Diffstat (limited to 'sys-boot/grub')
-rw-r--r--sys-boot/grub/Manifest19
-rw-r--r--sys-boot/grub/files/gfxpayload.patch29
-rw-r--r--sys-boot/grub/files/grub-0.97-Add-esp-to-list-of-clobbered-registers.patch53
-rw-r--r--sys-boot/grub/files/grub-0.97-ncurses-pkgconfig.patch18
-rw-r--r--sys-boot/grub/files/grub-2.02_beta2-KERNEL_GLOBS.patch67
-rw-r--r--sys-boot/grub/files/grub.conf.gentoo16
-rw-r--r--sys-boot/grub/files/grub.default-373
-rw-r--r--sys-boot/grub/grub-0.97-r16.ebuild301
-rw-r--r--sys-boot/grub/grub-0.97-r17.ebuild293
-rw-r--r--sys-boot/grub/grub-2.02.ebuild298
-rw-r--r--sys-boot/grub/grub-9999.ebuild298
-rw-r--r--sys-boot/grub/metadata.xml42
12 files changed, 1507 insertions, 0 deletions
diff --git a/sys-boot/grub/Manifest b/sys-boot/grub/Manifest
new file mode 100644
index 000000000000..eadd66f1d43a
--- /dev/null
+++ b/sys-boot/grub/Manifest
@@ -0,0 +1,19 @@
+AUX gfxpayload.patch 1118 SHA256 3ac2043d55ed70649bccc7482918b762d5833cc1f100de0620af73b64e5e2c4b SHA512 00324825c369902a0383b792cd21e161853eadccbdc5abe2420f2d443bf6a74f72be6c15243107b936acd38c3547387c3771dc2cb566003c4c754c9260b4aa00 WHIRLPOOL 6417222278d437821221b09c3b18df5507a4edd57bfb5a8f682a53eea4f8491a6b2865b6223392a1f04dfca7200f71b4c5ecfc3b088f139ba94a90b31aa66918
+AUX grub-0.97-Add-esp-to-list-of-clobbered-registers.patch 1612 SHA256 515d609d54602c285e98aeaec66ac95136512d54bb16ee80f22cf06f02999948 SHA512 85241fc4f939cbf6dc9e18b0b68034835bcb4ac7162fa1dc497e169422b66f0320d59d8270bc13c827a325f45d260028276641cff3f12b4d6096e2d33a12261b WHIRLPOOL 4dda1385591e71766a7d3141038f67bee1ceda3d1deef97913a2a684dbea03ac5fd982291ae017d8bb82ac222e378db5c9cac537a0a7b47328361e00314e5ff3
+AUX grub-0.97-ncurses-pkgconfig.patch 799 SHA256 273bd077ae5591cd8fdcd6dc61bf8890e30a1c84a04ef05d5e5fa32176583162 SHA512 9456c422e05e75e4221101d66bf1c1ba3efa195ef67872a75790362da825bffe1bcd74c5ff6e3f5a9ccda6b364f02c631c0d513c0de5aa19a78be9bea525c13f WHIRLPOOL dd285a51cd10461b1b74b1a1bc892911015fbbc68c33de15b50cf642284ec67165b6d6ec0de345addcd4964bab694d444c0ab041a7f547efe8d29bbfb7095c67
+AUX grub-2.02_beta2-KERNEL_GLOBS.patch 2121 SHA256 444bf2afb4d009b106a2dc9f3f10e180f90d3aa5fef6b7e398f65fdb189b6115 SHA512 f85bc538ae647c46efbe07d7b87acf49daa7b07e9752af3aa3f77019f48ea24cd1b6a095a6f9c19d50128701753f453c531b9b068e11ee22a259f3fdf8ac205e WHIRLPOOL 7f82e79bfb3cc2bf1f9ec4fe4f37457066c975942f77a64a6e1380121b9b2fde3cac69ff15ad606bf85f8d214b53455e96c977204415481121aa55eb0dfcbaf9
+AUX grub.conf.gentoo 591 SHA256 e656b5716d6a5904a035960b460494431d8c1327df51fcd9ffb39243425fe142 SHA512 23036b9e558b604082d9ae8c848f18ea552181416937e3ef62287e53c38086b8d7ffef0e67d04af04f05f5b23c6da7aaf1f1f23e0ee1cffd5dbd5320e8648cb1 WHIRLPOOL 184284cac00bc039d36c5b2f8d7be0f425e75ba904c4c04c2ec531a094cd191c42cb7382276e73a5d176e1661dcdd1bdc5e3806b9d7abe9b38563575ecb6ee76
+AUX grub.default-3 2532 SHA256 5e25d29a7d6779163e440eb044dc6a6093541efbfcb4347ae4dc1952a98a7036 SHA512 2faf5e730331b7d04045ee64d990227ef02f1b14a1cf88b5b71a18c91a9a8cba773a601eb3f5442092f6937935efed02629a278bd6822fac60f9c72045e4b13d WHIRLPOOL 8104c756215ef78b9c480a369917f6dfba7f6b754f356bc85b5c920958bd68184991579a1012f558341757a17fd88aad77d85ddedbb15e50e5be41f90690b8a8
+DIST dejavu-sans-ttf-2.37.zip 417746 SHA256 5c6e497a2f36552cb5ffb112c413a6af39c0f3c47653662b90b4fa6499822fd7 SHA512 ede5899daa1984c5aa8cacb1c850eb53f189dddef3d9bb78bf9774d8976b7c0d6eb0bcf86237cd7d11f5b36cf5b5058d42cd94d3bd76f2bd0931c7ceb1271fae WHIRLPOOL 6f19280e76ea3efe265db09236e94bdd00268c5d8742c191100b8eb19faa532289fb03d838e33aa3c501d8a3243db248648af8929d5d5dba1bfd2ea2c10358cd
+DIST grub-0.97-patches-1.14.tar.bz2 52916 SHA256 5c7ca31fd9b2123471daf2e46a1936c4044ad0c12e353d9d3d8c3f83a1c7a0e5 SHA512 d9a8d420fd5a36f181ca608f9b70be90f9d82cee66c8484636fda5085290586071b5d9379d917e8141b993ffc4777859cd02971c916d6167dca6f50d83282c26 WHIRLPOOL 60abd5087e85d9969784b9f5a100934606a76da03b665533d9d4d1d13f4e2d15de233a71e67a32d18a5fbfe128c2c8bf04c0d4451de24e6ca4fbd8dd862e23ea
+DIST grub-0.97.tar.gz 971783 SHA256 4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b SHA512 c2bc9ffc8583aeae71cee9ddcc4418969768d4e3764d47307da54f93981c0109fb07d84b061b3a3628bd00ba4d14a54742bc04848110eb3ae8ca25dbfbaabadb WHIRLPOOL 0ad7f5dc035e2a3ad5fd29b6388f06fd12a8cc694117b4cbd42b5302433aa522db23566222d35219fe17fb95edb5090553156198507f70208eda5d858fd52dd5
+DIST grub-2.02.tar.xz 6113260 SHA256 810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f SHA512 cc6eb0a42b5c8df2f671cc128ff725afb3ff1f8832a196022e433cf0d3b75decfca2316d0aa5fabea75747d55e88f3d021dd93508563f8ca80fd7b9e7fe1f088 WHIRLPOOL a7f5d786064642f926faa444b9db1555ccfbb460655f81a0ca408bc5ad2acfb89fe596f81d161078944ce1b2dc00e82e8fb056f050bf026fc07f6417af7b9776
+DIST splash.xpm.gz 33856 SHA256 b95600f777331b0dd31d51c68f60f0e846e4c8b628857a41165f4e6b30e6acaf SHA512 5ae1f786f7d46a95a7061068d5b2b3ad64607c7b190d6f28379508c5dce67e26308325bfd637542a84855dfcf1ea3d143947326fdb189a6a8972208d3ead23da WHIRLPOOL d95b7b588ea8ac7c2c8c53eb8057aef21c825da6411afe3b7e864c606aeffaaebce8ae41ce3e979f277bd6b48a9e82a1f2ea8afc836213b56523d8a854227d7b
+DIST unifont-9.0.06.pcf.gz 1360354 SHA256 6d23e82ea3fd3d79849d675c0c30129b62a3973a83b4cdc05f9994efef773b86 SHA512 dd0a1afa72f5204c62055d83f22750c74af38ffafdb8eda8e1f1cf7292e572a14969b8a9a6a2cb336d5bed4ab633f6b5a962c59117a590e4238788959cb82774 WHIRLPOOL 3153fe2a254cffa5aac6c5915468262bf60f993ce5a2aa47885ccef2a6714e205724b01fd9d26d499b9efbc5213e3cea0037c91f17fb2ae780ee289cab0de69b
+EBUILD grub-0.97-r16.ebuild 9699 SHA256 03223c6cec66ca01d0ee08db83a96ef3021bca3fa2414fd862727a9ae9cade07 SHA512 0edce20bd616493dc8e83276fd89fc2b762794cc25572c4ad3cc055c1c8c209ca2d6dc6a1a90a54deb17a245f7218468f7054099d20688ebd0debf227624c057 WHIRLPOOL e58455c072c3616fc317359e6d9a6bbf69399be84e30af641530c2892b0e05dec2cd799e2f49e244700982e62666cff33ddcc4a1ec6bb1112d7fff0f3f284b2c
+EBUILD grub-0.97-r17.ebuild 9281 SHA256 66a9f548b0b7e4def066a72a06b96ef3292c15c6adf9d90bade0f1552b960916 SHA512 659b416c659c023cbbbec587f1b6f2e7995016a41194905b647ebff5d0efb670bba83d468ed3b6dd01abd96f1df0c2b013f91c301e437a01e55febde7f223727 WHIRLPOOL a296fd473102bdfadb3ffd4fa8466dace236e183c815a68c9a1d8beb780ea5e20f7e1d39280f689636a6517a6f7b2c5a5997212c29e530f1dba416bbd5eac9d3
+EBUILD grub-2.02.ebuild 7597 SHA256 ada3921a987f213615b625b6d97491c1d33448f700410413d411a1d95a04660e SHA512 d3aa7a602989d0eee9c48ddd527253099cfb81887171c69add1f83fea36bac295147fc11cd9cdd2c06410670c435cf1c3f20303660675aa936668b04178cb8ba WHIRLPOOL f7032a2a33a7a571f15b99d02ba59bd30582e531a7330932d1d860485f83569fef9ef8bb5f16759691744fdfb28c6fb12bd24f64c82481281739289ae0da170d
+EBUILD grub-9999.ebuild 7599 SHA256 dda50136976d84a46106a3e6b6ffb657c2094a44d44e520b31c1654cc54b32a6 SHA512 cfb7ffc4a2d94d0ceaaf6fa63d6c587b8c35488c3f00cc667073926a00c90044c58e94f69e53d765b13ea792f7e79e49b59529ad2788460367259ad2524bd410 WHIRLPOOL fc8b0d52d2d7659fc1594f2ed07661bcc2edf52db8c9b3fa3d20dcd756e65002812cffac281149728d2e6e58f621fe0fb8cda082ba6946024a3a909d7ff4a002
+MISC ChangeLog 14166 SHA256 fd94eac2c96265c94e4fd203e094dd6f8985ab3146103f313b647aab5ea76814 SHA512 eeea31f9e358370b12e81075308271fe2ae64d6e84b2828261d1c74577fafdd33b412f0d0faa784a0fbd502481ae3619d2320542b49e06a3b6bd0c11c90a1d6d WHIRLPOOL 2732342665c419b0b6f5d8c75b888437cf73600857c30d06f2c39342f64055db79a2de7e4015827bca82ad6d3f0b16532bf6adab6f1e89a3c12e0e2f06556141
+MISC ChangeLog-2015 68266 SHA256 ef0fa0fe0c1cb3d89ada4d451fba86eddb65057241a162d038bb653fc24c8bc4 SHA512 b8f361b605eada55e197c0079843b3ead0390b1df356b9bc337dba8eb8718f3f7f9928b212b1dfda763b9df87181368518d6a035a4054403d598863ef9a2cb09 WHIRLPOOL 6e62ed831e8f960da784180691a2d529447491177ce5c26ab19080a7c18f6c286850220051f4fdcd18fa162ecb6b20ebbae78e7c424c5f0f87797d3718bf8003
+MISC metadata.xml 1488 SHA256 0ddda5b7b9fcb5e294d315fc49fa1718e0038097befe74d8d7a3738a109c210a SHA512 71f3e48b73c3d20f213ae928b16499131417562d98b83f2d82a5fb026c8cc06ecddf9db32565d9e1602d4258f7a2cc1796eb523c4cb98fb6b7753328a29e93ba WHIRLPOOL c105fd3480c9f1c30928558d5456778a916fb8ecf51ebffffc7937385f4393630bd93355180b149390f0506e4a8feba060b35eec485c1863bdb9931c52bc6b2d
diff --git a/sys-boot/grub/files/gfxpayload.patch b/sys-boot/grub/files/gfxpayload.patch
new file mode 100644
index 000000000000..6c63ef88b09e
--- /dev/null
+++ b/sys-boot/grub/files/gfxpayload.patch
@@ -0,0 +1,29 @@
+From e2d5bf1bc6aaaabeba538c1ca94ea8601e4e1474 Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Thu, 16 Oct 2014 23:43:51 -0400
+Subject: [PATCH] 10_linux: Default gfxpayload=keep only when booting using efi
+
+vesafb seems to be unreliable when using BIOS compat mode.
+
+---
+ util/grub.d/10_linux.in | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index d2e2a8f..a54b888 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -104,7 +104,9 @@ linux_entry ()
+ echo " load_video" | sed "s/^/$submenu_indentation/"
+ if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \
+ && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then
+- echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/"
++ echo ' if [ "x$grub_platform" = xefi ]; then' | sed "s/^/$submenu_indentation/"
++ echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/"
++ echo ' fi' | sed "s/^/$submenu_indentation/"
+ fi
+ else
+ if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
+--
+2.7.2
+
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
new file mode 100644
index 000000000000..c550aabd6167
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.97-Add-esp-to-list-of-clobbered-registers.patch
@@ -0,0 +1,53 @@
+From 5a52ee4b5cd152fa4ccd1c1f938ce2eba652af52 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Mon, 14 Dec 2015 23:59:17 +0000
+Subject: [PATCH] Add %esp to list of clobbered registers
+
+GCC assumes that it can combine stacks from
+outer
+ grub_stage2()
+and inner
+ trampoline doit()
+functions (optimisation -fcombine-stack-adjustments).
+
+But doit() function clobbers %esp in inline
+assebly statement as:
+
+ asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n"
+ : "=&r" (realstack) : "r" (simstack));
+
+which tricks gcc into computing invalid local variable
+offsets from current %esp value.
+
+Fix by hinting gcc about %esp change in clobber list.
+
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ grub/asmstub.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/grub/asmstub.c b/grub/asmstub.c
+index 6354806..44b056f 100644
+--- a/grub/asmstub.c
++++ b/grub/asmstub.c
+@@ -174,7 +174,7 @@ grub_stage2 (void)
+ {
+ /* Make sure our stack lives in the simulated memory area. */
+ asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n"
+- : "=&r" (realstack) : "r" (simstack));
++ : "=&r" (realstack) : "r" (simstack) : "%esp");
+
+ /* Do a setjmp here for the stop command. */
+ if (! setjmp (env_for_exit))
+@@ -191,7 +191,7 @@ grub_stage2 (void)
+ }
+
+ /* Replace our stack before we use any local variables. */
+- asm volatile ("movl %0, %%esp\n" : : "r" (realstack));
++ asm volatile ("movl %0, %%esp\n" : : "r" (realstack) : "%esp");
+ }
+
+ assert (grub_scratch_mem == 0);
+--
+2.6.3
+
diff --git a/sys-boot/grub/files/grub-0.97-ncurses-pkgconfig.patch b/sys-boot/grub/files/grub-0.97-ncurses-pkgconfig.patch
new file mode 100644
index 000000000000..d62e4346c338
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.97-ncurses-pkgconfig.patch
@@ -0,0 +1,18 @@
+--- a/configure.ac 2015-12-17 11:09:56.807893315 -0500
++++ b/configure.ac 2015-12-17 11:11:06.697570856 -0500
+@@ -234,10 +234,14 @@
+
+ # Unless the user specify --without-curses, check for curses.
+ if test "x$with_curses" != "xno"; then
++ PKG_CHECK_MODULES([NCURSES],[ncurses],[
++ AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])
++ GRUB_LIBS="$GRUB_LIBS $NCURSES_LIBS"
++ ],[
+ AC_CHECK_LIB(ncurses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lncurses"
+ AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])],
+ [AC_CHECK_LIB(curses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lcurses"
+- AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])])])
++ AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])])])])
+ fi
+
+ AC_SUBST(GRUB_LIBS)
diff --git a/sys-boot/grub/files/grub-2.02_beta2-KERNEL_GLOBS.patch b/sys-boot/grub/files/grub-2.02_beta2-KERNEL_GLOBS.patch
new file mode 100644
index 000000000000..c66ee68dc8de
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.02_beta2-KERNEL_GLOBS.patch
@@ -0,0 +1,67 @@
+From 43e3295aaad5278a1e53c5282e2660b72cd76d28 Mon Sep 17 00:00:00 2001
+From: "Robin H. Johnson" <robbat2@gentoo.org>
+Date: Tue, 29 Dec 2015 15:29:14 -0800
+Subject: [PATCH] GRUB_LINUX_KERNEL_GLOBS: configurable kernel selection
+
+* util/grub.d/10_linux.in: Implement GRUB_LINUX_KERNEL_GLOBS
+* docs/grub.texi: Document GRUB_LINUX_KERNEL_GLOBS
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+---
+ docs/grub.texi | 5 +++++
+ util/grub.d/10_linux.in | 21 +++++++++++----------
+ 2 files changed, 16 insertions(+), 10 deletions(-)
+
+diff --git a/docs/grub.texi b/docs/grub.texi
+index 9a25a0b..d1129ec 100644
+--- a/docs/grub.texi
++++ b/docs/grub.texi
+@@ -1490,6 +1490,11 @@ This option may be set to a list of GRUB module names separated by spaces.
+ Each module will be loaded as early as possible, at the start of
+ @file{grub.cfg}.
+
++@item GRUB_LINUX_KERNEL_GLOBS
++This option may be set to override the list of path globs used to find Linux
++kernels. The defaults vary by architecture, and generally include both
++@file{/boot} and @file{/}.
++
+ @end table
+
+ The following options are still accepted for compatibility with existing
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 859b608..e5ac11d 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -145,18 +145,19 @@ EOF
+ }
+
+ machine=`uname -m`
+-case "x$machine" in
++globs="$GRUB_LINUX_KERNEL_GLOBS"
++[ -z "$globs" ] && case "x$machine" in
+ xi?86 | xx86_64)
+- list=
+- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
+- done ;;
+- *)
+- list=
+- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
+- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
+- done ;;
++ globs="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*"
++ ;;
++ *)
++ globs="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-*"
++ ;;
+ esac
++list=
++for i in ${globs} ; do
++ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
++done
+
+ case "$machine" in
+ i?86) GENKERNEL_ARCH="x86" ;;
+--
+2.3.0
+
diff --git a/sys-boot/grub/files/grub.conf.gentoo b/sys-boot/grub/files/grub.conf.gentoo
new file mode 100644
index 000000000000..984470b3860d
--- /dev/null
+++ b/sys-boot/grub/files/grub.conf.gentoo
@@ -0,0 +1,16 @@
+# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
+# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
+# If you are not using Genkernel and you need help creating this file, you
+# should consult the handbook. Alternatively, consult the grub.conf.sample that
+# is included with the Grub documentation.
+
+default 0
+timeout 30
+#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
+
+#title Gentoo Linux 3.8.13
+#root (hd0,0)
+#kernel /boot/kernel-genkernel-x86-3.8.13-gentoo root=/dev/sda3
+#initrd /boot/initramfs-genkernel-x86-3.8.13
+
+# vim:ft=conf:
diff --git a/sys-boot/grub/files/grub.default-3 b/sys-boot/grub/files/grub.default-3
new file mode 100644
index 000000000000..593b019db7d4
--- /dev/null
+++ b/sys-boot/grub/files/grub.default-3
@@ -0,0 +1,73 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+#
+# To populate all changes in this file you need to regenerate your
+# grub configuration file afterwards:
+# 'grub2-mkconfig -o /boot/grub/grub.cfg'
+#
+# See the grub info page for documentation on possible variables and
+# their associated values.
+
+GRUB_DISTRIBUTOR="Gentoo"
+
+# Default menu entry
+#GRUB_DEFAULT=0
+
+# Boot the default entry this many seconds after the menu is displayed
+#GRUB_TIMEOUT=5
+#GRUB_TIMEOUT_STYLE=menu
+
+# Append parameters to the linux kernel command line
+#GRUB_CMDLINE_LINUX=""
+#
+# Examples:
+#
+# Boot with network interface renaming disabled
+# GRUB_CMDLINE_LINUX="net.ifnames=0"
+#
+# Boot with systemd instead of sysvinit (openrc)
+# GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd"
+
+# Append parameters to the linux kernel command line for non-recovery entries
+#GRUB_CMDLINE_LINUX_DEFAULT=""
+
+# Uncomment to disable graphical terminal (grub-pc only)
+#GRUB_TERMINAL=console
+
+# The resolution used on graphical terminal.
+# Note that you can use only modes which your graphic card supports via VBE.
+# You can see them in real GRUB with the command `vbeinfo'.
+#GRUB_GFXMODE=640x480
+
+# Set to 'text' to force the Linux kernel to boot in normal text
+# mode, 'keep' to preserve the graphics mode set using
+# 'GRUB_GFXMODE', 'WIDTHxHEIGHT'['xDEPTH'] to set a particular
+# graphics mode, or a sequence of these separated by commas or
+# semicolons to try several modes in sequence.
+#GRUB_GFXPAYLOAD_LINUX=
+
+# Path to theme spec txt file.
+# The starfield is by default provided with use truetype.
+# NOTE: when enabling custom theme, ensure you have required font/etc.
+#GRUB_THEME="/boot/grub/themes/starfield/theme.txt"
+
+# Background image used on graphical terminal.
+# Can be in various bitmap formats.
+#GRUB_BACKGROUND="/boot/grub/mybackground.png"
+
+# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
+#GRUB_DISABLE_LINUX_UUID=true
+
+# Uncomment to disable generation of recovery mode menu entries
+#GRUB_DISABLE_RECOVERY=true
+
+# Uncomment to disable generation of the submenu and put all choices on
+# the top-level menu.
+# Besides the visual affect of no sub menu, this makes navigation of the
+# menu easier for a user who can't see the screen.
+#GRUB_DISABLE_SUBMENU=y
+
+# Uncomment to play a tone when the main menu is displayed.
+# This is useful, for example, to allow users who can't see the screen
+# to know when they can make a choice on the menu.
+#GRUB_INIT_TUNE="60 800 1"
diff --git a/sys-boot/grub/grub-0.97-r16.ebuild b/sys-boot/grub/grub-0.97-r16.ebuild
new file mode 100644
index 000000000000..06d9aa23b124
--- /dev/null
+++ b/sys-boot/grub/grub-0.97-r16.ebuild
@@ -0,0 +1,301 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# XXX: we need to review menu.lst vs grub.conf handling. We've been converting
+# all systems to grub.conf (and symlinking menu.lst to grub.conf), but
+# we never updated any of the source code (it still all wants menu.lst),
+# and there is no indication that upstream is making the transition.
+
+# If you need to roll a new grub-static distfile, here is how.
+# - Robin H. Johnson <robbat2@gentoo.org> - 29 Nov 2010
+# FEATURES='-noauto -noinfo -nodoc -noman -splitdebug nostrip' \
+# USE='static -ncurses -netboot -custom-cflags' \
+# PORTAGE_COMPRESS=true GRUB_STATIC_PACKAGE_BUILDING=1 ebuild \
+# grub-${PVR}.ebuild clean package && \
+# qtbz2 -s -j ${PKGDIR}/${CAT}/${PF}.tbz2 && \
+# mv ${PF}.tar.bz2 ${DISTDIR}/grub-static-${PVR}.tar.bz2
+
+EAPI="5"
+
+inherit eutils mount-boot toolchain-funcs linux-info flag-o-matic autotools pax-utils multiprocessing
+
+PATCHVER="1.14" # Should match the revision ideally
+DESCRIPTION="GNU GRUB Legacy boot loader"
+HOMEPAGE="https://www.gnu.org/software/grub/"
+SRC_URI="mirror://gentoo/${P}.tar.gz
+ mirror://gnu-alpha/${PN}/${P}.tar.gz
+ mirror://gentoo/splash.xpm.gz
+ mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86 ~x86-fbsd"
+IUSE="custom-cflags ncurses netboot static"
+
+LIB_DEPEND="ncurses? ( >=sys-libs/ncurses-5.9-r3:0[static-libs(+),abi_x86_32(-)] )"
+RDEPEND="!static? ( ${LIB_DEPEND//[static-libs(+),/=[} )"
+DEPEND="${RDEPEND}
+ static? ( ${LIB_DEPEND} )"
+RDEPEND+=" !sys-boot/grub:2[-multislot]"
+
+pkg_setup() {
+ case $(tc-arch) in
+ amd64) CONFIG_CHECK='~IA32_EMULATION' check_extra_config ;;
+ esac
+}
+
+src_prepare() {
+ # Grub will not handle a kernel larger than EXTENDED_MEMSIZE Mb as
+ # discovered in bug 160801. We can change this, however, using larger values
+ # for this variable means that Grub needs more memory to run and boot. For a
+ # kernel of size N, Grub needs (N+1)*2. Advanced users should set a custom
+ # value in make.conf, it is possible to make kernels ~16Mb in size, but it
+ # needs the kitchen sink built-in.
+ local t="custom"
+ if [[ -z ${GRUB_MAX_KERNEL_SIZE} ]] ; then
+ case $(tc-arch) in
+ amd64) GRUB_MAX_KERNEL_SIZE=9 ;;
+ x86) GRUB_MAX_KERNEL_SIZE=5 ;;
+ esac
+ t="default"
+ fi
+ einfo "Grub will support the ${t} maximum kernel size of ${GRUB_MAX_KERNEL_SIZE} Mb (GRUB_MAX_KERNEL_SIZE)"
+
+ sed -i \
+ -e "/^#define.*EXTENDED_MEMSIZE/s,3,${GRUB_MAX_KERNEL_SIZE},g" \
+ "${S}"/grub/asmstub.c \
+ || die
+
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+
+ # Work around issue where the default CFLAGS fail with gcc-4.9.3 (possibly newer), force -O0 instead
+ # bug 564890, 566638
+ if [[ $(gcc-major-version) -ge 5 || $(gcc-major-version) -eq 4 && $(gcc-minor-version) -ge 9 ]]; then
+ if use custom-cflags; then
+ ewarn "You are using custom cflags with gcc-4.9 or newer."
+ ewarn "Be aware the result may segfault at runtime due to unknown optimization"
+ ewarn "incompatibilities."
+ else
+ einfo "Forcing -O0 to get around optimization issue caused by gcc-4.9 and newer with -O2"
+ sed -i -e "/CFLAGS/s/-O2/-O0/" \
+ "${S}"/configure.ac || die
+ fi
+ fi
+
+ rm -f "${S}"/aclocal.m4 # seems to keep bug 418287 away
+ eautoreconf
+}
+
+src_configure() {
+ filter-flags -fPIE #168834
+
+ use amd64 && multilib_toolchain_setup x86
+
+ unset BLOCK_SIZE #73499
+
+ ### i686-specific code in the boot loader is a bad idea; disabling to ensure
+ ### at least some compatibility if the hard drive is moved to an older or
+ ### incompatible system.
+
+ # grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
+ # but the objcopy's (faulty) test fails if -fstack-protector is default.
+ # create a cache telling configure that objcopy is ok, and add -C to econf
+ # to make use of the cache.
+ #
+ # CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
+ # STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
+ # -fno-stack-protector detected by configure, removed from netboot's emake.
+ use custom-cflags || unset CFLAGS
+
+ tc-ld-disable-gold #439082 #466536 #526348
+
+ export grub_cv_prog_objcopy_absolute=yes #79734
+ use static && append-ldflags -static
+
+ if use amd64 && use static ; then
+ if [[ -n ${GRUB_STATIC_PACKAGE_BUILDING} ]] ; then
+ eerror "You have set GRUB_STATIC_PACKAGE_BUILDING. This"
+ eerror "is specifically intended for building the tarballs for the"
+ eerror "grub-static package via USE='static -ncurses'."
+ eerror "All bets are now off."
+ fi
+ fi
+
+ multijob_init
+
+ # build the net-bootable grub first, but only if "netboot" is set
+ if use netboot ; then
+ (
+ multijob_child_init
+ mkdir -p "${WORKDIR}"/netboot
+ pushd "${WORKDIR}"/netboot >/dev/null
+ ECONF_SOURCE=${S} \
+ econf \
+ --libdir=/lib \
+ --datadir=/usr/lib/grub \
+ --exec-prefix=/ \
+ --disable-auto-linux-mem-opt \
+ --enable-diskless \
+ --enable-{3c{5{03,07,09,29,95},90x},cs89x0,davicom,depca,eepro{,100}} \
+ --enable-{epic100,exos205,ni5210,lance,ne2100,ni{50,65}10,natsemi} \
+ --enable-{ne,ns8390,wd,otulip,rtl8139,sis900,sk-g16,smc9000,tiara} \
+ --enable-{tulip,via-rhine,w89c840}
+ popd >/dev/null
+ ) &
+ multijob_post_fork
+ fi
+
+ # Now build the regular grub
+ # Note that FFS and UFS2 support are broken for now - stage1_5 files too big
+ econf \
+ --libdir=/lib \
+ --datadir=/usr/lib/grub \
+ --exec-prefix=/ \
+ --disable-auto-linux-mem-opt \
+ $(use_with ncurses curses)
+
+ # sanity check due to common failure
+ use ncurses && ! grep -qs "HAVE_LIBCURSES.*1" config.h && die "USE=ncurses but curses not found"
+
+ multijob_finish
+}
+
+src_compile() {
+ use netboot && emake -C "${WORKDIR}"/netboot w89c840_o_CFLAGS="-O"
+ emake
+}
+
+src_test() {
+ # non-default block size also give false pass/fails.
+ unset BLOCK_SIZE
+ emake -j1 check
+}
+
+src_install() {
+ default
+ if use netboot ; then
+ exeinto /usr/lib/grub/${CHOST}
+ doexe "${WORKDIR}"/netboot/stage2/{nbgrub,pxegrub}
+ newexe "${WORKDIR}"/netboot/stage2/stage2 stage2.netboot
+ fi
+
+ pax-mark -m "${D}"/sbin/grub #330745
+
+ newdoc docs/menu.lst grub.conf.sample
+ dodoc "${FILESDIR}"/grub.conf.gentoo
+
+ [[ -n ${GRUB_STATIC_PACKAGE_BUILDING} ]] && \
+ mv "${D}"/usr/share/doc/{${PF},grub-static-${PF/grub-}}
+
+ insinto /usr/share/grub
+ doins "${DISTDIR}"/splash.xpm.gz
+}
+
+setup_boot_dir() {
+ local boot_dir=$1
+ local dir=${boot_dir}
+
+ mkdir -p "${dir}"
+ [[ ! -L ${dir}/boot ]] && ln -s . "${dir}/boot"
+ dir="${dir}/grub"
+ if [[ ! -e ${dir} ]] ; then
+ mkdir "${dir}" || die
+ fi
+
+ # change menu.lst to grub.conf
+ if [[ ! -e ${dir}/grub.conf ]] && [[ -e ${dir}/menu.lst ]] ; then
+ mv -f "${dir}"/menu.lst "${dir}"/grub.conf
+ ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
+ echo
+ fi
+
+ if [[ ! -e ${dir}/menu.lst ]]; then
+ einfo "Linking from new grub.conf name to menu.lst"
+ ln -snf grub.conf "${dir}"/menu.lst
+ fi
+
+ if [[ -e ${dir}/stage2 ]] ; then
+ mv "${dir}"/stage2{,.old}
+ ewarn "*** IMPORTANT NOTE: you must run grub and install"
+ ewarn "the new version's stage1 to your MBR. Until you do,"
+ ewarn "stage1 and stage2 will still be the old version, but"
+ ewarn "later stages will be the new version, which could"
+ ewarn "cause problems such as an unbootable system."
+ ewarn
+ ewarn "This means you must use either grub-install or perform"
+ ewarn "root/setup manually."
+ ewarn
+ ewarn "For more help, see the wiki:"
+ ewarn "https://wiki.gentoo.org/wiki/GRUB"
+ echo
+ fi
+
+ einfo "Copying files from /lib/grub and /usr/share/grub to ${dir}"
+ for x in \
+ "${ROOT}"/lib*/grub/*/* \
+ "${ROOT}"/usr/share/grub/* ; do
+ [[ -f ${x} ]] && cp -p "${x}" "${dir}"/
+ done
+
+ if [[ ! -e ${dir}/grub.conf ]] ; then
+ s="${ROOT}/usr/share/doc/${PF}/grub.conf.gentoo"
+ [[ -e "${s}" ]] && cat "${s}" >${dir}/grub.conf
+ [[ -e "${s}.gz" ]] && zcat "${s}.gz" >${dir}/grub.conf
+ [[ -e "${s}.bz2" ]] && bzcat "${s}.bz2" >${dir}/grub.conf
+ fi
+
+ # Per bug 218599, we support grub.conf.install for users that want to run a
+ # specific set of Grub setup commands rather than the default ones.
+ grub_config=${dir}/grub.conf.install
+ [[ -e ${grub_config} ]] || grub_config=${dir}/grub.conf
+ if [[ -e ${grub_config} ]] ; then
+ egrep \
+ -v '^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)' \
+ "${grub_config}" | \
+ /sbin/grub --batch \
+ --device-map="${dir}"/device.map \
+ > /dev/null
+ fi
+
+ # the grub default commands silently piss themselves if
+ # the default file does not exist ahead of time
+ if [[ ! -e ${dir}/default ]] ; then
+ grub-set-default --root-directory="${boot_dir}" default
+ fi
+ einfo "Grub has been installed to ${boot_dir} successfully."
+}
+
+pkg_postinst() {
+ mount-boot_mount_boot_partition
+
+ if [[ -n ${DONT_MOUNT_BOOT} ]]; then
+ elog "WARNING: you have DONT_MOUNT_BOOT in effect, so you must apply"
+ elog "the following instructions for your /boot!"
+ elog "Neglecting to do so may cause your system to fail to boot!"
+ elog
+ else
+ setup_boot_dir "${ROOT}"/boot
+ # Trailing output because if this is run from pkg_postinst, it gets mixed into
+ # the other output.
+ einfo ""
+ fi
+ elog "To interactively install grub files to another device such as a USB"
+ elog "stick, just run the following and specify the directory as prompted:"
+ elog " emerge --config =${PF}"
+ elog "Alternately, you can export GRUB_ALT_INSTALLDIR=/path/to/use to tell"
+ elog "grub where to install in a non-interactive way."
+
+ # needs to be after we call setup_boot_dir
+ mount-boot_pkg_postinst
+}
+
+pkg_config() {
+ local dir
+ if [ ! -d "${GRUB_ALT_INSTALLDIR}" ]; then
+ einfo "Enter the directory where you want to setup grub:"
+ read dir
+ else
+ dir="${GRUB_ALT_INSTALLDIR}"
+ fi
+ setup_boot_dir "${dir}"
+}
diff --git a/sys-boot/grub/grub-0.97-r17.ebuild b/sys-boot/grub/grub-0.97-r17.ebuild
new file mode 100644
index 000000000000..038a541f8795
--- /dev/null
+++ b/sys-boot/grub/grub-0.97-r17.ebuild
@@ -0,0 +1,293 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# XXX: we need to review menu.lst vs grub.conf handling. We've been converting
+# all systems to grub.conf (and symlinking menu.lst to grub.conf), but
+# we never updated any of the source code (it still all wants menu.lst),
+# and there is no indication that upstream is making the transition.
+
+# If you need to roll a new grub-static distfile, here is how.
+# - Robin H. Johnson <robbat2@gentoo.org> - 29 Nov 2010
+# FEATURES='-noauto -noinfo -nodoc -noman -splitdebug nostrip' \
+# USE='static -ncurses -netboot -custom-cflags' \
+# PORTAGE_COMPRESS=true GRUB_STATIC_PACKAGE_BUILDING=1 ebuild \
+# grub-${PVR}.ebuild clean package && \
+# qtbz2 -s -j ${PKGDIR}/${CAT}/${PF}.tbz2 && \
+# mv ${PF}.tar.bz2 ${DISTDIR}/grub-static-${PVR}.tar.bz2
+
+EAPI="5"
+
+inherit eutils mount-boot toolchain-funcs linux-info flag-o-matic autotools pax-utils multiprocessing
+
+PATCHVER="1.14" # Should match the revision ideally
+DESCRIPTION="GNU GRUB Legacy boot loader"
+HOMEPAGE="https://www.gnu.org/software/grub/"
+SRC_URI="mirror://gentoo/${P}.tar.gz
+ mirror://gnu-alpha/${PN}/${P}.tar.gz
+ mirror://gentoo/splash.xpm.gz
+ mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~x86-fbsd"
+IUSE="custom-cflags ncurses netboot static"
+
+LIB_DEPEND="ncurses? ( >=sys-libs/ncurses-5.9-r3:0[static-libs(+),abi_x86_32(-)] )"
+RDEPEND="!static? ( ${LIB_DEPEND//[static-libs(+),/=[} )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ static? ( ${LIB_DEPEND} )"
+RDEPEND+=" !sys-boot/grub:2[-multislot]"
+
+pkg_setup() {
+ case $(tc-arch) in
+ amd64) CONFIG_CHECK='~IA32_EMULATION' check_extra_config ;;
+ esac
+}
+
+src_prepare() {
+ # Grub will not handle a kernel larger than EXTENDED_MEMSIZE Mb as
+ # discovered in bug 160801. We can change this, however, using larger values
+ # for this variable means that Grub needs more memory to run and boot. For a
+ # kernel of size N, Grub needs (N+1)*2. Advanced users should set a custom
+ # value in make.conf, it is possible to make kernels ~16Mb in size, but it
+ # needs the kitchen sink built-in.
+ local t="custom"
+ if [[ -z ${GRUB_MAX_KERNEL_SIZE} ]] ; then
+ case $(tc-arch) in
+ amd64) GRUB_MAX_KERNEL_SIZE=9 ;;
+ x86) GRUB_MAX_KERNEL_SIZE=5 ;;
+ esac
+ t="default"
+ fi
+ einfo "Grub will support the ${t} maximum kernel size of ${GRUB_MAX_KERNEL_SIZE} Mb (GRUB_MAX_KERNEL_SIZE)"
+
+ sed -i \
+ -e "/^#define.*EXTENDED_MEMSIZE/s,3,${GRUB_MAX_KERNEL_SIZE},g" \
+ "${S}"/grub/asmstub.c \
+ || die
+
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ # bug 564890, 566638
+ epatch "${FILESDIR}"/grub-0.97-Add-esp-to-list-of-clobbered-registers.patch
+ epatch "${FILESDIR}"/grub-0.97-ncurses-pkgconfig.patch
+
+ epatch_user
+
+ rm -f "${S}"/aclocal.m4 # seems to keep bug 418287 away
+ eautoreconf
+}
+
+src_configure() {
+ filter-flags -fPIE #168834
+
+ use amd64 && multilib_toolchain_setup x86
+
+ unset BLOCK_SIZE #73499
+
+ ### i686-specific code in the boot loader is a bad idea; disabling to ensure
+ ### at least some compatibility if the hard drive is moved to an older or
+ ### incompatible system.
+
+ # grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
+ # but the objcopy's (faulty) test fails if -fstack-protector is default.
+ # create a cache telling configure that objcopy is ok, and add -C to econf
+ # to make use of the cache.
+ #
+ # CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
+ # STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
+ # -fno-stack-protector detected by configure, removed from netboot's emake.
+ use custom-cflags || unset CFLAGS
+
+ tc-ld-disable-gold #439082 #466536 #526348
+
+ export grub_cv_prog_objcopy_absolute=yes #79734
+ use static && append-ldflags -static
+
+ if use amd64 && use static ; then
+ if [[ -n ${GRUB_STATIC_PACKAGE_BUILDING} ]] ; then
+ eerror "You have set GRUB_STATIC_PACKAGE_BUILDING. This"
+ eerror "is specifically intended for building the tarballs for the"
+ eerror "grub-static package via USE='static -ncurses'."
+ eerror "All bets are now off."
+ fi
+ fi
+
+ multijob_init
+
+ # build the net-bootable grub first, but only if "netboot" is set
+ if use netboot ; then
+ (
+ multijob_child_init
+ mkdir -p "${WORKDIR}"/netboot
+ pushd "${WORKDIR}"/netboot >/dev/null
+ ECONF_SOURCE=${S} \
+ econf \
+ --libdir=/lib \
+ --datadir=/usr/lib/grub \
+ --exec-prefix=/ \
+ --disable-auto-linux-mem-opt \
+ --enable-diskless \
+ --enable-{3c{5{03,07,09,29,95},90x},cs89x0,davicom,depca,eepro{,100}} \
+ --enable-{epic100,exos205,ni5210,lance,ne2100,ni{50,65}10,natsemi} \
+ --enable-{ne,ns8390,wd,otulip,rtl8139,sis900,sk-g16,smc9000,tiara} \
+ --enable-{tulip,via-rhine,w89c840}
+ popd >/dev/null
+ ) &
+ multijob_post_fork
+ fi
+
+ # Now build the regular grub
+ # Note that FFS and UFS2 support are broken for now - stage1_5 files too big
+ econf \
+ --libdir=/lib \
+ --datadir=/usr/lib/grub \
+ --exec-prefix=/ \
+ --disable-auto-linux-mem-opt \
+ $(use_with ncurses curses)
+
+ # sanity check due to common failure
+ use ncurses && ! grep -qs "HAVE_LIBCURSES.*1" config.h && die "USE=ncurses but curses not found"
+
+ multijob_finish
+}
+
+src_compile() {
+ use netboot && emake -C "${WORKDIR}"/netboot w89c840_o_CFLAGS="-O"
+ emake
+}
+
+src_test() {
+ # non-default block size also give false pass/fails.
+ unset BLOCK_SIZE
+ emake -j1 check
+}
+
+src_install() {
+ default
+ if use netboot ; then
+ exeinto /usr/lib/grub/${CHOST}
+ doexe "${WORKDIR}"/netboot/stage2/{nbgrub,pxegrub}
+ newexe "${WORKDIR}"/netboot/stage2/stage2 stage2.netboot
+ fi
+
+ pax-mark -m "${D}"/sbin/grub #330745
+
+ newdoc docs/menu.lst grub.conf.sample
+ dodoc "${FILESDIR}"/grub.conf.gentoo
+
+ [[ -n ${GRUB_STATIC_PACKAGE_BUILDING} ]] && \
+ mv "${D}"/usr/share/doc/{${PF},grub-static-${PF/grub-}}
+
+ insinto /usr/share/grub
+ doins "${DISTDIR}"/splash.xpm.gz
+}
+
+setup_boot_dir() {
+ local boot_dir=$1
+ local dir=${boot_dir}
+
+ mkdir -p "${dir}"
+ [[ ! -L ${dir}/boot ]] && ln -s . "${dir}/boot"
+ dir="${dir}/grub"
+ if [[ ! -e ${dir} ]] ; then
+ mkdir "${dir}" || die
+ fi
+
+ # change menu.lst to grub.conf
+ if [[ ! -e ${dir}/grub.conf ]] && [[ -e ${dir}/menu.lst ]] ; then
+ mv -f "${dir}"/menu.lst "${dir}"/grub.conf
+ ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
+ echo
+ fi
+
+ if [[ ! -e ${dir}/menu.lst ]]; then
+ einfo "Linking from new grub.conf name to menu.lst"
+ ln -snf grub.conf "${dir}"/menu.lst
+ fi
+
+ if [[ -e ${dir}/stage2 ]] ; then
+ mv "${dir}"/stage2{,.old}
+ ewarn "*** IMPORTANT NOTE: you must run grub and install"
+ ewarn "the new version's stage1 to your MBR. Until you do,"
+ ewarn "stage1 and stage2 will still be the old version, but"
+ ewarn "later stages will be the new version, which could"
+ ewarn "cause problems such as an unbootable system."
+ ewarn
+ ewarn "This means you must use either grub-install or perform"
+ ewarn "root/setup manually."
+ ewarn
+ ewarn "For more help, see the wiki:"
+ ewarn "https://wiki.gentoo.org/wiki/GRUB"
+ echo
+ fi
+
+ einfo "Copying files from /lib/grub and /usr/share/grub to ${dir}"
+ for x in \
+ "${ROOT}"/lib*/grub/*/* \
+ "${ROOT}"/usr/share/grub/* ; do
+ [[ -f ${x} ]] && cp -p "${x}" "${dir}"/
+ done
+
+ if [[ ! -e ${dir}/grub.conf ]] ; then
+ s="${ROOT}/usr/share/doc/${PF}/grub.conf.gentoo"
+ [[ -e "${s}" ]] && cat "${s}" >${dir}/grub.conf
+ [[ -e "${s}.gz" ]] && zcat "${s}.gz" >${dir}/grub.conf
+ [[ -e "${s}.bz2" ]] && bzcat "${s}.bz2" >${dir}/grub.conf
+ fi
+
+ # Per bug 218599, we support grub.conf.install for users that want to run a
+ # specific set of Grub setup commands rather than the default ones.
+ grub_config=${dir}/grub.conf.install
+ [[ -e ${grub_config} ]] || grub_config=${dir}/grub.conf
+ if [[ -e ${grub_config} ]] ; then
+ egrep \
+ -v '^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)' \
+ "${grub_config}" | \
+ /sbin/grub --batch \
+ --device-map="${dir}"/device.map \
+ > /dev/null
+ fi
+
+ # the grub default commands silently piss themselves if
+ # the default file does not exist ahead of time
+ if [[ ! -e ${dir}/default ]] ; then
+ grub-set-default --root-directory="${boot_dir}" default
+ fi
+ einfo "Grub has been installed to ${boot_dir} successfully."
+}
+
+pkg_postinst() {
+ mount-boot_mount_boot_partition
+
+ if [[ -n ${DONT_MOUNT_BOOT} ]]; then
+ elog "WARNING: you have DONT_MOUNT_BOOT in effect, so you must apply"
+ elog "the following instructions for your /boot!"
+ elog "Neglecting to do so may cause your system to fail to boot!"
+ elog
+ else
+ setup_boot_dir "${ROOT}"/boot
+ # Trailing output because if this is run from pkg_postinst, it gets mixed into
+ # the other output.
+ einfo ""
+ fi
+ elog "To interactively install grub files to another device such as a USB"
+ elog "stick, just run the following and specify the directory as prompted:"
+ elog " emerge --config =${PF}"
+ elog "Alternately, you can export GRUB_ALT_INSTALLDIR=/path/to/use to tell"
+ elog "grub where to install in a non-interactive way."
+
+ # needs to be after we call setup_boot_dir
+ mount-boot_pkg_postinst
+}
+
+pkg_config() {
+ local dir
+ if [ ! -d "${GRUB_ALT_INSTALLDIR}" ]; then
+ einfo "Enter the directory where you want to setup grub:"
+ read dir
+ else
+ dir="${GRUB_ALT_INSTALLDIR}"
+ fi
+ setup_boot_dir "${dir}"
+}
diff --git a/sys-boot/grub/grub-2.02.ebuild b/sys-boot/grub/grub-2.02.ebuild
new file mode 100644
index 000000000000..44db1517a9f3
--- /dev/null
+++ b/sys-boot/grub/grub-2.02.ebuild
@@ -0,0 +1,298 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+if [[ ${PV} == 9999 ]]; then
+ GRUB_AUTOGEN=1
+fi
+
+if [[ -n ${GRUB_AUTOGEN} ]]; then
+ PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} )
+ WANT_LIBTOOL=none
+ inherit autotools python-any-r1
+fi
+
+inherit autotools bash-completion-r1 flag-o-matic multibuild pax-utils toolchain-funcs versionator
+
+if [[ ${PV} != 9999 ]]; then
+ if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
+ # The quote style is to work with <=bash-4.2 and >=bash-4.3 #503860
+ MY_P=${P/_/'~'}
+ SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
+ S=${WORKDIR}/${MY_P}
+ else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+ S=${WORKDIR}/${P%_*}
+ fi
+ KEYWORDS="amd64 ~arm64 x86"
+else
+ inherit git-r3
+ EGIT_REPO_URI="git://git.sv.gnu.org/grub.git
+ http://git.savannah.gnu.org/r/grub.git"
+fi
+
+PATCHES=(
+ "${FILESDIR}"/gfxpayload.patch
+ "${FILESDIR}"/grub-2.02_beta2-KERNEL_GLOBS.patch
+)
+
+DEJAVU=dejavu-sans-ttf-2.37
+UNIFONT=unifont-9.0.06
+SRC_URI+=" fonts? ( mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz )
+ themes? ( mirror://sourceforge/dejavu/${DEJAVU}.zip )"
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="https://www.gnu.org/software/grub/"
+
+# Includes licenses for dejavu and unifont
+LICENSE="GPL-3 fonts? ( GPL-2-with-font-exception ) themes? ( BitstreamVera )"
+SLOT="2/${PVR}"
+IUSE="debug device-mapper doc efiemu +fonts mount multislot nls static sdl test +themes truetype libzfs"
+
+GRUB_ALL_PLATFORMS=( coreboot efi-32 efi-64 emu ieee1275 loongson multiboot qemu qemu-mips pc uboot xen xen-32 )
+IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}"
+
+REQUIRED_USE="
+ grub_platforms_coreboot? ( fonts )
+ grub_platforms_qemu? ( fonts )
+ grub_platforms_ieee1275? ( fonts )
+ grub_platforms_loongson? ( fonts )
+"
+
+# os-prober: Used on runtime to detect other OSes
+# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
+RDEPEND="
+ app-arch/xz-utils
+ >=sys-libs/ncurses-5.2-r5:0=
+ debug? (
+ sdl? ( media-libs/libsdl )
+ )
+ device-mapper? ( >=sys-fs/lvm2-2.02.45 )
+ libzfs? ( sys-fs/zfs )
+ mount? ( sys-fs/fuse )
+ truetype? ( media-libs/freetype:2= )
+ ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+ ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+"
+DEPEND="${RDEPEND}
+ ${PYTHON_DEPS}
+ app-misc/pax-utils
+ sys-devel/flex
+ sys-devel/bison
+ sys-apps/help2man
+ sys-apps/texinfo
+ fonts? ( media-libs/freetype:2 )
+ grub_platforms_xen? ( app-emulation/xen-tools:= )
+ grub_platforms_xen-32? ( app-emulation/xen-tools:= )
+ static? (
+ app-arch/xz-utils[static-libs(+)]
+ truetype? (
+ app-arch/bzip2[static-libs(+)]
+ media-libs/freetype[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ )
+ )
+ test? (
+ app-admin/genromfs
+ app-arch/cpio
+ app-arch/lzop
+ app-emulation/qemu
+ dev-libs/libisoburn
+ sys-apps/miscfiles
+ sys-block/parted
+ sys-fs/squashfs-tools
+ )
+ themes? (
+ app-arch/unzip
+ media-libs/freetype:2
+ )
+"
+RDEPEND+="
+ kernel_linux? (
+ grub_platforms_efi-32? ( sys-boot/efibootmgr )
+ grub_platforms_efi-64? ( sys-boot/efibootmgr )
+ )
+ !multislot? ( !sys-boot/grub:0 !sys-boot/grub-static )
+ nls? ( sys-devel/gettext )
+"
+
+DEPEND+=" !!=media-libs/freetype-2.5.4"
+
+RESTRICT="strip !test? ( test )"
+
+QA_EXECSTACK="usr/bin/grub*-emu* usr/lib/grub/*"
+QA_WX_LOAD="usr/lib/grub/*"
+QA_MULTILIB_PATHS="usr/lib/grub/.*"
+
+src_unpack() {
+ if [[ ${PV} == 9999 ]]; then
+ git-r3_src_unpack
+ fi
+ default
+}
+
+src_prepare() {
+ default
+
+ sed -i -e /autoreconf/d autogen.sh || die
+
+ if use multislot; then
+ # fix texinfo file name, bug 416035
+ sed -i -e 's/^\* GRUB:/* GRUB2:/' -e 's/(grub)/(grub2)/' docs/grub.texi || die
+ fi
+
+ # Nothing in Gentoo packages 'american-english' in the exact path
+ # wanted for the test, but all that is needed is a compressible text
+ # file, and we do have 'words' from miscfiles in the same path.
+ sed -i \
+ -e '/CFILESSRC.*=/s,american-english,words,' \
+ tests/util/grub-fs-tester.in \
+ || die
+
+ if [[ -n ${GRUB_AUTOGEN} ]]; then
+ python_setup
+ bash autogen.sh || die
+ autopoint() { :; }
+ eautoreconf
+ fi
+}
+
+grub_do() {
+ multibuild_foreach_variant run_in_build_dir "$@"
+}
+
+grub_do_once() {
+ multibuild_for_best_variant run_in_build_dir "$@"
+}
+
+grub_configure() {
+ local platform
+
+ case ${MULTIBUILD_VARIANT} in
+ efi*) platform=efi ;;
+ xen*) platform=xen ;;
+ guessed) ;;
+ *) platform=${MULTIBUILD_VARIANT} ;;
+ esac
+
+ case ${MULTIBUILD_VARIANT} in
+ *-32)
+ if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then
+ local CTARGET=i386
+ fi ;;
+ *-64)
+ if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then
+ local CTARGET=x86_64
+ local -x TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
+ local -x TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
+ fi ;;
+ esac
+
+ local myeconfargs=(
+ --disable-werror
+ --program-prefix=
+ --libdir="${EPREFIX}"/usr/lib
+ --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
+ $(use_enable debug mm-debug)
+ $(use_enable device-mapper)
+ $(use_enable mount grub-mount)
+ $(use_enable nls)
+ $(use_enable themes grub-themes)
+ $(use_enable truetype grub-mkfont)
+ $(use_enable libzfs)
+ $(use sdl && use_enable debug grub-emu-sdl)
+ ${platform:+--with-platform=}${platform}
+
+ # Let configure detect this where supported
+ $(usex efiemu '' '--disable-efiemu')
+ )
+
+ if use multislot; then
+ myeconfargs+=( --program-transform-name="s,grub,grub2," )
+ fi
+
+ # Set up font symlinks
+ ln -s "${WORKDIR}/${UNIFONT}.pcf" unifont.pcf || die
+ if use themes; then
+ ln -s "${WORKDIR}/${DEJAVU}/ttf/DejaVuSans.ttf" DejaVuSans.ttf || die
+ fi
+
+ local ECONF_SOURCE="${S}"
+ econf "${myeconfargs[@]}"
+}
+
+src_configure() {
+ # Bug 508758.
+ replace-flags -O3 -O2
+
+ # We don't want to leak flags onto boot code.
+ export HOST_CCASFLAGS=${CCASFLAGS}
+ export HOST_CFLAGS=${CFLAGS}
+ export HOST_CPPFLAGS=${CPPFLAGS}
+ export HOST_LDFLAGS=${LDFLAGS}
+ unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
+
+ use static && HOST_LDFLAGS+=" -static"
+
+ tc-ld-disable-gold #439082 #466536 #526348
+ export TARGET_LDFLAGS="${TARGET_LDFLAGS} ${LDFLAGS}"
+ unset LDFLAGS
+
+ tc-export CC NM OBJCOPY RANLIB STRIP
+ tc-export BUILD_CC # Bug 485592
+
+ MULTIBUILD_VARIANTS=()
+ local p
+ for p in "${GRUB_ALL_PLATFORMS[@]}"; do
+ use "grub_platforms_${p}" && MULTIBUILD_VARIANTS+=( "${p}" )
+ done
+ [[ ${#MULTIBUILD_VARIANTS[@]} -eq 0 ]] && MULTIBUILD_VARIANTS=( guessed )
+ grub_do grub_configure
+}
+
+src_compile() {
+ # Sandbox bug 404013.
+ use libzfs && addpredict /etc/dfs:/dev/zfs
+
+ grub_do emake
+ use doc && grub_do_once emake -C docs html
+}
+
+src_test() {
+ # The qemu dependency is a bit complex.
+ # You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform.
+ grub_do emake check
+}
+
+src_install() {
+ grub_do emake install DESTDIR="${D}" bashcompletiondir="$(get_bashcompdir)"
+ use doc && grub_do_once emake -C docs install-html DESTDIR="${D}"
+
+ einstalldocs
+
+ if use multislot; then
+ mv "${ED%/}"/usr/share/info/grub{,2}.info || die
+ fi
+
+ insinto /etc/default
+ newins "${FILESDIR}"/grub.default-3 grub
+}
+
+pkg_postinst() {
+ elog "For information on how to configure GRUB2 please refer to the guide:"
+ elog " https://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
+
+ if has_version 'sys-boot/grub:0'; then
+ elog "A migration guide for GRUB Legacy users is available:"
+ elog " https://wiki.gentoo.org/wiki/GRUB2_Migration"
+ fi
+
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ elog
+ elog "You may consider installing the following optional packages:"
+ optfeature "Detect other operating systems (grub-mkconfig)" sys-boot/os-prober
+ optfeature "Create rescue media (grub-mkrescue)" dev-libs/libisoburn
+ optfeature "Enable RAID device detection" sys-fs/mdadm
+ fi
+}
diff --git a/sys-boot/grub/grub-9999.ebuild b/sys-boot/grub/grub-9999.ebuild
new file mode 100644
index 000000000000..cc6db989c6e8
--- /dev/null
+++ b/sys-boot/grub/grub-9999.ebuild
@@ -0,0 +1,298 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+if [[ ${PV} == 9999 ]]; then
+ GRUB_AUTOGEN=1
+fi
+
+if [[ -n ${GRUB_AUTOGEN} ]]; then
+ PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} )
+ WANT_LIBTOOL=none
+ inherit autotools python-any-r1
+fi
+
+inherit autotools bash-completion-r1 flag-o-matic multibuild pax-utils toolchain-funcs versionator
+
+if [[ ${PV} != 9999 ]]; then
+ if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
+ # The quote style is to work with <=bash-4.2 and >=bash-4.3 #503860
+ MY_P=${P/_/'~'}
+ SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
+ S=${WORKDIR}/${MY_P}
+ else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+ S=${WORKDIR}/${P%_*}
+ fi
+ KEYWORDS="~amd64 ~arm64 ~x86"
+else
+ inherit git-r3
+ EGIT_REPO_URI="git://git.sv.gnu.org/grub.git
+ http://git.savannah.gnu.org/r/grub.git"
+fi
+
+PATCHES=(
+ "${FILESDIR}"/gfxpayload.patch
+ "${FILESDIR}"/grub-2.02_beta2-KERNEL_GLOBS.patch
+)
+
+DEJAVU=dejavu-sans-ttf-2.37
+UNIFONT=unifont-9.0.06
+SRC_URI+=" fonts? ( mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz )
+ themes? ( mirror://sourceforge/dejavu/${DEJAVU}.zip )"
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="https://www.gnu.org/software/grub/"
+
+# Includes licenses for dejavu and unifont
+LICENSE="GPL-3 fonts? ( GPL-2-with-font-exception ) themes? ( BitstreamVera )"
+SLOT="2/${PVR}"
+IUSE="debug device-mapper doc efiemu +fonts mount multislot nls static sdl test +themes truetype libzfs"
+
+GRUB_ALL_PLATFORMS=( coreboot efi-32 efi-64 emu ieee1275 loongson multiboot qemu qemu-mips pc uboot xen xen-32 )
+IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}"
+
+REQUIRED_USE="
+ grub_platforms_coreboot? ( fonts )
+ grub_platforms_qemu? ( fonts )
+ grub_platforms_ieee1275? ( fonts )
+ grub_platforms_loongson? ( fonts )
+"
+
+# os-prober: Used on runtime to detect other OSes
+# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
+RDEPEND="
+ app-arch/xz-utils
+ >=sys-libs/ncurses-5.2-r5:0=
+ debug? (
+ sdl? ( media-libs/libsdl )
+ )
+ device-mapper? ( >=sys-fs/lvm2-2.02.45 )
+ libzfs? ( sys-fs/zfs )
+ mount? ( sys-fs/fuse )
+ truetype? ( media-libs/freetype:2= )
+ ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+ ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+"
+DEPEND="${RDEPEND}
+ ${PYTHON_DEPS}
+ app-misc/pax-utils
+ sys-devel/flex
+ sys-devel/bison
+ sys-apps/help2man
+ sys-apps/texinfo
+ fonts? ( media-libs/freetype:2 )
+ grub_platforms_xen? ( app-emulation/xen-tools:= )
+ grub_platforms_xen-32? ( app-emulation/xen-tools:= )
+ static? (
+ app-arch/xz-utils[static-libs(+)]
+ truetype? (
+ app-arch/bzip2[static-libs(+)]
+ media-libs/freetype[static-libs(+)]
+ sys-libs/zlib[static-libs(+)]
+ )
+ )
+ test? (
+ app-admin/genromfs
+ app-arch/cpio
+ app-arch/lzop
+ app-emulation/qemu
+ dev-libs/libisoburn
+ sys-apps/miscfiles
+ sys-block/parted
+ sys-fs/squashfs-tools
+ )
+ themes? (
+ app-arch/unzip
+ media-libs/freetype:2
+ )
+"
+RDEPEND+="
+ kernel_linux? (
+ grub_platforms_efi-32? ( sys-boot/efibootmgr )
+ grub_platforms_efi-64? ( sys-boot/efibootmgr )
+ )
+ !multislot? ( !sys-boot/grub:0 !sys-boot/grub-static )
+ nls? ( sys-devel/gettext )
+"
+
+DEPEND+=" !!=media-libs/freetype-2.5.4"
+
+RESTRICT="strip !test? ( test )"
+
+QA_EXECSTACK="usr/bin/grub*-emu* usr/lib/grub/*"
+QA_WX_LOAD="usr/lib/grub/*"
+QA_MULTILIB_PATHS="usr/lib/grub/.*"
+
+src_unpack() {
+ if [[ ${PV} == 9999 ]]; then
+ git-r3_src_unpack
+ fi
+ default
+}
+
+src_prepare() {
+ default
+
+ sed -i -e /autoreconf/d autogen.sh || die
+
+ if use multislot; then
+ # fix texinfo file name, bug 416035
+ sed -i -e 's/^\* GRUB:/* GRUB2:/' -e 's/(grub)/(grub2)/' docs/grub.texi || die
+ fi
+
+ # Nothing in Gentoo packages 'american-english' in the exact path
+ # wanted for the test, but all that is needed is a compressible text
+ # file, and we do have 'words' from miscfiles in the same path.
+ sed -i \
+ -e '/CFILESSRC.*=/s,american-english,words,' \
+ tests/util/grub-fs-tester.in \
+ || die
+
+ if [[ -n ${GRUB_AUTOGEN} ]]; then
+ python_setup
+ bash autogen.sh || die
+ autopoint() { :; }
+ eautoreconf
+ fi
+}
+
+grub_do() {
+ multibuild_foreach_variant run_in_build_dir "$@"
+}
+
+grub_do_once() {
+ multibuild_for_best_variant run_in_build_dir "$@"
+}
+
+grub_configure() {
+ local platform
+
+ case ${MULTIBUILD_VARIANT} in
+ efi*) platform=efi ;;
+ xen*) platform=xen ;;
+ guessed) ;;
+ *) platform=${MULTIBUILD_VARIANT} ;;
+ esac
+
+ case ${MULTIBUILD_VARIANT} in
+ *-32)
+ if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then
+ local CTARGET=i386
+ fi ;;
+ *-64)
+ if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then
+ local CTARGET=x86_64
+ local -x TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
+ local -x TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
+ fi ;;
+ esac
+
+ local myeconfargs=(
+ --disable-werror
+ --program-prefix=
+ --libdir="${EPREFIX}"/usr/lib
+ --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
+ $(use_enable debug mm-debug)
+ $(use_enable device-mapper)
+ $(use_enable mount grub-mount)
+ $(use_enable nls)
+ $(use_enable themes grub-themes)
+ $(use_enable truetype grub-mkfont)
+ $(use_enable libzfs)
+ $(use sdl && use_enable debug grub-emu-sdl)
+ ${platform:+--with-platform=}${platform}
+
+ # Let configure detect this where supported
+ $(usex efiemu '' '--disable-efiemu')
+ )
+
+ if use multislot; then
+ myeconfargs+=( --program-transform-name="s,grub,grub2," )
+ fi
+
+ # Set up font symlinks
+ ln -s "${WORKDIR}/${UNIFONT}.pcf" unifont.pcf || die
+ if use themes; then
+ ln -s "${WORKDIR}/${DEJAVU}/ttf/DejaVuSans.ttf" DejaVuSans.ttf || die
+ fi
+
+ local ECONF_SOURCE="${S}"
+ econf "${myeconfargs[@]}"
+}
+
+src_configure() {
+ # Bug 508758.
+ replace-flags -O3 -O2
+
+ # We don't want to leak flags onto boot code.
+ export HOST_CCASFLAGS=${CCASFLAGS}
+ export HOST_CFLAGS=${CFLAGS}
+ export HOST_CPPFLAGS=${CPPFLAGS}
+ export HOST_LDFLAGS=${LDFLAGS}
+ unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
+
+ use static && HOST_LDFLAGS+=" -static"
+
+ tc-ld-disable-gold #439082 #466536 #526348
+ export TARGET_LDFLAGS="${TARGET_LDFLAGS} ${LDFLAGS}"
+ unset LDFLAGS
+
+ tc-export CC NM OBJCOPY RANLIB STRIP
+ tc-export BUILD_CC # Bug 485592
+
+ MULTIBUILD_VARIANTS=()
+ local p
+ for p in "${GRUB_ALL_PLATFORMS[@]}"; do
+ use "grub_platforms_${p}" && MULTIBUILD_VARIANTS+=( "${p}" )
+ done
+ [[ ${#MULTIBUILD_VARIANTS[@]} -eq 0 ]] && MULTIBUILD_VARIANTS=( guessed )
+ grub_do grub_configure
+}
+
+src_compile() {
+ # Sandbox bug 404013.
+ use libzfs && addpredict /etc/dfs:/dev/zfs
+
+ grub_do emake
+ use doc && grub_do_once emake -C docs html
+}
+
+src_test() {
+ # The qemu dependency is a bit complex.
+ # You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform.
+ grub_do emake check
+}
+
+src_install() {
+ grub_do emake install DESTDIR="${D}" bashcompletiondir="$(get_bashcompdir)"
+ use doc && grub_do_once emake -C docs install-html DESTDIR="${D}"
+
+ einstalldocs
+
+ if use multislot; then
+ mv "${ED%/}"/usr/share/info/grub{,2}.info || die
+ fi
+
+ insinto /etc/default
+ newins "${FILESDIR}"/grub.default-3 grub
+}
+
+pkg_postinst() {
+ elog "For information on how to configure GRUB2 please refer to the guide:"
+ elog " https://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
+
+ if has_version 'sys-boot/grub:0'; then
+ elog "A migration guide for GRUB Legacy users is available:"
+ elog " https://wiki.gentoo.org/wiki/GRUB2_Migration"
+ fi
+
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ elog
+ elog "You may consider installing the following optional packages:"
+ optfeature "Detect other operating systems (grub-mkconfig)" sys-boot/os-prober
+ optfeature "Create rescue media (grub-mkrescue)" dev-libs/libisoburn
+ optfeature "Enable RAID device detection" sys-fs/mdadm
+ fi
+}
diff --git a/sys-boot/grub/metadata.xml b/sys-boot/grub/metadata.xml
new file mode 100644
index 000000000000..9070bcc55024
--- /dev/null
+++ b/sys-boot/grub/metadata.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer restrict="&gt;=sys-boot/grub-2" type="person">
+ <email>floppym@gentoo.org</email>
+ <name>Mike Gilbert</name>
+ <description>GRUB2 only - do not assign bugs related to GRUB Legacy (0.97)</description>
+</maintainer>
+<maintainer restrict="&lt;sys-boot/grub-1" type="person">
+ <email>axs@gentoo.org</email>
+ <name>Ian Stakenvicius</name>
+ <description>GRUB-Legacy only - do not assign bugs related to GRUB2</description>
+</maintainer>
+<maintainer type="project">
+ <email>base-system@gentoo.org</email>
+ <name>Gentoo Base System</name>
+</maintainer>
+<use>
+ <flag name="device-mapper">
+ Enable support for device-mapper from <pkg>sys-fs/lvm2</pkg>
+ </flag>
+ <flag name="efiemu">
+ Build and install the efiemu runtimes
+ </flag>
+ <flag name="fonts">Build and install fonts for the gfxterm module</flag>
+ <flag name="mount">
+ Build and install the grub-mount utility
+ </flag>
+ <flag name="libzfs">
+ Enable support for <pkg>sys-fs/zfs</pkg>
+ </flag>
+ <flag name="multislot">
+ Allow concurrent installation of <pkg>sys-boot/grub</pkg> SLOT 0 and
+ <pkg>sys-boot/grub</pkg> SLOT 2 by renaming all programs.
+ </flag>
+ <flag name="themes">Build and install GRUB themes (starfield)</flag>
+ <flag name="truetype">Build and install grub-mkfont conversion utility</flag>
+</use>
+<upstream>
+ <remote-id type="sourceforge">dejavu</remote-id>
+</upstream>
+</pkgmetadata>