|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] stubdom: remove support for grub-pv
commit 0724c68d85b3e7db5345bcbe151577a498968aa1
Author: Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Mon Jul 20 10:18:28 2026 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Aug 13 15:11:20 2026 +0200
stubdom: remove support for grub-pv
The Mini-OS based grub-pv is not being built by default since Xen 4.16.
Additionally it can be replaced in most cases by the more modern pvgrub
(part of grub upstream), while grub-pv is based on legacy grub 0.97.
In case someone is really depending on grub-pv, an old build from a
previous Xen version can be used without any problem, as only stable
hypercall interfaces are used by it.
Remove grub-pv from the build system.
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Makefile | 6 -
config/Stubdom.mk.in | 3 -
stubdom/.gitignore | 1 -
stubdom/Makefile | 54 -
stubdom/configure | 65 -
stubdom/configure.ac | 2 -
stubdom/grub.patches/00cvs | 1022 -------
stubdom/grub.patches/10graphics.diff | 2297 ----------------
stubdom/grub.patches/11graphics-keyboard.diff | 13 -
stubdom/grub.patches/20print_func.diff | 52 -
stubdom/grub.patches/30savedefault.diff | 186 --
stubdom/grub.patches/40ext3_256byte_inode.diff | 114 -
stubdom/grub.patches/50fs_fulldisk.diff | 72 -
stubdom/grub.patches/60ext4.diff | 474 ----
stubdom/grub.patches/61btrfs.diff | 3499 ------------------------
stubdom/grub.patches/70compiler_warnings.diff | 45 -
stubdom/grub.patches/99minios | 1570 -----------
stubdom/grub/Makefile | 88 -
stubdom/grub/boot-x86_32.S | 112 -
stubdom/grub/boot-x86_64.S | 108 -
stubdom/grub/config.h | 12 -
stubdom/grub/kexec.c | 434 ---
stubdom/grub/mini-os.c | 771 ------
stubdom/grub/mini-os.h | 7 -
stubdom/grub/minios.cfg | 4 -
stubdom/grub/osdep.h | 30 -
26 files changed, 11041 deletions(-)
diff --git a/Makefile b/Makefile
index 67b71ac3d4..ea432e21b0 100644
--- a/Makefile
+++ b/Makefile
@@ -71,9 +71,6 @@ build-tools-oxenstored: build-tools-public-headers
.PHONY: build-stubdom
build-stubdom: mini-os-dir build-tools-public-headers
$(MAKE) -C stubdom build
-ifeq (x86_64,$(XEN_TARGET_ARCH))
- XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub-if-enabled
-endif
define do-subtree
$(1)/%: FORCE
@@ -149,9 +146,6 @@ install-tools: install-tools-public-headers
.PHONY: install-stubdom
install-stubdom: mini-os-dir install-tools-public-headers
$(MAKE) -C stubdom install
-ifeq (x86_64,$(XEN_TARGET_ARCH))
- XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub-if-enabled
-endif
.PHONY: tools/firmware/seabios-dir-force-update
tools/firmware/seabios-dir-force-update:
diff --git a/config/Stubdom.mk.in b/config/Stubdom.mk.in
index b399d77740..0d70d03941 100644
--- a/config/Stubdom.mk.in
+++ b/config/Stubdom.mk.in
@@ -23,9 +23,6 @@ NEWLIB_URL := @NEWLIB_URL@
LWIP_VERSION := @LWIP_VERSION@
LWIP_URL := @LWIP_URL@
-GRUB_VERSION := @GRUB_VERSION@
-GRUB_URL := @GRUB_URL@
-
GMP_VERSION := @GMP_VERSION@
GMP_URL := @GMP_URL@
diff --git a/stubdom/.gitignore b/stubdom/.gitignore
index 1b69656d45..08f2e9b432 100644
--- a/stubdom/.gitignore
+++ b/stubdom/.gitignore
@@ -9,7 +9,6 @@
/cross-root-*
/gcc-*
/gmp-*
-/grub-*
/include
/libs-*
/libxencall-*
diff --git a/stubdom/Makefile b/stubdom/Makefile
index acd5e56f16..850e8544ca 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -361,32 +361,6 @@ vtpmmgr-minios-config.mk: $(CURDIR)/vtpmmgr/minios.cfg
vtpmmgr: cross-polarssl vtpmmgr-minios-config.mk
XEN_TARGET_ARCH="$(XEN_TARGET_ARCH)" CPPFLAGS="$(TARGET_CPPFLAGS)
$(shell cat vtpmmgr-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -C $@
-######
-# Grub
-######
-
-grub-$(GRUB_VERSION).tar.gz:
- $(FETCHER) $@ $(GRUB_URL)/$@
-
-grub-upstream: grub-$(GRUB_VERSION).tar.gz
- tar xzf $<
- mv grub-$(GRUB_VERSION) $@
- for i in grub.patches/* ; do \
- patch -d $@ -p1 < $$i || exit 1; \
- done
-
-grub/minios.gen.cfg: APP_LIBS = guest ctrl toollog
-grub/minios.gen.cfg: grub/minios.cfg Makefile
- $(GEN_config) >$@
-
-grub-$(XEN_TARGET_ARCH)-minios-config.mk: grub/minios.gen.cfg
- MINIOS_CONFIG="$(CURDIR)/$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE)
DESTDIR= -C $(MINI_OS) config
-
-.PHONY: grub
-grub: cross-polarssl grub-upstream $(CROSS_ROOT)
grub-$(XEN_TARGET_ARCH)-minios-config.mk
- mkdir -p grub-$(XEN_TARGET_ARCH)
- CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat
grub-$(XEN_TARGET_ARCH)-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE)
DESTDIR= -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
-
##########
# xenstore
##########
@@ -429,17 +403,6 @@ vtpm-stubdom: mini-os-$(XEN_TARGET_ARCH)-vtpm vtpm
vtpmmgr-stubdom: mini-os-$(XEN_TARGET_ARCH)-vtpmmgr vtpmmgr
DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)"
DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/vtpmmgr/minios.cfg"
$(MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$<
APP_OBJS="$(CURDIR)/vtpmmgr/vtpmmgr.a" APP_LDLIBS="-lm -lpolarssl"
-.PHONY: pv-grub
-pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxenguest grub
- DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)"
DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.gen.cfg"
$(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$<
APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
-
-.PHONY: pv-grub-if-enabled
-ifneq ($(filter grub,$(STUBDOM_TARGETS)),)
-pv-grub-if-enabled: pv-grub
-else
-pv-grub-if-enabled:
-endif
-
XENSTORE_DEPS := libxenevtchn libxengnttab libxenmanage
.PHONY: xenstore-stubdom
@@ -460,16 +423,6 @@ else
install:
endif
-install-grub: pv-grub
- $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
- $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-grub/mini-os.gz
"$(DESTDIR)$(XENFIRMWAREDIR)/pv-grub-$(XEN_TARGET_ARCH).gz"
-
-ifneq ($(filter grub,$(STUBDOM_TARGETS)),)
-install-grub-if-enabled: install-grub
-else
-install-grub-if-enabled:
-endif
-
install-xenstore: xenstore-stubdom
$(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
$(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-xenstore/mini-os.gz
"$(DESTDIR)$(XENFIRMWAREDIR)/xenstore-stubdom.gz"
@@ -500,9 +453,6 @@ else
uninstall:
endif
-uninstall-grub:
- rm -f $(DESTDIR)$(XENFIRMWAREDIR)/pv-grub-$(XEN_TARGET_ARCH).gz
-
uninstall-xenstore:
rm -f $(DESTDIR)$(XENFIRMWAREDIR)/xenstore-stubdom.gz
@@ -523,14 +473,12 @@ uninstall-vtpmmgr:
.PHONY: clean
clean: $(foreach lib,$(STUB_LIBS),clean-libxen$(lib))
clean:
- rm -fr mini-os-$(XEN_TARGET_ARCH)-grub
rm -fr mini-os-$(XEN_TARGET_ARCH)-xenstore
rm -fr mini-os-$(XEN_TARGET_ARCH)-xenstorepvh
rm -fr mini-os-$(XEN_TARGET_ARCH)-vtpm
rm -fr mini-os-$(XEN_TARGET_ARCH)-vtpmmgr
$(MAKE) -C vtpm clean
$(MAKE) -C vtpmmgr clean
- rm -fr grub-$(XEN_TARGET_ARCH)
rm -f *-minios-config.mk
rm -f *.gen.cfg
rm -fr pkg-config
@@ -559,7 +507,6 @@ patchclean: crossclean
rm -fr polarssl-$(XEN_TARGET_ARCH)
rm -fr tpm_emulator-$(XEN_TARGET_ARCH)
rm -fr lwip-$(XEN_TARGET_ARCH)
- rm -fr grub-upstream
# clean downloads
.PHONY: downloadclean
@@ -569,7 +516,6 @@ downloadclean: patchclean
rm -f gmp-$(GMP_VERSION).tar.bz2
rm -f tpm_emulator-$(TPMEMU_VERSION).tar.gz
rm -f pciutils-$(LIBPCI_VERSION).tar.bz2
- rm -f grub-$(GRUB_VERSION).tar.gz
rm -f lwip-$(LWIP_VERSION).tar.gz
rm -f polarssl-$(POLARSSL_VERSION)-gpl.tgz
diff --git a/stubdom/configure b/stubdom/configure
index 8a0a798bd2..689ff4d6ed 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -630,8 +630,6 @@ POLARSSL_VERSION
POLARSSL_URL
GMP_VERSION
GMP_URL
-GRUB_VERSION
-GRUB_URL
LWIP_VERSION
LWIP_URL
NEWLIB_VERSION
@@ -660,7 +658,6 @@ extfiles
debug
xenstorepvh
xenstore
-grub
host_os
host_vendor
host_cpu
@@ -711,7 +708,6 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
-enable_pv_grub
enable_xenstore_stubdom
enable_xenstorepvh_stubdom
enable_vtpm_stubdom
@@ -732,7 +728,6 @@ ZLIB_URL
LIBPCI_URL
NEWLIB_URL
LWIP_URL
-GRUB_URL
GMP_URL
POLARSSL_URL
TPMEMU_URL'
@@ -1358,7 +1353,6 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-pv-grub Build and install pv-grub (default is DISABLED)
--disable-xenstore-stubdom
Build and install xenstore-stubdom (default is
ENABLED)
@@ -1385,7 +1379,6 @@ Some influential environment variables:
LIBPCI_URL Download url for libpci
NEWLIB_URL Download url for newlib
LWIP_URL Download url for lwip
- GRUB_URL Download url for grub
GMP_URL Download url for libgmp
POLARSSL_URL
Download url for polarssl
@@ -2403,47 +2396,6 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed
's/ /-/g'`;; esac
# Enable/disable stub domains
-# Check whether --enable-pv-grub was given.
-if test ${enable_pv_grub+y}
-then :
- enableval=$enable_pv_grub;
-
-if test "x$enableval" = "xyes"
-then :
-
-
-grub=y
-STUBDOM_TARGETS="$STUBDOM_TARGETS grub"
-STUBDOM_BUILD="$STUBDOM_BUILD pv-grub"
-STUBDOM_INSTALL="$STUBDOM_INSTALL install-grub"
-STUBDOM_UNINSTALL="$STUBDOM_UNINSTALL install-grub"
-
-
-else $as_nop
-
-if test "x$enableval" = "xno"
-then :
-
-
-grub=n
-
-
-fi
-
-fi
-
-
-else $as_nop
-
-
-grub=n
-
-
-fi
-
-
-
-
# Check whether --enable-xenstore-stubdom was given.
if test ${enable_xenstore_stubdom+y}
then :
@@ -4137,23 +4089,6 @@ LWIP_VERSION="1.3.0"
-if test "x$GRUB_URL" = "x"
-then :
-
- if test "x$extfiles" = "xy"
-then :
- GRUB_URL=\$\(XEN_EXTFILES_URL\)
-else $as_nop
- GRUB_URL="https://alpha.gnu.org/gnu/grub"
-fi
-
-fi
-GRUB_VERSION="0.97"
-
-
-
-
-
if test "x$GMP_URL" = "x"
then :
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index 33f170144e..6ff3ab0ee9 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -18,7 +18,6 @@ m4_include([../m4/depends.m4])
m4_include([../m4/fetcher.m4])
# Enable/disable stub domains
-AX_STUBDOM_DEFAULT_DISABLE([pv-grub], [grub])
AX_STUBDOM_DEFAULT_ENABLE([xenstore-stubdom], [xenstore])
AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh])
AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
@@ -43,7 +42,6 @@ AX_STUBDOM_LIB([ZLIB], [zlib], [1.2.3])
AX_STUBDOM_LIB([LIBPCI], [libpci], [2.2.9],
[https://mirrors.edge.kernel.org/pub/software/utils/pciutils])
AX_STUBDOM_LIB([NEWLIB], [newlib], [1.16.0],
[https://sourceware.org/ftp/newlib])
AX_STUBDOM_LIB([LWIP], [lwip], [1.3.0],
[https://download.savannah.gnu.org/releases/lwip])
-AX_STUBDOM_LIB([GRUB], [grub], [0.97], [https://alpha.gnu.org/gnu/grub])
AX_STUBDOM_LIB([GMP], [libgmp], [4.3.2],
[https://gmplib.org/download/gmp/archive])
AX_STUBDOM_LIB([POLARSSL], [polarssl], [1.1.4])
AX_STUBDOM_LIB([TPMEMU], [berlios tpm emulator], [0.7.4])
diff --git a/stubdom/grub.patches/00cvs b/stubdom/grub.patches/00cvs
deleted file mode 100644
index 47d66f3a3b..0000000000
--- a/stubdom/grub.patches/00cvs
+++ /dev/null
@@ -1,1022 +0,0 @@
-diff -uprN grub-0.97/acinclude.m4 grub/acinclude.m4
---- grub-0.97/acinclude.m4 2004-04-27 21:48:06.000000000 +0100
-+++ grub/acinclude.m4 2007-11-05 01:29:46.000000000 +0000
-@@ -57,7 +57,7 @@ else
- fi
- grub_cv_prog_objcopy_absolute=yes
- for link_addr in 2000 8000 7C00; do
-- if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext
-Wl,$link_addr conftest.o -o conftest.exec]); then :
-+ if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} ${LDFLAGS} -nostdlib -Wl,-N
-Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
- else
- AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
- fi
-diff -uprN grub-0.97/ChangeLog grub/ChangeLog
---- grub-0.97/ChangeLog 2005-05-08 03:47:02.000000000 +0100
-+++ grub/ChangeLog 2008-05-20 12:04:18.000000000 +0100
-@@ -1,3 +1,127 @@
-+2008-05-20 Robert Millan <rmh@xxxxxxxxxxx>
-+
-+ * netboot/cs89x0.c: Fix license violation.
-+ * netboot/cs89x0.h: Likewise.
-+
-+2008-04-10 Pavel Roskin <proski@xxxxxxx>
-+
-+ * configure.ac: Always use "_cv_" in cache variables for
-+ compatibility with Autoconf 2.62.
-+
-+2008-03-28 Robert Millan <rmh@xxxxxxxxxxx>
-+
-+ Surpass 1 TiB disk addressing limit. Note: there are no plans to handle
-+ the 2 TiB disk limit in GRUB Legacy, since that would need considerable
-+ rework. If you have >2TiB disks, use GRUB 2 instead.
-+
-+ * grub/asmstub.c (biosdisk): Add unsigned qualifier to `sector'.
-+ * stage2/bios.c (biosdisk): Likewise.
-+ * stage2/disk_io.c (rawread, devread, rawwrite, devwrite): Likewise.
-+ * stage2/shared.h (rawread, devread, rawwrite, devwrite): Likewise.
-+ * lib/device.c (get_drive_geometry): Replace BLKGETSIZE with
-+ BLKGETSIZE64.
-+
-+2007-10-29 Pavel Roskin <proski@xxxxxxx>
-+
-+ * configure.ac: Test if '--build-id=none' is supported by the
-+ linker and add it to LDFLAGS if possible. Build ID causes
-+ objcopy to generate huge binary files.
-+ * aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Use LDFLAGS when
-+ linking, so that build ID doesn't break the test.
-+ * stage1/Makefile.am: Preserve LDFLAGS, use stage1_exec_LDFLAGS.
-+
-+2007-02-22 Pavel Roskin <proski@xxxxxxx>
-+
-+ * stage2/iso9660.h: Remove unnecessary packed attributes.
-+
-+2007-02-22 Robert Millan <rmh@xxxxxxxxxxx>
-+
-+ * util/mkbimage: Update my email address, and remove my name from
-+ some places where unnecessary credit is given.
-+
-+2006-09-10 Pavel Roskin <proski@xxxxxxx>
-+
-+ * netboot/natsemi.c: Fix compile error with gcc 4.1.1. Cast
-+ cannot make a variable volatile - it should be declared as such.
-+ * netboot/sis900.c: Likewise.
-+
-+2006-09-08 Pavel Roskin <proski@xxxxxxx>
-+
-+ * netboot/etherboot.h: Remove incorrect extern declarations of
-+ the variables later declared static. Move BOOTP_DATA_ADDR ...
-+ * netboot/main.c: ... here. Eliminate end_of_rfc1533 - it's
-+ write-only.
-+
-+2006-06-24 Yoshinori K. Okuji <okuji@xxxxxxxxx>
-+
-+ * docs/grub.texi: Changed the license term to the GNU Free
-+ Documentation License 1.2.
-+
-+ * docs/multiboot.texi: Reformatted to show the license term
-+ and the version number explicitly.
-+
-+ * docs/fdl.texi: New file.
-+
-+ * docs/Makefile.am (grub_TEXINFOS): Added fdl.texi.
-+
-+2006-06-24 Robert Millan <robertmh@xxxxxxx>
-+
-+ * lib/device.c (write_to_partition): /dev/ataraid/ and /dev/rd/
-+ partitions have a "p" prefix. Add it.
-+
-+2006-06-24 Robert Millan <robertmh@xxxxxxx>
-+
-+ * lib/device.c (get_i2o_disk_name): New function.
-+ (init_device_map) [__linux__]: Add support for I2O devices.
-+
-+2006-05-02 Pavel Roskin <proski@xxxxxxx>
-+
-+ * stage2/stage2.c (run_menu): Fix "savedefault" to save only top
-+ level menu positions. Remember current position when calling a
-+ submenu. Don't recalculate it when booting from a submenu.
-+
-+ * grub/main.c (main): Make sure the boot drive number doesn't
-+ exceed 255.
-+
-+2006-05-02 Vesa Jaaskelainen <chaac@xxxxxx>
-+
-+ * stage2/shared.h (vbe_mode): Back ported aligment fix from GRUB 2
-+ to GRUB Legacy. Problem reported by Gerardo Richarte.
-+
-+2006-04-23 Robert Millan <robertmh@xxxxxxx>
-+
-+ * grub/asmstub.c (get_diskinfo): Optimize sysctl routine.
-+
-+2006-04-20 Robert Millan <robertmh@xxxxxxx>
-+
-+ Fixes for kernel of FreeBSD:
-+ * grub/asmstub.c (get_diskinfo): Toggle "kern.geom.debugflags" sysctl
-+ before opening a device for writing.
-+ * util/grub-install.in: Devices don't have this "r" prefix anymore.
-+
-+2006-04-16 Yoshinori K. Okuji <okuji@xxxxxxxxx>
-+
-+ * docs/multiboot.texi: Correct the offset of address
-+ fields. Reported by Jeroen Dekkers.
-+
-+2006-03-21 Yoshinori K. Okuji <okuji@xxxxxxxxx>
-+
-+ * stage2/builtins.c (setup_func): Specify the size of DEVICE to
-+ grub_strncat instead of a strange number 256. Reported by Vitaly
-+ Fertman <vitaly@xxxxxxxxxxx>.
-+
-+2005-09-29 Yoshinori K. Okuji <okuji@xxxxxxxxx>
-+
-+ * docs/multiboot.texi: Fix a bug in the byte order of
-+ boot_device. I hope this won't affect any OS image.
-+ Increased the version number to 0.6.94.
-+
-+2005-09-28 Yoshinori K. Okuji <okuji@xxxxxxxxx>
-+
-+ * stage2/boot.c (load_image): Even if an OS image is an ELF
-+ object, use the a.out kludge if MULTIBOOT_AOUT_KLUDGE is
-+ specified.
-+
- 2005-05-08 Yoshinori K. Okuji <okuji@xxxxxxxxx>
-
- * configure.ac (AC_INIT): Upgraded to 0.97.
-diff -uprN grub-0.97/configure grub/configure
---- grub-0.97/configure 2005-05-08 03:48:12.000000000 +0100
-+++ grub/configure 2007-11-05 01:29:46.000000000 +0000
-@@ -3694,6 +3694,64 @@ if test "x$undef_flag" = xyes; then
- CPPFLAGS="$CPPFLAGS -Wundef"
- fi
-
-+# Check if build ID can be disabled in the linker
-+echo "$as_me:$LINENO: checking whether linker accepts \`--build-id=none'" >&5
-+echo $ECHO_N "checking whether linker accepts \`--build-id=none'... $ECHO_C"
>&6
-+save_LDFLAGS="$LDFLAGS"
-+LDFLAGS="$LDFLAGS -Wl,--build-id=none"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag"
-+ || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ build_id_flag=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+build_id_flag=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+echo "$as_me:$LINENO: result: $build_id_flag" >&5
-+echo "${ECHO_T}$build_id_flag" >&6
-+LDFLAGS="$save_LDFLAGS"
-+if test "x$build_id_flag" = xyes; then
-+ LDFLAGS="$LDFLAGS -Wl,--build-id=none"
-+fi
-+
- if test "x$with_binutils" != x; then
- # Extract the first word of "objcopy", so it can be a program name with
args.
- set dummy objcopy; ac_word=$2
-@@ -3892,7 +3950,7 @@ echo "$as_me: error: ${CC-cc} cannot com
- fi
- grub_cv_prog_objcopy_absolute=yes
- for link_addr in 2000 8000 7C00; do
-- if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr
conftest.o -o conftest.exec'
-+ if { ac_try='${CC-cc} ${CFLAGS} ${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext
-Wl,$link_addr conftest.o -o conftest.exec'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
-diff -uprN grub-0.97/configure.ac grub/configure.ac
---- grub-0.97/configure.ac 2005-05-08 03:36:03.000000000 +0100
-+++ grub/configure.ac 2008-04-10 23:26:50.000000000 +0100
-@@ -86,13 +86,13 @@ if test "x$ac_cv_prog_gcc" = xyes; then
- fi
- STAGE1_CFLAGS="-O2"
- GRUB_CFLAGS="-O2"
-- AC_CACHE_CHECK([whether optimization for size works], size_flag, [
-+ AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [
- saved_CFLAGS=$CFLAGS
- CFLAGS="-Os -g"
-- AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
-+ AC_TRY_COMPILE(, , grub_cv_cc_Os=yes, grub_cv_cc_Os=no)
- CFLAGS=$saved_CFLAGS
- ])
-- if test "x$size_flag" = xyes; then
-+ if test "x$grub_cv_cc_Os" = xyes; then
- STAGE2_CFLAGS="-Os"
- else
- STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops"
-@@ -100,16 +100,16 @@ if test "x$ac_cv_prog_gcc" = xyes; then
- # OpenBSD has a GCC extension for protecting applications from
- # stack smashing attacks, but GRUB doesn't want this feature.
- AC_CACHE_CHECK([whether gcc has -fno-stack-protector],
-- no_stack_protector_flag, [
-+ grub_cv_cc_no_stack_protector, [
- saved_CFLAGS=$CFLAGS
- CFLAGS="-fno-stack-protector"
- AC_TRY_COMPILE(,
- ,
-- no_stack_protector_flag=yes,
-- no_stack_protector_flag=no)
-+ grub_cv_cc_no_stack_protector=yes,
-+ grub_cv_cc_no_stack_protector=no)
- CFLAGS=$saved_CFLAGS
- ])
-- if test "x$no_stack_protector_flag" = xyes; then
-+ if test "x$grub_cv_cc_no_stack_protector" = xyes; then
- STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector"
- fi
- fi
-@@ -123,33 +123,44 @@ AC_SUBST(GRUB_CFLAGS)
- CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused -Wshadow"
- CPPFLAGS="$CPPFLAGS -Wpointer-arith"
-
--AC_CACHE_CHECK([whether -Wundef works], undef_flag, [
-+AC_CACHE_CHECK([whether -Wundef works], grub_cv_cc_Wundef, [
- saved_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="-Wundef"
-- AC_TRY_COMPILE(, , undef_flag=yes, undef_flag=no)
-+ AC_TRY_COMPILE(, , grub_cv_cc_Wundef=yes, grub_cv_cc_Wundef=no)
- CPPFLAGS="$saved_CPPFLAGS"
- ])
-
- # The options `-falign-*' are supported by gcc 3.0 or later.
- # Probably it is sufficient to only check for -falign-loops.
--AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [
-+AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
- saved_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="-falign-loops=1"
-- AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no])
-+ AC_TRY_COMPILE(, , [grub_cv_cc_falign_loop=yes],
[grub_cv_cc_falign_loop=no])
- CPPFLAGS="$saved_CPPFLAGS"
- ])
-
- # Force no alignment to save space.
--if test "x$falign_loop_flag" = xyes; then
-+if test "x$grub_cv_cc_falign_loop" = xyes; then
- CPPFLAGS="$CPPFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
- else
- CPPFLAGS="$CPPFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
- fi
-
--if test "x$undef_flag" = xyes; then
-+if test "x$grub_cv_cc_Wundef" = xyes; then
- CPPFLAGS="$CPPFLAGS -Wundef"
- fi
-
-+# Check if build ID can be disabled in the linker
-+AC_MSG_CHECKING([whether linker accepts `--build-id=none'])
-+save_LDFLAGS="$LDFLAGS"
-+LDFLAGS="$LDFLAGS -Wl,--build-id=none"
-+AC_TRY_LINK(, , build_id_flag=yes, build_id_flag=no)
-+AC_MSG_RESULT([$build_id_flag])
-+LDFLAGS="$save_LDFLAGS"
-+if test "x$build_id_flag" = xyes; then
-+ LDFLAGS="$LDFLAGS -Wl,--build-id=none"
-+fi
-+
- if test "x$with_binutils" != x; then
- dnl AC_PATH_TOOL(OBJCOPY, objcopy, , "$with_binutils:$PATH")
- AC_PATH_PROG(OBJCOPY, objcopy, , "$with_binutils:$PATH")
-diff -uprN grub-0.97/grub/asmstub.c grub/grub/asmstub.c
---- grub-0.97/grub/asmstub.c 2005-02-16 20:45:14.000000000 +0000
-+++ grub/grub/asmstub.c 2008-03-28 13:22:28.000000000 +0000
-@@ -55,6 +55,10 @@ int grub_stage2 (void);
- # endif /* ! BLKFLSBUF */
- #endif /* __linux__ */
-
-+#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
-+# include <sys/sysctl.h>
-+#endif
-+
- /* We want to prevent any circularararity in our stubs, as well as
- libc name clashes. */
- #define WITHOUT_LIBC_STUBS 1
-@@ -777,7 +781,39 @@ get_diskinfo (int drive, struct geometry
-
- /* Open read/write, or read-only if that failed. */
- if (! read_only)
-- disks[drive].flags = open (devname, O_RDWR);
-+ {
-+/* By default, kernel of FreeBSD does not allow overwriting MBR */
-+#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
-+#define GEOM_SYSCTL "kern.geom.debugflags"
-+ int old_flags, flags;
-+ size_t sizeof_int = sizeof (int);
-+
-+ if (sysctlbyname (GEOM_SYSCTL, &old_flags, &sizeof_int, NULL, 0) != 0)
-+ grub_printf ("failed to get " GEOM_SYSCTL "sysctl: %s\n", strerror
(errno));
-+
-+ if ((old_flags & 0x10) == 0)
-+ {
-+ /* "allow foot shooting", see geom(4) */
-+ flags = old_flags | 0x10;
-+
-+ if (sysctlbyname (GEOM_SYSCTL, NULL, NULL, &flags, sizeof (int))
!= 0)
-+ {
-+ flags = old_flags;
-+ grub_printf ("failed to set " GEOM_SYSCTL "sysctl: %s\n",
strerror (errno));
-+ }
-+ }
-+ else
-+ flags = old_flags;
-+#endif
-+ disks[drive].flags = open (devname, O_RDWR);
-+#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
-+ if (flags != old_flags)
-+ {
-+ if (sysctlbyname (GEOM_SYSCTL, NULL, NULL, &old_flags, sizeof
(int)) != 0)
-+ grub_printf ("failed to set " GEOM_SYSCTL "sysctl: %s\n",
strerror (errno));
-+ }
-+#endif
-+ }
-
- if (disks[drive].flags == -1)
- {
-@@ -926,7 +962,7 @@ hex_dump (void *buf, size_t size)
-
- int
- biosdisk (int subfunc, int drive, struct geometry *geometry,
-- int sector, int nsec, int segment)
-+ unsigned int sector, int nsec, int segment)
- {
- char *buf;
- int fd = geometry->flags;
-diff -uprN grub-0.97/grub/main.c grub/grub/main.c
---- grub-0.97/grub/main.c 2003-07-09 12:45:36.000000000 +0100
-+++ grub/grub/main.c 2006-05-05 22:43:46.000000000 +0100
-@@ -32,6 +32,7 @@ int grub_stage2 (void);
- #define WITHOUT_LIBC_STUBS 1
- #include <shared.h>
- #include <term.h>
-+#include <device.h>
-
- char *program_name = 0;
- int use_config_file = 1;
-@@ -192,6 +193,12 @@ main (int argc, char **argv)
- perror ("strtoul");
- exit (1);
- }
-+ if (boot_drive >= NUM_DISKS)
-+ {
-+ fprintf (stderr, "boot_drive should be from 0 to %d\n",
-+ NUM_DISKS - 1);
-+ exit (1);
-+ }
- break;
-
- case OPT_NO_CONFIG_FILE:
-diff -uprN grub-0.97/lib/device.c grub/lib/device.c
---- grub-0.97/lib/device.c 2005-03-28 00:14:25.000000000 +0100
-+++ grub/lib/device.c 2008-03-28 13:22:28.000000000 +0000
-@@ -69,9 +69,9 @@ struct hd_geometry
- # ifndef CDROM_GET_CAPABILITY
- # define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
- # endif /* ! CDROM_GET_CAPABILITY */
--# ifndef BLKGETSIZE
--# define BLKGETSIZE _IO(0x12,96) /* return device size */
--# endif /* ! BLKGETSIZE */
-+# ifndef BLKGETSIZE64
-+# define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size */
-+# endif /* ! BLKGETSIZE64 */
- #endif /* __linux__ */
-
- /* Use __FreeBSD_kernel__ instead of __FreeBSD__ for compatibility with
-@@ -152,19 +152,19 @@ get_drive_geometry (struct geometry *geo
- /* Linux */
- {
- struct hd_geometry hdg;
-- unsigned long nr;
-+ unsigned long long nr;
-
- if (ioctl (fd, HDIO_GETGEO, &hdg))
- goto fail;
-
-- if (ioctl (fd, BLKGETSIZE, &nr))
-+ if (ioctl (fd, BLKGETSIZE64, &nr))
- goto fail;
-
- /* Got the geometry, so save it. */
- geom->cylinders = hdg.cylinders;
- geom->heads = hdg.heads;
- geom->sectors = hdg.sectors;
-- geom->total_sectors = nr;
-+ geom->total_sectors = nr / 512;
-
- goto success;
- }
-@@ -407,6 +407,12 @@ get_ataraid_disk_name (char *name, int u
- {
- sprintf (name, "/dev/ataraid/d%c", unit + '0');
- }
-+
-+static void
-+get_i2o_disk_name (char *name, char unit)
-+{
-+ sprintf (name, "/dev/i2o/hd%c", unit);
-+}
- #endif
-
- /* Check if DEVICE can be read. If an error occurs, return zero,
-@@ -801,6 +807,29 @@ init_device_map (char ***map, const char
- }
- }
- }
-+
-+ /* This is for I2O - we have /dev/i2o/hd<logical drive><partition> */
-+ {
-+ int unit;
-+
-+ for (unit = 'a'; unit < 'f'; unit++)
-+ {
-+ char name[24];
-+
-+ get_i2o_disk_name (name, unit);
-+ if (check_device (name))
-+ {
-+ (*map)[num_hd + 0x80] = strdup (name);
-+ assert ((*map)[num_hd + 0x80]);
-+
-+ /* If the device map file is opened, write the map. */
-+ if (fp)
-+ fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
-+
-+ num_hd++;
-+ }
-+ }
-+ }
- #endif /* __linux__ */
-
- /* OK, close the device map file if opened. */
-@@ -861,6 +890,12 @@ write_to_partition (char **map, int driv
- if (strcmp (dev + strlen(dev) - 5, "/disc") == 0)
- strcpy (dev + strlen(dev) - 5, "/part");
- }
-+ else
-+ {
-+ if ((strncmp (dev, "/dev/ataraid/", 13) == 0) ||
-+ (strncmp (dev, "/dev/rd/", 8) == 0))
-+ strcpy (dev + strlen(dev), "p");
-+ }
- sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1);
-
- /* Open the partition. */
-diff -uprN grub-0.97/netboot/3c509.c grub/netboot/3c509.c
---- grub-0.97/netboot/3c509.c 2003-07-09 12:45:37.000000000 +0100
-+++ grub/netboot/3c509.c 2002-01-02 21:56:40.000000000 +0000
-@@ -18,7 +18,7 @@ Author: Martin Renters.
-
- 3c509 support added by Serge Babkin (babkin@xxxxxxxxxxxxxx)
-
--$Id: 3c509.c,v 1.4 2002/01/02 21:56:40 okuji Exp $
-+$Id: 3c509.c 609 2002-01-02 21:56:40Z okuji $
-
- ***************************************************************************/
-
-diff -uprN grub-0.97/netboot/cs89x0.c grub/netboot/cs89x0.c
---- grub-0.97/netboot/cs89x0.c 2003-07-09 12:45:37.000000000 +0100
-+++ grub/netboot/cs89x0.c 2008-05-20 12:04:18.000000000 +0100
-@@ -1,3 +1,21 @@
-+/**
-+ Per an email message from Russ Nelson <nelson@xxxxxxxxxx> on
-+ 18 March 2008 this file is now licensed under GPL Version 2.
-+
-+ From: Russ Nelson <nelson@xxxxxxxxxx>
-+ Date: Tue, 18 Mar 2008 12:42:00 -0400
-+ Subject: Re: [Etherboot-developers] cs89x0 driver in etherboot
-+ -- quote from email
-+ As copyright holder, if I say it doesn't conflict with the GPL,
-+ then it doesn't conflict with the GPL.
-+
-+ However, there's no point in causing people's brains to overheat,
-+ so yes, I grant permission for the code to be relicensed under the
-+ GPLv2. Please make sure that this change in licensing makes its
-+ way upstream. -russ
-+ -- quote from email
-+**/
-+
- /* cs89x0.c: A Crystal Semiconductor CS89[02]0 driver for etherboot. */
- /*
- Permission is granted to distribute the enclosed cs89x0.[ch] driver
-diff -uprN grub-0.97/netboot/cs89x0.h grub/netboot/cs89x0.h
---- grub-0.97/netboot/cs89x0.h 2003-07-09 12:45:37.000000000 +0100
-+++ grub/netboot/cs89x0.h 2008-05-20 12:04:18.000000000 +0100
-@@ -1,3 +1,21 @@
-+/**
-+ Per an email message from Russ Nelson <nelson@xxxxxxxxxx> on
-+ 18 March 2008 this file is now licensed under GPL Version 2.
-+
-+ From: Russ Nelson <nelson@xxxxxxxxxx>
-+ Date: Tue, 18 Mar 2008 12:42:00 -0400
-+ Subject: Re: [Etherboot-developers] cs89x0 driver in etherboot
-+ -- quote from email
-+ As copyright holder, if I say it doesn't conflict with the GPL,
-+ then it doesn't conflict with the GPL.
-+
-+ However, there's no point in causing people's brains to overheat,
-+ so yes, I grant permission for the code to be relicensed under the
-+ GPLv2. Please make sure that this change in licensing makes its
-+ way upstream. -russ
-+ -- quote from email
-+**/
-+
- /* Copyright, 1988-1992, Russell Nelson, Crynwr Software
-
- This program is free software; you can redistribute it and/or modify
-diff -uprN grub-0.97/netboot/etherboot.h grub/netboot/etherboot.h
---- grub-0.97/netboot/etherboot.h 2003-07-09 12:45:37.000000000 +0100
-+++ grub/netboot/etherboot.h 2006-09-08 13:56:22.000000000 +0100
-@@ -531,9 +531,6 @@ extern int ip_abort;
- extern int network_ready;
- extern struct rom_info rom;
- extern struct arptable_t arptable[MAX_ARP];
--extern struct bootpd_t bootp_data;
--#define BOOTP_DATA_ADDR (&bootp_data)
--extern unsigned char *end_of_rfc1533;
-
- /* config.c */
- extern struct nic nic;
-diff -uprN grub-0.97/netboot/main.c grub/netboot/main.c
---- grub-0.97/netboot/main.c 2004-05-20 23:19:33.000000000 +0100
-+++ grub/netboot/main.c 2006-09-08 13:56:22.000000000 +0100
-@@ -56,7 +56,8 @@ static int vendorext_isvalid;
- static unsigned long netmask;
- static struct bootpd_t bootp_data;
- static unsigned long xid;
--static unsigned char *end_of_rfc1533 = NULL;
-+
-+#define BOOTP_DATA_ADDR (&bootp_data)
-
- #ifndef NO_DHCP_SUPPORT
- #endif /* NO_DHCP_SUPPORT */
-@@ -967,7 +968,6 @@ decode_rfc1533 (unsigned char *p, int bl
-
- if (block == 0)
- {
-- end_of_rfc1533 = NULL;
- vendorext_isvalid = 0;
-
- if (grub_memcmp (p, rfc1533_cookie, 4))
-@@ -1021,7 +1021,7 @@ decode_rfc1533 (unsigned char *p, int bl
- }
- else if (c == RFC1533_END)
- {
-- end_of_rfc1533 = endp = p;
-+ endp = p;
- continue;
- }
- else if (c == RFC1533_NETMASK)
-diff -uprN grub-0.97/netboot/natsemi.c grub/netboot/natsemi.c
---- grub-0.97/netboot/natsemi.c 2003-07-09 12:45:38.000000000 +0100
-+++ grub/netboot/natsemi.c 2006-09-10 08:26:10.000000000 +0100
-@@ -608,7 +608,7 @@ natsemi_transmit(struct nic *nic,
- const char *p) /* Packet */
- {
- u32 status, to, nstype;
-- u32 tx_status;
-+ volatile u32 tx_status;
-
- /* Stop the transmitter */
- outl(TxOff, ioaddr + ChipCmd);
-@@ -647,7 +647,7 @@ natsemi_transmit(struct nic *nic,
-
- to = currticks() + TX_TIMEOUT;
-
-- while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() <
to))
-+ while (((tx_status=txd.cmdsts) & OWN) && (currticks() < to))
- /* wait */ ;
-
- if (currticks() >= to) {
-diff -uprN grub-0.97/netboot/sis900.c grub/netboot/sis900.c
---- grub-0.97/netboot/sis900.c 2003-07-09 12:45:38.000000000 +0100
-+++ grub/netboot/sis900.c 2006-09-10 08:26:10.000000000 +0100
-@@ -901,7 +901,7 @@ sis900_transmit(struct nic *nic,
- const char *p) /* Packet */
- {
- u32 status, to, nstype;
-- u32 tx_status;
-+ volatile u32 tx_status;
-
- /* Stop the transmitter */
- outl(TxDIS, ioaddr + cr);
-@@ -940,7 +940,7 @@ sis900_transmit(struct nic *nic,
-
- to = currticks() + TX_TIMEOUT;
-
-- while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() <
to))
-+ while (((tx_status=txd.cmdsts) & OWN) && (currticks() < to))
- /* wait */ ;
-
- if (currticks() >= to) {
-diff -uprN grub-0.97/netboot/sk_g16.c grub/netboot/sk_g16.c
---- grub-0.97/netboot/sk_g16.c 2003-07-09 12:45:38.000000000 +0100
-+++ grub/netboot/sk_g16.c 2002-01-02 21:56:40.000000000 +0000
-@@ -13,12 +13,12 @@ Changes to make it work with Etherboot b
- *
- * Module : sk_g16.c
- *
-- * Version : $Revision: 1.4 $
-+ * Version : $Revision: 609 $
- *
- * Author : Patrick J.D. Weichmann
- *
- * Date Created : 94/05/26
-- * Last Updated : $Date: 2002/01/02 21:56:40 $
-+ * Last Updated : $Date: 2002-01-02 21:56:40 +0000 (mer 02 jan 2002) $
- *
- * Description : Schneider & Koch G16 Ethernet Device Driver for
- * Linux Kernel >= 1.1.22
-diff -uprN grub-0.97/netboot/sk_g16.h grub/netboot/sk_g16.h
---- grub-0.97/netboot/sk_g16.h 2003-07-09 12:45:38.000000000 +0100
-+++ grub/netboot/sk_g16.h 2000-07-29 20:22:54.000000000 +0100
-@@ -4,7 +4,7 @@
- * of the GNU Public License, incorporated herein by reference.
- *
- * Module : sk_g16.h
-- * Version : $Revision: 1.3 $
-+ * Version : $Revision: 388 $
- *
- * Author : M.Hipp (mhipp@xxxxxxxxxxxxxxxxxxxxxxxx)
- * changes by : Patrick J.D. Weichmann
-@@ -15,8 +15,8 @@
- * the am7990 (LANCE) chip used for writing a
- * network device driver which uses this chip
- *
-- * $Log: sk_g16.h,v $
-- * Revision 1.3 2000/07/29 19:22:54 okuji
-+ * $Log$
-+ * Revision 1.3 2000-07-29 19:22:54 okuji
- * update the network support to etherboot-4.6.4.
- *
- -*/
-diff -uprN grub-0.97/stage1/Makefile.am grub/stage1/Makefile.am
---- grub-0.97/stage1/Makefile.am 2004-07-16 12:44:56.000000000 +0100
-+++ grub/stage1/Makefile.am 2007-11-05 01:29:46.000000000 +0000
-@@ -5,7 +5,7 @@ CLEANFILES = $(nodist_pkglib_DATA)
-
- # We can't use builtins or standard includes.
- AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
--LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
-+stage1_exec_LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
-
- noinst_PROGRAMS = stage1.exec
- stage1_exec_SOURCES = stage1.S stage1.h
-diff -uprN grub-0.97/stage1/Makefile.in grub/stage1/Makefile.in
---- grub-0.97/stage1/Makefile.in 2005-05-08 03:42:36.000000000 +0100
-+++ grub/stage1/Makefile.in 2007-11-05 01:29:46.000000000 +0000
-@@ -110,7 +110,7 @@ INSTALL_DATA = @INSTALL_DATA@
- INSTALL_PROGRAM = @INSTALL_PROGRAM@
- INSTALL_SCRIPT = @INSTALL_SCRIPT@
- INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
--LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
-+LDFLAGS = @LDFLAGS@
- LIBOBJS = @LIBOBJS@
- LIBS = @LIBS@
- LTLIBOBJS = @LTLIBOBJS@
-@@ -188,6 +188,7 @@ CLEANFILES = $(nodist_pkglib_DATA)
-
- # We can't use builtins or standard includes.
- AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
-+stage1_exec_LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
- stage1_exec_SOURCES = stage1.S stage1.h
- SUFFIXES = .exec
- all: all-am
-diff -uprN grub-0.97/stage2/bios.c grub/stage2/bios.c
---- grub-0.97/stage2/bios.c 2004-03-27 16:34:04.000000000 +0000
-+++ grub/stage2/bios.c 2008-03-28 13:22:28.000000000 +0000
-@@ -47,7 +47,7 @@ extern int get_diskinfo_floppy (int driv
- return the error number. Otherwise, return 0. */
- int
- biosdisk (int read, int drive, struct geometry *geometry,
-- int sector, int nsec, int segment)
-+ unsigned int sector, int nsec, int segment)
- {
- int err;
-
-diff -uprN grub-0.97/stage2/boot.c grub/stage2/boot.c
---- grub-0.97/stage2/boot.c 2004-03-30 12:44:08.000000000 +0100
-+++ grub/stage2/boot.c 2005-09-28 22:47:55.000000000 +0100
-@@ -1,7 +1,7 @@
- /* boot.c - load and bootstrap a kernel */
- /*
- * GRUB -- GRand Unified Bootloader
-- * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation,
Inc.
-+ * Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software
Foundation, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -96,7 +96,7 @@ load_image (char *kernel, char *arg, ker
- lh = (struct linux_kernel_header *) buffer;
-
- /* ELF loading supported if multiboot, FreeBSD and NetBSD. */
-- if ((type == KERNEL_TYPE_MULTIBOOT
-+ if (((type == KERNEL_TYPE_MULTIBOOT && ! (flags & MULTIBOOT_AOUT_KLUDGE))
- || pu.elf->e_ident[EI_OSABI] == ELFOSABI_FREEBSD
- || grub_strcmp (pu.elf->e_ident + EI_BRAND, "FreeBSD") == 0
- || suggested_type == KERNEL_TYPE_NETBSD)
-diff -uprN grub-0.97/stage2/builtins.c grub/stage2/builtins.c
---- grub-0.97/stage2/builtins.c 2005-02-15 21:58:23.000000000 +0000
-+++ grub/stage2/builtins.c 2006-03-21 20:51:58.000000000 +0000
-@@ -3830,15 +3830,15 @@ setup_func (char *arg, int flags)
- {
- char tmp[16];
- grub_sprintf (tmp, ",%d", (partition >> 16) & 0xFF);
-- grub_strncat (device, tmp, 256);
-+ grub_strncat (device, tmp, sizeof (device));
- }
- if ((partition & 0x00FF00) != 0x00FF00)
- {
- char tmp[16];
- grub_sprintf (tmp, ",%c", 'a' + ((partition >> 8) & 0xFF));
-- grub_strncat (device, tmp, 256);
-+ grub_strncat (device, tmp, sizeof (device));
- }
-- grub_strncat (device, ")", 256);
-+ grub_strncat (device, ")", sizeof (device));
- }
-
- int embed_stage1_5 (char *stage1_5, int drive, int partition)
-diff -uprN grub-0.97/stage2/disk_io.c grub/stage2/disk_io.c
---- grub-0.97/stage2/disk_io.c 2004-05-23 17:35:24.000000000 +0100
-+++ grub/stage2/disk_io.c 2008-03-28 13:22:28.000000000 +0000
-@@ -137,7 +137,7 @@ log2 (unsigned long word)
- }
-
- int
--rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
-+rawread (int drive, unsigned int sector, int byte_offset, int byte_len, char
*buf)
- {
- int slen, sectors_per_vtrack;
- int sector_size_bits = log2 (buf_geom.sector_size);
-@@ -261,7 +261,7 @@ rawread (int drive, int sector, int byte
- */
- if (disk_read_func)
- {
-- int sector_num = sector;
-+ unsigned int sector_num = sector;
- int length = buf_geom.sector_size - byte_offset;
- if (length > size)
- length = size;
-@@ -291,7 +291,7 @@ rawread (int drive, int sector, int byte
-
-
- int
--devread (int sector, int byte_offset, int byte_len, char *buf)
-+devread (unsigned int sector, int byte_offset, int byte_len, char *buf)
- {
- /*
- * Check partition boundaries
-@@ -330,7 +330,7 @@ devread (int sector, int byte_offset, in
-
- #ifndef STAGE1_5
- int
--rawwrite (int drive, int sector, char *buf)
-+rawwrite (int drive, unsigned int sector, char *buf)
- {
- if (sector == 0)
- {
-@@ -363,7 +363,7 @@ rawwrite (int drive, int sector, char *b
- }
-
- int
--devwrite (int sector, int sector_count, char *buf)
-+devwrite (unsigned int sector, int sector_count, char *buf)
- {
- #if defined(GRUB_UTIL) && defined(__linux__)
- if (current_partition != 0xFFFFFF
-diff -uprN grub-0.97/stage2/fsys_ffs.c grub/stage2/fsys_ffs.c
---- grub-0.97/stage2/fsys_ffs.c 2003-07-09 12:45:52.000000000 +0100
-+++ grub/stage2/fsys_ffs.c 2001-11-12 06:57:29.000000000 +0000
-@@ -50,7 +50,7 @@
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd
-- * $Id: fsys_ffs.c,v 1.10 2001/11/12 06:57:29 okuji Exp $
-+ * $Id: fsys_ffs.c 594 2001-11-12 06:57:29Z okuji $
- */
-
- #ifdef FSYS_FFS
-diff -uprN grub-0.97/stage2/fsys_ufs2.c grub/stage2/fsys_ufs2.c
---- grub-0.97/stage2/fsys_ufs2.c 2004-06-19 13:17:52.000000000 +0100
-+++ grub/stage2/fsys_ufs2.c 2004-06-19 13:17:52.000000000 +0100
-@@ -51,7 +51,7 @@
- * the rights to redistribute these changes.
- *
- * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd
-- * $Id: fsys_ufs2.c,v 1.2 2004/06/19 12:17:52 okuji Exp $
-+ * $Id: fsys_ufs2.c 841 2004-06-19 12:17:52Z okuji $
- */
-
- #ifdef FSYS_UFS2
-diff -uprN grub-0.97/stage2/imgact_aout.h grub/stage2/imgact_aout.h
---- grub-0.97/stage2/imgact_aout.h 2003-07-09 12:45:53.000000000 +0100
-+++ grub/stage2/imgact_aout.h 1999-06-24 01:03:29.000000000 +0100
-@@ -32,7 +32,7 @@
- * SUCH DAMAGE.
- *
- * from: @(#)exec.h 8.1 (Berkeley) 6/11/93
-- * $Id: imgact_aout.h,v 1.1 1999/06/24 00:03:22 okuji Exp $
-+ * $Id: imgact_aout.h 98 1999-06-24 00:03:29Z okuji $
- */
- /*
- * 11/23/95 - Kludge to get "ntohl" null macro added. -- ESB
-diff -uprN grub-0.97/stage2/iso9660.h grub/stage2/iso9660.h
---- grub-0.97/stage2/iso9660.h 2004-03-27 16:02:38.000000000 +0000
-+++ grub/stage2/iso9660.h 2007-02-22 23:40:25.000000000 +0000
-@@ -73,11 +73,11 @@ typedef union {
-
- typedef struct __iso_16bit {
- u_int16_t l, b;
--} iso_16bit_t __attribute__ ((packed));
-+} iso_16bit_t;
-
- typedef struct __iso_32bit {
- u_int32_t l, b;
--} iso_32bit_t __attribute__ ((packed));
-+} iso_32bit_t;
-
- typedef u_int8_t iso_date_t[7];
-
-diff -uprN grub-0.97/stage2/shared.h grub/stage2/shared.h
---- grub-0.97/stage2/shared.h 2004-06-19 17:40:09.000000000 +0100
-+++ grub/stage2/shared.h 2008-03-28 13:22:28.000000000 +0000
-@@ -499,7 +499,11 @@ struct vbe_mode
- unsigned char linear_reserved_field_position;
- unsigned long max_pixel_clock;
-
-- unsigned char reserved3[189];
-+ /* Reserved field to make structure to be 256 bytes long, VESA BIOS
-+ Extension 3.0 Specification says to reserve 189 bytes here but
-+ that doesn't make structure to be 256 bytes. So additional one is
-+ added here. */
-+ unsigned char reserved3[189 + 1];
- } __attribute__ ((packed));
-
-
-@@ -807,7 +811,7 @@ int checkkey (void);
- /* Low-level disk I/O */
- int get_diskinfo (int drive, struct geometry *geometry);
- int biosdisk (int subfunc, int drive, struct geometry *geometry,
-- int sector, int nsec, int segment);
-+ unsigned int sector, int nsec, int segment);
- void stop_floppy (void);
-
- /* Command-line interface functions. */
-@@ -920,10 +924,10 @@ int gunzip_test_header (void);
- int gunzip_read (char *buf, int len);
- #endif /* NO_DECOMPRESSION */
-
--int rawread (int drive, int sector, int byte_offset, int byte_len, char *buf);
--int devread (int sector, int byte_offset, int byte_len, char *buf);
--int rawwrite (int drive, int sector, char *buf);
--int devwrite (int sector, int sector_len, char *buf);
-+int rawread (int drive, unsigned int sector, int byte_offset, int byte_len,
char *buf);
-+int devread (unsigned int sector, int byte_offset, int byte_len, char *buf);
-+int rawwrite (int drive, unsigned int sector, char *buf);
-+int devwrite (unsigned int sector, int sector_len, char *buf);
-
- /* Parse a device string and initialize the global parameters. */
- char *set_device (char *device);
-diff -uprN grub-0.97/stage2/stage2.c grub/stage2/stage2.c
---- grub-0.97/stage2/stage2.c 2005-03-19 17:51:57.000000000 +0000
-+++ grub/stage2/stage2.c 2006-05-05 23:06:31.000000000 +0100
-@@ -651,7 +651,10 @@ restart:
- *(new_heap++) = 0;
-
- if (config_entries)
-- run_menu (heap, NULL, new_num_entries, new_heap, 0);
-+ {
-+ current_entryno = first_entry + entryno;
-+ run_menu (heap, NULL, new_num_entries, new_heap, 0);
-+ }
- else
- {
- cls ();
-@@ -727,7 +730,8 @@ restart:
- cur_entry = get_entry (config_entries, first_entry + entryno, 1);
-
- /* Set CURRENT_ENTRYNO for the command "savedefault". */
-- current_entryno = first_entry + entryno;
-+ if (config_entries)
-+ current_entryno = first_entry + entryno;
-
- if (run_script (cur_entry, heap))
- {
-diff -uprN grub-0.97/stage2/tparm.c grub/stage2/tparm.c
---- grub-0.97/stage2/tparm.c 2003-07-09 12:45:53.000000000 +0100
-+++ grub/stage2/tparm.c 2002-11-29 20:39:24.000000000 +0000
-@@ -63,7 +63,7 @@ typedef char grub_bool;
- #define MAX_FORMAT_LEN 256
- #define max(a,b) ((a) > (b) ? (a) : (b))
-
--//MODULE_ID("$Id: tparm.c,v 1.1 2002/11/29 20:39:24 okuji Exp $")
-+//MODULE_ID("$Id: tparm.c 708 2002-11-29 20:39:24Z okuji $")
-
- /*
- * char *
-diff -uprN grub-0.97/stamp-h.in grub/stamp-h.in
---- grub-0.97/stamp-h.in 1970-01-01 01:00:00.000000000 +0100
-+++ grub/stamp-h.in 1999-09-13 14:32:31.000000000 +0100
-@@ -0,0 +1 @@
-+timestamp
-diff -uprN grub-0.97/THANKS grub/THANKS
---- grub-0.97/THANKS 2005-05-08 03:17:43.000000000 +0100
-+++ grub/THANKS 2006-03-21 20:51:58.000000000 +0000
-@@ -121,3 +121,4 @@ Vesa Jaaskelainen <jaaskela@tietomyrsky.
- Yedidyah Bar-David <didi@xxxxxxxxxxxxxx>
- Yury V. Umanets <umka@xxxxxxxxxxx>
- Yuri Zaporogets <yuriz@xxxxxxx>
-+Vitaly Fertman <vitaly@xxxxxxxxxxx>
-diff -uprN grub-0.97/util/grub-install.in grub/util/grub-install.in
---- grub-0.97/util/grub-install.in 2004-07-24 19:57:31.000000000 +0100
-+++ grub/util/grub-install.in 2006-04-20 14:46:46.000000000 +0100
-@@ -112,8 +112,8 @@ convert () {
- tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'`
- tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;;
- freebsd* | kfreebsd*-gnu)
-- tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' \
-- | sed 's%r\{0,1\}\(da[0-9]*\).*$%r\1%'`
-+ tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%\1%' \
-+ | sed 's%r\{0,1\}\(da[0-9]*\).*$%\1%'`
- tmp_part=`echo "$1" \
- | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \
- | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"`
-diff -uprN grub-0.97/util/mkbimage grub/util/mkbimage
---- grub-0.97/util/mkbimage 2004-07-24 19:57:31.000000000 +0100
-+++ grub/util/mkbimage 2007-02-22 16:01:03.000000000 +0000
-@@ -1,7 +1,7 @@
- #!/bin/sh
- # MaKe a Bootable IMAGE --- 1.44, 2.88 and El Torito no-emulation mode
- # C) 2001,2002,2003 Thierry Laronde <tlaronde@xxxxxxxxxxx>
--# C) 2001,2002,2003 Robert Millan <robertmh@xxxxxxx>
-+# C) 2001,2002,2003 Robert Millan <rmh@xxxxxxxxxxx>
-
-
- # This program is free software; you can redistribute it and/or modify
-@@ -19,7 +19,7 @@
- # program's maintainer or write to: The Free Software Foundation,
- # Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
-
--# $Id: mkbimage,v 1.19 2004/07/21 14:43:04 robertmh Exp $
-+# $Id: mkbimage 1233 2007-02-22 16:01:03Z robertmh $
-
- # Global variables
- tarfile=
-@@ -58,7 +58,7 @@ stage2_os_name=
-
- # Name by which this script was invoked.
- program=`echo "$0" | sed -e 's/[^\/]*\///g'`
--version_number='$Revision: 1.19 $'
-+version_number='$Revision: 1233 $'
-
- usage="
- Usage: $program [-hVF] [-t TYPE] [-d DIRECTORY] [-s FS_TYPE] -f TAR_FILE
-@@ -94,15 +94,13 @@ Options:
- display Version information and exit
-
- Copyright (c) 2001,2002,2003 Thierry Laronde <tlaronde@xxxxxxxxxxx>.
--Copyright (c) 2001,2002 Robert Millan <zeratul2@xxxxxxxxxx>.
- GPLed."
-
- version="mkbimage $version_number
-
--Written by Thierry Laronde and Robert Millan.
-+Written by Thierry Laronde.
-
- Copyright (c) 2001,2002,2003 Thierry Laronde <tlaronde@xxxxxxxxxxx>.
--Copyright (c) 2001,2002,2003 Robert Millan <zeratul2@xxxxxxxxxx>.
-
- This is free software under the GPL version 2 or later; see the source for
- copying conditions. There is NO warranty, not even for MERCHANTABILITY or
diff --git a/stubdom/grub.patches/10graphics.diff
b/stubdom/grub.patches/10graphics.diff
deleted file mode 100644
index 5ee2852fd7..0000000000
--- a/stubdom/grub.patches/10graphics.diff
+++ /dev/null
@@ -1,2297 +0,0 @@
-diff -Naur grub-0.97.orig/configure.ac grub-0.97/configure.ac
---- grub-0.97.orig/configure.ac 2005-05-07 23:36:03.000000000 -0300
-+++ grub-0.97/configure.ac 2005-06-12 20:56:49.000000000 -0300
-@@ -595,6 +595,11 @@
- [ --enable-diskless enable diskless support])
- AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes)
-
-+dnl Graphical splashscreen support
-+AC_ARG_ENABLE(graphics,
-+ [ --disable-graphics disable graphics terminal support])
-+AM_CONDITIONAL(GRAPHICS_SUPPORT, test "x$enable_graphics" != xno)
-+
- dnl Hercules terminal
- AC_ARG_ENABLE(hercules,
- [ --disable-hercules disable hercules terminal support])
-diff -Naur grub-0.97.orig/stage2/asm.S grub-0.97/stage2/asm.S
---- grub-0.97.orig/stage2/asm.S 2004-06-19 13:55:22.000000000 -0300
-+++ grub-0.97/stage2/asm.S 2005-06-13 14:05:31.000000000 -0300
-@@ -2216,7 +2216,304 @@
- pop %ebx
- pop %ebp
- ret
--
-+
-+
-+/* graphics mode functions */
-+#ifdef SUPPORT_GRAPHICS
-+VARIABLE(cursorX)
-+.word 0
-+VARIABLE(cursorY)
-+.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)
-+ call write_data
-+
-+int1c_done:
-+ popa
-+ iret
-+ /* call previous int1c handler */
-+ /* ljmp */
-+ .byte 0xea
-+int1c_offset: .word 0
-+int1c_segment: .word 0
-+ .code32
-+
-+
-+/*
-+ * unsigned char set_videomode(unsigned char mode)
-+ * BIOS call "INT 10H Function 0h" to set video mode
-+ * Call with %ah = 0x0
-+ * %al = video mode
-+ * Returns old videomode.
-+ */
-+ENTRY(set_videomode)
-+ pushl %ebp
-+ movl %esp,%ebp
-+ pushl %ebx
-+ pushl %ecx
-+
-+ movb 8(%ebp), %cl
-+
-+ call EXT_C(prot_to_real)
-+ .code16
-+
-+ xorb %al, %al
-+ 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
-+
-+ xorl %eax, %eax
-+ movb %ch, %al
-+
-+ popl %ecx
-+ popl %ebx
-+ popl %ebp
-+ ret
-+
-+
-+/*
-+ * int get_videomode()
-+ * BIOS call "INT 10H Function 0Fh" to get current video mode
-+ * Call with %al = 0x0
-+ * %ah = 0xF
-+ * Returns current videomode.
-+ */
-+ENTRY(get_videomode)
-+ pushl %ebp
-+ movl %esp,%ebp
-+ pushl %ebx
-+ pushl %ecx
-+
-+ call EXT_C(prot_to_real)
-+ .code16
-+
-+ xorb %al, %al
-+ movb $0xF, %ah
-+ int $0x10 /* Get Current Video mode */
-+ movb %al, %cl /* For now we only want display mode */
-+
-+ DATA32 call EXT_C(real_to_prot)
-+ .code32
-+
-+ xorl %eax, %eax
-+ movb %cl, %al
-+
-+ popl %ecx
-+ popl %ebx
-+ popl %ebp
-+ ret
-+
-+
-+/*
-+ * unsigned char * graphics_get_font()
-+ * BIOS call "INT 10H Function 11h" to set font
-+ * Call with %ah = 0x11
-+ */
-+ENTRY(graphics_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
-+
-+
-+/*
-+ * graphics_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(graphics_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 /* SUPPORT_GRAPHICS */
-+
-+
- /*
- * getrtsecs()
- * if a seconds value can be read, read it and return it (BCD),
-diff -Naur grub-0.97.orig/stage2/builtins.c grub-0.97/stage2/builtins.c
---- grub-0.97.orig/stage2/builtins.c 2005-02-15 19:58:23.000000000 -0200
-+++ grub-0.97/stage2/builtins.c 2005-06-13 18:44:03.000000000 -0300
-@@ -28,6 +28,10 @@
- #include <filesys.h>
- #include <term.h>
-
-+#ifdef SUPPORT_GRAPHICS
-+# include <graphics.h>
-+#endif
-+
- #ifdef SUPPORT_NETBOOT
- # define GRUB 1
- # include <etherboot.h>
-@@ -237,12 +241,22 @@
- static int
- boot_func (char *arg, int flags)
- {
-+ struct term_entry *prev_term = current_term;
- /* Clear the int15 handler if we can boot the kernel successfully.
- This assumes that the boot code never fails only if KERNEL_TYPE is
- not KERNEL_TYPE_NONE. Is this assumption is bad? */
- if (kernel_type != KERNEL_TYPE_NONE)
- unset_int15_handler ();
-
-+ /* if our terminal needed initialization, we should shut it down
-+ * before booting the kernel, but we want to save what it was so
-+ * we can come back if needed */
-+ if (current_term->shutdown)
-+ {
-+ current_term->shutdown();
-+ current_term = term_table; /* assumption: console is first */
-+ }
-+
- #ifdef SUPPORT_NETBOOT
- /* Shut down the networking. */
- cleanup_net ();
-@@ -306,6 +320,13 @@
- return 1;
- }
-
-+ /* if we get back here, we should go back to what our term was before */
-+ current_term = prev_term;
-+ if (current_term->startup)
-+ /* if our terminal fails to initialize, fall back to console since
-+ * it should always work */
-+ if (current_term->startup() == 0)
-+ current_term = term_table; /* we know that console is first */
- return 0;
- }
-
-@@ -852,6 +873,251 @@
- };
- #endif /* SUPPORT_NETBOOT */
-
-+#ifdef SUPPORT_GRAPHICS
-+
-+static int splashimage_func(char *arg, int flags) {
-+ int i;
-+
-+ /* filename can only be 256 characters due to our buffer size */
-+ if (grub_strlen(arg) > 256) {
-+ grub_printf("Splash image filename too large\n");
-+ grub_printf("Press any key to continue...");
-+ getkey();
-+ return 1;
-+ }
-+
-+ /* get rid of TERM_NEED_INIT from the graphics terminal. */
-+ for (i = 0; term_table[i].name; i++) {
-+ if (grub_strcmp (term_table[i].name, "graphics") == 0) {
-+ term_table[i].flags &= ~TERM_NEED_INIT;
-+ break;
-+ }
-+ }
-+
-+ graphics_set_splash(arg);
-+
-+ if (flags == BUILTIN_CMDLINE && graphics_inited) {
-+ graphics_end();
-+ if (graphics_init() == 0) {
-+ /* Fallback to default term */
-+ current_term = term_table;
-+ max_lines = current_term->max_lines;
-+ if (current_term->cls)
-+ current_term->cls();
-+ grub_printf("Failed to set splash image and/or graphics mode\n");
-+ return 1;
-+ }
-+ graphics_cls();
-+ }
-+
-+ if (flags == BUILTIN_MENU)
-+ current_term = term_table + i;
-+
-+ return 0;
-+}
-+
-+static struct builtin builtin_splashimage =
-+{
-+ "splashimage",
-+ splashimage_func,
-+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
-+ "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 && graphics_inited) {
-+ graphics_end();
-+ graphics_init();
-+ graphics_cls();
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+static struct builtin builtin_shade =
-+{
-+ "shade",
-+ shade_func,
-+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
-+ "shade INTEGER",
-+ "If set to 0, disables the use of shaded text, else enables it."
-+};
-+
-+
-+/* 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 (graphics_inited)
-+ graphics_set_palette(15, r, g, b);
-+
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+static struct builtin builtin_foreground =
-+{
-+ "foreground",
-+ foreground_func,
-+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
-+ "foreground RRGGBB",
-+ "Sets the foreground color when in graphics mode."
-+ "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
-+};
-+
-+
-+/* 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 (graphics_inited)
-+ graphics_set_palette(0, r, g, b);
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+static struct builtin builtin_background =
-+{
-+ "background",
-+ background_func,
-+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
-+ "background RRGGBB",
-+ "Sets the background color when in graphics mode."
-+ "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
-+};
-+
-+
-+/* border */
-+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;
-+
-+ window_border = (r << 16) | (g << 8) | b;
-+ if (graphics_inited)
-+ graphics_set_palette(0x11, r, g, b);
-+
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+static struct builtin builtin_border =
-+{
-+ "border",
-+ border_func,
-+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
-+ "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."
-+};
-+
-+
-+/* viewport */
-+static int
-+viewport_func (char *arg, int flags)
-+{
-+ int i;
-+ int x0 = 0, y0 = 0, x1 = 80, y1 = 30;
-+ int *pos[4] = { &x0, &y0, &x1, &y1 };
-+
-+ 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;
-+ }
-+
-+ /* minimum size is 65 colums and 16 rows */
-+ if (x0 > x1 - 66 || y0 > y1 - 16 || x0 < 0 || y0 < 0 || x1 > 80 || y1 >
30)
-+ return 1;
-+
-+ view_x0 = x0;
-+ view_y0 = y0;
-+ view_x1 = x1;
-+ view_y1 = y1;
-+
-+ if (flags == BUILTIN_CMDLINE && graphics_inited) {
-+ graphics_end();
-+ graphics_init();
-+ graphics_cls();
-+ }
-+
-+ return 0;
-+}
-+
-+static struct builtin builtin_viewport =
-+{
-+ "viewport",
-+ viewport_func,
-+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
-+ "viewport x0 y0 x1 y1",
-+ "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 graphics interface."
-+};
-+
-+#endif /* SUPPORT_GRAPHICS */
-+
-+
-+/* clear */
-+static int
-+clear_func()
-+{
-+ if (current_term->cls)
-+ current_term->cls();
-+
-+ return 0;
-+}
-+
-+static struct builtin builtin_clear =
-+{
-+ "clear",
-+ clear_func,
-+ BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
-+ "clear",
-+ "Clear the screen"
-+};
-+
-
- /* displayapm */
- static int
-@@ -1454,14 +1720,20 @@
-
-
- /* 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 all = 0, max_short_doc_len, max_long_doc_len;
-+ max_short_doc_len = 39;
-+ max_long_doc_len = 66;
-+#ifdef SUPPORT_GRAPHICS
-+ if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1)
== 0)
-+ {
-+ max_short_doc_len = (view_x1 - view_x0 + 1) / 2 - 1;
-+ max_long_doc_len = (view_x1 - view_x0) - 14;
-+ }
-+#endif
-+
- if (grub_memcmp (arg, "--all", sizeof ("--all") - 1) == 0)
- {
- all = 1;
-@@ -1491,13 +1763,13 @@
-
- len = grub_strlen ((*builtin)->short_doc);
- /* If the length of SHORT_DOC is too long, truncate it. */
-- if (len > MAX_SHORT_DOC_LEN - 1)
-- len = MAX_SHORT_DOC_LEN - 1;
-+ if (len > max_short_doc_len - 1)
-+ len = max_short_doc_len - 1;
-
- for (i = 0; i < len; i++)
- grub_putchar ((*builtin)->short_doc[i]);
-
-- for (; i < MAX_SHORT_DOC_LEN; i++)
-+ for (; i < max_short_doc_len; i++)
- grub_putchar (' ');
-
- if (! left)
-@@ -1546,10 +1818,10 @@
- int i;
-
- /* If LEN is too long, fold DOC. */
-- if (len > MAX_LONG_DOC_LEN)
-+ if (len > max_long_doc_len)
- {
- /* Fold this line at the position of a space. */
-- for (len = MAX_LONG_DOC_LEN; len > 0; len--)
-+ for (len = max_long_doc_len; len > 0; len--)
- if (doc[len - 1] == ' ')
- break;
- }
-@@ -4085,7 +4357,7 @@
- };
-
-
--#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES)
-+#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) ||
defined(SUPPORT_GRAPHICS)
- /* terminal */
- static int
- terminal_func (char *arg, int flags)
-@@ -4244,17 +4516,29 @@
- end:
- current_term = term_table + default_term;
- current_term->flags = term_flags;
--
-+
- if (lines)
- max_lines = lines;
- else
-- /* 24 would be a good default value. */
-- max_lines = 24;
--
-+ max_lines = current_term->max_lines;
-+
- /* If the interface is currently the command-line,
- restart it to repaint the screen. */
-- if (current_term != prev_term && (flags & BUILTIN_CMDLINE))
-+ if ((current_term != prev_term) && (flags & BUILTIN_CMDLINE)){
-+ if (prev_term->shutdown)
-+ prev_term->shutdown();
-+ if (current_term->startup) {
-+ /* If startup fails, return to previous term */
-+ if (current_term->startup() == 0) {
-+ current_term = prev_term;
-+ max_lines = current_term->max_lines;
-+ if (current_term->cls) {
-+ current_term->cls();
-+ }
-+ }
-+ }
- grub_longjmp (restart_cmdline_env, 0);
-+ }
-
- return 0;
- }
-@@ -4264,7 +4548,7 @@
- "terminal",
- terminal_func,
- BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
-- "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES]
[--silent] [console] [serial] [hercules]",
-+ "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES]
[--silent] [console] [serial] [hercules] [graphics]",
- "Select a terminal. When multiple terminals are specified, wait until"
- " you push any key to continue. If both console and serial are specified,"
- " the terminal to which you input a key first will be selected. If no"
-@@ -4276,7 +4560,7 @@
- " seconds. The option --lines specifies the maximum number of lines."
- " The option --silent is used to suppress messages."
- };
--#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */
-+#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */
-
-
- #ifdef SUPPORT_SERIAL
-@@ -4795,13 +5079,20 @@
- /* The table of builtin commands. Sorted in dictionary order. */
- struct builtin *builtin_table[] =
- {
-+#ifdef SUPPORT_GRAPHICS
-+ &builtin_background,
-+#endif
- &builtin_blocklist,
- &builtin_boot,
- #ifdef SUPPORT_NETBOOT
- &builtin_bootp,
- #endif /* SUPPORT_NETBOOT */
-+#ifdef SUPPORT_GRAPHICS
-+ &builtin_border,
-+#endif
- &builtin_cat,
- &builtin_chainloader,
-+ &builtin_clear,
- &builtin_cmp,
- &builtin_color,
- &builtin_configfile,
-@@ -4821,6 +5112,9 @@
- &builtin_embed,
- &builtin_fallback,
- &builtin_find,
-+#ifdef SUPPORT_GRAPHICS
-+ &builtin_foreground,
-+#endif
- &builtin_fstest,
- &builtin_geometry,
- &builtin_halt,
-@@ -4864,9 +5158,13 @@
- #endif /* SUPPORT_SERIAL */
- &builtin_setkey,
- &builtin_setup,
--#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES)
-+#ifdef SUPPORT_GRAPHICS
-+ &builtin_shade,
-+ &builtin_splashimage,
-+#endif /* SUPPORT_GRAPHICS */
-+#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) ||
defined(SUPPORT_GRAPHICS)
- &builtin_terminal,
--#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */
-+#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */
- #ifdef SUPPORT_SERIAL
- &builtin_terminfo,
- #endif /* SUPPORT_SERIAL */
-@@ -4880,5 +5178,8 @@
- &builtin_unhide,
- &builtin_uppermem,
- &builtin_vbeprobe,
-+#ifdef SUPPORT_GRAPHICS
-+ &builtin_viewport,
-+#endif
- 0
- };
-diff -Naur grub-0.97.orig/stage2/char_io.c grub-0.97/stage2/char_io.c
---- grub-0.97.orig/stage2/char_io.c 2005-02-01 18:51:23.000000000 -0200
-+++ grub-0.97/stage2/char_io.c 2005-06-12 20:56:49.000000000 -0300
-@@ -29,12 +29,17 @@
- # include <serial.h>
- #endif
-
-+#ifdef SUPPORT_GRAPHICS
-+# include <graphics.h>
-+#endif
-+
- #ifndef STAGE1_5
- struct term_entry term_table[] =
- {
- {
- "console",
- 0,
-+ 24,
- console_putchar,
- console_checkkey,
- console_getkey,
-@@ -43,13 +48,16 @@
- console_cls,
- console_setcolorstate,
- console_setcolor,
-- console_setcursor
-+ console_setcursor,
-+ 0,
-+ 0
- },
- #ifdef SUPPORT_SERIAL
- {
- "serial",
- /* A serial device must be initialized. */
- TERM_NEED_INIT,
-+ 24,
- serial_putchar,
- serial_checkkey,
- serial_getkey,
-@@ -58,6 +66,8 @@
- serial_cls,
- serial_setcolorstate,
- 0,
-+ 0,
-+ 0,
- 0
- },
- #endif /* SUPPORT_SERIAL */
-@@ -65,6 +75,7 @@
- {
- "hercules",
- 0,
-+ 24,
- hercules_putchar,
- console_checkkey,
- console_getkey,
-@@ -73,11 +84,30 @@
- hercules_cls,
- hercules_setcolorstate,
- hercules_setcolor,
-- hercules_setcursor
-+ hercules_setcursor,
-+ 0,
-+ 0
- },
- #endif /* SUPPORT_HERCULES */
-+#ifdef SUPPORT_GRAPHICS
-+ { "graphics",
-+ TERM_NEED_INIT, /* flags */
-+ 30, /* number of lines */
-+ graphics_putchar, /* putchar */
-+ console_checkkey, /* checkkey */
-+ console_getkey, /* getkey */
-+ graphics_getxy, /* getxy */
-+ graphics_gotoxy, /* gotoxy */
-+ graphics_cls, /* cls */
-+ graphics_setcolorstate, /* setcolorstate */
-+ graphics_setcolor, /* setcolor */
-+ graphics_setcursor, /* nocursor */
-+ graphics_init, /* initialize */
-+ graphics_end /* shutdown */
-+ },
-+#endif /* SUPPORT_GRAPHICS */
- /* This must be the last entry. */
-- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
- };
-
- /* This must be console. */
-@@ -305,9 +335,10 @@
-
- /* 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
--
-+
-+ /* command-line limits */
-+ int cmdline_width = 78, col_start = 0;
- int xpos, lpos, c, section;
- /* The length of PROMPT. */
- int plen;
-@@ -338,7 +369,7 @@
-
- /* If the cursor is in the first section, display the first section
- instead of the second. */
-- if (section == 1 && plen + lpos < CMDLINE_WIDTH)
-+ if (section == 1 && plen + lpos < cmdline_width)
- cl_refresh (1, 0);
- else if (xpos - count < 1)
- cl_refresh (1, 0);
-@@ -354,7 +385,7 @@
- grub_putchar ('\b');
- }
- else
-- gotoxy (xpos, getxy () & 0xFF);
-+ gotoxy (xpos + col_start, getxy () & 0xFF);
- }
- }
-
-@@ -364,7 +395,7 @@
- lpos += count;
-
- /* If the cursor goes outside, scroll the screen to the right. */
-- if (xpos + count >= CMDLINE_WIDTH)
-+ if (xpos + count >= cmdline_width)
- cl_refresh (1, 0);
- else
- {
-@@ -383,7 +414,7 @@
- }
- }
- else
-- gotoxy (xpos, getxy () & 0xFF);
-+ gotoxy (xpos + col_start, getxy () & 0xFF);
- }
- }
-
-@@ -398,14 +429,14 @@
- if (full)
- {
- /* Recompute the section number. */
-- if (lpos + plen < CMDLINE_WIDTH)
-+ if (lpos + plen < cmdline_width)
- section = 0;
- else
-- section = ((lpos + plen - CMDLINE_WIDTH)
-- / (CMDLINE_WIDTH - 1 - CMDLINE_MARGIN) + 1);
-+ section = ((lpos + plen - cmdline_width)
-+ / (cmdline_width - 1 - CMDLINE_MARGIN) + 1);
-
- /* From the start to the end. */
-- len = CMDLINE_WIDTH;
-+ len = cmdline_width;
- pos = 0;
- grub_putchar ('\r');
-
-@@ -445,8 +476,8 @@
- if (! full)
- offset = xpos - 1;
-
-- start = ((section - 1) * (CMDLINE_WIDTH - 1 - CMDLINE_MARGIN)
-- + CMDLINE_WIDTH - plen - CMDLINE_MARGIN);
-+ start = ((section - 1) * (cmdline_width - 1 - CMDLINE_MARGIN)
-+ + cmdline_width - plen - CMDLINE_MARGIN);
- xpos = lpos + 1 - start;
- start += offset;
- }
-@@ -471,7 +502,7 @@
-
- /* If the cursor is at the last position, put `>' or a space,
- depending on if there are more characters in BUF. */
-- if (pos == CMDLINE_WIDTH)
-+ if (pos == cmdline_width)
- {
- if (start + len < llen)
- grub_putchar ('>');
-@@ -488,7 +519,7 @@
- grub_putchar ('\b');
- }
- else
-- gotoxy (xpos, getxy () & 0xFF);
-+ gotoxy (xpos + col_start, getxy () & 0xFF);
- }
-
- /* Initialize the command-line. */
-@@ -518,10 +549,10 @@
-
- llen += l;
- lpos += l;
-- if (xpos + l >= CMDLINE_WIDTH)
-+ if (xpos + l >= cmdline_width)
- cl_refresh (1, 0);
-- else if (xpos + l + llen - lpos > CMDLINE_WIDTH)
-- cl_refresh (0, CMDLINE_WIDTH - xpos);
-+ else if (xpos + l + llen - lpos > cmdline_width)
-+ cl_refresh (0, cmdline_width - xpos);
- else
- cl_refresh (0, l + llen - lpos);
- }
-@@ -533,12 +564,22 @@
- grub_memmove (buf + lpos, buf + lpos + count, llen - count + 1);
- llen -= count;
-
-- if (xpos + llen + count - lpos > CMDLINE_WIDTH)
-- cl_refresh (0, CMDLINE_WIDTH - xpos);
-+ if (xpos + llen + count - lpos > cmdline_width)
-+ cl_refresh (0, cmdline_width - xpos);
- else
- cl_refresh (0, llen + count - lpos);
- }
-
-+ max_lines = current_term->max_lines;
-+#ifdef SUPPORT_GRAPHICS
-+ if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1)
== 0)
-+ {
-+ cmdline_width = (view_x1 - view_x0) - 2;
-+ col_start = view_x0;
-+ max_lines = view_y1 - view_y0;
-+ }
-+#endif
-+
- plen = grub_strlen (prompt);
- llen = grub_strlen (cmdline);
-
-@@ -1006,6 +1047,48 @@
- }
- #endif /* ! STAGE1_5 */
-
-+#ifndef STAGE1_5
-+/* Internal pager. */
-+int
-+do_more (void)
-+{
-+ if (count_lines >= 0)
-+ {
-+ count_lines++;
-+ if (count_lines >= max_lines - 2)
-+ {
-+ int tmp;
-+
-+ /* It's important to disable the feature temporarily, because
-+ the following grub_printf call will print newlines. */
-+ count_lines = -1;
-+
-+ grub_printf("\n");
-+ if (current_term->setcolorstate)
-+ current_term->setcolorstate (COLOR_STATE_HIGHLIGHT);
-+
-+ grub_printf ("[Hit return to continue]");
-+
-+ if (current_term->setcolorstate)
-+ current_term->setcolorstate (COLOR_STATE_NORMAL);
-+
-+
-+ do
-+ {
-+ tmp = ASCII_CHAR (getkey ());
-+ }
-+ while (tmp != '\n' && tmp != '\r');
-+ grub_printf ("\r \r");
-+
-+ /* Restart to count lines. */
-+ count_lines = 0;
-+ return 1;
-+ }
-+ }
-+ return 0;
-+}
-+#endif
-+
- /* Display an ASCII character. */
- void
- grub_putchar (int c)
-@@ -1034,38 +1117,11 @@
-
- if (c == '\n')
- {
-+ int flag;
- /* Internal `more'-like feature. */
-- if (count_lines >= 0)
-- {
-- count_lines++;
-- if (count_lines >= max_lines - 2)
-- {
-- int tmp;
--
-- /* It's important to disable the feature temporarily, because
-- the following grub_printf call will print newlines. */
-- count_lines = -1;
--
-- if (current_term->setcolorstate)
-- current_term->setcolorstate (COLOR_STATE_HIGHLIGHT);
--
-- grub_printf ("\n[Hit return to continue]");
--
-- if (current_term->setcolorstate)
-- current_term->setcolorstate (COLOR_STATE_NORMAL);
--
-- do
-- {
-- tmp = ASCII_CHAR (getkey ());
-- }
-- while (tmp != '\n' && tmp != '\r');
-- grub_printf ("\r \r");
--
-- /* Restart to count lines. */
-- count_lines = 0;
-- return;
-- }
-- }
-+ flag = do_more ();
-+ if (flag)
-+ return;
- }
-
- current_term->putchar (c);
-@@ -1090,7 +1146,7 @@
- cls (void)
- {
- /* If the terminal is dumb, there is no way to clean the terminal. */
-- if (current_term->flags & TERM_DUMB)
-+ if (current_term->flags & TERM_DUMB)
- grub_putchar ('\n');
- else
- current_term->cls ();
-@@ -1217,6 +1273,16 @@
- return ! errnum;
- }
-
-+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];
-+}
-+
- void *
- grub_memmove (void *to, const void *from, int len)
- {
-diff -Naur grub-0.97.orig/stage2/cmdline.c grub-0.97/stage2/cmdline.c
---- grub-0.97.orig/stage2/cmdline.c 2004-08-16 20:23:01.000000000 -0300
-+++ grub-0.97/stage2/cmdline.c 2005-06-12 20:56:49.000000000 -0300
-@@ -50,10 +50,11 @@
- void
- print_cmdline_message (int forever)
- {
-- printf (" [ Minimal BASH-like line editing is supported. For the first
word, TAB\n"
-- " lists possible command completions. Anywhere else TAB lists the
possible\n"
-- " completions of a device/filename.%s ]\n",
-- (forever ? "" : " ESC at any time exits."));
-+ grub_printf(" [ Minimal BASH-like line editing is supported. For\n"
-+ " the first word, TAB lists possible command\n"
-+ " completions. Anywhere else TAB lists the possible\n"
-+ " completions of a device/filename.%s ]\n",
-+ (forever ? "" : " ESC at any time\n exits."));
- }
-
- /* Find the builtin whose command name is COMMAND and return the
-diff -Naur grub-0.97.orig/stage2/graphics.c grub-0.97/stage2/graphics.c
---- grub-0.97.orig/stage2/graphics.c 1969-12-31 21:00:00.000000000 -0300
-+++ grub-0.97/stage2/graphics.c 2005-06-13 19:13:31.000000000 -0300
-@@ -0,0 +1,584 @@
-+/*
-+ * graphics.c - graphics mode support for GRUB
-+ * Implemented as a terminal type by Jeremy Katz <katzj@xxxxxxxxxx> based
-+ * on a patch by Paulo César Pereira de Andrade <pcpa@xxxxxxxxxxxxxxxx>
-+ * Options and enhancements made by Herton Ronaldo Krzesinski
-+ * <herton@xxxxxxxxxxxx>
-+ *
-+ * GRUB -- GRand Unified Bootloader
-+ * Copyright (C) 2001,2002 Red Hat, Inc.
-+ * Portions copyright (C) 2000 Conectiva, Inc.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; If not, see <http://www.gnu.org/licenses/>
-+ */
-+
-+#ifdef SUPPORT_GRAPHICS
-+
-+#include <term.h>
-+#include <shared.h>
-+#include <graphics.h>
-+
-+int saved_videomode;
-+unsigned char *font8x16;
-+
-+int graphics_inited = 0;
-+static char splashimage[256];
-+
-+int shade = 1, no_cursor = 0;
-+
-+#define VSHADOW VSHADOW1
-+unsigned char VSHADOW1[38400];
-+unsigned char VSHADOW2[38400];
-+unsigned char VSHADOW4[38400];
-+unsigned char VSHADOW8[38400];
-+
-+/* define the default viewable area */
-+int view_x0 = 0;
-+int view_y0 = 0;
-+int view_x1 = 80;
-+int view_y1 = 30;
-+
-+/* text buffer has to be kept around so that we can write things as we
-+ * scroll and the like */
-+unsigned short text[80 * 30];
-+
-+/* graphics options */
-+int foreground = (63 << 16) | (63 << 8) | (63), background = 0, window_border
= 0;
-+
-+/* current position */
-+static int fontx = 0;
-+static int fonty = 0;
-+
-+/* global state so that we don't try to recursively scroll or cursor */
-+static int no_scroll = 0;
-+
-+/* color state */
-+static int graphics_standard_color = A_NORMAL;
-+static int graphics_normal_color = A_NORMAL;
-+static int graphics_highlight_color = A_REVERSE;
-+static int graphics_current_color = A_NORMAL;
-+static color_state graphics_color_state = COLOR_STATE_STANDARD;
-+
-+static inline void outb(unsigned short port, unsigned char val)
-+{
-+ __asm __volatile ("outb %0,%1"::"a" (val), "d" (port));
-+}
-+
-+static void MapMask(int value) {
-+ outb(0x3c4, 2);
-+ outb(0x3c5, value);
-+}
-+
-+/* bit mask register */
-+static void BitMask(int value) {
-+ outb(0x3ce, 8);
-+ outb(0x3cf, value);
-+}
-+
-+/* move the graphics cursor location to col, row */
-+static void graphics_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;
-+ }
-+}
-+
-+/* scroll the screen */
-+static void graphics_scroll() {
-+ int i, j, k;
-+
-+ /* we don't want to scroll recursively... that would be bad */
-+ if (no_scroll)
-+ return;
-+ no_scroll = 1;
-+
-+ /* disable pager temporarily */
-+ k = count_lines;
-+ count_lines = -1;
-+
-+ /* move everything up a line */
-+ for (j = view_y0 + 1; j < view_y1; j++) {
-+ graphics_gotoxy(view_x0, j - 1);
-+ for (i = view_x0; i < view_x1; i++) {
-+ graphics_putchar(text[j * 80 + i]);
-+ }
-+ }
-+
-+ /* last line should be blank */
-+ graphics_gotoxy(view_x0, view_y1 - 1);
-+ for (i = view_x0; i < view_x1; i++)
-+ graphics_putchar(' ');
-+ graphics_setxy(view_x0, view_y1 - 1);
-+
-+ count_lines = k;
-+
-+ no_scroll = 0;
-+}
-+
-+/* Set the splash image */
-+void graphics_set_splash(char *splashfile) {
-+ grub_strcpy(splashimage, splashfile);
-+}
-+
-+/* Get the current splash image */
-+char *graphics_get_splash(void) {
-+ return splashimage;
-+}
-+
-+/*
-+ * Initialize a vga16 graphics display with the palette based off of
-+ * the image in splashimage. If the image doesn't exist, leave graphics
-+ * mode. The mode initiated is 12h. From "Ralf Brown's Interrupt List":
-+ * text/ text pixel pixel colors disply scrn system
-+ * grph resol box resolution pages addr
-+ * 12h G 80x30 8x16 640x480 16/256K . A000 VGA,ATI VIP
-+ * G 80x30 8x16 640x480 16/64 . A000 ATI EGA Wonder
-+ * G . . 640x480 16 . . UltraVision+256K EGA
-+ */
-+int graphics_init()
-+{
-+ if (!graphics_inited) {
-+ saved_videomode = set_videomode(0x12);
-+ if (get_videomode() != 0x12) {
-+ set_videomode(saved_videomode);
-+ return 0;
-+ }
-+ graphics_inited = 1;
-+ }
-+ else
-+ return 1;
-+
-+ font8x16 = (unsigned char*)graphics_get_font();
-+
-+ /* make sure that the highlight color is set correctly */
-+ graphics_highlight_color = ((graphics_normal_color >> 4) |
-+ ((graphics_normal_color & 0xf) << 4));
-+
-+ graphics_cls();
-+
-+ if (!read_image(splashimage)) {
-+ grub_printf("Failed to read splash image (%s)\n", splashimage);
-+ grub_printf("Press any key to continue...");
-+ getkey();
-+ set_videomode(saved_videomode);
-+ graphics_inited = 0;
-+ return 0;
-+ }
-+
-+ set_int1c_handler();
-+
-+ return 1;
-+}
-+
-+/* Leave graphics mode */
-+void graphics_end(void)
-+{
-+ if (graphics_inited) {
-+ unset_int1c_handler();
-+ set_videomode(saved_videomode);
-+ graphics_inited = 0;
-+ no_cursor = 0;
-+ }
-+}
-+
-+/* Print ch on the screen. Handle any needed scrolling or the like */
-+void graphics_putchar(int ch) {
-+ ch &= 0xff;
-+
-+ graphics_cursor(0);
-+
-+ if (ch == '\n') {
-+ if (fonty + 1 < view_y1)
-+ graphics_setxy(fontx, fonty + 1);
-+ else
-+ graphics_scroll();
-+ graphics_cursor(1);
-+ return;
-+ } else if (ch == '\r') {
-+ graphics_setxy(view_x0, fonty);
-+ graphics_cursor(1);
-+ return;
-+ }
-+
-+ graphics_cursor(0);
-+
-+ text[fonty * 80 + fontx] = ch;
-+ text[fonty * 80 + fontx] &= 0x00ff;
-+ if (graphics_current_color & 0xf0)
-+ text[fonty * 80 + fontx] |= 0x100;
-+
-+ graphics_cursor(0);
-+
-+ if ((fontx + 1) >= view_x1) {
-+ graphics_setxy(view_x0, fonty);
-+ if (fonty + 1 < view_y1)
-+ graphics_setxy(view_x0, fonty + 1);
-+ else
-+ graphics_scroll();
-+ graphics_cursor(1);
-+ do_more ();
-+ graphics_cursor(0);
-+ } else {
-+ graphics_setxy(fontx + 1, fonty);
-+ }
-+
-+ graphics_cursor(1);
-+}
-+
-+/* get the current location of the cursor */
-+int graphics_getxy(void) {
-+ return (fontx << 8) | fonty;
-+}
-+
-+void graphics_gotoxy(int x, int y) {
-+ graphics_cursor(0);
-+
-+ graphics_setxy(x, y);
-+
-+ graphics_cursor(1);
-+}
-+
-+void graphics_cls(void) {
-+ int i;
-+ unsigned char *mem, *s1, *s2, *s4, *s8;
-+
-+ graphics_cursor(0);
-+ graphics_gotoxy(view_x0, view_y0);
-+
-+ mem = (unsigned char*)VIDEOMEM;
-+ 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] = ' ';
-+ graphics_cursor(1);
-+
-+ BitMask(0xff);
-+
-+ /* plane 1 */
-+ MapMask(1);
-+ grub_memcpy(mem, s1, 38400);
-+
-+ /* plane 2 */
-+ MapMask(2);
-+ grub_memcpy(mem, s2, 38400);
-+
-+ /* plane 3 */
-+ MapMask(4);
-+ grub_memcpy(mem, s4, 38400);
-+
-+ /* plane 4 */
-+ MapMask(8);
-+ grub_memcpy(mem, s8, 38400);
-+
-+ MapMask(15);
-+
-+ if (no_cursor) {
-+ no_cursor = 0;
-+ set_int1c_handler();
-+ }
-+}
-+
-+void graphics_setcolorstate (color_state state) {
-+ switch (state) {
-+ case COLOR_STATE_STANDARD:
-+ graphics_current_color = graphics_standard_color;
-+ break;
-+ case COLOR_STATE_NORMAL:
-+ graphics_current_color = graphics_normal_color;
-+ break;
-+ case COLOR_STATE_HIGHLIGHT:
-+ graphics_current_color = graphics_highlight_color;
-+ break;
-+ default:
-+ graphics_current_color = graphics_standard_color;
-+ break;
-+ }
-+
-+ graphics_color_state = state;
-+}
-+
-+void graphics_setcolor (int normal_color, int highlight_color) {
-+ graphics_normal_color = normal_color;
-+ graphics_highlight_color = highlight_color;
-+
-+ graphics_setcolorstate (graphics_color_state);
-+}
-+
-+int graphics_setcursor (int on) {
-+ if (!no_cursor && !on) {
-+ no_cursor = 1;
-+ unset_int1c_handler();
-+ graphics_cursor(0);
-+ }
-+ else if(no_cursor && on) {
-+ no_cursor = 0;
-+ set_int1c_handler();
-+ graphics_cursor(1);
-+ }
-+ return 0;
-+}
-+
-+/* Read in the splashscreen image and set the palette up appropriately.
-+ * Format of splashscreen is an xpm (can be gzipped) with 16 colors and
-+ * 640x480. */
-+int read_image(char *s)
-+{
-+ char buf[32], pal[16], c;
-+ unsigned char base, mask, *s1, *s2, *s4, *s8;
-+ unsigned i, len, idx, colors, x, y, width, height;
-+
-+ if (!grub_open(s))
-+ 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;
-+ graphics_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) {
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |