summarylogtreecommitdiffstats
path: root/snapshot.patch
diff options
context:
space:
mode:
Diffstat (limited to 'snapshot.patch')
-rw-r--r--snapshot.patch872
1 files changed, 872 insertions, 0 deletions
diff --git a/snapshot.patch b/snapshot.patch
new file mode 100644
index 000000000000..9388ccba7d1a
--- /dev/null
+++ b/snapshot.patch
@@ -0,0 +1,872 @@
+Description: Upstream snapshot up to 2009-07-02
+
+--- grub-0.97.orig/ChangeLog
++++ grub-0.97/ChangeLog
+@@ -1,3 +1,120 @@
++2009-07-02 Pavel Roskin <proski@gnu.org>
++
++ * docs/boot.S: Fix missing newline at the end.
++ * docs/boot.S.texi: Regenerate.
++
++2008-05-20 Robert Millan <rmh@aybabtu.com>
++
++ * netboot/cs89x0.c: Fix license violation.
++ * netboot/cs89x0.h: Likewise.
++
++2008-04-10 Pavel Roskin <proski@gnu.org>
++
++ * configure.ac: Always use "_cv_" in cache variables for
++ compatibility with Autoconf 2.62.
++
++2008-03-28 Robert Millan <rmh@aybabtu.com>
++
++ 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@gnu.org>
++
++ * 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@gnu.org>
++
++ * stage2/iso9660.h: Remove unnecessary packed attributes.
++
++2007-02-22 Robert Millan <rmh@aybabtu.com>
++
++ * util/mkbimage: Update my email address, and remove my name from
++ some places where unnecessary credit is given.
++
++2006-09-10 Pavel Roskin <proski@gnu.org>
++
++ * 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@gnu.org>
++
++ * 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 Robert Millan <robertmh@gnu.org>
++
++ * lib/device.c (write_to_partition): /dev/ataraid/ and /dev/rd/
++ partitions have a "p" prefix. Add it.
++
++2006-06-24 Robert Millan <robertmh@gnu.org>
++
++ * lib/device.c (get_i2o_disk_name): New function.
++ (init_device_map) [__linux__]: Add support for I2O devices.
++
++2006-05-02 Pavel Roskin <proski@gnu.org>
++
++ * 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@nic.fi>
++
++ * 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@gnu.org>
++
++ * grub/asmstub.c (get_diskinfo): Optimize sysctl routine.
++
++2006-04-20 Robert Millan <robertmh@gnu.org>
++
++ 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@enbug.org>
++
++ * docs/multiboot.texi: Correct the offset of address
++ fields. Reported by Jeroen Dekkers.
++
++2006-03-21 Yoshinori K. Okuji <okuji@enbug.org>
++
++ * stage2/builtins.c (setup_func): Specify the size of DEVICE to
++ grub_strncat instead of a strange number 256. Reported by Vitaly
++ Fertman <vitaly@namesys.com>.
++
++2005-09-29 Yoshinori K. Okuji <okuji@enbug.org>
++
++ * 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@enbug.org>
++
++ * 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@enbug.org>
+
+ * configure.ac (AC_INIT): Upgraded to 0.97.
+--- grub-0.97.orig/THANKS
++++ grub-0.97/THANKS
+@@ -92,7 +92,7 @@
+ Neal H Walfield <neal@walfield.org>
+ Neelkanth Natu <neelnatu@yahoo.com>
+ OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
+-Pavel Roskin <pavel_roskin@geocities.com>
++Pavel Roskin <proski@gnu.org>
+ Per Lundberg <plundis@byggdok.se>
+ Peter Astrand <altic@lysator.liu.se>
+ Ralf Medow <ralf.medow@t-online.de>
+@@ -121,3 +121,4 @@
+ Yedidyah Bar-David <didi@post.tau.ac.il>
+ Yury V. Umanets <umka@namesys.com>
+ Yuri Zaporogets <yuriz@ukr.net>
++Vitaly Fertman <vitaly@namesys.com>
+--- grub-0.97.orig/acinclude.m4
++++ grub-0.97/acinclude.m4
+@@ -57,7 +57,7 @@
+ 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
+--- grub-0.97.orig/configure.ac
++++ grub-0.97/configure.ac
+@@ -86,13 +86,13 @@
+ 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 @@
+ # 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 @@
+ 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")
+--- grub-0.97.orig/docs/boot.S
++++ grub-0.97/docs/boot.S
+@@ -77,4 +77,3 @@
+
+ /* Our stack area. */
+ .comm stack, STACK_SIZE
+-
+\ No newline at end of file
+--- grub-0.97.orig/docs/boot.S.texi
++++ grub-0.97/docs/boot.S.texi
+@@ -77,4 +77,3 @@
+
+ /* @r{Our stack area.} */
+ .comm stack, STACK_SIZE
+-
+\ No newline at end of file
+--- grub-0.97.orig/docs/grub.8
++++ grub-0.97/docs/grub.8
+@@ -1,5 +1,5 @@
+ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
+-.TH GRUB "8" "May 2005" "grub (GNU GRUB 0.97)" FSF
++.TH GRUB "8" "September 2005" "grub (GNU GRUB 0.97)" FSF
+ .SH NAME
+ grub \- the grub shell
+ .SH SYNOPSIS
+--- grub-0.97.orig/docs/multiboot.texi
++++ grub-0.97/docs/multiboot.texi
+@@ -25,7 +25,7 @@
+ @ifinfo
+ Copyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu>
+ Copyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org>
+-Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
++Copyright @copyright{} 1999, 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc.
+
+ Permission is granted to make and distribute verbatim copies of
+ this manual provided the copyright notice and this permission notice
+@@ -57,7 +57,7 @@
+ @vskip 0pt plus 1filll
+ Copyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu>
+ Copyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org>
+-Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
++Copyright @copyright{} 1999, 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc.
+
+ Permission is granted to make and distribute verbatim copies of
+ this manual provided the copyright notice and this permission notice
+@@ -80,7 +80,7 @@
+ @top Multiboot Specification
+
+ This file documents Multiboot Specification, the proposal for the boot
+-sequence standard. This edition documents version 0.6.93.
++sequence standard. This edition documents version 0.6.94.
+ @end ifnottex
+
+ @menu
+@@ -426,7 +426,7 @@
+ kernel.
+
+ If bit 16 in the @samp{flags} word is set, then the fields at offsets
+-8-24 in the Multiboot header are valid, and the boot loader should use
++12-28 in the Multiboot header are valid, and the boot loader should use
+ them instead of the fields in the actual executable header to calculate
+ where to load the OS image. This information does not need to be
+ provided if the kernel image is in @sc{elf} format, but it @emph{must}
+@@ -677,7 +677,7 @@
+ @example
+ @group
+ +-------+-------+-------+-------+
+-| drive | part1 | part2 | part3 |
++| part3 | part2 | part1 | drive |
+ +-------+-------+-------+-------+
+ @end group
+ @end example
+@@ -1197,6 +1197,13 @@
+ @item
+ The maintainer changes to the GNU GRUB maintainer team
+ @email{bug-grub@@gnu.org}, from Bryan Ford and Erich Stefan Boleyn.
++
++@item
++The byte order of the @samp{boot_device} in Multiboot information is
++reversed. This was a mistake.
++
++@item
++The offset of the address fields were wrong.
+ @end itemize
+
+ @item 0.6
+--- grub-0.97.orig/grub/asmstub.c
++++ grub-0.97/grub/asmstub.c
+@@ -55,6 +55,10 @@
+ # 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 @@
+
+ /* 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 @@
+
+ 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;
+--- grub-0.97.orig/grub/main.c
++++ grub-0.97/grub/main.c
+@@ -32,6 +32,7 @@
+ #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 @@
+ 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:
+--- grub-0.97.orig/lib/device.c
++++ grub-0.97/lib/device.c
+@@ -69,9 +69,9 @@
+ # 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 @@
+ /* 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 @@
+ {
+ 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 @@
+ }
+ }
+ }
++
++ /* 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 @@
+ 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. */
+--- grub-0.97.orig/netboot/cs89x0.c
++++ grub-0.97/netboot/cs89x0.c
+@@ -1,3 +1,21 @@
++/**
++ Per an email message from Russ Nelson <nelson@crynwr.com> on
++ 18 March 2008 this file is now licensed under GPL Version 2.
++
++ From: Russ Nelson <nelson@crynwr.com>
++ 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
+--- grub-0.97.orig/netboot/cs89x0.h
++++ grub-0.97/netboot/cs89x0.h
+@@ -1,3 +1,21 @@
++/**
++ Per an email message from Russ Nelson <nelson@crynwr.com> on
++ 18 March 2008 this file is now licensed under GPL Version 2.
++
++ From: Russ Nelson <nelson@crynwr.com>
++ 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
+--- grub-0.97.orig/netboot/etherboot.h
++++ grub-0.97/netboot/etherboot.h
+@@ -531,9 +531,6 @@
+ 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;
+--- grub-0.97.orig/netboot/main.c
++++ grub-0.97/netboot/main.c
+@@ -56,7 +56,8 @@
+ 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 @@
+
+ if (block == 0)
+ {
+- end_of_rfc1533 = NULL;
+ vendorext_isvalid = 0;
+
+ if (grub_memcmp (p, rfc1533_cookie, 4))
+@@ -1021,7 +1021,7 @@
+ }
+ else if (c == RFC1533_END)
+ {
+- end_of_rfc1533 = endp = p;
++ endp = p;
+ continue;
+ }
+ else if (c == RFC1533_NETMASK)
+--- grub-0.97.orig/netboot/natsemi.c
++++ grub-0.97/netboot/natsemi.c
+@@ -608,7 +608,7 @@
+ 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 @@
+
+ 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) {
+--- grub-0.97.orig/netboot/sis900.c
++++ grub-0.97/netboot/sis900.c
+@@ -901,7 +901,7 @@
+ 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 @@
+
+ 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) {
+--- grub-0.97.orig/stage1/Makefile.am
++++ grub-0.97/stage1/Makefile.am
+@@ -5,7 +5,7 @@
+
+ # 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
+--- grub-0.97.orig/stage2/bios.c
++++ grub-0.97/stage2/bios.c
+@@ -47,7 +47,7 @@
+ 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;
+
+--- grub-0.97.orig/stage2/boot.c
++++ grub-0.97/stage2/boot.c
+@@ -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 @@
+ 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)
+--- grub-0.97.orig/stage2/builtins.c
++++ grub-0.97/stage2/builtins.c
+@@ -3830,15 +3830,15 @@
+ {
+ 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)
+--- grub-0.97.orig/stage2/disk_io.c
++++ grub-0.97/stage2/disk_io.c
+@@ -137,7 +137,7 @@
+ }
+
+ 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 @@
+ */
+ 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 @@
+
+
+ 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 @@
+
+ #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 @@
+ }
+
+ 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
+--- grub-0.97.orig/stage2/iso9660.h
++++ grub-0.97/stage2/iso9660.h
+@@ -73,11 +73,11 @@
+
+ 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];
+
+--- grub-0.97.orig/stage2/shared.h
++++ grub-0.97/stage2/shared.h
+@@ -499,7 +499,11 @@
+ 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 @@
+ /* 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_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);
+--- grub-0.97.orig/stage2/stage2.c
++++ grub-0.97/stage2/stage2.c
+@@ -651,7 +651,10 @@
+ *(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 @@
+ 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))
+ {
+--- grub-0.97.orig/stamp-h.in
++++ grub-0.97/stamp-h.in
+@@ -0,0 +1 @@
++timestamp
+--- grub-0.97.orig/util/grub-install.in
++++ grub-0.97/util/grub-install.in
+@@ -112,8 +112,8 @@
+ 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%"`
+--- grub-0.97.orig/util/mkbimage
++++ grub-0.97/util/mkbimage
+@@ -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@polynum.org>
+-# C) 2001,2002,2003 Robert Millan <robertmh@gnu.org>
++# C) 2001,2002,2003 Robert Millan <rmh@aybabtu.com>
+
+
+ # This program is free software; you can redistribute it and/or modify
+@@ -94,15 +94,13 @@
+ display Version information and exit
+
+ Copyright (c) 2001,2002,2003 Thierry Laronde <tlaronde@polynum.org>.
+-Copyright (c) 2001,2002 Robert Millan <zeratul2@wanadoo.es>.
+ GPLed."
+
+ version="mkbimage $version_number
+
+-Written by Thierry Laronde and Robert Millan.
++Written by Thierry Laronde.
+
+ Copyright (c) 2001,2002,2003 Thierry Laronde <tlaronde@polynum.org>.
+-Copyright (c) 2001,2002,2003 Robert Millan <zeratul2@wanadoo.es>.
+
+ 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