summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeemant Kulleen <seemant@gentoo.org>2003-12-09 08:13:57 +0000
committerSeemant Kulleen <seemant@gentoo.org>2003-12-09 08:13:57 +0000
commitd3740957074291c280ad815e805b0a24e6dd0c65 (patch)
tree3f4092e69aa8ed6c82b05054eff8fe4b9ca02ed8 /sys-boot/grub
parentadded sys-boot category for bootloaders (diff)
downloadhistorical-d3740957074291c280ad815e805b0a24e6dd0c65.tar.gz
historical-d3740957074291c280ad815e805b0a24e6dd0c65.tar.bz2
historical-d3740957074291c280ad815e805b0a24e6dd0c65.zip
moved from sys-apps to sys-boot
Diffstat (limited to 'sys-boot/grub')
-rw-r--r--sys-boot/grub/ChangeLog146
-rw-r--r--sys-boot/grub/Manifest25
-rw-r--r--sys-boot/grub/files/digest-grub-0.92-r120
-rw-r--r--sys-boot/grub/files/digest-grub-0.93.2003011821
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.5.96.1-special-raid-devices.patch17
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.90-addsyncs.patch57
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.90-append.patch111
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.90-configfile.patch98
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.90-install.in.patch34
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.90-installcopyonly.patch85
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.90-passwordprompt.patch146
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.90-staticcurses.patch14
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.90-symlinkmenulst.patch16
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.90-vga16-keypressclear.patch36
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.91-bootonce.patch249
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.91-splashimagehelp.patch28
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.91-vga16-serial.patch58
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.92-automake16.patch161
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.92-nodeprecatedflags.patch11
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.92-usbfix.patch83
-rw-r--r--sys-boot/grub/files/grub-0.92/grub-0.92-vga16.patch2058
-rw-r--r--sys-boot/grub/files/grub-0.93-gcc3.3.diff17
-rw-r--r--sys-boot/grub/files/splash.xpm.gzbin0 -> 33856 bytes
-rw-r--r--sys-boot/grub/grub-0.92-r1.ebuild96
-rw-r--r--sys-boot/grub/grub-0.93.20030118.ebuild88
-rw-r--r--sys-boot/grub/metadata.xml6
26 files changed, 3681 insertions, 0 deletions
diff --git a/sys-boot/grub/ChangeLog b/sys-boot/grub/ChangeLog
new file mode 100644
index 000000000000..2ada773faf8e
--- /dev/null
+++ b/sys-boot/grub/ChangeLog
@@ -0,0 +1,146 @@
+# ChangeLog for sys-apps/grub
+# Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/ChangeLog,v 1.1 2003/12/09 08:12:07 seemant Exp $
+
+*grub-0.93.20030118 (08 Dec 2003)
+
+ 08 Dec 2003; Seemant Kulleen <seemant@gentoo.org> grub-0.92-r1.ebuild,
+ grub-0.93.20030118.ebuild, metadata.xml, files/grub-0.93-gcc3.3.diff,
+ files/splash.xpm.gz,
+ files/grub-0.92/grub-0.5.96.1-special-raid-devices.patch,
+ files/grub-0.92/grub-0.90-addsyncs.patch,
+ files/grub-0.92/grub-0.90-append.patch,
+ files/grub-0.92/grub-0.90-configfile.patch,
+ files/grub-0.92/grub-0.90-install.in.patch,
+ files/grub-0.92/grub-0.90-installcopyonly.patch,
+ files/grub-0.92/grub-0.90-passwordprompt.patch,
+ files/grub-0.92/grub-0.90-staticcurses.patch,
+ files/grub-0.92/grub-0.90-symlinkmenulst.patch,
+ files/grub-0.92/grub-0.90-vga16-keypressclear.patch,
+ files/grub-0.92/grub-0.91-bootonce.patch,
+ files/grub-0.92/grub-0.91-splashimagehelp.patch,
+ files/grub-0.92/grub-0.91-vga16-serial.patch,
+ files/grub-0.92/grub-0.92-automake16.patch,
+ files/grub-0.92/grub-0.92-nodeprecatedflags.patch,
+ files/grub-0.92/grub-0.92-usbfix.patch,
+ files/grub-0.92/grub-0.92-vga16.patch:
+ moved from sys-apps to sys-boot
+
+ 01 Dec 2003; Alexander Gabert <pappy@gentoo.org> grub-0.93.20030118.ebuild:
+ added CC -yno_propolice because configure has problems with -nostdlib
+ requesting __guard symbol but cannot be resolved, future releases of
+ hardened-gcc will honour this behaviour
+
+ 07 Sep 2003; Alexander Gabert <pappy@gentoo.org> grub-0.93.20030118.ebuild:
+ added hardened-gcc excludes
+
+ 14 Sep 2003; John Mylchreest <johnm@gentoo.org>; grub-0.93.20030118.ebuild,
+ files/grub-0.93-gcc3.3.diff:
+ Updating for gcc 3.3 compat
+
+ 27 Jul 2003; Olivier Crete <tester@gentoo.org> grub-0.93.20030118.ebuild:
+ Added support for static building
+
+ 24 Jan 2002; <woodchip@gentoo.org> *.ebuild : Reorder mount-boot.eclass
+ function, clean some fluff.
+
+*grub-0.93.20030118 (18 Jan 2003)
+
+ 11 Apr 2003; Joshua Brindle <method@gentoo.org> grub-0.92-r1.ebuild,
+ grub-0.93.20030118.ebuild:
+ Added filter-flags -fstack-protector
+
+ 24 Feb 2003; Nicholas Wourms <dragon@gentoo.org> grub-0.93.20030118.ebuild :
+ This is definitely not for mips. Maybe sometime in the future...
+
+ 18 Jan 2003; Donny Davies <woodchip@gentoo.org> grub-0.93.20030118.ebuild :
+ New testing release; closing #11821, #13242, #9180. See the ebuild
+ for the detailed patch list.
+
+*grub-0.92-r1 (02 Oct 2002)
+
+ 10 Mar 2003; Seemant Kulleen <seemant@gentoo.org> grub-0.92-r1.ebuild:
+ change to use epatch instead, much prettier output
+
+ 24 Feb 2003; Nicholas Wourms <dragon@gentoo.org> grub-0.92-r1.ebuild :
+ This is definitely not for mips. Maybe sometime in the future...
+
+ 06 Jan 2002; Seemant Kulleen <seemant@gentoo.org> *.ebuild :
+ PROVIDE virtual/bootloader
+
+ 06 Dec 2002; Rodney Rees <manson@gentoo.org> : changed sparc ~sparc keywords
+
+ 02 Oct 2002; Donny Davies <woodchip@gentoo.org> :
+ Merge changes from Markus Krainer <markus-krainer@chello.at> to fix:
+ bootlogo; #6820. menu.lst was renamed to grub.conf; #6300.
+
+*grub-0.92 (25 Jun 2002)
+
+ 29 Sep 2002; Donny Davies <woodchip@gentoo.org> grub-0.92.ebuild :
+ Now uses mount-boot eclass; from #7903.
+
+ 13 Aug 2002; Joachim Blaabjerg <styx@gentoo.org> grub-0.92.ebuild :
+ Added grub-0.92-usbfix.patch to hopefully fix bug #6372. It still compiles!
+
+ 14 Jul 2002; phoen][x <phoenix@gentoo.org> grub-0.92.ebuild :
+ Added KEYWORDS.
+
+ 25 Jun 2002; Martin Schlemmer <azarah@gentoo.org> :
+ Add the latest version thanks to good work from (bug #4020)
+ Markus Krainer <markus-krainer@chello.at>. Slotified the lot,
+ as well as move splash.xpm.gz to ${FILESDIR}/, as having three
+ seems a bit much.
+
+*grub-0.90-r7 (14 July 2002)
+
+ 29 Sep 2002; Donny Davies <woodchip@gentoo.org> grub-0.90-r7.ebuild :
+ Now uses mount-boot eclass; from #7903.
+
+ 21 Jul 2002; Mark Guertin <gerk@gentoo.org>:
+ updated keywords (-ppc -sparc -sparc64)
+
+ 14 Jul 2002; phoen][x <phoenix@gentoo.org> grub-0.90-r7.ebuild :
+ Added KEYWORDS.
+
+*grub-0.90-r4 (8 Mar 2002)
+*grub-0.91-r3 (8 Mar 2002)
+
+ 29 Sep 2002; Donny Davies <woodchip@gentoo.org> grub-0.91-r3.ebuild :
+ Now uses mount-boot eclass; from #7903.
+
+ 19 Aug 2002; Sascha Schwabbauer <cybersystem@gentoo.org> grub-0.91-r3.ebuild :
+ Added -ppc to keywords
+
+ 14 Jul 2002; phoen][x <phoenix@gentoo.org> grub-0.91-r3.ebuild :
+ Added KEYWORDS.
+
+ 8 Mar 2002; Bruce A. Locke <blocke@shivan.org> : grub-0.90-r4.ebuild,
+ grub-0.91-r3.ebuild: made check of /etc/fstab not match on commented out
+ entries and added a notice telling users to remove invalid /boot entries
+ from their /etc/fstab (a user had this problem while installing)
+
+*grub-0.90-r6 (4 Feb 2002)
+*grub-0.91-r1 (4 Feb 2002)
+
+ 4 Feb 2002; Daniel Robbins <drobbins@gentoo.org>: grub-0.90-r6.ebuild,
+ grub-0.91-r1.ebuild: unset CFLAGS to ensure that GRUB code is i486-compatible,
+ a good thing for a boot loader. Upgraded /boot mounting code to be compatible
+ with systems without a dedicated /boot filesystem. Tweaked GRUB installation
+ so that the /boot/grub/*stage* files don't get overwritten, since this could
+ mess up the currently-in-the-MBR GRUB. These fixes also close bug #527.
+
+*grub-0.90-r5 (4 Feb 2002)
+
+ 4 Feb 2002; G.Bevin <gbevin@gentoo.org> grub-0.90-r5.ebuild, grub-0.91.ebuild :
+ Added new setup function which detects if /boot is mounted or not, in case
+ it's not mounted it will try to do it automatically and in case of a failure
+ exit with an error message.
+
+*grub-0.90-r4 (1 Feb 2002)
+
+ 1 Feb 2002; G.Bevin <gbevin@gentoo.org> ChangeLog :
+ Added initial ChangeLog which should be updated whenever the package is
+ updated in any way. This changelog is targetted to users. This means that the
+ comments should well explained and written in clean English. The details about
+ writing correct changelogs are explained in the skel.ChangeLog file which you
+ can find in the root directory of the portage repository.
diff --git a/sys-boot/grub/Manifest b/sys-boot/grub/Manifest
new file mode 100644
index 000000000000..dfbdeca2aa3f
--- /dev/null
+++ b/sys-boot/grub/Manifest
@@ -0,0 +1,25 @@
+MD5 434ca34580a47e5b2afb09c4a95807ca grub-0.92-r1.ebuild 3207
+MD5 16e7f774fbfdf05caddcbadbfdcc36f3 ChangeLog 6050
+MD5 df80617024893a2415f0cd21931eeaa8 grub-0.93.20030118.ebuild 2417
+MD5 e6543624c262cae90cc830cde90ad3ae metadata.xml 165
+MD5 cdd6c89d48982ecd544c0b4774755afd files/splash.xpm.gz 33856
+MD5 b302edf756d9f8996d9e1ae6d3a49768 files/digest-grub-0.93.20030118 1764
+MD5 ca87163749e014bc3424d53c6bd76dce files/digest-grub-0.92-r1 1680
+MD5 8d898cd9d1928916596cc3f9883eac67 files/grub-0.93-gcc3.3.diff 639
+MD5 03404170b492e04031b0da877991efd2 files/grub-0.92/grub-0.90-symlinkmenulst.patch 518
+MD5 aa18890ce9d1679091e382aeb8294194 files/grub-0.92/grub-0.90-configfile.patch 3833
+MD5 f31b7278a8a83d245c4ca27382cf54b3 files/grub-0.92/grub-0.5.96.1-special-raid-devices.patch 632
+MD5 f105856e2fedfdb0cb5982e6ef8294fd files/grub-0.92/grub-0.92-usbfix.patch 2072
+MD5 3086a3674abb6c7e59a2627f25b3cca3 files/grub-0.92/grub-0.92-automake16.patch 5956
+MD5 4d871cd43370b130057788f07db38cc3 files/grub-0.92/grub-0.90-install.in.patch 1079
+MD5 82efba51ac305b8381d3122996eb3136 files/grub-0.92/grub-0.92-vga16.patch 43815
+MD5 bd8b83027e46c01ee7b67cbccd06fa08 files/grub-0.92/grub-0.90-passwordprompt.patch 3612
+MD5 bb016a75234fb52358a2f5412afc2e58 files/grub-0.92/grub-0.91-splashimagehelp.patch 944
+MD5 6ad20fdf6c7c5d16bf3ac56ff8fd704d files/grub-0.92/grub-0.91-vga16-serial.patch 1628
+MD5 e4f6b75eb4518eaad834f177ad98a25a files/grub-0.92/grub-0.91-bootonce.patch 6748
+MD5 75011272c27e8d9926633851e29a9a22 files/grub-0.92/grub-0.90-staticcurses.patch 600
+MD5 e1afae6eadfc123e08920e3f78e0b38b files/grub-0.92/grub-0.90-vga16-keypressclear.patch 920
+MD5 f3aa6906e6a340e3b38536b1fd0571f5 files/grub-0.92/grub-0.90-installcopyonly.patch 2017
+MD5 59c9235025c9048d6165d68562dbc0ec files/grub-0.92/grub-0.90-append.patch 2893
+MD5 93c92f5020925b376742d2ad8022160b files/grub-0.92/grub-0.92-nodeprecatedflags.patch 375
+MD5 d4ac36a6a292a66b276ebc8a4ce2a41d files/grub-0.92/grub-0.90-addsyncs.patch 2071
diff --git a/sys-boot/grub/files/digest-grub-0.92-r1 b/sys-boot/grub/files/digest-grub-0.92-r1
new file mode 100644
index 000000000000..c9f9b3f8d413
--- /dev/null
+++ b/sys-boot/grub/files/digest-grub-0.92-r1
@@ -0,0 +1,20 @@
+MD5 cdd6c89d48982ecd544c0b4774755afd /files/splash.xpm.gz 33856
+MD5 03404170b492e04031b0da877991efd2 /files/grub-0.92/grub-0.90-symlinkmenulst.patch 518
+MD5 aa18890ce9d1679091e382aeb8294194 /files/grub-0.92/grub-0.90-configfile.patch 3833
+MD5 f31b7278a8a83d245c4ca27382cf54b3 /files/grub-0.92/grub-0.5.96.1-special-raid-devices.patch 632
+MD5 f105856e2fedfdb0cb5982e6ef8294fd /files/grub-0.92/grub-0.92-usbfix.patch 2072
+MD5 3086a3674abb6c7e59a2627f25b3cca3 /files/grub-0.92/grub-0.92-automake16.patch 5956
+MD5 4d871cd43370b130057788f07db38cc3 /files/grub-0.92/grub-0.90-install.in.patch 1079
+MD5 82efba51ac305b8381d3122996eb3136 /files/grub-0.92/grub-0.92-vga16.patch 43815
+MD5 bd8b83027e46c01ee7b67cbccd06fa08 /files/grub-0.92/grub-0.90-passwordprompt.patch 3612
+MD5 bb016a75234fb52358a2f5412afc2e58 /files/grub-0.92/grub-0.91-splashimagehelp.patch 944
+MD5 6ad20fdf6c7c5d16bf3ac56ff8fd704d /files/grub-0.92/grub-0.91-vga16-serial.patch 1628
+MD5 e4f6b75eb4518eaad834f177ad98a25a /files/grub-0.92/grub-0.91-bootonce.patch 6748
+MD5 75011272c27e8d9926633851e29a9a22 /files/grub-0.92/grub-0.90-staticcurses.patch 600
+MD5 e1afae6eadfc123e08920e3f78e0b38b /files/grub-0.92/grub-0.90-vga16-keypressclear.patch 920
+MD5 f3aa6906e6a340e3b38536b1fd0571f5 /files/grub-0.92/grub-0.90-installcopyonly.patch 2017
+MD5 59c9235025c9048d6165d68562dbc0ec /files/grub-0.92/grub-0.90-append.patch 2893
+MD5 93c92f5020925b376742d2ad8022160b /files/grub-0.92/grub-0.92-nodeprecatedflags.patch 375
+MD5 d4ac36a6a292a66b276ebc8a4ce2a41d /files/grub-0.92/grub-0.90-addsyncs.patch 2071
+MD5 67c5dc359348e825f53accd3716ea685 /grub-0.92-r1.ebuild 3200
+MD5 50f2786e7bf96b1115ee82b9c101a816 grub-0.92.tar.gz 877112
diff --git a/sys-boot/grub/files/digest-grub-0.93.20030118 b/sys-boot/grub/files/digest-grub-0.93.20030118
new file mode 100644
index 000000000000..226666a48f32
--- /dev/null
+++ b/sys-boot/grub/files/digest-grub-0.93.20030118
@@ -0,0 +1,21 @@
+MD5 cdd6c89d48982ecd544c0b4774755afd /files/splash.xpm.gz 33856
+MD5 03404170b492e04031b0da877991efd2 /files/grub-0.92/grub-0.90-symlinkmenulst.patch 518
+MD5 aa18890ce9d1679091e382aeb8294194 /files/grub-0.92/grub-0.90-configfile.patch 3833
+MD5 f31b7278a8a83d245c4ca27382cf54b3 /files/grub-0.92/grub-0.5.96.1-special-raid-devices.patch 632
+MD5 f105856e2fedfdb0cb5982e6ef8294fd /files/grub-0.92/grub-0.92-usbfix.patch 2072
+MD5 3086a3674abb6c7e59a2627f25b3cca3 /files/grub-0.92/grub-0.92-automake16.patch 5956
+MD5 4d871cd43370b130057788f07db38cc3 /files/grub-0.92/grub-0.90-install.in.patch 1079
+MD5 82efba51ac305b8381d3122996eb3136 /files/grub-0.92/grub-0.92-vga16.patch 43815
+MD5 bd8b83027e46c01ee7b67cbccd06fa08 /files/grub-0.92/grub-0.90-passwordprompt.patch 3612
+MD5 bb016a75234fb52358a2f5412afc2e58 /files/grub-0.92/grub-0.91-splashimagehelp.patch 944
+MD5 6ad20fdf6c7c5d16bf3ac56ff8fd704d /files/grub-0.92/grub-0.91-vga16-serial.patch 1628
+MD5 e4f6b75eb4518eaad834f177ad98a25a /files/grub-0.92/grub-0.91-bootonce.patch 6748
+MD5 75011272c27e8d9926633851e29a9a22 /files/grub-0.92/grub-0.90-staticcurses.patch 600
+MD5 e1afae6eadfc123e08920e3f78e0b38b /files/grub-0.92/grub-0.90-vga16-keypressclear.patch 920
+MD5 f3aa6906e6a340e3b38536b1fd0571f5 /files/grub-0.92/grub-0.90-installcopyonly.patch 2017
+MD5 59c9235025c9048d6165d68562dbc0ec /files/grub-0.92/grub-0.90-append.patch 2893
+MD5 93c92f5020925b376742d2ad8022160b /files/grub-0.92/grub-0.92-nodeprecatedflags.patch 375
+MD5 d4ac36a6a292a66b276ebc8a4ce2a41d /files/grub-0.92/grub-0.90-addsyncs.patch 2071
+MD5 4e26a27cce3a7a48266c9f10108c002c /grub-0.93.20030118.ebuild 1981
+MD5 289ed7946dec7ac4eac146b3a5c0c608 grub-0.93.tar.gz 891032
+MD5 a1d905b0ec3450c44e7142ef1671aa76 grub-0.93.20030118-gentoo.diff.bz2 29995
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.5.96.1-special-raid-devices.patch b/sys-boot/grub/files/grub-0.92/grub-0.5.96.1-special-raid-devices.patch
new file mode 100644
index 000000000000..15176e7c19da
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.5.96.1-special-raid-devices.patch
@@ -0,0 +1,17 @@
+--- grub-0.5.96.1/lib/device.c.pix Mon Oct 16 16:41:54 2000
++++ grub-0.5.96.1/lib/device.c Tue Apr 3 12:01:41 2001
+@@ -616,7 +616,13 @@
+ if (strcmp (dev + strlen(dev) - 5, "/disc") == 0)
+ strcat (dev + strlen(dev) - 5, "/part");
+ }
+- sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1);
++
++ sprintf (dev + strlen(dev), "%s%d",
++ /* Compaq smart and others */
++ (strncmp(dev, "/dev/ida/", 9) == 0 ||
++ strncmp(dev, "/dev/cciss/", 11) == 0 ||
++ strncmp(dev, "/dev/rd/", 8) == 0) ? "p" : "",
++ ((partition >> 16) & 0xFF) + 1);
+
+ /* Open the partition. */
+ fd = open (dev, O_RDWR);
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.90-addsyncs.patch b/sys-boot/grub/files/grub-0.92/grub-0.90-addsyncs.patch
new file mode 100644
index 000000000000..4c53344a3cbe
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.90-addsyncs.patch
@@ -0,0 +1,57 @@
+
+I just found another semi-critical bug, whose fix should really get
+into 0.91.
+
+It turns out that "grub-install" doesn't have any "sync" calls to make
+sure any filesystem caches are coherent with the raw devices they are
+on top of... so if your filesystem waits to write out any data from the
+copy command in the script to put the "stage1" and "stage2" in their
+final location, you're hosed.
+
+I found this because it just bit me on one of my systems running stock
+RedHat 7.2 with a large "stage2".
+
+The only script that is patched here is "grub-install". The others
+don't appear to need it as they either unmount things first or don't
+refer to devices.
+
+Hmm. Maybe the right fix is to make the "sync" system call when
+starting the GRUB shell with a device map that refers to any real disks
+or something like that.
+
+------------------------(start patch)-----------------------
+--- grub.orig/util/grub-install.in Mon Oct 22 16:46:07 2001
++++ grub/util/grub-install.in Sat Oct 27 13:06:33 2001
+@@ -244,6 +244,10 @@
+ # Create a safe temporary file.
+ test -x /bin/tempfile && log_file=`tempfile --prefix=grub`
+
++ # Before all invocations of the grub shell, call sync to make sure
++ # the raw device is in sync with any bufferring in filesystems.
++ sync
++
+ $grub_shell --batch --device-map=$device_map <<EOF >$log_file
+ quit
+ EOF
+@@ -318,6 +322,10 @@
+ # Create a safe temporary file.
+ test -x /bin/tempfile && log_file=`tempfile --prefix=grub`
+
++# Before all invocations of the grub shell, call sync to make sure
++# the raw device is in sync with any bufferring in filesystems.
++sync
++
+ # Now perform the installation.
+ $grub_shell --batch --device-map=$device_map <<EOF >$log_file
+ root $root_drive
+------------------------(end patch)-----------------------
+
+--
+ Erich Stefan Boleyn <erich@uruk.org> http://www.uruk.org/
+"Reality is truly stranger than fiction; Probably why fiction is so popular"
+
+_______________________________________________
+Bug-grub mailing list
+Bug-grub@gnu.org
+http://mail.gnu.org/mailman/listinfo/bug-grub
+
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.90-append.patch b/sys-boot/grub/files/grub-0.92/grub-0.90-append.patch
new file mode 100644
index 000000000000..99cd0285faef
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.90-append.patch
@@ -0,0 +1,111 @@
+--- grub-0.90/stage2/stage2.c.append Thu Dec 20 08:20:48 2001
++++ grub-0.90/stage2/stage2.c Thu Dec 20 17:01:20 2001
+@@ -500,7 +500,8 @@
+ if (config_entries)
+ printf ("\
+ Press enter to boot the selected OS, \'e\' to edit the\n\
+- commands before booting, or \'c\' for a command-line.");
++ commands before booting, \'a\' to modify the kernel arguments\n\
++ before booting, or \'c\' for a command-line.");
+ else
+ printf ("\
+ Press \'b\' to boot, \'e\' to edit the selected command in the\n\
+@@ -787,6 +788,98 @@
+ enter_cmdline (heap, 0);
+ goto restart;
+ }
++ if (config_entries && c == 'a')
++ {
++ int new_num_entries = 0, i = 0, j;
++ int needs_padding, amount;
++ char *new_heap;
++ char * entries;
++ char * entry_copy;
++ char * append_line;
++ char * start;
++
++ entry_copy = new_heap = heap;
++ cur_entry = get_entry (config_entries, first_entry + entryno,
++ 1);
++
++ do
++ {
++ while ((*(new_heap++) = cur_entry[i++]) != 0);
++ new_num_entries++;
++ }
++ while (config_entries && cur_entry[i]);
++
++ /* this only needs to be done if config_entries is non-NULL,
++ but it doesn't hurt to do it always */
++ *(new_heap++) = 0;
++
++ new_heap = heap + NEW_HEAPSIZE + 1;
++
++ entries = entry_copy;
++ while (*entries)
++ {
++ if ((strstr(entries, "kernel") == entries) &&
++ isspace(entries[6]))
++ break;
++
++ while (*entries) entries++;
++ entries++;
++ }
++
++ if (!*entries)
++ goto restart;
++
++ start = entries + 6;
++
++ /* skip the white space */
++ while (*start && isspace(*start)) start++;
++ /* skip the kernel name */
++ while (*start && !isspace(*start)) start++;
++
++ /* skip the white space */
++ needs_padding = (!*start || !isspace(*start));
++ while (*start && isspace(*start)) start++;
++
++ append_line = new_heap;
++ grub_strcpy(append_line, start);
++
++ cls();
++ print_cmdline_message (0);
++
++ if (get_cmdline(PACKAGE " append> ",
++ append_line, NEW_HEAPSIZE + 1,
++ 0, 1))
++ goto restart;
++
++ /* have new args; append_line points to the
++ new args and start points to the old
++ args */
++
++ i = grub_strlen(start);
++ j = grub_strlen(append_line);
++
++ if (i > (j + needs_padding))
++ amount = i;
++ else
++ amount = j + needs_padding;
++
++ /* align rest of commands properly */
++ memmove (start + j + needs_padding, start + i,
++ ((int) append_line) - ((int) start) - (amount));
++
++ if (needs_padding)
++ *start = ' ';
++
++ /* copy command to correct area */
++ memmove (start + needs_padding, append_line, j);
++
++ /* set up this entry to boot */
++ config_entries = NULL;
++ cur_entry = entry_copy;
++ heap = new_heap;
++
++ break;
++ }
+ #ifdef GRUB_UTIL
+ if (c == 'q')
+ {
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.90-configfile.patch b/sys-boot/grub/files/grub-0.92/grub-0.90-configfile.patch
new file mode 100644
index 000000000000..c12160da08fd
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.90-configfile.patch
@@ -0,0 +1,98 @@
+diff -ur grub-0.90/grub/asmstub.c grub/grub/asmstub.c
+--- grub-0.90/grub/asmstub.c Thu May 3 04:34:56 2001
++++ grub/grub/asmstub.c Mon Jul 16 11:01:52 2001
+@@ -70,7 +70,7 @@
+ unsigned long boot_drive = 0;
+ int saved_entryno = 0;
+ char version_string[] = VERSION;
+-char config_file[128] = "/boot/grub/menu.lst"; /* FIXME: arbitrary */
++char config_file[128] = "/boot/grub/grub.conf"; /* FIXME: arbitrary */
+ unsigned long linux_text_len = 0;
+ unsigned short io_map[IO_MAP_SIZE];
+ struct apm_info apm_bios_info;
+diff -ur grub-0.90/stage2/asm.S grub/stage2/asm.S
+--- grub-0.90/stage2/asm.S Mon Jul 16 10:39:14 2001
++++ grub/stage2/asm.S Mon Jul 16 11:02:39 2001
+@@ -98,7 +98,7 @@
+ .string VERSION
+ VARIABLE(config_file)
+ #ifndef STAGE1_5
+- .string "/boot/grub/menu.lst"
++ .string "/boot/grub/grub.conf"
+ #else /* STAGE1_5 */
+ .long 0xffffffff
+ .string "/boot/grub/stage2"
+diff -ur grub-0.90/stage2/builtins.c grub/stage2/builtins.c
+--- grub-0.90/stage2/builtins.c Mon Jul 16 10:39:14 2001
++++ grub/stage2/builtins.c Mon Jul 16 11:02:26 2001
+@@ -3939,7 +3939,7 @@
+
+ /* The prefix was determined. */
+ grub_sprintf (stage2, "%s%s", prefix, "/stage2");
+- grub_sprintf (config_filename, "%s%s", prefix, "/menu.lst");
++ grub_sprintf (config_filename, "%s%s", prefix, "/grub.conf");
+ *real_config_filename = 0;
+
+ /* Check if stage2 exists. */
+diff -ur --exclude *~ --exclude *config grub-0.90/docs/grub.8 grub/docs/grub.8
+--- grub-0.90/docs/grub.8 Thu Jul 5 07:29:56 2001
++++ grub/docs/grub.8 Mon Jul 16 11:43:07 2001
+@@ -15,7 +15,7 @@
+ specify stage2 boot_drive [default=0x0]
+ .TP
+ \fB\-\-config\-file\fR=\fIFILE\fR
+-specify stage2 config_file [default=/boot/grub/menu.lst]
++specify stage2 config_file [default=/boot/grub/grub.conf]
+ .TP
+ \fB\-\-device\-map\fR=\fIFILE\fR
+ Use the device map file FILE
+diff -ur --exclude *~ --exclude *config grub-0.90/docs/grub.texi grub/docs/grub.texi
+--- grub-0.90/docs/grub.texi Thu Jul 5 07:14:21 2001
++++ grub/docs/grub.texi Mon Jul 16 11:47:04 2001
+@@ -971,7 +971,7 @@
+ keys) that will do everything to boot an OS.
+
+ To enable the menu, you need a configuration file,
+-@file{menu.lst} under the boot directory. We'll analyze an example
++@file{grub.conf} under the boot directory. We'll analyze an example
+ file.
+
+ The file first contains some general settings, the menu interface
+@@ -1512,8 +1512,8 @@
+
+ An absolute file name resembles a Unix absolute file name, using
+ @samp{/} for the directory separator (not @samp{\} as in DOS). One
+-example is @samp{(hd0,0)/boot/grub/menu.lst}. This means the file
+-@file{/boot/grub/menu.lst} in the first partition of the first hard
++example is @samp{(hd0,0)/boot/grub/grub.conf}. This means the file
++@file{/boot/grub/grub.conf} in the first partition of the first hard
+ disk. If you omit the device name in an absolute file name, GRUB uses
+ GRUB's @dfn{root device} implicitly. So if you set the root device to,
+ say, @samp{(hd1,0)} by the command @command{root} (@pxref{root}), then
+@@ -3112,7 +3112,7 @@
+
+ @item --config-file=@var{file}
+ Read the configuration file @var{file} instead of
+-@file{/boot/grub/menu.lst}. The format is the same as the normal GRUB
++@file{/boot/grub/grub.conf}. The format is the same as the normal GRUB
+ syntax. See @ref{Filesystem}, for more information.
+
+ @item --boot-drive=@var{drive}
+@@ -3369,7 +3369,7 @@
+
+ @item
+ Copy the GRUB images to @file{/mnt/boot/grub}. Only @file{stage1},
+-@file{stage2} and @file{menu.lst} are necessary. You may not copy
++@file{stage2} and @file{grub.conf} are necessary. You may not copy
+ @dfn{stage1.5}s.
+
+ @item
+@@ -3497,7 +3497,7 @@
+ @example
+ @group
+ grub> @kbd{root (hd0,1)}
+-grub> @kbd{install /grub/stage1 d (hd0) /grub/stage2 p /grub/menu.lst}
++grub> @kbd{install /grub/stage1 d (hd0) /grub/stage2 p /grub/grub.conf}
+ @end group
+ @end example
+ @end enumerate
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.90-install.in.patch b/sys-boot/grub/files/grub-0.92/grub-0.90-install.in.patch
new file mode 100644
index 000000000000..c714196a4402
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.90-install.in.patch
@@ -0,0 +1,34 @@
+--- grub-0.90/util/grub-install.in~ Wed Feb 28 06:19:39 2001
++++ grub-0.90/util/grub-install.in Thu Jul 19 16:01:12 2001
+@@ -224,6 +224,15 @@
+ test -d "$bootdir" || mkdir "$bootdir" || exit 1
+ test -d "$grubdir" || mkdir "$grubdir" || exit 1
+
++# Copy the GRUB images to the GRUB directory.
++for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
++ rm -f $file || exit 1
++done
++for file in \
++ ${pkgdatadir}/stage1 ${pkgdatadir}/stage2 ${pkgdatadir}/*stage1_5; do
++ cp -f $file ${grubdir} || exit 1
++done
++
+ # If --recheck is specified, remove the device map, if present.
+ if test $recheck = yes; then
+ rm -f $device_map
+@@ -297,15 +306,6 @@
+ EOF
+ exit 1
+ fi
+-
+-# Copy the GRUB images to the GRUB directory.
+-for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
+- rm -f $file || exit 1
+-done
+-for file in \
+- ${pkgdatadir}/stage1 ${pkgdatadir}/stage2 ${pkgdatadir}/*stage1_5; do
+- cp -f $file ${grubdir} || exit 1
+-done
+
+ # Create a safe temporary file.
+ test -x /bin/tempfile && log_file=`tempfile --prefix=grub`
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.90-installcopyonly.patch b/sys-boot/grub/files/grub-0.92/grub-0.90-installcopyonly.patch
new file mode 100644
index 000000000000..1083ab507e71
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.90-installcopyonly.patch
@@ -0,0 +1,85 @@
+--- grub-0.90/util/grub-install.in~ Thu Jul 19 18:42:58 2001
++++ grub-0.90/util/grub-install.in Thu Jul 19 18:43:12 2001
+@@ -38,6 +38,7 @@
+ force_lba=
+ recheck=no
+ debug=no
++justcopy=no
+
+ # Usage: usage
+ # Print the usage.
+@@ -149,6 +150,17 @@
+ fi
+ }
+
++copy_images() {
++ # Copy the GRUB images to the GRUB directory.
++ for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
++ rm -f $file || exit 1
++ done
++ for file in \
++ ${pkgdatadir}/stage1 ${pkgdatadir}/stage2 ${pkgdatadir}/*stage1_5; do
++ cp -f $file ${grubdir} || exit 1
++ done
++}
++
+ # Check the arguments.
+ for option in "$@"; do
+ case "$option" in
+@@ -166,6 +178,8 @@
+ force_lba="--force-lba" ;;
+ --recheck)
+ recheck=yes ;;
++ --just-copy)
++ justcopy=yes ;;
+ # This is an undocumented feature...
+ --debug)
+ debug=yes ;;
+@@ -179,12 +193,6 @@
+ esac
+ done
+
+-if test "x$install_device" = x; then
+- echo "install_device not specified." 1>&2
+- usage
+- exit 1
+-fi
+-
+ # If the debugging feature is enabled, print commands.
+ if test $debug = yes; then
+ set -x
+@@ -195,6 +203,18 @@
+ grubdir=${bootdir}/grub
+ device_map=${grubdir}/device.map
+
++# if they just want the images copied, copy the images and then exit
++if test $justcopy = yes; then
++ copy_images
++ exit 0
++fi
++
++if test "x$install_device" = x; then
++ echo "install_device not specified." 1>&2
++ usage
++ exit 1
++fi
++
+ # Check if GRUB is installed
+ if test -f "$grub_shell"; then
+ :
+@@ -224,14 +244,7 @@
+ test -d "$bootdir" || mkdir "$bootdir" || exit 1
+ test -d "$grubdir" || mkdir "$grubdir" || exit 1
+
+-# Copy the GRUB images to the GRUB directory.
+-for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
+- rm -f $file || exit 1
+-done
+-for file in \
+- ${pkgdatadir}/stage1 ${pkgdatadir}/stage2 ${pkgdatadir}/*stage1_5; do
+- cp -f $file ${grubdir} || exit 1
+-done
++copy_images
+
+ # If --recheck is specified, remove the device map, if present.
+ if test $recheck = yes; then
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.90-passwordprompt.patch b/sys-boot/grub/files/grub-0.92/grub-0.90-passwordprompt.patch
new file mode 100644
index 000000000000..47810a9ca9b9
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.90-passwordprompt.patch
@@ -0,0 +1,146 @@
+diff -ur grub-0.90/stage2/stage2.c grub/stage2/stage2.c
+--- grub-0.90/stage2/stage2.c Thu Jul 19 01:58:59 2001
++++ grub/stage2/stage2.c Thu Jul 19 01:59:11 2001
+@@ -316,6 +316,7 @@
+ char *cur_entry = 0;
+ int disp_up = DISP_UP;
+ int disp_down = DISP_DOWN;
++ int ask_pass = 0;
+
+ /*
+ * Main loop for menu UI.
+@@ -423,8 +424,72 @@
+ grub_printf ("\n\
+ Use the %c and %c keys to select which entry is highlighted.\n",
+ disp_up, disp_down);
+-
+- if (! auth && password)
++
++ if (! auth && password && ask_pass)
++ {
++ /* Do password check here! */
++ char entered[32];
++ char *pptr = password;
++
++ /* we've asked, so don't ask again */
++ ask_pass = 0;
++
++ if (terminal & TERMINAL_DUMB)
++ grub_printf ("\n\nThe selected entry is %d ", entryno);
++ else
++ {
++ print_entries (view_y0 + 3, 12, first_entry, menu_entries);
++ /* highlight initial line */
++ set_line_highlight (view_y0 + 4 + entryno, first_entry + entryno,
++ menu_entries);
++ }
++
++ /* Wipe out the previously entered password */
++ memset (entered, 0, sizeof (entered));
++ gotoxy (view_x0 + 1, view_y0 + 16);
++ get_cmdline (" Password: ", entered, 31, '*', 0);
++
++ while (! isspace (*pptr) && *pptr)
++ pptr++;
++
++ /* Make sure that PASSWORD is NUL-terminated. */
++ *pptr++ = 0;
++
++ if (! check_password (entered, password, password_type))
++ {
++ char *new_file = config_file;
++
++ while (isspace (*pptr))
++ pptr++;
++
++ /* If *PPTR is NUL, then allow the user to use
++ privileged instructions, otherwise, load
++ another configuration file. */
++ if (*pptr != 0)
++ {
++ while ((*(new_file++) = *(pptr++)) != 0)
++ ;
++
++ /* Make sure that the user will not have
++ authority in the next configuration. */
++ auth = 0;
++ return;
++ }
++ else
++ {
++ /* Now the user is superhuman. */
++ auth = 1;
++ goto restart;
++ }
++ }
++ else
++ {
++ printf (" Failed!\n Press any key to continue...");
++ getkey ();
++ goto restart;
++ }
++ }
++ else if (! auth && password)
+ {
+ printf ("\
+ Press enter to boot the selected OS or \'p\' to enter a\n\
+@@ -637,57 +702,8 @@
+ {
+ if (c == 'p')
+ {
+- /* Do password check here! */
+- char entered[32];
+- char *pptr = password;
+-
+- if (terminal & TERMINAL_DUMB)
+- grub_printf ("\r ");
+- else
+- gotoxy (view_x0 + 1, view_y1 + 21);
+-
+- /* Wipe out the previously entered password */
+- memset (entered, 0, sizeof (entered));
+- get_cmdline (" Password: ", entered, 31, '*', 0);
+-
+- while (! isspace (*pptr) && *pptr)
+- pptr++;
+-
+- /* Make sure that PASSWORD is NUL-terminated. */
+- *pptr++ = 0;
+-
+- if (! check_password (entered, password, password_type))
+- {
+- char *new_file = config_file;
+- while (isspace (*pptr))
+- pptr++;
+-
+- /* If *PPTR is NUL, then allow the user to use
+- privileged instructions, otherwise, load
+- another configuration file. */
+- if (*pptr != 0)
+- {
+- while ((*(new_file++) = *(pptr++)) != 0)
+- ;
+-
+- /* Make sure that the user will not have
+- authority in the next configuration. */
+- auth = 0;
+- return;
+- }
+- else
+- {
+- /* Now the user is superhuman. */
+- auth = 1;
+- goto restart;
+- }
+- }
+- else
+- {
+- printf ("Failed!\n Press any key to continue...");
+- getkey ();
+- goto restart;
+- }
++ ask_pass = 1;
++ goto restart;
+ }
+ }
+ else
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.90-staticcurses.patch b/sys-boot/grub/files/grub-0.92/grub-0.90-staticcurses.patch
new file mode 100644
index 000000000000..0dff39b17c2e
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.90-staticcurses.patch
@@ -0,0 +1,14 @@
+--- grub-0.90/configure.in~ Thu Aug 2 20:14:19 2001
++++ grub-0.90/configure.in Fri Aug 3 12:52:20 2001
+@@ -171,9 +171,9 @@
+
+ # Unless the user specify --without-curses, check for curses.
+ if test "x$with_curses" != "xno"; then
+- AC_CHECK_LIB(ncurses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lncurses"
++ AC_CHECK_LIB(ncurses, wgetch, [GRUB_LIBS="$GRUB_LIBS /usr/lib/libncurses.a"
+ AC_DEFINE(HAVE_LIBCURSES)],
+- [AC_CHECK_LIB(curses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lcurses"
++ [AC_CHECK_LIB(curses, wgetch, [GRUB_LIBS="$GRUB_LIBS /usr/lib/libncurses.a"
+ AC_DEFINE(HAVE_LIBCURSES)])])
+ fi
+
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.90-symlinkmenulst.patch b/sys-boot/grub/files/grub-0.92/grub-0.90-symlinkmenulst.patch
new file mode 100644
index 000000000000..553d15a6c016
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.90-symlinkmenulst.patch
@@ -0,0 +1,16 @@
+Only in grub: ChangeLog~
+diff -ur grub-0.90/util/grub-install.in grub/util/grub-install.in
+--- grub-0.90/util/grub-install.in Wed Sep 5 15:50:06 2001
++++ grub/util/grub-install.in Wed Sep 5 15:50:24 2001
+@@ -320,6 +320,10 @@
+ exit 1
+ fi
+
++if ! test -e ${grubdir}/grub.conf ; then
++ test -e ${grubdir}/menu.lst && ln -s ./menu.lst ${grubdir}/grub.conf
++fi
++
+ # Create a safe temporary file.
+ test -x /bin/mktemp && log_file=`/bin/mktemp /tmp/grub-install.log.XXXXXX`
+
+Only in grub/util: grub-install.in.orig
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.90-vga16-keypressclear.patch b/sys-boot/grub/files/grub-0.92/grub-0.90-vga16-keypressclear.patch
new file mode 100644
index 000000000000..e1678344ba12
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.90-vga16-keypressclear.patch
@@ -0,0 +1,36 @@
+diff -ur grub/stage2/stage2.c grub-0.90/stage2/stage2.c
+--- grub/stage2/stage2.c Thu Jul 19 01:43:41 2001
++++ grub-0.90/stage2/stage2.c Thu Jul 19 01:50:23 2001
+@@ -503,19 +503,6 @@
+
+ c = translate_keycode (getkey ());
+
+- if (grub_timeout >= 0)
+- {
+- if (terminal & TERMINAL_DUMB)
+- grub_putchar ('\r');
+- else
+- gotoxy (view_x0 + 3, 22);
+- printf (" ");
+- grub_timeout = -1;
+- fallback_entry = -1;
+- if (! (terminal & TERMINAL_DUMB))
+- gotoxy (view_x1 - 6, view_x0 + 4 + entryno);
+- }
+-
+ /* We told them above (at least in SUPPORT_SERIAL) to use
+ '^' or 'v' so accept these keys. */
+ if (c == 16 || c == '^')
+@@ -792,6 +779,12 @@
+ }
+ #endif
+ }
++ if (grub_timeout >= 0)
++ {
++ grub_timeout = -1;
++ fallback_entry = -1;
++ goto restart;
++ }
+ }
+ }
+
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.91-bootonce.patch b/sys-boot/grub/files/grub-0.92/grub-0.91-bootonce.patch
new file mode 100644
index 000000000000..90d7cfd3fda4
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.91-bootonce.patch
@@ -0,0 +1,249 @@
+To: bug-grub@gnu.org
+cc: Keir.Fraser@cl.cam.ac.uk
+Subject: PATCH (updated): 'lilo -R' functionality
+From: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
+Message-Id: <E16iFu3-0002VK-00@wisbech.cl.cam.ac.uk>
+
+The following is a slight modification to the patch I submitted a week
+or so ago. This will cause GRUB to skip displaying the boot menu if a
+one-shot default has been specified (just as lilo does with '-R').
+
+Same caveats as for previous patch:
+ * The new 'savedefault' function in the GRUB shell is incomplete.
+ Only works if the filesystem containing stage2 file is mounted.
+ * Patch is against grub-0.90, but patches directly to 0.91
+
+I hope this goes into CVS in the next round of updates :-)
+
+ -- Keir Fraser
+
+
+
+diff -urBP grub-0.90-old/stage2/builtins.c grub-0.90-modified/stage2/builtins.c
+--- grub-0.90-old/stage2/builtins.c Fri Feb 22 11:59:57 2002
++++ grub-0.90-modified/stage2/builtins.c Fri Feb 22 13:48:36 2002
+@@ -785,6 +785,17 @@
+ default_func (char *arg, int flags)
+ {
+ #ifndef SUPPORT_DISKLESS
++#ifndef GRUB_UTIL
++ /* Has a forced once-only default been specified? */
++ static int savedefault_helper(int);
++ if ((saved_entryno & STAGE2_ONCEONLY_ENTRY) != 0)
++ {
++ grub_timeout = 0;
++ default_entry = saved_entryno & ~STAGE2_ONCEONLY_ENTRY;
++ savedefault_helper(0);
++ return 0;
++ }
++#endif
+ if (grub_strcmp (arg, "saved") == 0)
+ {
+ default_entry = saved_entryno;
+@@ -3074,22 +3085,15 @@
+ };
+
+
+-/* savedefault */
++
++#if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL)
++/* Write specified default entry number into stage2 file. */
+ static int
+-savedefault_func (char *arg, int flags)
++savedefault_helper(int new_default)
+ {
+-#if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL)
+ char buffer[512];
+ int *entryno_ptr;
+-
+- /* This command is only useful when you boot an entry from the menu
+- interface. */
+- if (! (flags & BUILTIN_SCRIPT))
+- {
+- errnum = ERR_UNRECOGNIZED;
+- return 1;
+- }
+-
++
+ /* Get the geometry of the boot drive (i.e. the disk which contains
+ this stage2). */
+ if (get_diskinfo (boot_drive, &buf_geom))
+@@ -3115,10 +3119,10 @@
+ entryno_ptr = (int *) (buffer + STAGE2_SAVED_ENTRYNO);
+
+ /* Check if the saved entry number differs from current entry number. */
+- if (*entryno_ptr != current_entryno)
++ if (*entryno_ptr != new_default)
+ {
+ /* Overwrite the saved entry number. */
+- *entryno_ptr = current_entryno;
++ *entryno_ptr = new_default;
+
+ /* Save the image in the disk. */
+ if (! rawwrite (boot_drive, install_second_sector, buffer))
+@@ -3129,6 +3133,117 @@
+ }
+
+ return 0;
++}
++#endif
++
++#if !defined(SUPPORT_DISKLESS) && defined(GRUB_UTIL)
++/*
++ * Full implementation of new `savedefault' for GRUB shell.
++ * XXX This needs fixing for stage2 files which aren't accessible
++ * through a mounted filesystem.
++ */
++static int
++savedefault_shell(char *arg, int flags)
++{
++ char *stage2_os_file = "/boot/grub/stage2"; /* Default filename */
++ FILE *fp;
++ char buffer[512];
++ int *entryno_ptr;
++ int new_default = 0;
++
++ while (1)
++ {
++ if (grub_memcmp ("--stage2=", arg, sizeof ("--stage2=") - 1) == 0)
++ {
++ stage2_os_file = arg + sizeof ("--stage2=") - 1;
++ arg = skip_to (0, arg);
++ nul_terminate (stage2_os_file);
++ }
++ else if (grub_memcmp ("--default=", arg, sizeof ("--default=") - 1) == 0)
++ {
++ char *p = arg + sizeof ("--default=") - 1;
++ if (! safe_parse_maxint (&p, &new_default))
++ return 1;
++ arg = skip_to (0, arg);
++ }
++ else if (grub_memcmp ("--once", arg, sizeof ("--once") - 1) == 0)
++ {
++ new_default |= STAGE2_ONCEONLY_ENTRY;
++ arg = skip_to (0, arg);
++ }
++ else
++ break;
++ }
++
++ if (! (fp = fopen(stage2_os_file, "r+")))
++ {
++ errnum = ERR_FILE_NOT_FOUND;
++ return 1;
++ }
++
++ if (fseek (fp, SECTOR_SIZE, SEEK_SET) != 0)
++ {
++ fclose (fp);
++ errnum = ERR_BAD_VERSION;
++ return 1;
++ }
++
++ if (fread (buffer, 1, SECTOR_SIZE, fp) != SECTOR_SIZE)
++ {
++ fclose (fp);
++ errnum = ERR_READ;
++ return 1;
++ }
++
++ /* Sanity check. */
++ if (buffer[STAGE2_STAGE2_ID] != STAGE2_ID_STAGE2
++ || *((short *) (buffer + STAGE2_VER_MAJ_OFFS)) != COMPAT_VERSION)
++ {
++ errnum = ERR_BAD_VERSION;
++ return 1;
++ }
++
++ entryno_ptr = (int *) (buffer + STAGE2_SAVED_ENTRYNO);
++ *entryno_ptr = new_default;
++
++ if (fseek (fp, SECTOR_SIZE, SEEK_SET) != 0)
++ {
++ fclose (fp);
++ errnum = ERR_BAD_VERSION;
++ return 1;
++ }
++
++ if (fwrite (buffer, 1, SECTOR_SIZE, fp) != SECTOR_SIZE)
++ {
++ fclose (fp);
++ errnum = ERR_WRITE;
++ return 1;
++ }
++
++ (void)fflush (fp);
++ fclose (fp);
++ return 0;
++}
++#endif
++
++/* savedefault */
++static int
++savedefault_func (char *arg, int flags)
++{
++#if !defined(SUPPORT_DISKLESS)
++#if !defined(GRUB_UTIL)
++ /* This command is only useful when you boot an entry from the menu
++ interface. */
++ if (! (flags & BUILTIN_SCRIPT))
++ {
++ errnum = ERR_UNRECOGNIZED;
++ return 1;
++ }
++
++ return savedefault_helper(current_entryno);
++#else /* defined(GRUB_UTIL) */
++ return savedefault_shell(arg, flags);
++#endif
+ #else /* ! SUPPORT_DISKLESS && ! GRUB_UTIL */
+ errnum = ERR_UNRECOGNIZED;
+ return 1;
+@@ -3140,8 +3255,14 @@
+ "savedefault",
+ savedefault_func,
+ BUILTIN_CMDLINE,
++#ifdef GRUB_UTIL
++ "savedefault [--stage2=STAGE2_FILE] [--default=DEFAULT] [--once]",
++ "Save DEFAULT as the default boot entry in STAGE2_FILE. If '--once'"
++ " is specified, the default is reset after the next reboot."
++#else
+ "savedefault",
+ "Save the current entry as the default boot entry."
++#endif
+ };
+
+
+@@ -4217,6 +4338,15 @@
+ static int
+ timeout_func (char *arg, int flags)
+ {
++ /* One-shot default shenanigans -- don't piss around with the menu! */
++ if (grub_timeout != -1)
++ return 0;
++ if ((saved_entryno & STAGE2_ONCEONLY_ENTRY) != 0)
++ {
++ grub_timeout = 0;
++ return 0;
++ }
++
+ if (! safe_parse_maxint (&arg, &grub_timeout))
+ return 1;
+
+diff -urBP grub-0.90-old/stage2/shared.h grub-0.90-modified/stage2/shared.h
+--- grub-0.90-old/stage2/shared.h Fri Feb 22 11:59:53 2002
++++ grub-0.90-modified/stage2/shared.h Fri Feb 22 10:51:49 2002
+@@ -199,6 +199,8 @@
+ #define STAGE2_FORCE_LBA 0x11
+ #define STAGE2_VER_STR_OFFS 0x12
+
++#define STAGE2_ONCEONLY_ENTRY 0x10000
++
+ /* Stage 2 identifiers */
+ #define STAGE2_ID_STAGE2 0
+ #define STAGE2_ID_FFS_STAGE1_5 1
+
+_______________________________________________
+Bug-grub mailing list
+Bug-grub@gnu.org
+http://mail.gnu.org/mailman/listinfo/bug-grub
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.91-splashimagehelp.patch b/sys-boot/grub/files/grub-0.92/grub-0.91-splashimagehelp.patch
new file mode 100644
index 000000000000..cc7807350493
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.91-splashimagehelp.patch
@@ -0,0 +1,28 @@
+diff -ur grub-0.91/docs/grub.texi grub/docs/grub.texi
+--- grub-0.91/docs/grub.texi Mon Jan 21 22:57:46 2002
++++ grub/docs/grub.texi Mon Jan 21 22:57:51 2002
+@@ -1891,6 +1891,7 @@
+ * rarp:: Initialize a network device via RARP
+ * serial:: Set up a serial device
+ * setkey:: Configure the key map
++* splashimage:: Use a splash image
+ * terminal:: Choose a terminal
+ * tftpserver:: Specify a TFTP server
+ * unhide:: Unhide a partition
+@@ -2260,6 +2261,16 @@
+ @end deffn
+
+
++@node splashimage
++@subsection splashimage
++
++@deffn Command splashimage file
++Select an image to use as the background image. This should be
++specified using normal GRUB device naming syntax. The format of the
++file is a gzipped xpm which is 640x480 with a 14 color palette.
++@end deffn
++
++
+ @node terminal
+ @subsection terminal
+
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.91-vga16-serial.patch b/sys-boot/grub/files/grub-0.92/grub-0.91-vga16-serial.patch
new file mode 100644
index 000000000000..97d6f7dfa56f
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.91-vga16-serial.patch
@@ -0,0 +1,58 @@
+2002-04-14 Grant Edwards <grante@visi.com>
+
+ * stage2/builtins.c (terminal_func): Force VGA16 code
+ to use "text" display if serial console is selected.
+ Enables use of serial and splashimage/vga16 console
+ combination.
+diff -U5 -r grub-0.91-vga/stage2/builtins.c grub-0.91-vga-fixed/stage2/builtins.c
+--- grub-0.91-vga/stage2/builtins.c Sun Apr 14 13:18:30 2002
++++ grub-0.91-vga-fixed/stage2/builtins.c Sun Apr 14 10:51:53 2002
+@@ -159,10 +159,12 @@
+ BUILTIN_CMDLINE | BUILTIN_MENU,
+ "background RRGGBB",
+ "Sets the background color when in graphics mode."
+ "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
+ };
++
++extern int vga_disabled;
+ #endif /* VGA16 */
+
+
+ /* blocklist */
+ static int
+@@ -4170,11 +4172,15 @@
+ }
+ else if ((terminal & TERMINAL_SERIAL) && serial_checkkey () != -1)
+ {
+ terminal &= (TERMINAL_SERIAL | TERMINAL_DUMB);
+ (void) getkey ();
+-
++#ifdef VGA16
++ vga_disabled = 1;
++ display_idx = 0;
++ display = &display_entries[0];
++#endif
+ /* If the interface is currently the command-line, restart
+ it to repaint the screen. */
+ if (flags & BUILTIN_CMDLINE)
+ grub_longjmp (restart_cmdline_env, 0);
+
+@@ -4182,10 +4188,18 @@
+ }
+ }
+
+ /* Expired. */
+ terminal &= (default_terminal | TERMINAL_DUMB);
++#ifdef VGA16
++ if (!(terminal & TERMINAL_CONSOLE))
++ {
++ vga_disabled = 1;
++ display_idx = 0;
++ display = &display_entries[0];
++ }
++#endif
+ }
+ #endif /* SUPPORT_SERIAL */
+
+ return 0;
+ }
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.92-automake16.patch b/sys-boot/grub/files/grub-0.92/grub-0.92-automake16.patch
new file mode 100644
index 000000000000..5b07ed9ec8cb
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.92-automake16.patch
@@ -0,0 +1,161 @@
+diff -ur grub-0.92/configure.in grub/configure.in
+--- grub-0.92/configure.in Wed May 1 20:54:16 2002
++++ grub/configure.in Wed May 1 20:55:39 2002
+@@ -55,8 +55,8 @@
+ _AM_DEPENDENCIES(CC)
+
+ dnl Because recent automake complains about AS, set it here.
+-AS="$CC"
+-AC_SUBST(AS)
++CCAS="$CC"
++AC_SUBST(CCAS)
+
+ AC_ARG_WITH(binutils,
+ [ --with-binutils=DIR search the directory DIR to find binutils])
+@@ -607,9 +607,9 @@
+ AC_SUBST(NET_EXTRAFLAGS)
+ AC_SUBST(NETBOOT_DRIVERS)
+
+-dnl Because recent automake complains about ASFLAGS, set it here.
+-ASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)'
+-AC_SUBST(ASFLAGS)
++dnl Because recent automake complains about CCASFLAGS, set it here.
++CCASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)'
++AC_SUBST(CCASFLAGS)
+
+ AC_ARG_ENABLE(vga16,
+ [ --disable-vga16 disable VGA graphics interface])
+diff -ur grub-0.92/stage1/Makefile.am grub/stage1/Makefile.am
+--- grub-0.92/stage1/Makefile.am Wed Jul 4 03:33:48 2001
++++ grub/stage1/Makefile.am Wed May 1 20:56:58 2002
+@@ -4,7 +4,7 @@
+ CLEANFILES = $(nodist_pkgdata_DATA)
+
+ # We can't use builtins or standard includes.
+-AM_ASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
++AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
+ LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
+
+ noinst_PROGRAMS = stage1.exec
+Only in grub/stage1: Makefile.am~
+diff -ur grub-0.92/stage2/Makefile.am grub/stage2/Makefile.am
+--- grub-0.92/stage2/Makefile.am Sun Feb 3 23:55:48 2002
++++ grub/stage2/Makefile.am Wed May 1 20:57:51 2002
+@@ -87,7 +87,7 @@
+ fsys_vstafs.c fsys_xfs.c hercules.c serial.c smp-imps.c \
+ stage2.c md5.c
+ pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
+-pre_stage2_exec_ASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
++pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
+ pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
+
+ if NETBOOT_SUPPORT
+@@ -108,7 +108,7 @@
+ echo "#define STAGE2_SIZE $$6" > stage2_size.h
+
+ start_exec_SOURCES = start.S
+-start_exec_ASFLAGS = $(STAGE2_COMPILE)
++start_exec_CCASFLAGS = $(STAGE2_COMPILE)
+ start_exec_LDFLAGS = $(START_LINK)
+
+ # XXX: automake doesn't provide a way to specify dependencies for object
+@@ -126,7 +126,7 @@
+ stage1_5.c fsys_ext2fs.c bios.c
+ e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \
+ -DNO_BLOCK_FILES=1
+-e2fs_stage1_5_exec_ASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \
++e2fs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \
+ -DNO_BLOCK_FILES=1
+ e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
+@@ -135,7 +135,7 @@
+ stage1_5.c fsys_fat.c bios.c
+ fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \
+ -DNO_BLOCK_FILES=1
+-fat_stage1_5_exec_ASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \
++fat_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 \
+ -DNO_BLOCK_FILES=1
+ fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
+@@ -144,7 +144,7 @@
+ stage1_5.c fsys_ffs.c bios.c
+ ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
+ -DNO_BLOCK_FILES=1
+-ffs_stage1_5_exec_ASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
++ffs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
+ -DNO_BLOCK_FILES=1
+ ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
+@@ -153,7 +153,7 @@
+ stage1_5.c fsys_minix.c bios.c
+ minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \
+ -DNO_BLOCK_FILES=1
+-minix_stage1_5_exec_ASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \
++minix_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \
+ -DNO_BLOCK_FILES=1
+ minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
+@@ -162,7 +162,7 @@
+ disk_io.c stage1_5.c fsys_reiserfs.c bios.c
+ reiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \
+ -DNO_BLOCK_FILES=1
+-reiserfs_stage1_5_exec_ASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \
++reiserfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \
+ -DNO_BLOCK_FILES=1
+ reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
+@@ -171,7 +171,7 @@
+ disk_io.c stage1_5.c fsys_vstafs.c bios.c
+ vstafs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \
+ -DNO_BLOCK_FILES=1
+-vstafs_stage1_5_exec_ASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \
++vstafs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_VSTAFS=1 \
+ -DNO_BLOCK_FILES=1
+ vstafs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
+@@ -180,7 +180,7 @@
+ disk_io.c stage1_5.c fsys_jfs.c bios.c
+ jfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \
+ -DNO_BLOCK_FILES=1
+-jfs_stage1_5_exec_ASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \
++jfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_JFS=1 \
+ -DNO_BLOCK_FILES=1
+ jfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
+@@ -189,7 +189,7 @@
+ disk_io.c stage1_5.c fsys_xfs.c bios.c
+ xfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \
+ -DNO_BLOCK_FILES=1
+-xfs_stage1_5_exec_ASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \
++xfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_XFS=1 \
+ -DNO_BLOCK_FILES=1
+ xfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
+@@ -197,7 +197,7 @@
+ diskless_exec_SOURCES = $(pre_stage2_exec_SOURCES)
+ diskless_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \
+ -DSUPPORT_DISKLESS=1
+-diskless_exec_ASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \
++diskless_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \
+ -DSUPPORT_DISKLESS=1
+ diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK)
+ diskless_exec_LDADD = ../netboot/libdrivers.a
+@@ -209,7 +209,7 @@
+
+ # For nbloader target.
+ nbloader_exec_SOURCES = nbloader.S
+-nbloader_exec_ASFLAGS = $(STAGE2_COMPILE)
++nbloader_exec_CCASFLAGS = $(STAGE2_COMPILE)
+ nbloader_exec_LDFLAGS = $(NBLOADER_LINK)
+
+ # XXX: See the comment for start_exec-start.o.
+@@ -222,7 +222,7 @@
+
+ # For pxeloader target.
+ pxeloader_exec_SOURCES = pxeloader.S
+-pxeloader_exec_ASFLAGS = $(STAGE2_COMPILE)
++pxeloader_exec_CCASFLAGS = $(STAGE2_COMPILE)
+ pxeloader_exec_LDFLAGS = $(PXELOADER_LINK)
+
+ # XXX: See the comment for start_exec-start.o.
+Only in grub/stage2: Makefile.am~
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.92-nodeprecatedflags.patch b/sys-boot/grub/files/grub-0.92/grub-0.92-nodeprecatedflags.patch
new file mode 100644
index 000000000000..592a8fc4a9fd
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.92-nodeprecatedflags.patch
@@ -0,0 +1,11 @@
+--- configure.in.cppflags Wed May 1 20:12:18 2002
++++ configure.in Wed May 1 20:14:15 2002
+@@ -110,7 +110,7 @@
+ ])
+
+ # Force no alignment to save space.
+-CPPFLAGS="$CPPFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
++CPPFLAGS="$CPPFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
+
+ if test "x$undef_flag" = xyes; then
+ CPPFLAGS="$CPPFLAGS -Wundef"
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.92-usbfix.patch b/sys-boot/grub/files/grub-0.92/grub-0.92-usbfix.patch
new file mode 100644
index 000000000000..2ec17311a52e
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.92-usbfix.patch
@@ -0,0 +1,83 @@
+diff -ur grub-0.92/stage2/shared.h grub/stage2/shared.h
+--- grub-0.92/stage2/shared.h 25 Mar 2002 21:43:55 -0000
++++ grub/stage2/shared.h 7 May 2002 18:34:23 -0000
+@@ -258,14 +258,18 @@
+ #define VARIABLE(x) ENTRY(x)
+
+
++/* Keyboard controller defines */
+ #define K_RDWR 0x60 /* keyboard data & cmds (read/write) */
+-#define K_STATUS 0x64 /* keyboard status */
++#define K_STATUS 0x64 /* keyboard status (read-only) */
+ #define K_CMD 0x64 /* keybd ctlr command (write-only) */
+
+ #define K_OBUF_FUL 0x01 /* output buffer full */
+ #define K_IBUF_FUL 0x02 /* input buffer full */
+
+-#define KC_CMD_WIN 0xd0 /* read output port */
++#define KC_CMD_KBDIS 0xad /* disable keyboard */
++#define KC_CMD_KBEN 0xae /* enable keyboard */
++
++#define KC_CMD_ROUT 0xd0 /* read output port */
+ #define KC_CMD_WOUT 0xd1 /* write output port */
+ #define KB_OUTPUT_MASK 0xdd /* enable output buffer full interrupt
+ enable data line
+diff -ur grub-0.92/stage2/asm.S grub/stage2/asm.S
+--- grub-0.92/stage2/asm.S 12 Nov 2001 06:57:29 -0000
++++ grub/stage2/asm.S 7 May 2002 18:34:28 -0000
+@@ -1694,10 +1694,24 @@
+ */
+
+ ENTRY(gateA20)
++ pushl %ebp
++ movl %esp, %ebp
+ pushl %eax
++ pushl %ebx
+
+ call gloop1
+
++ /* mask PS/2 interrupts */
++ movb $0x10, %al
++ outb $0xa1
++ movb $1, %al
++ outb $0x21
++ /* disable keyboard */
++ movb $KC_CMD_KBDIS, %al
++ outb $K_CMD
++ call gloop1
++
++ /* set up to write keyboard controller "output port" */
+ movb $KC_CMD_WOUT, %al
+ outb $K_CMD
+
+@@ -1707,16 +1721,29 @@
+ jnz gloopint1
+
+ movb $KB_OUTPUT_MASK, %al
+- cmpb $0, 0x8(%esp)
++ cmpb $0, 0x8(%ebp)
+ jz gdoit
+
+ orb $KB_A20_ENABLE, %al
+ gdoit:
++ /* write keyboard controller "output port" */
+ outb $K_RDWR
+
+ call gloop1
+
++ /* enable keyboard again (this also adds a bit of delay...) */
++ movb $KC_CMD_KBEN, %al
++ outb $K_CMD
++ call gloop1
++ /* unmask PS/2 interrupts */
++ movb $0, %al
++ outb $0xa1
++ movb $0, %al
++ outb $0x21
++
++ popl %ebx
+ popl %eax
++ popl %ebp
+ ret
+
+ gloop1:
diff --git a/sys-boot/grub/files/grub-0.92/grub-0.92-vga16.patch b/sys-boot/grub/files/grub-0.92/grub-0.92-vga16.patch
new file mode 100644
index 000000000000..0a915352e6ef
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.92/grub-0.92-vga16.patch
@@ -0,0 +1,2058 @@
+diff -ur grub-0.92/ChangeLog grub/ChangeLog
+--- grub-0.92/ChangeLog Mon Apr 29 14:51:03 2002
++++ grub/ChangeLog Wed May 1 20:29:20 2002
+@@ -2104,6 +2104,18 @@
+ [!STAGE1_5] (CMDLINE_WIDTH): New macro.
+ [!STAGE1_5] (CMDLINE_MARGIN): Likewise.
+ * stage2/shared.h (TERMINAL_DUMB): Likewise.
++
++2000-08-29 Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
++
++ * configure.in: Added --disable-vga16 option, in case user does not
++ want the new VGA graphics interface.
++ * stage2/asm.S: Added some new functions, for graphics operations,
++ and renamed several functions to allow wrapping them.
++ * stage2/stage2.c: Main changes for VGA16 support.
++ * stage2/char_io.c: Modified calls of grub_putchar to putchar
++ * stage2/disk_io.c: Same as for char_io.c
++ * stage2/cmdline.c: Also, the same as for char_io.c
++ * stage2/shared.h: Definitions for externs and wrapping functions.
+
+ 2000-08-28 OKUJI Yoshinori <okuji@gnu.org>
+
+diff -ur grub-0.92/configure.in grub/configure.in
+--- grub-0.92/configure.in Fri Mar 29 05:24:17 2002
++++ grub/configure.in Wed May 1 20:29:20 2002
+@@ -18,6 +18,7 @@
+ AC_PREREQ(2.13)
+
+ AC_CANONICAL_HOST
++AM_PROG_LIBTOOL
+
+ case "$host_cpu" in
+ i[[3456]]86) host_cpu=i386 ;;
+@@ -610,6 +611,12 @@
+ ASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)'
+ AC_SUBST(ASFLAGS)
+
++AC_ARG_ENABLE(vga16,
++ [ --disable-vga16 disable VGA graphics interface])
++
++if test x"$enable_vga16" != xno; then
++ STAGE2_CFLAGS="$STAGE2_CFLAGS -DVGA16=1"
++fi
+
+ dnl Output.
+ AC_OUTPUT([Makefile stage1/Makefile stage2/Makefile docs/Makefile \
+diff -ur grub-0.92/stage2/asm.S grub/stage2/asm.S
+--- grub-0.92/stage2/asm.S Mon Nov 12 01:57:29 2001
++++ grub/stage2/asm.S Wed May 1 20:29:20 2002
+@@ -1865,7 +1865,7 @@
+ * %cl = cursor ending scanline
+ */
+
+-ENTRY(nocursor)
++ENTRY(grub_nocursor)
+ push %ebp
+ push %ebx /* save EBX */
+
+@@ -1951,7 +1951,7 @@
+
+
+ /*
+- * console_set_attrib(attr) : Sets the character attributes for character at
++ * grub_set_attrib(attr) : Sets the character attributes for character at
+ * current cursor position.
+ *
+ * Bitfields for character's display attribute:
+@@ -1985,7 +1985,7 @@
+ * %cx = count to display (???, possible side-effects!!)
+ */
+
+-ENTRY(console_set_attrib)
++ENTRY(grub_set_attrib)
+ push %ebp
+ push %ebx
+
+@@ -2009,6 +2009,263 @@
+ pop %ebp
+ ret
+
++#ifdef VGA16
++VARIABLE(cursorX)
++.word 0
++VARIABLE(cursorY)
++.word 0
++VARIABLE(cursorWidth)
++.word 0
++VARIABLE(cursorHeight)
++.word 0
++VARIABLE(cursorCount)
++.word 0
++VARIABLE(cursorBuf)
++.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
++
++/*
++ * set_int1c_handler(void)
++ */
++ENTRY(set_int1c_handler)
++ pushl %edi
++
++ /* save the original int1c handler */
++ movl $0x70, %edi
++ movw (%edi), %ax
++ movw %ax, ABS(int1c_offset)
++ movw 2(%edi), %ax
++ movw %ax, ABS(int1c_segment)
++
++ /* save the new int1c handler */
++ movw $ABS(int1c_handler), %ax
++ movw %ax, (%edi)
++ xorw %ax, %ax
++ movw %ax, 2(%edi)
++
++ popl %edi
++ ret
++
++
++/*
++ * unset_int1c_handler(void)
++ */
++ENTRY(unset_int1c_handler)
++ pushl %edi
++
++ /* check if int1c_handler is set */
++ movl $0x70, %edi
++ movw $ABS(int1c_handler), %ax
++ cmpw %ax, (%edi)
++ jne int1c_1
++ xorw %ax, %ax
++ cmpw %ax, 2(%edi)
++ jne int1c_1
++
++ /* restore the original */
++ movw ABS(int1c_offset), %ax
++ movw %ax, (%edi)
++ movw ABS(int1c_segment), %ax
++ movw %ax, 2(%edi)
++
++int1c_1:
++ popl %edi
++ ret
++
++/*
++ * blinks graphics cursor
++ */
++ .code16
++write_data:
++ movw $0, %ax
++ movw %ax, %ds
++
++ mov $0xA000, %ax /* video in es:di */
++ mov %ax, %es
++ mov $80, %ax
++ movw $ABS(cursorY), %si
++ mov %ds:(%si), %bx
++ mul %bx
++ movw $ABS(cursorX), %si
++ mov %ds:(%si), %bx
++ shr $3, %bx /* %bx /= 8 */
++ add %bx, %ax
++ mov %ax, %di
++
++ movw $ABS(cursorBuf), %si /* fontBuf in ds:si */
++
++ /* prepare for data moving */
++ mov $16, %dx /* altura da fonte */
++ mov $80, %bx /* bytes por linha */
++
++write_loop:
++ movb %ds:(%si), %al
++ xorb $0xff, %al
++ movb %al, %ds:(%si) /* invert cursorBuf */
++ movb %al, %es:(%di) /* write to video */
++ add %bx, %di
++ inc %si
++ dec %dx
++ jg write_loop
++ ret
++
++int1c_handler:
++ pusha
++ mov $0, %ax
++ mov %ax, %ds
++ mov $ABS(cursorCount), %si
++ mov %ds:(%si), %ax
++ inc %ax
++ mov %ax, %ds:(%si)
++ cmp $9, %ax
++ jne int1c_done
++
++ mov $0, %ax
++ mov %ax, %ds:(%si)
++/*
++ movw $0x3c4, %dx
++ movb $0x020f, %ax
++ outw %ax, %dx
++*/
++ call write_data
++
++int1c_done:
++ popa
++ iret
++ /* call previous int1c handler */
++ /* ljmp */
++ .byte 0xea
++int1c_offset: .word 0
++int1c_segment: .word 0
++ .code32
++
++
++ENTRY(get_font)
++ push %ebp
++ push %ebx
++ push %ecx
++ push %edx
++
++ call EXT_C(prot_to_real)
++ .code16
++
++ movw $0x1130, %ax
++ movb $6, %bh /* font 8x16 */
++ int $0x10
++ movw %bp, %dx
++ movw %es, %cx
++
++ DATA32 call EXT_C(real_to_prot)
++ .code32
++
++ xorl %eax, %eax
++ movw %cx, %ax
++ shll $4, %eax
++ movw %dx, %ax
++
++ pop %edx
++ pop %ecx
++ pop %ebx
++ pop %ebp
++ ret
++
++/*
++ * set_videomode(mode)
++ * BIOS call "INT 10H Function 0h" to set video mode
++ * Call with %ah = 0x0
++ * %al = video mode
++ */
++ENTRY(set_videomode)
++ push %ebp
++ push %ebx
++ push %ecx
++
++ movb 0x10(%esp), %cl
++
++ call EXT_C(prot_to_real)
++ .code16
++
++ xorw %bx, %bx
++ movb $0xf, %ah
++ int $0x10 /* Get Current Video mode */
++ movb %al, %ch
++ xorb %ah, %ah
++ movb %cl, %al
++ int $0x10 /* Set Video mode */
++
++ DATA32 call EXT_C(real_to_prot)
++ .code32
++
++ xorb %ah, %ah
++ movb %ch, %al
++
++ pop %ecx
++ pop %ebx
++ pop %ebp
++ ret
++
++/*
++ * set_palette(index, red, green, blue)
++ * BIOS call "INT 10H Function 10h" to set individual dac register
++ * Call with %ah = 0x10
++ * %bx = register number
++ * %ch = new value for green (0-63)
++ * %cl = new value for blue (0-63)
++ * %dh = new value for red (0-63)
++ */
++
++ENTRY(set_palette)
++ push %ebp
++ push %eax
++ push %ebx
++ push %ecx
++ push %edx
++
++ movw $0x3c8, %bx /* address write mode register */
++
++ /* wait vertical retrace */
++
++ movw $0x3da, %dx
++l1b: inb %dx, %al /* wait vertical active display */
++ test $8, %al
++ jnz l1b
++
++l2b: inb %dx, %al /* wait vertical retrace */
++ test $8, %al
++ jnz l2b
++
++ mov %bx, %dx
++ movb 0x18(%esp), %al /* index */
++ outb %al, %dx
++ inc %dx
++
++ movb 0x1c(%esp), %al /* red */
++ outb %al, %dx
++
++ movb 0x20(%esp), %al /* green */
++ outb %al, %dx
++
++ movb 0x24(%esp), %al /* blue */
++ outb %al, %dx
++
++ movw 0x18(%esp), %bx
++
++ call EXT_C(prot_to_real)
++ .code16
++
++ movb %bl, %bh
++ movw $0x1000, %ax
++ int $0x10
++
++ DATA32 call EXT_C(real_to_prot)
++ .code32
++
++ pop %edx
++ pop %ecx
++ pop %ebx
++ pop %eax
++ pop %ebp
++ ret
++#endif
+
+ /*
+ * getrtsecs()
+diff -ur grub-0.92/stage2/builtins.c grub/stage2/builtins.c
+--- grub-0.92/stage2/builtins.c Sun Apr 28 20:26:49 2002
++++ grub/stage2/builtins.c Wed May 1 20:30:30 2002
+@@ -133,6 +133,36 @@
+ grub_printf ("[%d,%d,%d]", sector, offset, length);
+ }
+
++#ifdef VGA16
++/* background */
++static int
++background_func(char *arg, int flags)
++{
++ if (grub_strlen(arg) == 6) {
++ int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;
++ int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;
++ int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;
++
++ background = (r << 16) | (g << 8) | b;
++ if (vga_inited)
++ set_palette(0, r, g, b);
++ return (0);
++ }
++
++ return (1);
++}
++
++static struct builtin builtin_background =
++{
++ "background",
++ background_func,
++ BUILTIN_CMDLINE | BUILTIN_MENU,
++ "background RRGGBB",
++ "Sets the background color when in graphics mode."
++ "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
++};
++#endif /* VGA16 */
++
+
+ /* blocklist */
+ static int
+@@ -399,6 +429,40 @@
+ #endif /* SUPPORT_NETBOOT */
+
+
++#ifdef VGA16
++
++/* foreground */
++static int
++border_func(char *arg, int flags)
++{
++ if (grub_strlen(arg) == 6) {
++ int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;
++ int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;
++ int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;
++
++ border = (r << 16) | (g << 8) | b;
++ if (vga_inited)
++ set_palette(0x11, r, g, b);
++
++ return (0);
++ }
++
++ return (1);
++}
++
++static struct builtin builtin_border =
++{
++ "border",
++ border_func,
++ BUILTIN_CMDLINE | BUILTIN_MENU,
++ "border RRGGBB",
++ "Sets the border video color when in graphics mode."
++ "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
++};
++
++#endif /* VGA16 */
++
++
+ /* cat */
+ static int
+ cat_func (char *arg, int flags)
+@@ -409,7 +473,7 @@
+ return 1;
+
+ while (grub_read (&c, 1))
+- grub_putchar (c);
++ putchar (c);
+
+ grub_close ();
+ return 0;
+@@ -963,6 +1027,44 @@
+ return 0;
+ }
+
++
++#ifdef VGA16
++/* display */
++static int
++display_func(char *arg, int flags)
++{
++ int i;
++
++ for (i = 0; i < MAX_DISPLAYS; i++) {
++ if (grub_strcmp(arg, display_entries[i].name) == 0)
++ break;
++ }
++
++ if (i >= MAX_DISPLAYS)
++ return (1);
++
++ display_idx = i;
++ if (display->End)
++ (*display->End)();
++ display = &display_entries[display_idx];
++
++ /* Restart cmain */
++ grub_longjmp (restart_env, 0);
++ /*NOTREACHED*/
++
++ return (0);
++}
++
++static struct builtin builtin_display =
++{
++ "display",
++ display_func,
++ BUILTIN_CMDLINE,
++ "display MODEL",
++ "Changes display type. Available modes are \"text\" and \"vga16\"."
++};
++#endif /* VGA16 */
++
+ static struct builtin builtin_displaymem =
+ {
+ "displaymem",
+@@ -1298,6 +1400,39 @@
+ " the devices which contain the file."
+ };
+
++#ifdef VGA16
++
++/* foreground */
++static int
++foreground_func(char *arg, int flags)
++{
++ if (grub_strlen(arg) == 6) {
++ int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;
++ int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;
++ int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;
++
++ foreground = (r << 16) | (g << 8) | b;
++ if (vga_inited)
++ set_palette(15, r, g, b);
++
++ return (0);
++ }
++
++ return (1);
++}
++
++static struct builtin builtin_foreground =
++{
++ "foreground",
++ foreground_func,
++ BUILTIN_CMDLINE | BUILTIN_MENU,
++ "foreground RRGGBB",
++ "Sets the foreground color when in graphics mode."
++ "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
++};
++
++#endif /* VGA16 */
++
+
+ /* fstest */
+ static int
+@@ -1450,13 +1585,13 @@
+
+
+ /* help */
+-#define MAX_SHORT_DOC_LEN 39
+-#define MAX_LONG_DOC_LEN 66
+
+ static int
+ help_func (char *arg, int flags)
+ {
+ int all = 0;
++ int MAX_SHORT_DOC_LEN = (view_x1 - view_x0 + 1) / 2 - 1;
++ int MAX_LONG_DOC_LEN = (view_x1 - view_x0) - 14;
+
+ if (grub_memcmp (arg, "--all", sizeof ("--all") - 1) == 0)
+ {
+@@ -1491,13 +1626,13 @@
+ len = MAX_SHORT_DOC_LEN - 1;
+
+ for (i = 0; i < len; i++)
+- grub_putchar ((*builtin)->short_doc[i]);
++ putchar ((*builtin)->short_doc[i]);
+
+ for (; i < MAX_SHORT_DOC_LEN; i++)
+- grub_putchar (' ');
++ putchar (' ');
+
+ if (! left)
+- grub_putchar ('\n');
++ putchar ('\n');
+
+ left = ! left;
+ }
+@@ -1552,8 +1687,8 @@
+
+ grub_printf (" ");
+ for (i = 0; i < len; i++)
+- grub_putchar (*doc++);
+- grub_putchar ('\n');
++ putchar (*doc++);
++ putchar ('\n');
+ }
+ }
+ }
+@@ -3260,6 +3395,74 @@
+ "Save the current entry as the default boot entry."
+ };
+
++#ifdef VGA16
++/*splashimage*/
++static int
++splashimage_func(char *arg, int flags)
++{
++ if (strlen(arg) > 63)
++ return (1);
++ if (flags == BUILTIN_CMDLINE) {
++ if (!grub_open(arg))
++ return (1);
++ grub_close();
++ }
++
++ if (flags == BUILTIN_CMDLINE || !splash_set) {
++ strcpy(splashimage, arg);
++ splash_set = 1;
++ }
++
++ if (flags == BUILTIN_CMDLINE && vga_inited) {
++ display->End();
++ display->Begin();
++ cls();
++/* grub_longjmp(restart_env, 0);*/
++ }
++
++ return (0);
++}
++
++static struct builtin builtin_splashimage =
++{
++ "splashimage",
++ splashimage_func,
++ BUILTIN_CMDLINE | BUILTIN_MENU,
++ "splashimage FILE",
++ "Load FILE as the background image when in graphics mode."
++};
++
++/*shade*/
++static int
++shade_func(char *arg, int flags)
++{
++ int new_shade;
++
++ if (!arg || safe_parse_maxint(&arg, &new_shade) == 0)
++ return (1);
++
++ if (shade != new_shade) {
++ shade = new_shade;
++ if (flags == BUILTIN_CMDLINE && vga_inited) {
++ display->End();
++ display->Begin();
++ cls();
++ }
++ }
++
++ return (0);
++}
++
++static struct builtin builtin_shade =
++{
++ "shade",
++ shade_func,
++ BUILTIN_CMDLINE | BUILTIN_MENU,
++ "shade INTEGER",
++ "If set to 0, disables the use of shaded text, else enables it."
++};
++#endif /* VGA16 */
++
+
+ #ifdef SUPPORT_SERIAL
+ /* serial */
+@@ -4572,16 +4775,79 @@
+ "Probe VBE information. If the mode number MODE is specified, show only"
+ " the information about only the mode."
+ };
+-
++
++#ifdef VGA16
+
++/* viewport */
++static int
++viewport_func (char *arg, int flags)
++{
++ int i;
++ int x0 = 80, y0 = 25, x1 = 0, y1 = 0;
++ int *pos[4] = { &x0, &y0, &x1, &y1 };
++ extern int viewport_set;
++
++ if (!arg)
++ return (1);
++ for (i = 0; i < 4; i++) {
++ if (!*arg)
++ return (1);
++ while (*arg && (*arg == ' ' || *arg == '\t'))
++ ++arg;
++ if (!safe_parse_maxint(&arg, pos[i]))
++ return (1);
++ while (*arg && (*arg != ' ' && *arg != '\t'))
++ ++arg;
++ }
++
++ x1 += x0;
++ y1 += y0;
++
++ /* minimum size is 60 colums and 16 rows */
++ if (x0 > x1 - 60 || y0 > y1 - 16 || x0 < 0 || y0 < 0 || x1 > 80 || y1 > 30)
++ return (1);
++
++ viewport_set = 1;
++ view_x0 = x0;
++ view_y0 = y0;
++ view_x1 = x1;
++ view_y1 = y1;
++
++ if (flags == BUILTIN_CMDLINE && vga_inited) {
++ display->End();
++ display->Begin();
++ cls();
++ }
++
++ return (0);
++}
++
++static struct builtin builtin_viewport =
++{
++ "viewport",
++ viewport_func,
++ BUILTIN_CMDLINE | BUILTIN_MENU,
++ "viewport x y width height",
++ "Changes grub internals to output text in the window defined by"
++ " four parameters. The x and y parameters are 0 based. This option"
++ " only works with the vga interface."
++};
++#endif /* VGA16 */
++
+ /* The table of builtin commands. Sorted in dictionary order. */
+ struct builtin *builtin_table[] =
+ {
++#ifdef VGA16
++ &builtin_background,
++#endif /* VGA16 */
+ &builtin_blocklist,
+ &builtin_boot,
+ #ifdef SUPPORT_NETBOOT
+ &builtin_bootp,
+ #endif /* SUPPORT_NETBOOT */
++#ifdef VGA16
++ &builtin_border,
++#endif /* VGA16 */
+ &builtin_cat,
+ &builtin_chainloader,
+ &builtin_cmp,
+@@ -4597,12 +4863,18 @@
+ #endif /* SUPPORT_NETBOOT */
+ &builtin_displayapm,
+ &builtin_displaymem,
++#ifdef VGA16
++ &builtin_display,
++#endif /* VGA16 */
+ #ifdef GRUB_UTIL
+ &builtin_dump,
+ #endif /* GRUB_UTIL */
+ &builtin_embed,
+ &builtin_fallback,
+ &builtin_find,
++#ifdef VGA16
++ &builtin_foreground,
++#endif /* VGA16 */
+ &builtin_fstest,
+ &builtin_geometry,
+ &builtin_halt,
+@@ -4646,6 +4918,10 @@
+ #endif /* SUPPORT_SERIAL */
+ &builtin_setkey,
+ &builtin_setup,
++#ifdef VGA16
++ &builtin_shade,
++ &builtin_splashimage,
++#endif /* VGA16 */
+ #if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES)
+ &builtin_terminal,
+ #endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */
+@@ -4659,5 +4935,8 @@
+ &builtin_unhide,
+ &builtin_uppermem,
+ &builtin_vbeprobe,
++#ifdef VGA16
++ &builtin_viewport,
++#endif /* VGA16 */
+ 0
+ };
+diff -ur grub-0.92/stage2/char_io.c grub/stage2/char_io.c
+--- grub-0.92/stage2/char_io.c Mon Mar 25 16:43:55 2002
++++ grub/stage2/char_io.c Wed May 1 20:29:20 2002
+@@ -265,8 +265,8 @@
+
+ /* XXX: These should be defined in shared.h, but I leave these here,
+ until this code is freezed. */
+-#define CMDLINE_WIDTH 78
+-#define CMDLINE_MARGIN 10
++ int CMDLINE_WIDTH = (view_x1 - view_x0) - 2;
++ int CMDLINE_MARGIN = 10;
+
+ int xpos, lpos, c, section;
+ /* The length of PROMPT. */
+@@ -316,7 +316,7 @@
+ {
+ int y = getxy () & 0xFF;
+
+- gotoxy (xpos, y);
++ gotoxy (xpos + view_x0, y);
+ }
+ # ifdef SUPPORT_SERIAL
+ else if (! (terminal & TERMINAL_DUMB) && (count > 4))
+@@ -328,7 +328,7 @@
+ int i;
+
+ for (i = 0; i < count; i++)
+- grub_putchar ('\b');
++ putchar ('\b');
+ }
+ # endif /* SUPPORT_SERIAL */
+ }
+@@ -354,7 +354,7 @@
+ {
+ int y = getxy () & 0xFF;
+
+- gotoxy (xpos, y);
++ gotoxy (xpos + view_x0, y);
+ }
+ # ifdef SUPPORT_SERIAL
+ else if (! (terminal & TERMINAL_DUMB) && (count > 4))
+@@ -368,9 +368,9 @@
+ for (i = lpos - count; i < lpos; i++)
+ {
+ if (! echo_char)
+- grub_putchar (buf[i]);
++ putchar (buf[i]);
+ else
+- grub_putchar (echo_char);
++ putchar (echo_char);
+ }
+ }
+ # endif /* SUPPORT_SERIAL */
+@@ -398,7 +398,7 @@
+ /* From the start to the end. */
+ len = CMDLINE_WIDTH;
+ pos = 0;
+- grub_putchar ('\r');
++ putchar ('\r');
+
+ /* If SECTION is the first section, print the prompt, otherwise,
+ print `<'. */
+@@ -410,7 +410,7 @@
+ }
+ else
+ {
+- grub_putchar ('<');
++ putchar ('<');
+ len--;
+ pos++;
+ }
+@@ -446,9 +446,9 @@
+ for (i = start; i < start + len && i < llen; i++)
+ {
+ if (! echo_char)
+- grub_putchar (buf[i]);
++ putchar (buf[i]);
+ else
+- grub_putchar (echo_char);
++ putchar (echo_char);
+
+ pos++;
+ }
+@@ -458,7 +458,7 @@
+ /* Fill up the rest of the line with spaces. */
+ for (; i < start + len; i++)
+ {
+- grub_putchar (' ');
++ putchar (' ');
+ pos++;
+ }
+
+@@ -467,9 +467,9 @@
+ if (pos == CMDLINE_WIDTH)
+ {
+ if (start + len < llen)
+- grub_putchar ('>');
++ putchar ('>');
+ else
+- grub_putchar (' ');
++ putchar (' ');
+
+ pos++;
+ }
+@@ -483,7 +483,7 @@
+ {
+ int y = getxy () & 0xFF;
+
+- gotoxy (xpos, y);
++ gotoxy (xpos + view_x0, y);
+ }
+ # ifdef SUPPORT_SERIAL
+ else if (! (terminal & TERMINAL_SERIAL) && (pos - xpos > 4))
+@@ -493,7 +493,7 @@
+ else
+ {
+ for (i = 0; i < pos - xpos; i++)
+- grub_putchar ('\b');
++ putchar ('\b');
+ }
+ # endif /* SUPPORT_SERIAL */
+ }
+@@ -503,7 +503,7 @@
+ void cl_init (void)
+ {
+ /* Distinguish us from other lines and error messages! */
+- grub_putchar ('\n');
++ putchar ('\n');
+
+ /* Print full line and set position here. */
+ cl_refresh (1, 0);
+@@ -634,7 +634,7 @@
+ /* There are more than one candidates, so print
+ the list. */
+
+- grub_putchar ('\n');
++ putchar ('\n');
+ /* Enable the auto fill mode temporarily. */
+ auto_fill = 1;
+ print_completions (is_filename, 0);
+@@ -776,7 +776,7 @@
+ }
+ }
+
+- grub_putchar ('\n');
++ putchar ('\n');
+
+ /* If ECHO_CHAR is NUL, remove the leading spaces. */
+ lpos = 0;
+@@ -1122,7 +1122,7 @@
+ {
+ /* Fold a line only if AUTO_FILL is true. */
+ if (auto_fill && col >= 79)
+- grub_putchar ('\n');
++ putchar ('\n');
+
+ col++;
+ }
+@@ -1173,7 +1173,7 @@
+
+ #ifndef STAGE1_5
+ void
+-gotoxy (int x, int y)
++grub_gotoxy (int x, int y)
+ {
+ if (terminal & TERMINAL_CONSOLE)
+ console_gotoxy (x, y);
+@@ -1197,7 +1197,7 @@
+ #endif /* SUPPORT_SERIAL */
+
+ int
+-getxy (void)
++grub_getxy (void)
+ {
+ int ret = 0;
+
+@@ -1302,7 +1302,7 @@
+ #endif /* SUPPORT_SERIAL */
+
+ void
+-cls (void)
++grub_cls (void)
+ {
+ if (terminal & TERMINAL_CONSOLE)
+ console_cls ();
+@@ -1323,7 +1323,7 @@
+ {
+ /* If the terminal is dumb, there is no way to clean the terminal. */
+ if (terminal & TERMINAL_DUMB)
+- grub_putchar ('\n');
++ putchar ('\n');
+ else
+ grub_printf ("\e[H\e[J");
+ }
+diff -ur grub-0.92/stage2/cmdline.c grub/stage2/cmdline.c
+--- grub-0.92/stage2/cmdline.c Sun Mar 24 07:28:54 2002
++++ grub/stage2/cmdline.c Wed May 1 20:29:20 2002
+@@ -125,7 +125,7 @@
+ init_page ();
+ #ifdef SUPPORT_DISKLESS
+ print_network_configuration ();
+- grub_putchar ('\n');
++ putchar ('\n');
+ #endif
+ print_cmdline_message (forever);
+
+diff -ur grub-0.92/stage2/disk_io.c grub/stage2/disk_io.c
+--- grub-0.92/stage2/disk_io.c Wed Nov 28 13:43:56 2001
++++ grub/stage2/disk_io.c Wed May 1 20:29:20 2002
+@@ -1267,7 +1267,7 @@
+ }
+
+ if (! is_completion)
+- grub_putchar ('\n');
++ putchar ('\n');
+
+ print_error ();
+ do_completion = 0;
+@@ -1334,7 +1334,7 @@
+ }
+
+ if (! is_completion)
+- grub_putchar ('\n');
++ putchar ('\n');
+ }
+ else
+ {
+@@ -1408,7 +1408,7 @@
+ }
+
+ if (! is_completion)
+- grub_putchar ('\n');
++ putchar ('\n');
+ }
+ else
+ errnum = ERR_BAD_FILENAME;
+diff -ur grub-0.92/stage2/shared.h grub/stage2/shared.h
+--- grub-0.92/stage2/shared.h Mon Mar 25 16:43:55 2002
++++ grub/stage2/shared.h Wed May 1 20:29:20 2002
+@@ -44,6 +44,12 @@
+ # define RAW_SEG(x) (x)
+ #endif
+
++#if defined(VGA16)
++#if defined(GRUB_UTIL) || defined(STAGE1_5)
++#undef VGA16
++#endif
++#endif
++
+ /*
+ * Integer sizes
+ */
+@@ -367,8 +373,10 @@
+ #define isspace grub_isspace
+ #define printf grub_printf
+ #define sprintf grub_sprintf
++#ifndef VGA16
+ #undef putchar
+ #define putchar grub_putchar
++#endif
+ #define strncat grub_strncat
+ #define strstr grub_strstr
+ #define memcmp grub_memcmp
+@@ -383,6 +391,9 @@
+ /*
+ * Below this should be ONLY defines and other constructs for C code.
+ */
++#ifdef VGA16
++#define VIDEO 0xA0000
++#endif
+
+ /* multiboot stuff */
+
+@@ -779,26 +790,26 @@
+ int currticks (void);
+
+ /* Clear the screen. */
+-void cls (void);
++void grub_cls (void);
+
+ /* The console part of cls. */
+ void console_cls (void);
+
+ #ifndef GRUB_UTIL
+ /* Turn off cursor. */
+-void nocursor (void);
++void grub_nocursor (void);
+ #endif
+
+ /* Get the current cursor position (where 0,0 is the top left hand
+ corner of the screen). Returns packed values, (RET >> 8) is x,
+ (RET & 0xff) is y. */
+-int getxy (void);
++int grub_getxy (void);
+
+ /* The console part of getxy. */
+ int console_getxy (void);
+
+ /* Set the cursor position. */
+-void gotoxy (int x, int y);
++void grub_gotoxy (int x, int y);
+
+ /* The console part of gotoxy. */
+ void console_gotoxy (int x, int y);
+@@ -828,8 +839,64 @@
+ constants defined above. */
+ void set_attrib (int attr);
+
++extern int view_x0, view_y0, view_x1, view_y1;
++#ifdef VGA16
++#define MAX_DISPLAYS 2
++
++#define cls() (display->Cls ? (*display->Cls)() : 0)
++#define gotoxy(x, y) (display->Gotoxy ? (*display->Gotoxy)(x, y) : 0)
++#define putchar(c) (display->Putchar ? (*display->Putchar)(c) : 0)
++#define console_set_attrib(a) (display->SetAttrib ? (*display->SetAttrib)(a) : 0)
++#define getxy() (display->Getxy ? (*display->Getxy)() : 0)
++#define nocursor() (display->Nocursor ? (*display->Nocursor)() : 0)
++struct display_entry {
++ char *name;
++ int (*Begin)(void);
++ void (*End)(void);
++ void (*Cls)(void);
++ void (*Gotoxy)(int x, int y);
++ void (*Putchar)(int ch);
++ void (*SetAttrib)(int attr);
++ int (*Getxy)(void);
++ void (*Nocursor)(void);
++};
++struct display_entry display_entries[MAX_DISPLAYS + 1];
++extern struct display_entry *display;
++
++extern int vga_inited, foreground, background, shade, border;
++extern int display_idx, splash_set;
++extern short cursorX, cursorY, cursorWidth, cursorHeight;
++extern char cursorBuf[16], splashimage[64];
++
++int vga16_begin(void);
++void vga16_end(void);
++void vga16_cls(void);
++void vga16_gotoxy(int x, int y);
++void vga16_putchar(int ch);
++int vga16_getxy(void);
++void vga16_nocursor(void);
++void vga16_set_attrib(int attr);
++
++int read_image();
++void set_palette(int index, int red, int green, int blue);
++void *get_font(void);
++/* return previous video mode */
++int set_videomode(int mode);
++
++int hex(int);
++void set_int1c_handler();
++void unset_int1c_handler();
++void cursor(int state);
++#else
++#define cls grub_cls
++#define gotoxy grub_gotoxy
++#define console_set_attrib grub_set_attrib
++#define getxy grub_getxy
++#define nocursor grub_nocursor
++#endif
++
+ /* The console part of set_attrib. */
+-void console_set_attrib (int attr);
++void grub_set_attrib (int attr);
+
+ /* Low-level disk I/O */
+ int get_diskinfo (int drive, struct geometry *geometry);
+diff -ur grub-0.92/stage2/stage2.c grub/stage2/stage2.c
+--- grub-0.92/stage2/stage2.c Sun Mar 24 07:28:54 2002
++++ grub/stage2/stage2.c Wed May 1 20:31:22 2002
+@@ -19,7 +19,12 @@
+
+ #include "shared.h"
+
++int view_x0 = 0, view_y0 = 0, view_x1 = 80, view_y1 = 25;
+ grub_jmp_buf restart_env;
++#ifdef VGA16
++int vga_disabled = 0, viewport_set = 0;
++int sx0, sy0, sx1, sy1;
++#endif
+
+ #if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS)
+
+@@ -109,12 +114,12 @@
+ }
+ #endif /* SUPPORT_SERIAL */
+
+- gotoxy (77, y + 1);
++ gotoxy (view_x1 - 3, y + 1);
+
+ if (first)
+- grub_putchar (disp_up);
++ putchar (disp_up);
+ else
+- grub_putchar (' ');
++ putchar (' ');
+
+ menu_entries = get_entry (menu_entries, first, 0);
+
+@@ -122,13 +127,13 @@
+ {
+ int j = 0;
+
+- gotoxy (3, y + i);
++ gotoxy (view_x0 + 3, y + i);
+
+ while (*menu_entries)
+ {
+- if (j < 71)
++ if (j < (view_x1 - view_x0) - 9)
+ {
+- grub_putchar (*menu_entries);
++ putchar (*menu_entries);
+ j++;
+ }
+
+@@ -138,16 +143,16 @@
+ if (*(menu_entries - 1))
+ menu_entries++;
+
+- for (; j < 71; j++)
+- grub_putchar (' ');
++ for (; j < (view_x1 - view_x0) - 9; j++)
++ putchar (' ');
+ }
+
+- gotoxy (77, y + size);
++ gotoxy (view_x0 + 3, y + size);
+
+ if (*menu_entries)
+- grub_putchar (disp_down);
++ putchar (disp_down);
+ else
+- grub_putchar (' ');
++ putchar (' ');
+ }
+
+
+@@ -211,10 +216,10 @@
+ )
+ # endif
+ {
+- for (i = 0; i < 14; i++)
++ for (i = 0; i < 12; i++)
+ {
+ int j;
+- for (j = 0; j < 75; j++)
++ for (j = view_x0; j < (view_x1 - view_x0) - 5; j++)
+ {
+ gotoxy (j + 1, i + y);
+ set_attrib (normal_color);
+@@ -223,33 +228,33 @@
+ }
+ #endif
+
+- gotoxy (1, y);
++ gotoxy (view_x0 + 1, y);
+
+- grub_putchar (disp_ul);
+- for (i = 0; i < 73; i++)
+- grub_putchar (disp_horiz);
+- grub_putchar (disp_ur);
++ putchar (disp_ul);
++ for (i = view_x0; i < view_x1 - 7; i++)
++ putchar (disp_horiz);
++ putchar (disp_ur);
+
+ i = 1;
+
+ while (1)
+ {
+- gotoxy (1, y + i);
++ gotoxy (view_x0 + 1, y + i);
+
+ if (i > size)
+ break;
+
+- grub_putchar (disp_vert);
+- gotoxy (75, y + i);
+- grub_putchar (disp_vert);
++ putchar (disp_vert);
++ gotoxy (view_x1 - 5, y + i);
++ putchar (disp_vert);
+
+ i++;
+ }
+
+- grub_putchar (disp_ll);
+- for (i = 0; i < 73; i++)
+- grub_putchar (disp_horiz);
+- grub_putchar (disp_lr);
++ putchar (disp_ll);
++ for (i = view_x0; i < view_x1 - 7; i++)
++ putchar (disp_horiz);
++ putchar (disp_lr);
+ }
+
+ static void
+@@ -261,27 +266,27 @@
+ if (terminal & TERMINAL_SERIAL)
+ {
+ menu_entries = get_entry (menu_entries, entryno, 0);
+- gotoxy (2, y);
+- grub_putchar (' ');
+- for (x = 3; x < 75; x++)
++ gotoxy (view_x0 + 2, y);
++ putchar (' ');
++ for (x = view_x0 + 3; x < view_x1 - 5; x++)
+ {
+- if (*menu_entries && x < 71)
+- grub_putchar (*menu_entries++);
++ if (*menu_entries && x < view_x1 - 9)
++ putchar (*menu_entries++);
+ else
+- grub_putchar (' ');
++ putchar (' ');
+ }
+ }
+ else
+ #endif /* SUPPORT_SERIAL */
+ {
+- for (x = 2; x < 75; x++)
++ for (x = view_x0 + 2; x < view_x1 - 5; x++)
+ {
+ gotoxy (x, y);
+ set_attrib (attr);
+ }
+ }
+
+- gotoxy (74, y);
++ gotoxy (view_x1 - 6, y);
+ }
+
+ /* Set the attribute of the line Y to normal state. */
+@@ -334,7 +339,8 @@
+ invariant for TERMINAL_DUMB: first_entry == 0 */
+ if (! (terminal & TERMINAL_DUMB))
+ {
+- while (entryno > 11)
++ errnum = ERR_NONE;
++ while (entryno > 9)
+ {
+ first_entry++;
+ entryno--;
+@@ -399,7 +405,7 @@
+ #endif /* ! GRUB_UTIL */
+
+ if (! (terminal & TERMINAL_DUMB))
+- print_border (3, 12);
++ print_border (3 + view_y0, 12);
+
+ #ifdef GRUB_UTIL
+ /* In the grub shell, always use ACS_*. */
+@@ -455,10 +461,10 @@
+ grub_printf ("\n\nThe selected entry is %d ", entryno);
+ else
+ {
+- print_entries (3, 12, first_entry, menu_entries);
++ print_entries (view_y0 + 3, 12, first_entry, menu_entries);
+
+ /* highlight initial line */
+- set_line_highlight (4 + entryno, first_entry + entryno,
++ set_line_highlight (view_y0 + 4 + entryno, first_entry + entryno,
+ menu_entries);
+ }
+ }
+@@ -487,9 +493,9 @@
+ entryno, grub_timeout);
+ else
+ {
+- gotoxy (3, 22);
++ gotoxy (view_x0 + 3, view_y1 - 3);
+ printf ("The highlighted entry will be booted automatically in %d seconds. ", grub_timeout);
+- gotoxy (74, 4 + entryno);
++ gotoxy (view_x0 - 6, view_y0 + 4 + entryno);
+ }
+
+ grub_timeout--;
+@@ -515,12 +521,12 @@
+ if (terminal & TERMINAL_DUMB)
+ grub_putchar ('\r');
+ else
+- gotoxy (3, 22);
++ gotoxy (view_x0 + 3, 22);
+ printf (" ");
+ grub_timeout = -1;
+ fallback_entry = -1;
+ if (! (terminal & TERMINAL_DUMB))
+- gotoxy (74, 4 + entryno);
++ gotoxy (view_x1 - 6, view_x0 + 4 + entryno);
+ }
+
+ /* We told them above (at least in SUPPORT_SERIAL) to use
+@@ -536,17 +542,17 @@
+ {
+ if (entryno > 0)
+ {
+- set_line_normal (4 + entryno, first_entry + entryno,
++ set_line_normal (view_y0 + 4 + entryno, first_entry + entryno,
+ menu_entries);
+ entryno--;
+- set_line_highlight (4 + entryno, first_entry + entryno,
++ set_line_highlight (view_y0 + 4 + entryno, first_entry + entryno,
+ menu_entries);
+ }
+ else if (first_entry > 0)
+ {
+ first_entry--;
+- print_entries (3, 12, first_entry, menu_entries);
+- set_line_highlight (4, first_entry + entryno,
++ print_entries (view_y0 + 3, 12, first_entry, menu_entries);
++ set_line_highlight (view_y0 + 4, first_entry + entryno,
+ menu_entries);
+ }
+ }
+@@ -558,17 +564,17 @@
+ else
+ if (entryno < 11)
+ {
+- set_line_normal (4 + entryno, first_entry + entryno,
++ set_line_normal (view_y0 + 4 + entryno, first_entry + entryno,
+ menu_entries);
+ entryno++;
+- set_line_highlight (4 + entryno, first_entry + entryno,
++ set_line_highlight (view_y0 + 4 + entryno, first_entry + entryno,
+ menu_entries);
+ }
+ else if (num_entries > 12 + first_entry)
+ {
+ first_entry++;
+- print_entries (3, 12, first_entry, menu_entries);
+- set_line_highlight (15, first_entry + entryno, menu_entries);
++ print_entries (view_y0 + 3, 12, first_entry, menu_entries);
++ set_line_highlight (view_y0 + 15, first_entry + entryno, menu_entries);
+ }
+ }
+
+@@ -582,7 +588,7 @@
+ if ((c == 'd') || (c == 'o') || (c == 'O'))
+ {
+ if (! (terminal & TERMINAL_DUMB))
+- set_line_normal (4 + entryno, first_entry + entryno,
++ set_line_normal (view_y0 + 4 + entryno, first_entry + entryno,
+ menu_entries);
+
+ /* insert after is almost exactly like insert before */
+@@ -640,8 +646,8 @@
+ }
+ else
+ {
+- print_entries (3, 12, first_entry, menu_entries);
+- set_line_highlight (4 + entryno, first_entry + entryno,
++ print_entries (view_y0 + 3, 12, first_entry, menu_entries);
++ set_line_highlight (view_y0 + 4 + entryno, first_entry + entryno,
+ menu_entries);
+ }
+ }
+@@ -664,7 +670,7 @@
+ if (terminal & TERMINAL_DUMB)
+ grub_printf ("\r ");
+ else
+- gotoxy (1, 21);
++ gotoxy (view_x0 + 1, view_y1 + 21);
+
+ /* Wipe out the previously entered password */
+ memset (entered, 0, sizeof (entered));
+@@ -809,6 +815,11 @@
+ auto_fill = 1;
+
+ cls ();
++#ifdef VGA16
++ if (display->End)
++ (*display->End)();
++ display = &display_entries[0];
++#endif
+
+ while (1)
+ {
+@@ -840,6 +851,16 @@
+ break;
+ }
+
++#ifdef VGA16
++ if (display_idx >= 0)
++ display = &display_entries[display_idx];
++ else if (!vga_disabled)
++ display = &display_entries[1];
++
++ if (!display->Begin || !(*display->Begin)())
++ display = &display_entries[0];
++#endif
++
+ show_menu = 1;
+ goto restart;
+ }
+@@ -904,6 +925,560 @@
+ return pos;
+ }
+
++#ifdef VGA16
++struct display_entry display_entries[MAX_DISPLAYS + 1] = {
++ {"text", 0, 0, grub_cls, grub_gotoxy, grub_putchar, grub_set_attrib,
++ grub_getxy, grub_nocursor},
++ {"vga16",
++ vga16_begin, vga16_end, vga16_cls, vga16_gotoxy, vga16_putchar,
++ vga16_set_attrib, vga16_getxy, vga16_nocursor},
++ {0, 0, 0, 0, 0, 0, 0, 0, 0}
++};
++struct display_entry *display;
++int display_idx = -1;
++
++/* default vga palette */
++char vga16pal[16][3] = {
++ { 0, 0, 0},
++ { 0, 0, 42},
++ { 0, 42, 0},
++ { 0, 42, 42},
++ {42, 0, 0},
++ {42, 0, 42},
++ {42, 21, 0},
++ {42, 42, 42},
++ {21, 21, 21},
++ {21, 21, 63},
++ {21, 63, 21},
++ {21, 63, 63},
++ {63, 21, 21},
++ {63, 21, 63},
++ {63, 63, 21},
++ {63, 63, 63},
++};
++
++int fontx, fonty;
++unsigned char *font8x16;
++int saved_videomode, no_scroll = 0, no_cursor = 0, shade = 1, vga_inited = 0;
++unsigned short text[80 * 30];
++int foreground = (63 << 16) | (63 << 8) | (63), background = 0, border = 0;
++int splash_set;
++char splashimage[64];
++#define VSHADOW VSHADOW1
++unsigned char VSHADOW1[38400];
++unsigned char VSHADOW2[38400];
++unsigned char VSHADOW4[38400];
++unsigned char VSHADOW8[38400];
++
++static inline void
++outb(unsigned short port, unsigned char val)
++{
++ __asm __volatile ("outb %0,%1"::"a" (val), "d" (port));
++}
++
++static void
++ModeReg(int value)
++{
++ outb(0x3ce, 5);
++ outb(0x3cf, value);
++}
++
++static void
++MapMask(int value)
++{
++ outb(0x3c4, 2);
++ outb(0x3c5, value);
++}
++
++/* set/reset register */
++static void
++SetRes(int value)
++{
++ outb(0x3ce, 0);
++ outb(0x3cf, value);
++}
++
++/* enable set/reset register */
++static void
++ESetRes(int value)
++{
++ outb(0x3ce, 1);
++ outb(0x3cf, value);
++}
++
++static void
++ReadMap(int value)
++{
++ outb(0x3ce, 4);
++ outb(0x3cf, value);
++}
++
++/* bit mask register */
++static void
++BitMask(int value)
++{
++ outb(0x3ce, 8);
++ outb(0x3cf, value);
++}
++
++void
++grub_memcpy(void *dest, const void *src, int len)
++{
++ int i;
++ register char *d = (char*)dest, *s = (char*)src;
++
++ for (i = 0; i < len; i++)
++ d[i] = s[i];
++}
++
++int
++hex(int v)
++{
++ if (v >= 'A' && v <= 'F')
++ return (v - 'A' + 10);
++ if (v >= 'a' && v <= 'f')
++ return (v - 'a' + 10);
++ return (v - '0');
++}
++
++static void
++SetXY(int col, int row)
++{
++ if (col >= view_x0 && col < view_x1) {
++ fontx = col;
++ cursorX = col << 3;
++ }
++ if (row >= view_y0 && row < view_y1) {
++ fonty = row;
++ cursorY = row << 4;
++ }
++}
++
++void
++cursor(int set)
++{
++ unsigned char *pat, *mem, *ptr, chr[16 << 2];
++ int i, ch, invert, offset;
++
++ if (set && (no_cursor || no_scroll))
++ return;
++
++ offset = cursorY * 80 + fontx;
++ ch = text[fonty * 80 + fontx] & 0xff;
++ invert = (text[fonty * 80 + fontx] & 0xff00) != 0;
++ pat = font8x16 + (ch << 4);
++
++ mem = (unsigned char*)VIDEO + offset;
++
++ if (!set) {
++ for (i = 0; i < 16; i++) {
++ unsigned char mask = pat[i];
++
++ if (!invert) {
++ chr[i ] = ((unsigned char*)VSHADOW1)[offset];
++ chr[16 + i] = ((unsigned char*)VSHADOW2)[offset];
++ chr[32 + i] = ((unsigned char*)VSHADOW4)[offset];
++ chr[48 + i] = ((unsigned char*)VSHADOW8)[offset];
++
++ if (shade) {
++ if (ch == DISP_VERT || ch == DISP_LL ||
++ ch == DISP_UR || ch == DISP_LR) {
++ unsigned char pmask = ~(pat[i] >> 1);
++
++ chr[i ] &= pmask;
++ chr[16 + i] &= pmask;
++ chr[32 + i] &= pmask;
++ chr[48 + i] &= pmask;
++ }
++ if (i > 0 && ch != DISP_VERT) {
++ unsigned char pmask = ~(pat[i - 1] >> 1);
++
++ chr[i ] &= pmask;
++ chr[16 + i] &= pmask;
++ chr[32 + i] &= pmask;
++ chr[48 + i] &= pmask;
++ if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) {
++ pmask = ~pat[i - 1];
++
++ chr[i ] &= pmask;
++ chr[16 + i] &= pmask;
++ chr[32 + i] &= pmask;
++ chr[48 + i] &= pmask;
++ }
++ }
++ }
++ chr[i ] |= mask;
++ chr[16 + i] |= mask;
++ chr[32 + i] |= mask;
++ chr[48 + i] |= mask;
++
++ offset += 80;
++ }
++ else {
++ chr[i ] = mask;
++ chr[16 + i] = mask;
++ chr[32 + i] = mask;
++ chr[48 + i] = mask;
++ }
++ }
++ }
++ else {
++ MapMask(15);
++ ptr = mem;
++ for (i = 0; i < 16; i++, ptr += 80) {
++ cursorBuf[i] = pat[i];
++ *ptr = ~pat[i];
++ }
++ return;
++ }
++
++ offset = 0;
++ for (i = 1; i < 16; i <<= 1, offset += 16) {
++ int j;
++
++ MapMask(i);
++ ptr = mem;
++ for (j = 0; j < 16; j++, ptr += 80)
++ *ptr = chr[j + offset];
++ }
++
++ MapMask(15);
++}
++
++int
++read_image(void)
++{
++ char buf[32], pal[16];
++ unsigned char c, base, mask, *s1, *s2, *s4, *s8;
++ unsigned i, len, idx, colors, x, y, width, height;
++
++ if (!grub_open(splashimage))
++ return (0);
++
++ /* read header */
++ if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) {
++ grub_close();
++ return (0);
++ }
++
++ /* parse info */
++ while (grub_read(&c, 1)) {
++ if (c == '"')
++ break;
++ }
++
++ while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
++ ;
++
++ i = 0;
++ width = c - '0';
++ while (grub_read(&c, 1)) {
++ if (c >= '0' && c <= '9')
++ width = width * 10 + c - '0';
++ else
++ break;
++ }
++ while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
++ ;
++
++ height = c - '0';
++ while (grub_read(&c, 1)) {
++ if (c >= '0' && c <= '9')
++ height = height * 10 + c - '0';
++ else
++ break;
++ }
++ while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
++ ;
++
++ colors = c - '0';
++ while (grub_read(&c, 1)) {
++ if (c >= '0' && c <= '9')
++ colors = colors * 10 + c - '0';
++ else
++ break;
++ }
++
++ base = 0;
++ while (grub_read(&c, 1) && c != '"')
++ ;
++
++ /* palette */
++ for (i = 0, idx = 1; i < colors; i++) {
++ len = 0;
++
++ while (grub_read(&c, 1) && c != '"')
++ ;
++ grub_read(&c, 1); /* char */
++ base = c;
++ grub_read(buf, 4); /* \t c # */
++
++ while (grub_read(&c, 1) && c != '"') {
++ if (len < sizeof(buf))
++ buf[len++] = c;
++ }
++
++ if (len == 6 && idx < 15) {
++ int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2;
++ int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2;
++ int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2;
++
++ pal[idx] = base;
++ set_palette(idx, r, g, b);
++ ++idx;
++ }
++ }
++
++ x = y = len = 0;
++
++ s1 = (unsigned char*)VSHADOW1;
++ s2 = (unsigned char*)VSHADOW2;
++ s4 = (unsigned char*)VSHADOW4;
++ s8 = (unsigned char*)VSHADOW8;
++
++ for (i = 0; i < 38400; i++)
++ s1[i] = s2[i] = s4[i] = s8[i] = 0;
++
++ /* parse xpm data */
++ while (y < height) {
++ while (1) {
++ if (!grub_read(&c, 1)) {
++ grub_close();
++ return (0);
++ }
++ if (c == '"')
++ break;
++ }
++
++ while (grub_read(&c, 1) && c != '"') {
++ for (i = 1; i < 15; i++)
++ if (pal[i] == c) {
++ c = i;
++ break;
++ }
++
++ mask = 0x80 >> (x & 7);
++ if (c & 1)
++ s1[len + (x >> 3)] |= mask;
++ if (c & 2)
++ s2[len + (x >> 3)] |= mask;
++ if (c & 4)
++ s4[len + (x >> 3)] |= mask;
++ if (c & 8)
++ s8[len + (x >> 3)] |= mask;
++
++ if (++x >= 640) {
++ x = 0;
++
++ if (y < 480)
++ len += 80;
++ ++y;
++ }
++ }
++ }
++
++ grub_close();
++
++ set_palette(0, (background >> 16), (background >> 8) & 63, background & 63);
++ set_palette(15, (foreground >> 16), (foreground >> 8) & 63, foreground & 63);
++
++ set_palette(0x11, (border >> 16), (border >> 8) & 63, border & 63);
++
++ return (1);
++}
++
++int
++vga16_begin(void)
++{
++ if (vga_inited)
++ return (1);
++
++ if (!*splashimage)
++ grub_strcpy(splashimage, "/boot/grub/splash.xpm");
++
++ saved_videomode = set_videomode(0x12);
++ if (!read_image()) {
++ set_videomode(saved_videomode);
++ return (0);
++ }
++
++ font8x16 = (unsigned char*)get_font();
++
++ cursorWidth = 8;
++ cursorHeight = 16;
++
++ set_int1c_handler();
++
++ view_x0 = sx0;
++ view_y0 = sy0;
++ view_x1 = sx1;
++ view_y1 = sy1;
++
++ return (vga_inited = 1);
++}
++
++void
++vga16_end(void)
++{
++ if (vga_inited) {
++ unset_int1c_handler();
++ set_videomode(saved_videomode);
++ vga_inited = 0;
++ no_cursor = 0;
++ }
++
++ sx0 = view_x0;
++ sy0 = view_y0;
++ sx1 = view_x1;
++ sy1 = view_y1;
++ view_x0 = 0;
++ view_x1 = 80;
++ view_y0 = 0;
++ view_y1 = 25;
++}
++
++void
++vga16_cls(void)
++{
++ int i;
++ unsigned char *mem, *s1, *s2, *s4, *s8;
++
++ SetXY(view_x0, view_y0);
++
++ mem = (unsigned char*)VIDEO;
++ s1 = (unsigned char*)VSHADOW1;
++ s2 = (unsigned char*)VSHADOW2;
++ s4 = (unsigned char*)VSHADOW4;
++ s8 = (unsigned char*)VSHADOW8;
++
++ for (i = 0; i < 80 * 30; i++)
++ text[i] = ' ';
++
++ BitMask(0xff);
++
++ /* plano 1 */
++ MapMask(1);
++ grub_memcpy(mem, s1, 38400);
++
++ /* plano 2 */
++ MapMask(2);
++ grub_memcpy(mem, s2, 38400);
++
++ /* plano 3 */
++ MapMask(4);
++ grub_memcpy(mem, s4, 38400);
++
++ /* plano 4 */
++ MapMask(8);
++ grub_memcpy(mem, s8, 38400);
++
++ MapMask(15);
++
++ if (no_cursor) {
++ no_cursor = 0;
++ set_int1c_handler();
++ }
++}
++
++void
++vga16_gotoxy(int x, int y)
++{
++ cursor(0);
++
++ SetXY(x, y);
++
++ cursor(1);
++}
++
++static void
++scroll(void)
++{
++ int i, j;
++
++ if (no_scroll)
++ return;
++
++ no_scroll = 1;
++
++ for (j = view_y0 + 1; j < view_y1; j++) {
++ gotoxy(view_x0, j - 1);
++ for (i = view_x0; i < view_x1; i++)
++ putchar(text[j * 80 + i]);
++ }
++
++ gotoxy(view_x0, view_y1 - 1);
++ for (i = view_x0; i < view_x1; i++)
++ putchar(' ');
++
++ SetXY(view_x0, view_y1 - 1);
++
++ no_scroll = 0;
++}
++
++void
++vga16_putchar(int ch)
++{
++ ch &= 0xff;
++
++ cursor(0);
++
++ if (ch == '\n') {
++ SetXY(view_x0, fonty);
++ if (fonty + 1 < view_y1)
++ SetXY(view_x0, fonty + 1);
++ else
++ scroll();
++ cursor(1);
++ return;
++ }
++ else if (ch == '\r') {
++ SetXY(view_x0, fonty);
++ cursor(1);
++ return;
++ }
++
++ text[fonty * 80 + fontx] = ch;
++
++ cursor(0);
++
++ if ((fontx + 1) >= view_x1) {
++ SetXY(view_x0, fonty);
++ if (fonty + 1 < view_y1)
++ SetXY(view_x0, fonty + 1);
++ else
++ scroll();
++ }
++ else
++ SetXY(fontx + 1, fonty);
++
++ cursor(1);
++}
++
++int
++vga16_getxy()
++{
++ return ((fontx << 8) | fonty);
++}
++
++void
++vga16_nocursor()
++{
++ if (!no_cursor) {
++ no_cursor = 1;
++ unset_int1c_handler();
++ cursor(0);
++ }
++}
++
++void
++vga16_set_attrib(int attrib)
++{
++ text[fonty * 80 + fontx] &= 0x00ff;
++ if (attrib & 0xf0)
++ text[fonty * 80 + fontx] |= 0x100;
++ cursor(0);
++}
++#endif
+
+ /* This is the starting function in C. */
+ void
+@@ -924,6 +1499,14 @@
+ menu_entries = (char *) MENU_BUF;
+ init_config ();
+ }
++
++#ifdef VGA16
++ /* Make sure it points to a valid entry */
++ display = &display_entries[0];
++
++ if (ASCII_CHAR(checkkey()) == 0x1b)
++ vga_disabled = 1;
++#endif
+
+ /* Initialize the environment for restarting Stage 2. */
+ grub_setjmp (restart_env);
+@@ -1069,6 +1652,29 @@
+ while (is_preset);
+ }
+
++#ifdef VGA16
++ if (display_idx >= 0)
++ display = &display_entries[display_idx];
++ else if (!vga_disabled) {
++ display = &display_entries[1];
++ }
++ if (!viewport_set)
++ view_y1 = 30;
++ sx0 = view_x0;
++ sy0 = view_y0;
++ sx1 = view_x1;
++ sy1 = view_y1;
++
++ if (!display->Begin || !(*display->Begin)())
++ display = &display_entries[0];
++
++ if (!vga_inited) {
++ sx0 = sy0 = view_x0 = view_y0 = 0;
++ sx1 = view_x1 = 80;
++ sy1 = view_y1 = 25;
++ }
++#endif
++
+ if (! num_entries)
+ {
+ /* If no acceptable config file, goto command-line, starting
diff --git a/sys-boot/grub/files/grub-0.93-gcc3.3.diff b/sys-boot/grub/files/grub-0.93-gcc3.3.diff
new file mode 100644
index 000000000000..a32eb8093d46
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.93-gcc3.3.diff
@@ -0,0 +1,17 @@
+Submitter: Jim Gifford (patches at jg555 dot com)
+Origin: Grub CVS
+Date: 08-16-2003
+Description: Fixes GCC 3.3 Compile Errors
+
+diff -Naur grub-0.93.orig/stage2/fsys_reiserfs.c grub-0.93/stage2/fsys_reiserfs.c
+--- grub-0.93.orig/stage2/fsys_reiserfs.c 2002-11-29 17:46:01.000000000 +0000
++++ grub-0.93/stage2/fsys_reiserfs.c 2003-08-16 21:15:34.000000000 +0000
+@@ -112,7 +112,7 @@
+ /* offset in the log of where to start replay after a crash */
+ __u32 j_first_unflushed_offset;
+ /* mount id to detect very old transactions */
+- __u32 long j_mount_id;
++ __u32 j_mount_id;
+ };
+
+ /* magic string to find desc blocks in the journal */
diff --git a/sys-boot/grub/files/splash.xpm.gz b/sys-boot/grub/files/splash.xpm.gz
new file mode 100644
index 000000000000..8abf87065af2
--- /dev/null
+++ b/sys-boot/grub/files/splash.xpm.gz
Binary files differ
diff --git a/sys-boot/grub/grub-0.92-r1.ebuild b/sys-boot/grub/grub-0.92-r1.ebuild
new file mode 100644
index 000000000000..0f536d7a8cc8
--- /dev/null
+++ b/sys-boot/grub/grub-0.92-r1.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-0.92-r1.ebuild,v 1.1 2003/12/09 08:12:07 seemant Exp $
+
+inherit mount-boot eutils flag-o-matic
+
+filter-flags "-fstack-protector"
+
+S=${WORKDIR}/${P}
+DESCRIPTION="GNU GRUB boot loader"
+SRC_URI="ftp://alpha.gnu.org/gnu/grub/${P}.tar.gz"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="x86 -amd64 -ppc -sparc -alpha -mips"
+
+DEPEND=">=sys-libs/ncurses-5.2-r5"
+
+PROVIDE="virtual/bootloader"
+
+src_unpack() {
+ unpack ${A} || die
+ cd ${S} || die
+ epatch ${FILESDIR}/${P}/grub-0.92-vga16.patch
+ epatch ${FILESDIR}/${P}/grub-0.5.96.1-special-raid-devices.patch
+ epatch ${FILESDIR}/${P}/grub-0.90-configfile.patch
+ epatch ${FILESDIR}/${P}/grub-0.90-vga16-keypressclear.patch
+ epatch ${FILESDIR}/${P}/grub-0.90-passwordprompt.patch
+ epatch ${FILESDIR}/${P}/grub-0.90-install.in.patch
+ epatch ${FILESDIR}/${P}/grub-0.90-installcopyonly.patch
+ epatch ${FILESDIR}/${P}/grub-0.90-staticcurses.patch
+ epatch ${FILESDIR}/${P}/grub-0.90-symlinkmenulst.patch
+ epatch ${FILESDIR}/${P}/grub-0.90-append.patch
+ epatch ${FILESDIR}/${P}/grub-0.90-addsyncs.patch
+ epatch ${FILESDIR}/${P}/grub-0.91-splashimagehelp.patch
+ epatch ${FILESDIR}/${P}/grub-0.91-bootonce.patch
+ epatch ${FILESDIR}/${P}/grub-0.92-automake16.patch
+ epatch ${FILESDIR}/${P}/grub-0.92-nodeprecatedflags.patch
+ epatch ${FILESDIR}/${P}/grub-0.91-vga16-serial.patch
+ epatch ${FILESDIR}/${P}/grub-0.92-usbfix.patch
+}
+
+src_compile() {
+ #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.
+ unset CFLAGS
+ ./configure --prefix=/usr \
+ --sbindir=/sbin \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --disable-auto-linux-mem-opt \
+ || die "Configuration of package failed."
+
+ #the vga16.patch changes configure.in but not configure so
+ #--enable-vga16 doesnt work. config.h gets overwritten by make.
+ echo "#define VGA16 1" >> config.h.in
+
+ emake || die "Building failed!"
+}
+
+src_install() {
+ make prefix=${D}/usr \
+ sbindir=${D}/sbin \
+ mandir=${D}/usr/share/man \
+ infodir=${D}/usr/share/info \
+ install || die "Installation failed."
+
+ dodir /boot/grub
+ cp ${FILESDIR}/splash.xpm.gz ${D}/boot/grub
+ dodoc AUTHORS BUGS COPYING ChangeLog NEWS README THANKS TODO
+}
+
+pkg_postinst() {
+ [ "$ROOT" != "/" ] && return 0
+ if [ ! -e /boot/grub/stage1 ]
+ then
+ #if the boot loader files aren't in place, copy them over.
+ cd /usr/share/grub/i386-pc
+ cp stage1 stage2 *stage1_5 /boot/grub
+ else
+ einfo '*** A new GRUB has been installed. If you need to reinstall'
+ einfo '*** GRUB to a boot record on your drive, please remember to'
+ einfo '*** "cp /usr/share/grub/i386-pc/*stage* /boot/grub" first.'
+ einfo "*** If you're using XFS, unmount and remount /boot as well."
+ fi
+
+ # change menu.lst to grub.conf
+ if [ ! -e /boot/grub/grub.conf -a -e /boot/grub/menu.lst ]
+ then
+ mv /boot/grub/menu.lst /boot/grub/grub.conf
+ ln -s grub.conf /boot/grub/menu.lst
+ einfo "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
+ fi
+}
diff --git a/sys-boot/grub/grub-0.93.20030118.ebuild b/sys-boot/grub/grub-0.93.20030118.ebuild
new file mode 100644
index 000000000000..282efbff5ac0
--- /dev/null
+++ b/sys-boot/grub/grub-0.93.20030118.ebuild
@@ -0,0 +1,88 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-0.93.20030118.ebuild,v 1.1 2003/12/09 08:12:07 seemant Exp $
+
+inherit mount-boot eutils flag-o-matic
+
+filter-flags "-fstack-protector"
+
+NEWP=${PN}-${PV%.*}
+S=${WORKDIR}/${NEWP}
+
+SRC_URI="ftp://alpha.gnu.org/gnu/grub/${NEWP}.tar.gz
+ mirror://gentoo/${P}-gentoo.diff.bz2"
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+KEYWORDS="x86 -amd64 -ppc -sparc -alpha -mips"
+SLOT="0"
+LICENSE="GPL-2"
+DEPEND=">=sys-libs/ncurses-5.2-r5"
+PROVIDE="virtual/bootloader"
+IUSE="static"
+
+src_unpack() {
+ unpack ${A} || die
+ cd ${S} || die
+ # grub-0.93.20030118-gentoo.diff; <woodchip@gentoo.org> (18 Jan 2003)
+ # -fixes from grub CVS pulled on 20030118
+ # -vga16 patches; mined from Debian's grub-0.93+cvs20030102-1.diff
+ # -special-raid-devices.patch
+ # -addsyncs.patch
+ # -splashimagehelp.patch
+ # -configfile.patch
+ # -installcopyonly.patch
+ epatch ${DISTDIR}/${P}-gentoo.diff.bz2
+
+ # grub-0.93-gcc3.3.diff <johnm@gentoo.org> (14 Sep 2003)
+ # -fixes compile error with >=gcc-3.3
+ epatch ${FILESDIR}/grub-0.93-gcc3.3.diff
+
+ WANT_AUTOCONF_2_5=1 autoconf || die
+}
+
+src_compile() {
+ ### 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.
+ unset CFLAGS
+
+ use static && export LDFLAGS="${LDFLAGS} -static"
+
+ # http://www.gentoo.org/proj/en/hardened/etdyn-ssp.xml
+ if has_version 'sys-devel/hardened-gcc' && [ "${CC}"="gcc" ]
+ then
+ # the configure script has problems with -nostdlib
+ CC="${CC} -yet_exec -yno_propolice"
+ fi
+
+ econf --exec-prefix=/ \
+ --disable-auto-linux-mem-opt || die
+ emake || die
+}
+
+src_install() {
+ einstall exec_prefix=${D}/ || die
+
+ insinto /boot/grub
+ doins ${FILESDIR}/splash.xpm.gz
+ newins docs/menu.lst grub.conf.sample
+
+ dodoc AUTHORS BUGS COPYING ChangeLog NEWS README THANKS TODO
+ newdoc docs/menu.lst grub.conf.sample
+}
+
+pkg_postinst() {
+ [ "$ROOT" != "/" ] && return 0
+ /sbin/grub-install --just-copy
+
+ # change menu.lst to grub.conf
+ if [ ! -e /boot/grub/grub.conf -a -e /boot/grub/menu.lst ]
+ then
+ mv /boot/grub/menu.lst /boot/grub/grub.conf
+ ln -s grub.conf /boot/grub/menu.lst
+ ewarn
+ ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
+ ewarn
+ fi
+}
diff --git a/sys-boot/grub/metadata.xml b/sys-boot/grub/metadata.xml
new file mode 100644
index 000000000000..ef0805e71ae1
--- /dev/null
+++ b/sys-boot/grub/metadata.xml
@@ -0,0 +1,6 @@
+
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>