[grub/f15/master] Update to current upstream git.

Peter Jones pjones at fedoraproject.org
Mon Mar 14 14:14:54 UTC 2011


commit 35ec4c3fa0f309d85619a1636421017f6a76f381
Author: Peter Jones <pjones at redhat.com>
Date:   Mon Mar 14 09:57:17 2011 -0400

    Update to current upstream git.

 grub-0.97-flat-file-install.patch            |   72 -
 grub-0.97-support-4k-sector-size.patch       |  889 -------------
 grub-0.97-uninitialized.patch                |   27 -
 grub-fedora-14.patch => grub-fedora-15.patch | 1807 +++++++++++++++++++-------
 grub.spec                                    |   14 +-
 5 files changed, 1346 insertions(+), 1463 deletions(-)
---
diff --git a/grub-fedora-14.patch b/grub-fedora-15.patch
similarity index 97%
rename from grub-fedora-14.patch
rename to grub-fedora-15.patch
index 4e09630..d2c3c8a 100644
--- a/grub-fedora-14.patch
+++ b/grub-fedora-15.patch
@@ -1,16 +1,171 @@
 From: Peter Jones <pjones at redhat.com>
-Date: Fri, 19 Nov 2010 11:25:00 -0500
-Subject: [PATCH] Changes from grub-0.97 to fedora-14
+Date: Mon, 14 Mar, 2011 09:29:00 -0500
+Subject: [PATCH] Changes from grub-0.97 to fedora-15
 
-This patch is a bundle of the changes between grub-0.97 and fedora-14.
+This patch is a bundle of the changes between grub-0.97 and fedora-15.
 It can be reginerated from the git repository at:
 
 http://git.kernel.org/?p=boot/grub-fedora/grub-fedora.git;a=summary
 
 Using the command:
 
-git diff grub-0.97 fedora-14
+git diff grub-0.97 fedora-15
 
+ b/.gitignore                     |    8 
+ b/ChangeLog                      |   48 
+ b/Makefile.am                    |    3 
+ b/Makefile.in                    |  175 
+ b/acinclude.m4                   |    4 
+ b/aclocal.m4                     |  555 --
+ b/config.h.in                    |    5 
+ b/configure.in                   |  113 
+ b/docs/.gitignore                |    3 
+ b/docs/Makefile.am               |    9 
+ b/docs/Makefile.in               |  260 -
+ b/docs/grub-crypt.8              |   39 
+ b/docs/grub-install.8            |    2 
+ b/docs/grub.8                    |    2 
+ b/docs/grub.info                 |  370 -
+ b/docs/grub.texi                 |   79 
+ b/docs/stamp-vti                 |    4 
+ b/docs/version.texi              |    4 
+ b/efi/.gitignore                 |    7 
+ b/efi/Makefile.am                |   76 
+ b/efi/byteswap.h                 |   37 
+ b/efi/dhcp.h                     |  133 
+ b/efi/efichainloader.c           |  267 +
+ b/efi/eficon.c                   |  308 +
+ b/efi/eficore.c                  |  233 +
+ b/efi/efidisk.c                  |  787 ++++
+ b/efi/efidp.c                    |  984 +++++
+ b/efi/efigraph.c                 | 1461 +++++++
+ b/efi/efimain.c                  |  129 
+ b/efi/efimisc.c                  |  667 +++
+ b/efi/efimm.c                    |  514 ++
+ b/efi/efiserial.c                |  267 +
+ b/efi/efitftp.c                  |  230 +
+ b/efi/efiuga.c                   |  948 ++++
+ b/efi/font_8x16.c                | 4638 +++++++++++++++++++++++
+ b/efi/graphics.c                 |  570 ++
+ b/efi/graphics.h                 |   79 
+ b/efi/grub/.gitignore            |    1 
+ b/efi/grub/efi/api.h             | 1471 +++++++
+ b/efi/grub/efi/console_control.h |   59 
+ b/efi/grub/efi/efi.h             |   79 
+ b/efi/grub/efi/eficall.h         |   97 
+ b/efi/grub/efi/misc.h            |   58 
+ b/efi/grub/efi/time.h            |   31 
+ b/efi/grub/i386/linux.h          |  226 +
+ b/efi/grub/i386/types.h          |   32 
+ b/efi/grub/misc.h                |   71 
+ b/efi/grub/symbol.h              |   34 
+ b/efi/grub/types.h               |  158 
+ b/efi/grub/x86_64/linux.h        |  228 +
+ b/efi/grub/x86_64/types.h        |   32 
+ b/efi/ia32/callwrap.c            |  131 
+ b/efi/ia32/loader/bin_to_h.c     |   29 
+ b/efi/ia32/loader/linux.c        |  648 +++
+ b/efi/ia32/loader/switch.S       |  118 
+ b/efi/ia32/loader/switch.h       |   19 
+ b/efi/ia32/reloc.c               |   79 
+ b/efi/ia32/setjmp.S              |   86 
+ b/efi/pxe.c                      |  444 ++
+ b/efi/pxe.h                      |  237 +
+ b/efi/ugadebug.h                 |  201 +
+ b/efi/x86_64/callwrap.c          |  395 ++
+ b/efi/x86_64/crt0-efi.S          |   63 
+ b/efi/x86_64/elf_efi.lds         |   58 
+ b/efi/x86_64/loader/Makefile     |   20 
+ b/efi/x86_64/loader/bin_to_h.c   |   29 
+ b/efi/x86_64/loader/linux.c      |  588 +++
+ b/efi/x86_64/loader/switch.S     |   92 
+ b/efi/x86_64/loader/switch.h     |   25 
+ b/efi/x86_64/reloc.c             |   79 
+ b/efi/x86_64/setjmp.S            |   56 
+ b/efi/xpm.c                      |  231 +
+ b/efi/xpm.h                      |   36 
+ b/grub.spec                      |  438 ++
+ b/grub/.gitignore                |    2 
+ b/grub/Makefile.am               |    2 
+ b/grub/Makefile.in               |  117 
+ b/grub/asmstub.c                 |  194 
+ b/grub/efitftp.c                 |   34 
+ b/grub/main.c                    |    2 
+ b/lib/.gitignore                 |    2 
+ b/lib/Makefile.in                |  111 
+ b/lib/device.c                   |  360 +
+ b/netboot/.gitignore             |    2 
+ b/netboot/Makefile.in            |  359 -
+ b/netboot/etherboot.h            |   34 
+ b/netboot/main.c                 |    6 
+ b/netboot/misc.c                 |   58 
+ b/netboot/osdep.h                |   24 
+ b/stage1/.gitignore              |    2 
+ b/stage1/Makefile.am             |   15 
+ b/stage1/Makefile.in             |  169 
+ b/stage1/stage1.S                |    4 
+ b/stage2/.gitignore              |    5 
+ b/stage2/Makefile.am             |   73 
+ b/stage2/Makefile.in             | 1729 +++++---
+ b/stage2/asm.S                   |  284 +
+ b/stage2/boot.c                  |  114 
+ b/stage2/builtins.c              | 1312 ++++--
+ b/stage2/char_io.c               |  609 ++-
+ b/stage2/cmdline.c               |   19 
+ b/stage2/common.c                |   16 
+ b/stage2/disk_io.c               |  198 -
+ b/stage2/efistubs.c              |    7 
+ b/stage2/efistubs.h              |    8 
+ b/stage2/fat.h                   |    2 
+ b/stage2/filesys.h               |   17 
+ b/stage2/fsys_ext2fs.c           |  394 +-
+ b/stage2/fsys_fat.c              |   41 
+ b/stage2/fsys_iso9660.c          |    6 
+ b/stage2/fsys_jfs.c              |   12 
+ b/stage2/fsys_minix.c            |   10 
+ b/stage2/fsys_reiserfs.c         |   44 
+ b/stage2/fsys_vstafs.c           |   28 
+ b/stage2/fsys_xfs.c              |   22 
+ b/stage2/gpt.h                   |   69 
+ b/stage2/graphics.c              |  573 ++
+ b/stage2/graphics.h              |   42 
+ b/stage2/gunzip.c                |   15 
+ b/stage2/iso9660.h               |    4 
+ b/stage2/mb_info.h               |    4 
+ b/stage2/pc_slice.h              |   51 
+ b/stage2/serial.c                |    4 
+ b/stage2/sha256crypt.c           |  723 +++
+ b/stage2/sha512crypt.c           |  795 ++++
+ b/stage2/shared.h                |  118 
+ b/stage2/smp-imps.h              |    1 
+ b/stage2/stage1_5.c              |    3 
+ b/stage2/stage2.c                |  203 -
+ b/stage2/start.S                 |   13 
+ b/stage2/term.h                  |   35 
+ b/stage2/tparm.c                 |   14 
+ b/test                           |    1 
+ b/util/.gitignore                |    7 
+ b/util/Makefile.am               |   11 
+ b/util/Makefile.in               |  131 
+ b/util/grub-crypt.in             |   80 
+ b/util/grub-install.in           |  334 +
+ configure                        | 7639 ---------------------------------------
+ 139 files changed, 27375 insertions(+), 10639 deletions(-)
+
+diff --git a/.gitignore b/.gitignore
+new file mode 100644
+index 0000000..4e19579
+--- /dev/null
++++ b/.gitignore
+@@ -0,0 +1,8 @@
++Makefile.in
++Makefile
++configure
++autom4te.cache
++config.h
++config.log
++config.status
++stamp-h1
 diff --git a/ChangeLog b/ChangeLog
 index 0f93033..9602fb9 100644
 --- a/ChangeLog
@@ -8960,10 +9115,10 @@ diff --git a/configure.ac b/configure.in
 similarity index 86%
 rename from configure.ac
 rename to configure.in
-index bb9e1d9..baa1229 100644
+index bb9e1d9..e9745e6 100644
 --- a/configure.ac
 +++ b/configure.in
-@@ -29,6 +29,63 @@ esac
+@@ -29,6 +29,65 @@ esac
  AC_SUBST(host_cpu)
  AC_SUBST(host_vendor)
  
@@ -9016,6 +9171,8 @@ index bb9e1d9..baa1229 100644
 +AC_SUBST(GNUEFI_LDS)
 +LIBGNUEFI=${libdir}/libgnuefi.a
 +AC_SUBST(LIBGNUEFI)
++LIBEFI=${libdir}/libefi.a
++AC_SUBST(LIBEFI)
 +
 +AC_SUBST(platform)
 +AM_CONDITIONAL(PLATFORM_EFI, test "x$platform" = xefi)
@@ -9027,7 +9184,7 @@ index bb9e1d9..baa1229 100644
  #
  # Options
  #
-@@ -46,7 +103,7 @@ if test "x$CFLAGS" = x; then
+@@ -46,7 +105,7 @@ if test "x$CFLAGS" = x; then
    default_CFLAGS=yes
  fi
  
@@ -9036,7 +9193,7 @@ index bb9e1d9..baa1229 100644
    CFLAGS="-m32 $CFLAGS"
  fi
  
-@@ -63,6 +120,8 @@ dnl Because recent automake complains about AS, set it here.
+@@ -63,6 +122,8 @@ dnl Because recent automake complains about AS, set it here.
  CCAS="$CC"
  AC_SUBST(CCAS)
  
@@ -9045,7 +9202,7 @@ index bb9e1d9..baa1229 100644
  AC_ARG_WITH(binutils,
    [  --with-binutils=DIR     search the directory DIR to find binutils])
  
-@@ -114,6 +173,20 @@ if test "x$ac_cv_prog_gcc" = xyes; then
+@@ -114,6 +175,20 @@ if test "x$ac_cv_prog_gcc" = xyes; then
      fi
    fi
  fi
@@ -9066,7 +9223,7 @@ index bb9e1d9..baa1229 100644
  
  AC_SUBST(STAGE1_CFLAGS)
  AC_SUBST(STAGE2_CFLAGS)
-@@ -159,9 +232,12 @@ fi
+@@ -159,9 +234,12 @@ fi
  
  # Defined in acinclude.m4.
  grub_ASM_USCORE
@@ -9082,7 +9239,7 @@ index bb9e1d9..baa1229 100644
  fi
  
  grub_ASM_PREFIX_REQUIREMENT
-@@ -207,9 +283,9 @@ AC_CHECK_LIB(util, opendisk, [GRUB_LIBS="$GRUB_LIBS -lutil"
+@@ -207,9 +285,9 @@ AC_CHECK_LIB(util, opendisk, [GRUB_LIBS="$GRUB_LIBS -lutil"
  
  # Unless the user specify --without-curses, check for curses.
  if test "x$with_curses" != "xno"; then
@@ -9094,7 +9251,7 @@ index bb9e1d9..baa1229 100644
         AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])])])
  fi
  
-@@ -595,9 +671,18 @@ AC_ARG_ENABLE(diskless,
+@@ -595,9 +673,18 @@ AC_ARG_ENABLE(diskless,
    [  --enable-diskless       enable diskless support])
  AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes)
  
@@ -9115,7 +9272,7 @@ index bb9e1d9..baa1229 100644
  AM_CONDITIONAL(HERCULES_SUPPORT, test "x$enable_hercules" != xno)
  
  dnl Serial terminal
-@@ -662,9 +747,13 @@ AC_SUBST(CCASFLAGS)
+@@ -662,9 +749,13 @@ AC_SUBST(CCASFLAGS)
  
  
  dnl Output.
@@ -9132,6 +9289,15 @@ index bb9e1d9..baa1229 100644
 +		 util/grub-image util/grub-install util/grub-md5-crypt \
 +		 util/grub-terminfo])
  AC_OUTPUT
+diff --git a/docs/.gitignore b/docs/.gitignore
+new file mode 100644
+index 0000000..e440faf
+--- /dev/null
++++ b/docs/.gitignore
+@@ -0,0 +1,3 @@
++Makefile.in
++Makefile
++.deps
 diff --git a/docs/Makefile.am b/docs/Makefile.am
 index db99e2d..fe6b22b 100644
 --- a/docs/Makefile.am
@@ -10418,9 +10584,22 @@ index b97de24..eb5144d 100644
 + at set UPDATED-MONTH August 2007
  @set EDITION 0.97
  @set VERSION 0.97
+diff --git a/efi/.gitignore b/efi/.gitignore
+new file mode 100644
+index 0000000..a0e4294
+--- /dev/null
++++ b/efi/.gitignore
+@@ -0,0 +1,7 @@
++.deps
++Makefile.in
++Makefile
++*.a
++*.o
++*.so
++*.efi
 diff --git a/efi/Makefile.am b/efi/Makefile.am
 new file mode 100644
-index 0000000..4cffe7d
+index 0000000..88a82fd
 --- /dev/null
 +++ b/efi/Makefile.am
 @@ -0,0 +1,76 @@
@@ -10473,7 +10652,7 @@ index 0000000..4cffe7d
 +                   -j .rela -j .reloc --target=$(GRUBEFI_FORMAT) $^ $@
 +
 +grub.so: $(GRUBSO_OBJS) $(GRUBSO_LIBS) @LIBGNUEFI@
-+	$(LD) -o $@ $(GRUBSO_LD_FLAGS) $^
++	$(LD) -o $@ $(GRUBSO_LD_FLAGS) $^ @LIBEFI@
 +	echo '-------------- unresolved symbols ---------------------'
 +	! nm $@ | grep -iw u
 +	echo '-------------------------------------------------------'
@@ -10684,10 +10863,10 @@ index 0000000..a82a522
 +#endif /* DHCP_H */
 diff --git a/efi/efichainloader.c b/efi/efichainloader.c
 new file mode 100644
-index 0000000..016636c
+index 0000000..307048b
 --- /dev/null
 +++ b/efi/efichainloader.c
-@@ -0,0 +1,265 @@
+@@ -0,0 +1,267 @@
 +/* efichainloader.c - boot another boot loader */
 +/*
 + *  GRUB  --  GRand Unified Bootloader
@@ -10716,6 +10895,8 @@ index 0000000..016636c
 +
 +#include <shared.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +#define grub_file_size()    filemax
 +
 +static grub_efi_physical_address_t address;
@@ -10955,10 +11136,10 @@ index 0000000..016636c
 +}
 diff --git a/efi/eficon.c b/efi/eficon.c
 new file mode 100644
-index 0000000..037f050
+index 0000000..2a04247
 --- /dev/null
 +++ b/efi/eficon.c
-@@ -0,0 +1,306 @@
+@@ -0,0 +1,308 @@
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2006  Free Software Foundation, Inc.
@@ -10984,6 +11165,8 @@ index 0000000..037f050
 +#include <grub/efi/api.h>
 +#include <grub/efi/misc.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +#include <shared.h>
 +#include <term.h>
 +
@@ -11267,10 +11450,10 @@ index 0000000..037f050
 +}
 diff --git a/efi/eficore.c b/efi/eficore.c
 new file mode 100644
-index 0000000..259c5dc
+index 0000000..ff61fb0
 --- /dev/null
 +++ b/efi/eficore.c
-@@ -0,0 +1,231 @@
+@@ -0,0 +1,233 @@
 +/* eficore.c - generic EFI support */
 +/*
 + *  GRUB  --  GRand Unified Bootloader
@@ -11299,6 +11482,8 @@ index 0000000..259c5dc
 +#include <grub/efi/console_control.h>
 +#include <grub/efi/time.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +#include <shared.h>
 +
 +/* The handle of GRUB itself. Filled in by the startup code.  */
@@ -11504,10 +11689,10 @@ index 0000000..259c5dc
 +
 diff --git a/efi/efidisk.c b/efi/efidisk.c
 new file mode 100644
-index 0000000..145ed16
+index 0000000..9d94951
 --- /dev/null
 +++ b/efi/efidisk.c
-@@ -0,0 +1,740 @@
+@@ -0,0 +1,787 @@
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2006  Free Software Foundation, Inc.
@@ -11533,6 +11718,8 @@ index 0000000..145ed16
 +#include <grub/efi/efi.h>
 +#include <grub/efi/misc.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +#include <shared.h>
 +
 +struct grub_efidisk_data
@@ -11554,6 +11741,10 @@ index 0000000..145ed16
 +static struct grub_efidisk_data *hd_devices;
 +static struct grub_efidisk_data *cd_devices;
 +
++static int get_device_sector_bits(struct grub_efidisk_data *device);
++static int get_device_sector_size(struct grub_efidisk_data *device);
++static struct grub_efidisk_data *get_device_from_drive (int drive);
++
 +static struct grub_efidisk_data *
 +make_devices (void)
 +{
@@ -11700,7 +11891,9 @@ index 0000000..145ed16
 +      m = d->block_io->media;
 +      if (GRUB_EFI_DEVICE_PATH_TYPE(dp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE)
 +	{
-+	  if (m->read_only && m->block_size > SECTOR_SIZE)
++	  /* XXX FIXME this won't work if we see write-protected disks with
++	   * 4k sectors */
++	  if (m->read_only && m->block_size > 0x200)
 +	    {
 +	      add_device (&cd_devices, d);
 +	    } else
@@ -11763,13 +11956,12 @@ index 0000000..145ed16
 +  grub_efi_disk_io_t *dio;
 +  grub_efi_block_io_t *bio;
 +  grub_efi_status_t status;
-+  grub_efi_uint64_t sector_size;
++  grub_efi_uint64_t sector_size = get_device_sector_size(d);
 +
 +  dio = d->disk_io;
 +  bio = d->block_io;
-+  sector_size = d->block_io->media->block_size;
 +
-+  status = Call_Service_5 (dio->read ,
++  status = Call_Service_5 (dio->read,
 +			   dio, bio->media->media_id,
 +			   sector * sector_size,
 +			   size * sector_size,
@@ -11788,11 +11980,10 @@ index 0000000..145ed16
 +  grub_efi_disk_io_t *dio;
 +  grub_efi_block_io_t *bio;
 +  grub_efi_status_t status;
-+  grub_efi_uint64_t sector_size;
++  grub_efi_uint64_t sector_size = get_device_sector_size(d);
 +
 +  dio = d->disk_io;
 +  bio = d->block_io;
-+  sector_size = d->block_io->media->block_size;
 +
 +  grub_dprintf ("efidisk",
 +		"writing 0x%x sectors at the sector 0x%x to ??\n",
@@ -11823,6 +12014,47 @@ index 0000000..145ed16
 +  free_devices (cd_devices);
 +}
 +
++static int
++get_device_sector_size(struct grub_efidisk_data *device)
++{
++	return device->block_io->media->block_size;
++}
++
++int
++get_sector_size(int drive)
++{
++	struct grub_efidisk_data *device = get_device_from_drive(drive);
++	return get_device_sector_size(device);
++}
++
++/*
++ * ffz = Find First Zero in word. Undefined if no zero exists,
++ * so code should check against ~0UL first..
++ */
++static __inline__ unsigned int
++ffz (unsigned int word)
++{
++  __asm__ ("bsfl %1,%0"
++:	   "=r" (word)
++:	   "r" (~word));
++  return word;
++}
++#define log2(n) ffz(~(n))
++
++static int
++get_device_sector_bits(struct grub_efidisk_data *device)
++{
++	int sector_size = get_device_sector_size(device);
++	return log2(sector_size);
++}
++
++int
++get_sector_bits(int drive)
++{
++	int sector_size = get_sector_size(drive);
++	return log2(sector_size);
++}
++
 +static struct grub_efidisk_data *
 +get_device_from_drive (int drive)
 +{
@@ -11966,7 +12198,6 @@ index 0000000..145ed16
 +  unsigned long partition_start, partition_len, part_offset, part_extoffset;
 +  unsigned long gpt_offset;
 +  int gpt_count, gpt_size;
-+  char buf[SECTOR_SIZE];
 +  auto int find_bdev (struct grub_efidisk_data *c);
 +
 +  int find_bdev (struct grub_efidisk_data *c)
@@ -12051,6 +12282,7 @@ index 0000000..145ed16
 +  if (! found)
 +    return 0;
 +
++  char buf[get_sector_size(drv)];
 +  part = 0xFFFFFF;
 +  while (next_partition (drv, 0, &part, &part_type,
 +			 &partition_start, &partition_len,
@@ -13240,10 +13472,10 @@ index 0000000..3e0019d
 +}
 diff --git a/efi/efigraph.c b/efi/efigraph.c
 new file mode 100644
-index 0000000..51bfc2d
+index 0000000..9f309c7
 --- /dev/null
 +++ b/efi/efigraph.c
-@@ -0,0 +1,1457 @@
+@@ -0,0 +1,1461 @@
 +/* efigraph.c - EFI "graphics output" support for GRUB/EFI */
 +/*
 + *  GRUB  --  GRand Unified Bootloader
@@ -13280,6 +13512,8 @@ index 0000000..51bfc2d
 +#include <shared.h>
 +#include <graphics.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +#include "graphics.h"
 +#include "xpm.h"
 +
@@ -13406,7 +13640,7 @@ index 0000000..51bfc2d
 +get_graphics_mode_info_for_mode(struct eg *eg, int mode)
 +{
 +	int i;
-+	
++
 +	for (i = 0; i < eg->max_mode; i++) {
 +		if (eg->modes[i] == NULL)
 +			continue;
@@ -13460,7 +13694,7 @@ index 0000000..51bfc2d
 +            struct linux_kernel_params *params)
 +{
 +    struct eg *eg;
-+    
++
 +    if (!backend || !backend->priv)
 +        return;
 +
@@ -13502,7 +13736,7 @@ index 0000000..51bfc2d
 +            params->reserved_mask_size = 8;
 +            params->reserved_field_pos = 24;
 +            params->lfb_line_len = gop_info->pixels_per_scan_line * 4;
-+        } else if (gop_info->pixel_format == 
++        } else if (gop_info->pixel_format ==
 +                GRUB_EFI_PIXEL_BGRR_8BIT_PER_COLOR) {
 +            params->lfb_depth = 32;
 +            params->red_mask_size = 8;
@@ -13691,7 +13925,7 @@ index 0000000..51bfc2d
 +                blue >>= 8 - pinfo->blue_size;
 +#endif
 +
-+                color = (red << pinfo->red_pos) | 
++                color = (red << pinfo->red_pos) |
 +                        (green << pinfo->green_pos) |
 +                        (blue << pinfo->blue_pos);
 +                colorp = (void *)&color;
@@ -13726,7 +13960,7 @@ index 0000000..51bfc2d
 +                    shadow[x].rgbr.green = pixel[x].bgrr.green;
 +                    shadow[x].rgbr.blue = pixel[x].bgrr.blue;
 +                }
-+            
++
 +                memmove(raw_pixels, shadow, maxpixels * sizeof (*pixel));
 +            } else if (info->pixel_format == GRUB_EFI_PIXEL_BIT_MASK) {
 +                for (x = 0; x < maxpixels; x++) {
@@ -13753,7 +13987,7 @@ index 0000000..51bfc2d
 +                    blue >>= 8 - pinfo->blue_size;
 +#endif
 +
-+                    color = (red << pinfo->red_pos) | 
++                    color = (red << pinfo->red_pos) |
 +                            (green << pinfo->green_pos) |
 +                            (blue << pinfo->blue_pos);
 +                    colorp = (void *)&color;
@@ -13868,7 +14102,7 @@ index 0000000..51bfc2d
 +bltbuf_get_pixel_idx(struct bltbuf *bltbuf, position_t *pos, int *idx)
 +{
 +    grub_efi_graphics_output_pixel_t pixel;
-+    
++
 +    rgb_to_pixel(0, 0, 0, &pixel);
 +    bltbuf_get_pixel(bltbuf, pos, &pixel);
 +    for (*idx = 0; *idx < 16; (*idx)++) {
@@ -13890,7 +14124,7 @@ index 0000000..51bfc2d
 +        for (pos.x = 0; pos.x < xpm->width; pos.x++) {
 +            xpm_pixel_t xpl;
 +            unsigned char idx;
-+        
++
 +            idx = xpm_get_pixel_idx(xpm, pos.x, pos.y);
 +            xpm_get_idx(xpm, idx, &xpl);
 +
@@ -13909,9 +14143,9 @@ index 0000000..51bfc2d
 +    unsigned short *text;
 +    position_t fpos, screensz;
 +    int offset;
-+    
++
 +    eg = backend->priv;
-+    
++
 +    if (set && !graphics_get_scroll())
 +        return;
 +
@@ -14169,7 +14403,7 @@ index 0000000..51bfc2d
 +
 +    if (glyphpos.x < 0 || glyphpos.y < 0)
 +        return 0;
-+        
++
 +    ch = text[glyphpos.y * screensz.x + glyphpos.x] & 0xff;
 +    glyph = font8x16 + (ch << 4);
 +    return glyph[glyphbit.y] & (1 << ((fontsz.x-1) - glyphbit.x));
@@ -14523,7 +14757,7 @@ index 0000000..51bfc2d
 +try_enable(struct graphics_backend *backend)
 +{
 +    struct eg *eg = backend->priv;
-+    grub_efi_status_t efi_status;
++    grub_efi_status_t efi_status = GRUB_EFI_UNSUPPORTED;
 +    int i;
 +
 +    if (eg->text_mode == 0xffffffff) {
@@ -14556,6 +14790,8 @@ index 0000000..51bfc2d
 +	dbgdelay(__FILE__, __LINE__);
 +#endif
 +
++	efi_status = GRUB_EFI_UNSUPPORTED;
++
 +        for (i = eg->max_mode - 1; i >= 0; i--) {
 +            if (!eg->modes[i])
 +                continue;
@@ -14838,10 +15074,10 @@ index 0000000..e1a1e66
 +}
 diff --git a/efi/efimisc.c b/efi/efimisc.c
 new file mode 100644
-index 0000000..480ba25
+index 0000000..7b306c8
 --- /dev/null
 +++ b/efi/efimisc.c
-@@ -0,0 +1,665 @@
+@@ -0,0 +1,667 @@
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2006  Free Software Foundation, Inc.
@@ -14868,6 +15104,8 @@ index 0000000..480ba25
 +#include <grub/efi/misc.h>
 +#include <grub/misc.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +#include <shared.h>
 +
 +unsigned long install_partition = 0x20000;
@@ -15509,10 +15747,10 @@ index 0000000..480ba25
 +}
 diff --git a/efi/efimm.c b/efi/efimm.c
 new file mode 100644
-index 0000000..c3cbfc4
+index 0000000..776608a
 --- /dev/null
 +++ b/efi/efimm.c
-@@ -0,0 +1,512 @@
+@@ -0,0 +1,514 @@
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2006  Free Software Foundation, Inc.
@@ -15539,6 +15777,8 @@ index 0000000..c3cbfc4
 +#include <grub/efi/efi.h>
 +#include <grub/efi/misc.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +#include <shared.h>
 +
 +#define NEXT_MEMORY_DESCRIPTOR(desc, size)	\
@@ -16030,10 +16270,10 @@ new file mode 100644
 index 0000000..e69de29
 diff --git a/efi/efiserial.c b/efi/efiserial.c
 new file mode 100644
-index 0000000..32898a9
+index 0000000..c8c3fda
 --- /dev/null
 +++ b/efi/efiserial.c
-@@ -0,0 +1,265 @@
+@@ -0,0 +1,267 @@
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2007 Intel Corp.
@@ -16065,6 +16305,8 @@ index 0000000..32898a9
 +#include <serial.h>
 +#include <term.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +struct grub_efiserial_data
 +{
 +  grub_efi_handle_t handle;
@@ -16301,15 +16543,17 @@ index 0000000..32898a9
 +#endif /* SUPPORT_SERIAL */
 diff --git a/efi/efitftp.c b/efi/efitftp.c
 new file mode 100644
-index 0000000..ba6918f
+index 0000000..d11fd75
 --- /dev/null
 +++ b/efi/efitftp.c
-@@ -0,0 +1,228 @@
+@@ -0,0 +1,230 @@
 +#include <grub/efi/efi.h>
 +#include <grub/efi/api.h>
 +#include <grub/efi/misc.h>
 +#include <grub/misc.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +#include <shared.h>
 +#include <filesys.h>
 +#include "pxe.h"
@@ -16535,10 +16779,10 @@ index 0000000..ba6918f
 +}
 diff --git a/efi/efiuga.c b/efi/efiuga.c
 new file mode 100644
-index 0000000..b762eb8
+index 0000000..0ba67e5
 --- /dev/null
 +++ b/efi/efiuga.c
-@@ -0,0 +1,946 @@
+@@ -0,0 +1,948 @@
 +/* efiuga.c - "univeral graphics adapter" support for GRUB/EFI */
 +/*
 + *  GRUB  --  GRand Unified Bootloader
@@ -16575,6 +16819,8 @@ index 0000000..b762eb8
 +#include <shared.h>
 +#include <graphics.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +#include "graphics.h"
 +#include "xpm.h"
 +
@@ -19822,7 +20068,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 128 0x80 '€' */
++	/* 128 0x80 '€' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x3c, /* 00111100 */
@@ -19840,7 +20086,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 129 0x81 '' */
++	/* 129 0x81 '' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0xcc, /* 11001100 */
@@ -19858,7 +20104,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 130 0x82 '‚' */
++	/* 130 0x82 '‚' */
 +	0x00, /* 00000000 */
 +	0x0c, /* 00001100 */
 +	0x18, /* 00011000 */
@@ -19876,7 +20122,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 131 0x83 'ƒ' */
++	/* 131 0x83 'ƒ' */
 +	0x00, /* 00000000 */
 +	0x10, /* 00010000 */
 +	0x38, /* 00111000 */
@@ -19894,7 +20140,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 132 0x84 '„' */
++	/* 132 0x84 '„' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0xcc, /* 11001100 */
@@ -19912,7 +20158,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 133 0x85 '…' */
++	/* 133 0x85 'Â…' */
 +	0x00, /* 00000000 */
 +	0x60, /* 01100000 */
 +	0x30, /* 00110000 */
@@ -19930,7 +20176,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 134 0x86 '†' */
++	/* 134 0x86 '†' */
 +	0x00, /* 00000000 */
 +	0x38, /* 00111000 */
 +	0x6c, /* 01101100 */
@@ -19948,7 +20194,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 135 0x87 '‡' */
++	/* 135 0x87 '‡' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -19966,7 +20212,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 136 0x88 'ˆ' */
++	/* 136 0x88 'ˆ' */
 +	0x00, /* 00000000 */
 +	0x10, /* 00010000 */
 +	0x38, /* 00111000 */
@@ -19984,7 +20230,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 137 0x89 '‰' */
++	/* 137 0x89 '‰' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0xc6, /* 11000110 */
@@ -20002,7 +20248,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 138 0x8a 'Š' */
++	/* 138 0x8a 'Š' */
 +	0x00, /* 00000000 */
 +	0x60, /* 01100000 */
 +	0x30, /* 00110000 */
@@ -20020,7 +20266,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 139 0x8b '‹' */
++	/* 139 0x8b '‹' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x66, /* 01100110 */
@@ -20038,7 +20284,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 140 0x8c 'Œ' */
++	/* 140 0x8c 'Œ' */
 +	0x00, /* 00000000 */
 +	0x18, /* 00011000 */
 +	0x3c, /* 00111100 */
@@ -20056,7 +20302,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 141 0x8d '' */
++	/* 141 0x8d '' */
 +	0x00, /* 00000000 */
 +	0x60, /* 01100000 */
 +	0x30, /* 00110000 */
@@ -20074,7 +20320,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 142 0x8e 'Ž' */
++	/* 142 0x8e 'ÂŽ' */
 +	0x00, /* 00000000 */
 +	0xc6, /* 11000110 */
 +	0x00, /* 00000000 */
@@ -20092,7 +20338,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 143 0x8f '' */
++	/* 143 0x8f '' */
 +	0x38, /* 00111000 */
 +	0x6c, /* 01101100 */
 +	0x38, /* 00111000 */
@@ -20110,7 +20356,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 144 0x90 '' */
++	/* 144 0x90 '' */
 +	0x0c, /* 00001100 */
 +	0x18, /* 00011000 */
 +	0x00, /* 00000000 */
@@ -20128,7 +20374,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 145 0x91 '‘' */
++	/* 145 0x91 '‘' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -20146,7 +20392,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 146 0x92 '’' */
++	/* 146 0x92 'Â’' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x3e, /* 00111110 */
@@ -20164,7 +20410,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 147 0x93 '“' */
++	/* 147 0x93 '“' */
 +	0x00, /* 00000000 */
 +	0x10, /* 00010000 */
 +	0x38, /* 00111000 */
@@ -20182,7 +20428,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 148 0x94 '”' */
++	/* 148 0x94 '”' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0xc6, /* 11000110 */
@@ -20200,7 +20446,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 149 0x95 '•' */
++	/* 149 0x95 '•' */
 +	0x00, /* 00000000 */
 +	0x60, /* 01100000 */
 +	0x30, /* 00110000 */
@@ -20218,7 +20464,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 150 0x96 '–' */
++	/* 150 0x96 '–' */
 +	0x00, /* 00000000 */
 +	0x30, /* 00110000 */
 +	0x78, /* 01111000 */
@@ -20236,7 +20482,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 151 0x97 '—' */
++	/* 151 0x97 '—' */
 +	0x00, /* 00000000 */
 +	0x60, /* 01100000 */
 +	0x30, /* 00110000 */
@@ -20254,7 +20500,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 152 0x98 '˜' */
++	/* 152 0x98 '˜' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0xc6, /* 11000110 */
@@ -20272,7 +20518,7 @@ index 0000000..94829ec
 +	0x78, /* 01111000 */
 +	0x00, /* 00000000 */
 +
-+	/* 153 0x99 '™' */
++	/* 153 0x99 '™' */
 +	0x00, /* 00000000 */
 +	0xc6, /* 11000110 */
 +	0x00, /* 00000000 */
@@ -20290,7 +20536,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 154 0x9a 'š' */
++	/* 154 0x9a 'š' */
 +	0x00, /* 00000000 */
 +	0xc6, /* 11000110 */
 +	0x00, /* 00000000 */
@@ -20308,7 +20554,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 155 0x9b '›' */
++	/* 155 0x9b '›' */
 +	0x00, /* 00000000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -20326,7 +20572,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 156 0x9c 'œ' */
++	/* 156 0x9c 'œ' */
 +	0x00, /* 00000000 */
 +	0x38, /* 00111000 */
 +	0x6c, /* 01101100 */
@@ -20344,7 +20590,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 157 0x9d '' */
++	/* 157 0x9d '' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x66, /* 01100110 */
@@ -20362,7 +20608,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 158 0x9e 'ž' */
++	/* 158 0x9e 'ž' */
 +	0x00, /* 00000000 */
 +	0xf8, /* 11111000 */
 +	0xcc, /* 11001100 */
@@ -20380,7 +20626,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 159 0x9f 'Ÿ' */
++	/* 159 0x9f 'Ÿ' */
 +	0x00, /* 00000000 */
 +	0x0e, /* 00001110 */
 +	0x1b, /* 00011011 */
@@ -20398,7 +20644,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 160 0xa0 ' ' */
++	/* 160 0xa0 ' ' */
 +	0x00, /* 00000000 */
 +	0x18, /* 00011000 */
 +	0x30, /* 00110000 */
@@ -20416,7 +20662,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 161 0xa1 '¡' */
++	/* 161 0xa1 '¡' */
 +	0x00, /* 00000000 */
 +	0x0c, /* 00001100 */
 +	0x18, /* 00011000 */
@@ -20434,7 +20680,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 162 0xa2 '¢' */
++	/* 162 0xa2 '¢' */
 +	0x00, /* 00000000 */
 +	0x18, /* 00011000 */
 +	0x30, /* 00110000 */
@@ -20452,7 +20698,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 163 0xa3 '£' */
++	/* 163 0xa3 '£' */
 +	0x00, /* 00000000 */
 +	0x18, /* 00011000 */
 +	0x30, /* 00110000 */
@@ -20470,7 +20716,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 164 0xa4 '¤' */
++	/* 164 0xa4 '¤' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x76, /* 01110110 */
@@ -20488,7 +20734,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 165 0xa5 '¥' */
++	/* 165 0xa5 'Â¥' */
 +	0x76, /* 01110110 */
 +	0xdc, /* 11011100 */
 +	0x00, /* 00000000 */
@@ -20506,7 +20752,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 166 0xa6 '¦' */
++	/* 166 0xa6 '¦' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x3c, /* 00111100 */
@@ -20524,7 +20770,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 167 0xa7 '§' */
++	/* 167 0xa7 '§' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x38, /* 00111000 */
@@ -20542,7 +20788,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 168 0xa8 '¨' */
++	/* 168 0xa8 '¨' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x30, /* 00110000 */
@@ -20560,7 +20806,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 169 0xa9 '©' */
++	/* 169 0xa9 '©' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -20578,7 +20824,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 170 0xaa 'ª' */
++	/* 170 0xaa 'ª' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -20596,7 +20842,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 171 0xab '«' */
++	/* 171 0xab '«' */
 +	0x00, /* 00000000 */
 +	0x60, /* 01100000 */
 +	0xe0, /* 11100000 */
@@ -20614,7 +20860,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 172 0xac '¬' */
++	/* 172 0xac '¬' */
 +	0x00, /* 00000000 */
 +	0x60, /* 01100000 */
 +	0xe0, /* 11100000 */
@@ -20632,7 +20878,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 173 0xad '­' */
++	/* 173 0xad '­' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x18, /* 00011000 */
@@ -20650,7 +20896,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 174 0xae '®' */
++	/* 174 0xae '®' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -20668,7 +20914,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 175 0xaf '¯' */
++	/* 175 0xaf '¯' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -20686,7 +20932,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 176 0xb0 '°' */
++	/* 176 0xb0 '°' */
 +	0x11, /* 00010001 */
 +	0x44, /* 01000100 */
 +	0x11, /* 00010001 */
@@ -20704,7 +20950,7 @@ index 0000000..94829ec
 +	0x11, /* 00010001 */
 +	0x44, /* 01000100 */
 +
-+	/* 177 0xb1 '±' */
++	/* 177 0xb1 '±' */
 +	0x55, /* 01010101 */
 +	0xaa, /* 10101010 */
 +	0x55, /* 01010101 */
@@ -20722,7 +20968,7 @@ index 0000000..94829ec
 +	0x55, /* 01010101 */
 +	0xaa, /* 10101010 */
 +
-+	/* 178 0xb2 '²' */
++	/* 178 0xb2 '²' */
 +	0xdd, /* 11011101 */
 +	0x77, /* 01110111 */
 +	0xdd, /* 11011101 */
@@ -20740,7 +20986,7 @@ index 0000000..94829ec
 +	0xdd, /* 11011101 */
 +	0x77, /* 01110111 */
 +
-+	/* 179 0xb3 '³' */
++	/* 179 0xb3 '³' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -20758,7 +21004,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 180 0xb4 '´' */
++	/* 180 0xb4 '´' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -20776,7 +21022,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 181 0xb5 'µ' */
++	/* 181 0xb5 'µ' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -20794,7 +21040,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 182 0xb6 '¶' */
++	/* 182 0xb6 '¶' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -20812,7 +21058,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 183 0xb7 '·' */
++	/* 183 0xb7 '·' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -20830,7 +21076,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 184 0xb8 '¸' */
++	/* 184 0xb8 '¸' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -20848,7 +21094,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 185 0xb9 '¹' */
++	/* 185 0xb9 '¹' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -20866,7 +21112,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 186 0xba 'º' */
++	/* 186 0xba 'º' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -20884,7 +21130,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 187 0xbb '»' */
++	/* 187 0xbb '»' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -20902,7 +21148,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 188 0xbc '¼' */
++	/* 188 0xbc '¼' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -20920,7 +21166,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 189 0xbd '½' */
++	/* 189 0xbd '½' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -20938,7 +21184,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 190 0xbe '¾' */
++	/* 190 0xbe '¾' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -20956,7 +21202,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 191 0xbf '¿' */
++	/* 191 0xbf '¿' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -20974,7 +21220,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 192 0xc0 'À' */
++	/* 192 0xc0 'À' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -20992,7 +21238,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 193 0xc1 'Á' */
++	/* 193 0xc1 'Á' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -21010,7 +21256,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 194 0xc2 'Â' */
++	/* 194 0xc2 'Â' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21028,7 +21274,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 195 0xc3 'Ã' */
++	/* 195 0xc3 'Ã' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -21046,7 +21292,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 196 0xc4 'Ä' */
++	/* 196 0xc4 'Ä' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21064,7 +21310,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 197 0xc5 'Å' */
++	/* 197 0xc5 'Ã…' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -21082,7 +21328,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 198 0xc6 'Æ' */
++	/* 198 0xc6 'Æ' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -21100,7 +21346,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 199 0xc7 'Ç' */
++	/* 199 0xc7 'Ç' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -21118,7 +21364,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 200 0xc8 'È' */
++	/* 200 0xc8 'È' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -21136,7 +21382,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 201 0xc9 'É' */
++	/* 201 0xc9 'É' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21154,7 +21400,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 202 0xca 'Ê' */
++	/* 202 0xca 'Ê' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -21172,7 +21418,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 203 0xcb 'Ë' */
++	/* 203 0xcb 'Ë' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21190,7 +21436,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 204 0xcc 'Ì' */
++	/* 204 0xcc 'Ì' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -21208,7 +21454,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 205 0xcd 'Í' */
++	/* 205 0xcd 'Í' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21226,7 +21472,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 206 0xce 'Î' */
++	/* 206 0xce 'ÃŽ' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -21244,7 +21490,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 207 0xcf 'Ï' */
++	/* 207 0xcf 'Ï' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -21262,7 +21508,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 208 0xd0 'Ð' */
++	/* 208 0xd0 'Ð' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -21280,7 +21526,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 209 0xd1 'Ñ' */
++	/* 209 0xd1 'Ñ' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21298,7 +21544,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 210 0xd2 'Ò' */
++	/* 210 0xd2 'Ã’' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21316,7 +21562,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 211 0xd3 'Ó' */
++	/* 211 0xd3 'Ó' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -21334,7 +21580,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 212 0xd4 'Ô' */
++	/* 212 0xd4 'Ô' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -21352,7 +21598,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 213 0xd5 'Õ' */
++	/* 213 0xd5 'Õ' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21370,7 +21616,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 214 0xd6 'Ö' */
++	/* 214 0xd6 'Ö' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21388,7 +21634,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 215 0xd7 '×' */
++	/* 215 0xd7 '×' */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
@@ -21406,7 +21652,7 @@ index 0000000..94829ec
 +	0x36, /* 00110110 */
 +	0x36, /* 00110110 */
 +
-+	/* 216 0xd8 'Ø' */
++	/* 216 0xd8 'Ø' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -21424,7 +21670,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 217 0xd9 'Ù' */
++	/* 217 0xd9 'Ù' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -21442,7 +21688,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 218 0xda 'Ú' */
++	/* 218 0xda 'Ú' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21460,7 +21706,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 219 0xdb 'Û' */
++	/* 219 0xdb 'Û' */
 +	0xff, /* 11111111 */
 +	0xff, /* 11111111 */
 +	0xff, /* 11111111 */
@@ -21478,7 +21724,7 @@ index 0000000..94829ec
 +	0xff, /* 11111111 */
 +	0xff, /* 11111111 */
 +
-+	/* 220 0xdc 'Ü' */
++	/* 220 0xdc 'Ü' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21496,7 +21742,7 @@ index 0000000..94829ec
 +	0xff, /* 11111111 */
 +	0xff, /* 11111111 */
 +
-+	/* 221 0xdd 'Ý' */
++	/* 221 0xdd 'Ý' */
 +	0xf0, /* 11110000 */
 +	0xf0, /* 11110000 */
 +	0xf0, /* 11110000 */
@@ -21514,7 +21760,7 @@ index 0000000..94829ec
 +	0xf0, /* 11110000 */
 +	0xf0, /* 11110000 */
 +
-+	/* 222 0xde 'Þ' */
++	/* 222 0xde 'Þ' */
 +	0x0f, /* 00001111 */
 +	0x0f, /* 00001111 */
 +	0x0f, /* 00001111 */
@@ -21532,7 +21778,7 @@ index 0000000..94829ec
 +	0x0f, /* 00001111 */
 +	0x0f, /* 00001111 */
 +
-+	/* 223 0xdf 'ß' */
++	/* 223 0xdf 'ß' */
 +	0xff, /* 11111111 */
 +	0xff, /* 11111111 */
 +	0xff, /* 11111111 */
@@ -21550,7 +21796,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 224 0xe0 'à' */
++	/* 224 0xe0 'à' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21568,7 +21814,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 225 0xe1 'á' */
++	/* 225 0xe1 'á' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x78, /* 01111000 */
@@ -21586,7 +21832,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 226 0xe2 'â' */
++	/* 226 0xe2 'â' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0xfe, /* 11111110 */
@@ -21604,7 +21850,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 227 0xe3 'ã' */
++	/* 227 0xe3 'ã' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21622,7 +21868,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 228 0xe4 'ä' */
++	/* 228 0xe4 'ä' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0xfe, /* 11111110 */
@@ -21640,7 +21886,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 229 0xe5 'å' */
++	/* 229 0xe5 'Ã¥' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21658,7 +21904,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 230 0xe6 'æ' */
++	/* 230 0xe6 'æ' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21676,7 +21922,7 @@ index 0000000..94829ec
 +	0xc0, /* 11000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 231 0xe7 'ç' */
++	/* 231 0xe7 'ç' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21694,7 +21940,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 232 0xe8 'è' */
++	/* 232 0xe8 'è' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x7e, /* 01111110 */
@@ -21712,7 +21958,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 233 0xe9 'é' */
++	/* 233 0xe9 'é' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x38, /* 00111000 */
@@ -21730,7 +21976,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 234 0xea 'ê' */
++	/* 234 0xea 'ê' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x38, /* 00111000 */
@@ -21748,7 +21994,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 235 0xeb 'ë' */
++	/* 235 0xeb 'ë' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x1e, /* 00011110 */
@@ -21766,7 +22012,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 236 0xec 'ì' */
++	/* 236 0xec 'ì' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21784,7 +22030,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 237 0xed 'í' */
++	/* 237 0xed 'í' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21802,7 +22048,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 238 0xee 'î' */
++	/* 238 0xee 'î' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x1c, /* 00011100 */
@@ -21820,7 +22066,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 239 0xef 'ï' */
++	/* 239 0xef 'ï' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21838,7 +22084,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 240 0xf0 'ð' */
++	/* 240 0xf0 'ð' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21856,7 +22102,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 241 0xf1 'ñ' */
++	/* 241 0xf1 'ñ' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21874,7 +22120,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 242 0xf2 'ò' */
++	/* 242 0xf2 'ò' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21892,7 +22138,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 243 0xf3 'ó' */
++	/* 243 0xf3 'ó' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21910,7 +22156,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 244 0xf4 'ô' */
++	/* 244 0xf4 'ô' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x0e, /* 00001110 */
@@ -21928,7 +22174,7 @@ index 0000000..94829ec
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +
-+	/* 245 0xf5 'õ' */
++	/* 245 0xf5 'õ' */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
 +	0x18, /* 00011000 */
@@ -21946,7 +22192,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 246 0xf6 'ö' */
++	/* 246 0xf6 'ö' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21964,7 +22210,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 247 0xf7 '÷' */
++	/* 247 0xf7 '÷' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -21982,7 +22228,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 248 0xf8 'ø' */
++	/* 248 0xf8 'ø' */
 +	0x00, /* 00000000 */
 +	0x38, /* 00111000 */
 +	0x6c, /* 01101100 */
@@ -22000,7 +22246,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 249 0xf9 'ù' */
++	/* 249 0xf9 'ù' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -22018,7 +22264,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 250 0xfa 'ú' */
++	/* 250 0xfa 'ú' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -22036,7 +22282,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 251 0xfb 'û' */
++	/* 251 0xfb 'û' */
 +	0x00, /* 00000000 */
 +	0x0f, /* 00001111 */
 +	0x0c, /* 00001100 */
@@ -22054,7 +22300,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 252 0xfc 'ü' */
++	/* 252 0xfc 'ü' */
 +	0x00, /* 00000000 */
 +	0x6c, /* 01101100 */
 +	0x36, /* 00110110 */
@@ -22072,7 +22318,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 253 0xfd 'ý' */
++	/* 253 0xfd 'ý' */
 +	0x00, /* 00000000 */
 +	0x3c, /* 00111100 */
 +	0x66, /* 01100110 */
@@ -22090,7 +22336,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 254 0xfe 'þ' */
++	/* 254 0xfe 'þ' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -22108,7 +22354,7 @@ index 0000000..94829ec
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +
-+	/* 255 0xff 'ÿ' */
++	/* 255 0xff 'ÿ' */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
 +	0x00, /* 00000000 */
@@ -22131,10 +22377,10 @@ index 0000000..94829ec
 +#endif
 diff --git a/efi/graphics.c b/efi/graphics.c
 new file mode 100644
-index 0000000..5e91810
+index 0000000..e74c8f7
 --- /dev/null
 +++ b/efi/graphics.c
-@@ -0,0 +1,568 @@
+@@ -0,0 +1,570 @@
 +#ifdef SUPPORT_GRAPHICS
 +
 +#include <grub/misc.h>
@@ -22148,6 +22394,8 @@ index 0000000..5e91810
 +#include <shared.h>
 +#include <graphics.h>
 +
++#include </usr/include/efi/x86_64/efibind.h>
++
 +#include "graphics.h"
 +
 +#if 0
@@ -22788,6 +23036,13 @@ index 0000000..7bdd647
 +
 +#endif /* SUPPORT_GRAPHCIS */
 +#endif /* GRUB_EFI_GRAPHICS_H */
+diff --git a/efi/grub/.gitignore b/efi/grub/.gitignore
+new file mode 100644
+index 0000000..40a991e
+--- /dev/null
++++ b/efi/grub/.gitignore
+@@ -0,0 +1 @@
++cpu
 diff --git a/efi/grub/efi/api.h b/efi/grub/efi/api.h
 new file mode 100644
 index 0000000..8f75a68
@@ -24417,10 +24672,10 @@ index 0000000..936759b
 +#endif /* ! GRUB_EFI_EFI_HEADER */
 diff --git a/efi/grub/efi/eficall.h b/efi/grub/efi/eficall.h
 new file mode 100644
-index 0000000..2e79e04
+index 0000000..c4704d6
 --- /dev/null
 +++ b/efi/grub/efi/eficall.h
-@@ -0,0 +1,162 @@
+@@ -0,0 +1,97 @@
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2006  Free Software Foundation, Inc.
@@ -24488,83 +24743,18 @@ index 0000000..2e79e04
 +		      unsigned long h, unsigned long i,
 +		      unsigned long j);
 +
-+#define Call_Service(func)                      x64_call0((unsigned long)func)
-+
-+#define Call_Service_1(func,a)                  x64_call1((unsigned long)func, \
-+							  (unsigned long)a)
-+
-+#define Call_Service_2(func,a,b)                x64_call2((unsigned long)func, \
-+							  (unsigned long)a,    \
-+							  (unsigned long)b)
-+
-+#define Call_Service_3(func,a,b,c)              x64_call3((unsigned long)func, \
-+							  (unsigned long)a,    \
-+							  (unsigned long)b,    \
-+							  (unsigned long)c)
-+
-+#define Call_Service_4(func,a,b,c,d)            x64_call4((unsigned long)func, \
-+							  (unsigned long)a,    \
-+							  (unsigned long)b,    \
-+							  (unsigned long)c,    \
-+							  (unsigned long)d)
-+
-+#define Call_Service_5(func,a,b,c,d,e)          x64_call5((unsigned long)func, \
-+							  (unsigned long)a,    \
-+							  (unsigned long)b,    \
-+							  (unsigned long)c,    \
-+							  (unsigned long)d,    \
-+							  (unsigned long)e)
-+
-+#define Call_Service_6(func,a,b,c,d,e,f)        x64_call6((unsigned long)func, \
-+							  (unsigned long)a,    \
-+							  (unsigned long)b,    \
-+							  (unsigned long)c,    \
-+							  (unsigned long)d,    \
-+							  (unsigned long)e,    \
-+							  (unsigned long)f)
-+
-+#define Call_Service_7(func,a,b,c,d,e,f,g)      x64_call7((unsigned long)func, \
-+							  (unsigned long)a,    \
-+							  (unsigned long)b,    \
-+							  (unsigned long)c,    \
-+							  (unsigned long)d,    \
-+							  (unsigned long)e,    \
-+							  (unsigned long)f,    \
-+							  (unsigned long)g)
-+
-+#define Call_Service_8(func,a,b,c,d,e,f,g,h)    x64_call8((unsigned long)func, \
-+							  (unsigned long)a,    \
-+							  (unsigned long)b,    \
-+							  (unsigned long)c,    \
-+							  (unsigned long)d,    \
-+							  (unsigned long)e,    \
-+							  (unsigned long)f,    \
-+							  (unsigned long)g,    \
-+							  (unsigned long)h)
-+
-+#define Call_Service_9(func,a,b,c,d,e,f,g,h,i)  x64_call9((unsigned long)func, \
-+							  (unsigned long)a,    \
-+							  (unsigned long)b,    \
-+							  (unsigned long)c,    \
-+							  (unsigned long)d,    \
-+							  (unsigned long)e,    \
-+							  (unsigned long)f,    \
-+							  (unsigned long)g,    \
-+							  (unsigned long)h,    \
-+							  (unsigned long)i)
-+
-+#define Call_Service_10(func,a,b,c,d,e,f,g,h,i,j) \
-+					       x64_call10((unsigned long)func, \
-+							  (unsigned long)a,    \
-+							  (unsigned long)b,    \
-+							  (unsigned long)c,    \
-+							  (unsigned long)d,    \
-+							  (unsigned long)e,    \
-+							  (unsigned long)f,    \
-+							  (unsigned long)g,    \
-+							  (unsigned long)h,    \
-+							  (unsigned long)i,    \
-+							  (unsigned long)j)
++
++#define Call_Service(func)			uefi_call_wrapper(func,0)
++#define Call_Service_1(func,a)			uefi_call_wrapper(func,1,a)
++#define Call_Service_2(func,a,b)		uefi_call_wrapper(func,2,a,b)
++#define Call_Service_3(func,a,b,c)		uefi_call_wrapper(func,3,a,b,c)
++#define Call_Service_4(func,a,b,c,d)		uefi_call_wrapper(func,4,a,b,c,d)
++#define Call_Service_5(func,a,b,c,d,e)		uefi_call_wrapper(func,5,a,b,c,d,e)
++#define Call_Service_6(func,a,b,c,d,e,f)	uefi_call_wrapper(func,6,a,b,c,d,e,f)
++#define Call_Service_7(func,a,b,c,d,e,f,g)	uefi_call_wrapper(func,7,a,b,c,d,e,f,g)
++#define Call_Service_8(func,a,b,c,d,e,f,g,h)	uefi_call_wrapper(func,8,a,b,c,d,e,f,g,h)
++#define Call_Service_9(func,a,b,c,d,e,f,g,h,i)	uefi_call_wrapper(func,9,a,b,c,d,e,f,g,h,i)
++#define Call_Service_10(func,a,b,c,d,e,f,g,h,i,j)	uefi_call_wrapper(func,9,a,b,c,d,e,f,g,h,i,j)
 +
 +#else
 +
@@ -25687,10 +25877,10 @@ index 0000000..4cff104
 +
 diff --git a/efi/ia32/loader/linux.c b/efi/ia32/loader/linux.c
 new file mode 100644
-index 0000000..eb6b5de
+index 0000000..d795d28
 --- /dev/null
 +++ b/efi/ia32/loader/linux.c
-@@ -0,0 +1,641 @@
+@@ -0,0 +1,648 @@
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2006  Free Software Foundation, Inc.
@@ -25730,6 +25920,13 @@ index 0000000..eb6b5de
 +
 +#define PTR_HI(x) ((grub_uint32_t) ((unsigned long long)((unsigned long)(x)) >> 32))
 +
++#ifndef SECTOR_SIZE
++#define SECTOR_SIZE 0x200
++#endif /* defined(SECTOR_SIZE) */
++#ifndef SECTOR_BITS
++#define SECTOR_BITS 9
++#endif /* defined(SECTOR_BITS) */
++
 +static unsigned long linux_mem_size;
 +static int loaded;
 +static void *real_mode_mem;
@@ -28095,6 +28292,32 @@ index 0000000..18a9ab9
 +    *(.rela.reloc)
 +  }
 +}
+diff --git a/efi/x86_64/loader/Makefile b/efi/x86_64/loader/Makefile
+new file mode 100644
+index 0000000..0d8b888
+--- /dev/null
++++ b/efi/x86_64/loader/Makefile
+@@ -0,0 +1,20 @@
++
++all : switch.h
++
++bin_to_h: bin_to_h.c
++	$(CC) $(CFLAGS) -o $@ $<
++
++switch.h : switch.bin bin_to_h
++	./bin_to_h < $< > $@
++
++switch.bin : switch
++	objcopy -O binary $< $@
++
++switch : switch.o
++	ld.bfd -Ttext-segment=0x688 --init _start -o $@ $<
++
++switch.o : switch.S
++	as -march=generic64 -defsym _start=0 -o $@ $<
++
++clean :
++	@rm -vf switch.o switch switch.bin switch.h bin_to_h
 diff --git a/efi/x86_64/loader/bin_to_h.c b/efi/x86_64/loader/bin_to_h.c
 new file mode 100644
 index 0000000..4cff104
@@ -28132,10 +28355,10 @@ index 0000000..4cff104
 +
 diff --git a/efi/x86_64/loader/linux.c b/efi/x86_64/loader/linux.c
 new file mode 100644
-index 0000000..18746ea
+index 0000000..54d075b
 --- /dev/null
 +++ b/efi/x86_64/loader/linux.c
-@@ -0,0 +1,580 @@
+@@ -0,0 +1,588 @@
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2006  Free Software Foundation, Inc.
@@ -28175,6 +28398,13 @@ index 0000000..18746ea
 +
 +#define PTR_HI(x) ((grub_uint32_t) ((unsigned long long)((unsigned long)(x)) >> 32))
 +
++#ifndef SECTOR_SIZE
++#define SECTOR_SIZE 0x200
++#endif /* defined(SECTOR_SIZE) */
++#ifndef SECTOR_BITS
++#define SECTOR_BITS 9
++#endif /* defined(SECTOR_BITS) */
++
 +static unsigned long linux_mem_size;
 +static int loaded;
 +static void *real_mode_mem;
@@ -28297,7 +28527,8 @@ index 0000000..18746ea
 +
 +  if (!prot_mode_mem)
 +	grub_fatal("Cannot allocate pages for VMLINUZ");
-+    
++  grub_printf("Got pages at %p\n", prot_mode_mem);
++ 
 +  return 1;
 +
 + fail:
@@ -29708,13 +29939,21 @@ index 0000000..7e5982d
 +
 +* Mon Jun 25 2001 Jeremy Katz <katzj at redhat.com>
 +- update to current CVS 
-+- forward port VGA16 patch from Paulo César Pereira de 
++- forward port VGA16 patch from Paulo César Pereira de 
 +  Andrade <pcpa at conectiva.com.br>
 +- add patch for cciss, ida, and rd raid controllers
 +- don't pass mem= to the kernel
 +
 +* Wed May 23 2001 Erik Troan <ewt at redhat.com>
 +- initial build for Red Hat
+diff --git a/grub/.gitignore b/grub/.gitignore
+new file mode 100644
+index 0000000..5d89f6d
+--- /dev/null
++++ b/grub/.gitignore
+@@ -0,0 +1,2 @@
++Makefile.in
++.deps
 diff --git a/grub/Makefile.am b/grub/Makefile.am
 index 7eb2eaa..d4353f7 100644
 --- a/grub/Makefile.am
@@ -30037,7 +30276,7 @@ index 136c38f..0e40e1b 100644
  # Tell versions [3.59,3.63) of GNU make to not export all variables.
  # Otherwise a system limit (for SysV at least) may be exceeded.
 diff --git a/grub/asmstub.c b/grub/asmstub.c
-index ab95b4b..f420074 100644
+index ab95b4b..818be75 100644
 --- a/grub/asmstub.c
 +++ b/grub/asmstub.c
 @@ -42,6 +42,7 @@ int grub_stage2 (void);
@@ -30076,10 +30315,21 @@ index ab95b4b..f420074 100644
  
  struct geometry *disks = 0;
  
-@@ -103,14 +107,62 @@ static char *serial_device = 0;
+@@ -103,14 +107,73 @@ static char *serial_device = 0;
  static unsigned int serial_speed;
  #endif /* SIMULATE_SLOWNESS_OF_SERIAL */
  
++#ifdef GRUB_UTIL
++int get_sector_size (int drive)
++{
++  return 0x200;
++}
++int get_sector_bits (int drive)
++{
++  return 9;
++}
++#endif /* GRUB_UTIL */
++
 +/* This allocates page-aligned storage of the specified size, which must be
 + * a multiple of the page size as determined by calling sysconf(_SC_PAGESIZE)
 + */
@@ -30141,7 +30391,7 @@ index ab95b4b..f420074 100644
    int i;
  
    auto void doit (void);
-@@ -120,8 +172,13 @@ grub_stage2 (void)
+@@ -120,8 +183,13 @@ grub_stage2 (void)
    void doit (void)
      {
        /* Make sure our stack lives in the simulated memory area. */
@@ -30155,7 +30405,7 @@ index ab95b4b..f420074 100644
        
        /* Do a setjmp here for the stop command.  */
        if (! setjmp (env_for_exit))
-@@ -138,13 +195,43 @@ grub_stage2 (void)
+@@ -138,13 +206,43 @@ grub_stage2 (void)
  	}
        
        /* Replace our stack before we use any local variables. */
@@ -30202,7 +30452,7 @@ index ab95b4b..f420074 100644
  
    /* FIXME: simulate the memory holes using mprot, if available. */
  
-@@ -217,7 +304,7 @@ grub_stage2 (void)
+@@ -217,7 +315,7 @@ grub_stage2 (void)
    device_map = 0;
    free (disks);
    disks = 0;
@@ -30211,7 +30461,7 @@ index ab95b4b..f420074 100644
    grub_scratch_mem = 0;
  
    if (serial_device)
-@@ -699,6 +786,13 @@ console_getkey (void)
+@@ -699,6 +797,13 @@ console_getkey (void)
    return console_translate_key (c);
  }
  
@@ -30225,7 +30475,7 @@ index ab95b4b..f420074 100644
  /* returns packed values, LSB+1 is x, LSB is y */
  int
  console_getxy (void)
-@@ -766,7 +860,7 @@ get_diskinfo (int drive, struct geometry *geometry)
+@@ -766,7 +871,7 @@ get_diskinfo (int drive, struct geometry *geometry)
      {
        /* The unpartitioned device name: /dev/XdX */
        char *devname = device_map[drive];
@@ -30234,7 +30484,7 @@ index ab95b4b..f420074 100644
  
        if (! devname)
  	return -1;
-@@ -777,13 +871,13 @@ get_diskinfo (int drive, struct geometry *geometry)
+@@ -777,13 +882,13 @@ get_diskinfo (int drive, struct geometry *geometry)
  
        /* Open read/write, or read-only if that failed. */
        if (! read_only)
@@ -30250,7 +30500,7 @@ index ab95b4b..f420074 100644
  	      if (disks[drive].flags == -1)
  		{
  		  assign_device_name (drive, 0);
-@@ -797,6 +891,10 @@ get_diskinfo (int drive, struct geometry *geometry)
+@@ -797,6 +902,10 @@ get_diskinfo (int drive, struct geometry *geometry)
  	    }
  	}
  
@@ -30261,7 +30511,7 @@ index ab95b4b..f420074 100644
        /* Attempt to read the first sector.  */
        if (read (disks[drive].flags, buf, 512) != 512)
  	{
-@@ -808,6 +906,7 @@ get_diskinfo (int drive, struct geometry *geometry)
+@@ -808,6 +917,7 @@ get_diskinfo (int drive, struct geometry *geometry)
  
        if (disks[drive].flags != -1)
  	get_drive_geometry (&disks[drive], device_map, drive);
@@ -30269,7 +30519,7 @@ index ab95b4b..f420074 100644
      }
  
    if (disks[drive].flags == -1)
-@@ -829,24 +928,34 @@ static int
+@@ -829,24 +939,34 @@ static int
  nread (int fd, char *buf, size_t len)
  {
    int size = len;
@@ -30308,7 +30558,7 @@ index ab95b4b..f420074 100644
  }
  
  /* Write LEN bytes from BUF to FD. Return less than or equal to zero if an
-@@ -855,10 +964,18 @@ static int
+@@ -855,10 +975,18 @@ static int
  nwrite (int fd, char *buf, size_t len)
  {
    int size = len;
@@ -30328,7 +30578,22 @@ index ab95b4b..f420074 100644
  
        if (ret <= 0)
  	{
-@@ -959,7 +1076,7 @@ biosdisk (int subfunc, int drive, struct geometry *geometry,
+@@ -946,20 +1074,20 @@ biosdisk (int subfunc, int drive, struct geometry *geometry,
+     _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,
+ 	       loff_t *, res, uint, wh);
+ 
+-    offset = (loff_t) sector * (loff_t) SECTOR_SIZE;
++    offset = (loff_t) sector * (loff_t) get_sector_size(drive);
+     if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
+       return -1;
+   }
+ #else
+   {
+-    off_t offset = (off_t) sector * (off_t) SECTOR_SIZE;
++    off_t offset = (off_t) sector * (off_t) get_sector_size(drive);
+ 
+     if (lseek (fd, offset, SEEK_SET) != offset)
+       return -1;
    }
  #endif
  
@@ -30337,7 +30602,37 @@ index ab95b4b..f420074 100644
  
    switch (subfunc)
      {
-@@ -1273,3 +1390,21 @@ hercules_setcursor (int on)
+@@ -971,13 +1099,13 @@ biosdisk (int subfunc, int drive, struct geometry *geometry,
+ 	     sectors that are read together with the MBR in one read.  It
+ 	     should only remap the MBR, so we split the read in two 
+ 	     parts. -jochen  */
+-	  if (nread (fd, buf, SECTOR_SIZE) != SECTOR_SIZE)
++	  if (nread (fd, buf, get_sector_size(drive)) != get_sector_size(drive))
+ 	    return -1;
+-	  buf += SECTOR_SIZE;
++	  buf += get_sector_size(drive);
+ 	  nsec--;
+ 	}
+ #endif
+-      if (nread (fd, buf, nsec * SECTOR_SIZE) != nsec * SECTOR_SIZE)
++      if (nread (fd, buf, nsec * get_sector_size(drive)) != nsec * get_sector_size(drive))
+ 	return -1;
+       break;
+ 
+@@ -987,10 +1115,10 @@ biosdisk (int subfunc, int drive, struct geometry *geometry,
+ 	  grub_printf ("Write %d sectors starting from %d sector"
+ 		       " to drive 0x%x (%s)\n",
+ 		       nsec, sector, drive, device_map[drive]);
+-	  hex_dump (buf, nsec * SECTOR_SIZE);
++	  hex_dump (buf, nsec * get_sector_size(drive));
+ 	}
+       if (! read_only)
+-	if (nwrite (fd, buf, nsec * SECTOR_SIZE) != nsec * SECTOR_SIZE)
++	if (nwrite (fd, buf, nsec * get_sector_size(drive)) != nsec * get_sector_size(drive))
+ 	  return -1;
+       break;
+ 
+@@ -1273,3 +1401,21 @@ hercules_setcursor (int on)
  {
    return 1;
  }
@@ -30412,6 +30707,14 @@ index dfe847e..6083641 100644
      default_config_file = config_file;
    else
      default_config_file = "NONE";
+diff --git a/lib/.gitignore b/lib/.gitignore
+new file mode 100644
+index 0000000..5d89f6d
+--- /dev/null
++++ b/lib/.gitignore
+@@ -0,0 +1,2 @@
++Makefile.in
++.deps
 diff --git a/lib/Makefile.in b/lib/Makefile.in
 index 3dae206..e46d1c4 100644
 --- a/lib/Makefile.in
@@ -30696,10 +30999,20 @@ index 3dae206..e46d1c4 100644
  # Tell versions [3.59,3.63) of GNU make to not export all variables.
  # Otherwise a system limit (for SysV at least) may be exceeded.
 diff --git a/lib/device.c b/lib/device.c
-index d0663b3..45a300e 100644
+index d0663b3..50540bc 100644
 --- a/lib/device.c
 +++ b/lib/device.c
-@@ -131,6 +131,152 @@ get_kfreebsd_version ()
+@@ -36,6 +36,9 @@
+ #include <limits.h>
+ #include <stdarg.h>
+ 
++#define SECTOR_SIZE 0x200
++#define SECTOR_BITS 9
++
+ #ifdef __linux__
+ # if !defined(__GLIBC__) || \
+         ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
+@@ -131,6 +134,152 @@ get_kfreebsd_version ()
  #include <shared.h>
  #include <device.h>
  
@@ -30852,7 +31165,7 @@ index d0663b3..45a300e 100644
  /* Get the geometry of a drive DRIVE.  */
  void
  get_drive_geometry (struct geometry *geom, char **map, int drive)
-@@ -151,21 +297,16 @@ get_drive_geometry (struct geometry *geom, char **map, int drive)
+@@ -151,21 +300,16 @@ get_drive_geometry (struct geometry *geom, char **map, int drive)
  #if defined(__linux__)
    /* Linux */
    {
@@ -30877,7 +31190,7 @@ index d0663b3..45a300e 100644
      goto success;
    }
  
-@@ -403,10 +544,27 @@ get_dac960_disk_name (char *name, int controller, int drive)
+@@ -403,10 +547,27 @@ get_dac960_disk_name (char *name, int controller, int drive)
  }
  
  static void
@@ -30905,7 +31218,7 @@ index d0663b3..45a300e 100644
  #endif
  
  /* Check if DEVICE can be read. If an error occurs, return zero,
-@@ -490,27 +648,24 @@ check_device (const char *device)
+@@ -490,27 +651,24 @@ check_device (const char *device)
  }
  
  /* Read mapping information from FP, and write it to MAP.  */
@@ -30948,7 +31261,7 @@ index d0663b3..45a300e 100644
    /* If there is the device map file, use the data in it instead of
       probing devices.  */
    char buf[1024];		/* XXX */
-@@ -540,14 +695,14 @@ read_device_map (FILE *fp, char **map, const char *map_file)
+@@ -540,14 +698,14 @@ read_device_map (FILE *fp, char **map, const char *map_file)
        
        if (*ptr != '(')
  	{
@@ -30965,7 +31278,7 @@ index d0663b3..45a300e 100644
  	  return 0;
  	}
        
-@@ -558,12 +713,12 @@ read_device_map (FILE *fp, char **map, const char *map_file)
+@@ -558,12 +716,12 @@ read_device_map (FILE *fp, char **map, const char *map_file)
        drive = strtoul (ptr, &ptr, 10);
        if (drive < 0)
  	{
@@ -30980,7 +31293,7 @@ index d0663b3..45a300e 100644
  			"Ignoring %cd%d due to a BIOS limitation",
  			is_floppy ? 'f' : 'h', drive);
  	  continue;
-@@ -574,7 +729,7 @@ read_device_map (FILE *fp, char **map, const char *map_file)
+@@ -574,7 +732,7 @@ read_device_map (FILE *fp, char **map, const char *map_file)
        
        if (*ptr != ')')
  	{
@@ -30989,7 +31302,7 @@ index d0663b3..45a300e 100644
  	  return 0;
  	}
        
-@@ -585,7 +740,7 @@ read_device_map (FILE *fp, char **map, const char *map_file)
+@@ -585,7 +743,7 @@ read_device_map (FILE *fp, char **map, const char *map_file)
        
        if (! *ptr)
  	{
@@ -30998,7 +31311,7 @@ index d0663b3..45a300e 100644
  	  return 0;
  	}
        
-@@ -598,7 +753,7 @@ read_device_map (FILE *fp, char **map, const char *map_file)
+@@ -598,7 +756,7 @@ read_device_map (FILE *fp, char **map, const char *map_file)
        /* Multiple entries for a given drive is not allowed.  */
        if (map[drive])
  	{
@@ -31007,7 +31320,7 @@ index d0663b3..45a300e 100644
  	  return 0;
  	}
        
-@@ -782,7 +937,7 @@ init_device_map (char ***map, const char *map_file, int floppy_disks)
+@@ -782,7 +940,7 @@ init_device_map (char ***map, const char *map_file, int floppy_disks)
      
      for (controller = 0; controller < 8; controller++)
        {
@@ -31016,7 +31329,7 @@ index d0663b3..45a300e 100644
  	  {
  	    char name[24];
  	    
-@@ -801,6 +956,90 @@ init_device_map (char ***map, const char *map_file, int floppy_disks)
+@@ -801,6 +959,90 @@ init_device_map (char ***map, const char *map_file, int floppy_disks)
  	  }
        }
    }
@@ -31107,7 +31420,7 @@ index d0663b3..45a300e 100644
  #endif /* __linux__ */
    
    /* OK, close the device map file if opened.  */
-@@ -844,6 +1083,7 @@ write_to_partition (char **map, int drive, int partition,
+@@ -844,6 +1086,7 @@ write_to_partition (char **map, int drive, int partition,
  {
    char dev[PATH_MAX];	/* XXX */
    int fd;
@@ -31115,7 +31428,7 @@ index d0663b3..45a300e 100644
    
    if ((partition & 0x00FF00) != 0x00FF00)
      {
-@@ -861,7 +1101,16 @@ write_to_partition (char **map, int drive, int partition,
+@@ -861,44 +1104,35 @@ write_to_partition (char **map, int drive, int partition,
        if (strcmp (dev + strlen(dev) - 5, "/disc") == 0)
  	strcpy (dev + strlen(dev) - 5, "/part");
      }
@@ -31133,7 +31446,12 @@ index d0663b3..45a300e 100644
    
    /* Open the partition.  */
    fd = open (dev, O_RDWR);
-@@ -870,35 +1119,13 @@ write_to_partition (char **map, int drive, int partition,
+   if (fd < 0)
+     {
++      /* No partition file, pass thru and not worry about
++       * cache inconsistency. */
++      if (errno == ENOENT)
++        return -1;
        errnum = ERR_NO_PART;
        return 0;
      }
@@ -31175,6 +31493,14 @@ index d0663b3..45a300e 100644
    
    if (write (fd, buf, size * SECTOR_SIZE) != (size * SECTOR_SIZE))
      {
+diff --git a/netboot/.gitignore b/netboot/.gitignore
+new file mode 100644
+index 0000000..5d89f6d
+--- /dev/null
++++ b/netboot/.gitignore
+@@ -0,0 +1,2 @@
++Makefile.in
++.deps
 diff --git a/netboot/Makefile.in b/netboot/Makefile.in
 index 75ac299..3a6a501 100644
 --- a/netboot/Makefile.in
@@ -32340,6 +32666,14 @@ index 57218bf..881141b 100644
  
  /* ANSI prototyping macro */
  #ifdef	__STDC__
+diff --git a/stage1/.gitignore b/stage1/.gitignore
+new file mode 100644
+index 0000000..5d89f6d
+--- /dev/null
++++ b/stage1/.gitignore
+@@ -0,0 +1,2 @@
++Makefile.in
++.deps
 diff --git a/stage1/Makefile.am b/stage1/Makefile.am
 index 0afc285..cbae397 100644
 --- a/stage1/Makefile.am
@@ -32760,6 +33094,17 @@ index 985963d..3a896be 100644
  
  	/* do not probe LBA if the drive is a floppy */
  	testb	$STAGE1_BIOS_HD_FLAG, %dl
+diff --git a/stage2/.gitignore b/stage2/.gitignore
+new file mode 100644
+index 0000000..e0480a0
+--- /dev/null
++++ b/stage2/.gitignore
+@@ -0,0 +1,5 @@
++Makefile.in
++Makefile
++.deps
++*.a
++*.o
 diff --git a/stage2/Makefile.am b/stage2/Makefile.am
 index f8e6d42..477d129 100644
 --- a/stage2/Makefile.am
@@ -37051,7 +37396,7 @@ index 34b6e7d..5c4dd5e 100644
  /*
   * getrtsecs()
 diff --git a/stage2/boot.c b/stage2/boot.c
-index 4185d23..247b8c9 100644
+index 4185d23..e30daf8 100644
 --- a/stage2/boot.c
 +++ b/stage2/boot.c
 @@ -25,10 +25,14 @@
@@ -37102,6 +37447,15 @@ index 4185d23..247b8c9 100644
  	}
        else
  	{
+@@ -265,7 +281,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+ 	setup_sects = LINUX_DEFAULT_SETUP_SECTS;
+ 
+       data_len = setup_sects << 9;
+-      text_len = filemax - data_len - SECTOR_SIZE;
++      text_len = filemax - data_len - get_sector_size(current_drive);
+ 
+       linux_data_tmp_addr = (char *) LINUX_BZIMAGE_ADDR + text_len;
+       
 @@ -280,8 +296,12 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  	errnum = ERR_WONT_FIT;
        else
@@ -37117,7 +37471,26 @@ index 4185d23..247b8c9 100644
  
  	  /* Video mode selection support. What a mess!  */
  	  /* NOTE: Even the word "mess" is not still enough to
-@@ -404,7 +424,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -375,14 +395,15 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+       
+ 	  /* It is possible that DATA_LEN + SECTOR_SIZE is greater than
+ 	     MULTIBOOT_SEARCH, so the data may have been read partially.  */
+-	  if (data_len + SECTOR_SIZE <= MULTIBOOT_SEARCH)
++	  if (data_len + get_sector_size(current_drive) <= MULTIBOOT_SEARCH)
+ 	    grub_memmove (linux_data_tmp_addr, buffer,
+-			  data_len + SECTOR_SIZE);
++			  data_len + get_sector_size(current_drive));
+ 	  else
+ 	    {
+ 	      grub_memmove (linux_data_tmp_addr, buffer, MULTIBOOT_SEARCH);
+ 	      grub_read (linux_data_tmp_addr + MULTIBOOT_SEARCH,
+-			 data_len + SECTOR_SIZE - MULTIBOOT_SEARCH);
++			 data_len + get_sector_size(current_drive)
++			 - MULTIBOOT_SEARCH);
+ 	    }
+ 	  
+ 	  if (lh->header != LINUX_MAGIC_SIGNATURE ||
+@@ -404,7 +425,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  	    char *src = skip_to (0, arg);
  	    char *dest = linux_data_tmp_addr + LINUX_CL_OFFSET;
  	
@@ -37126,7 +37499,7 @@ index 4185d23..247b8c9 100644
  	      *(dest++) = *(src++);
  	
  	    /* Old Linux kernels have problems determining the amount of
-@@ -425,7 +445,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -425,7 +446,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  	    if (! grub_strstr (arg, "mem=")
  		&& ! (load_flags & KERNEL_LOAD_NO_MEM_OPTION)
  		&& lh->version < 0x0203		/* kernel version < 2.4.18 */
@@ -37135,7 +37508,16 @@ index 4185d23..247b8c9 100644
  	      {
  		*dest++ = ' ';
  		*dest++ = 'm';
-@@ -487,7 +507,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -441,7 +462,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+ 	  }
+       
+ 	  /* offset into file */
+-	  grub_seek (data_len + SECTOR_SIZE);
++	  grub_seek (data_len + get_sector_size(current_drive));
+       
+ 	  cur_addr = (int) linux_data_tmp_addr + LINUX_SETUP_MOVE_SIZE;
+ 	  grub_read ((char *) LINUX_BZIMAGE_ADDR, text_len);
+@@ -487,7 +508,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
    mbi.syms.a.addr = 0;
    mbi.syms.a.pad = 0;
  
@@ -37144,7 +37526,7 @@ index 4185d23..247b8c9 100644
  
    str = "";
  
-@@ -496,7 +516,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -496,7 +517,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
        if (flags & MULTIBOOT_AOUT_KLUDGE)
  	str = "-and-data";
  
@@ -37153,7 +37535,7 @@ index 4185d23..247b8c9 100644
  
        /* read text, then read data */
        if (grub_read ((char *) RAW_ADDR (cur_addr), text_len) == text_len)
-@@ -509,9 +529,9 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -509,9 +530,9 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  	      if (align_4k)
  		cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000;
  	      else
@@ -37165,7 +37547,7 @@ index 4185d23..247b8c9 100644
  
  	      if ((grub_read ((char *) RAW_ADDR (cur_addr), data_len)
  		   != data_len)
-@@ -525,7 +545,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -525,7 +546,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  	      memset ((char *) RAW_ADDR (cur_addr), 0, bss_len);
  	      cur_addr += bss_len;
  
@@ -37174,7 +37556,7 @@ index 4185d23..247b8c9 100644
  	    }
  	}
        else if (!errnum)
-@@ -545,7 +565,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -545,7 +566,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  	  *((int *) RAW_ADDR (cur_addr)) = pu.aout->a_syms;
  	  cur_addr += sizeof (int);
  	  
@@ -37183,7 +37565,7 @@ index 4185d23..247b8c9 100644
  
  	  if (grub_read ((char *) RAW_ADDR (cur_addr), pu.aout->a_syms)
  	      == pu.aout->a_syms)
-@@ -562,7 +582,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -562,7 +583,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  
  		  i -= sizeof (int);
  
@@ -37192,7 +37574,7 @@ index 4185d23..247b8c9 100644
  
  		  symtab_err = (grub_read ((char *) RAW_ADDR (cur_addr), i)
  				!= i);
-@@ -576,7 +596,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -576,7 +597,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  
  	  if (symtab_err)
  	    {
@@ -37201,7 +37583,7 @@ index 4185d23..247b8c9 100644
  	      cur_addr = orig_addr;
  	      mbi.syms.a.tabsize = 0;
  	      mbi.syms.a.strsize = 0;
-@@ -630,7 +650,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -630,7 +651,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  	      /* mark memory as used */
  	      if (cur_addr < memaddr + memsiz)
  		cur_addr = memaddr + memsiz;
@@ -37210,7 +37592,7 @@ index 4185d23..247b8c9 100644
  		      memsiz - filesiz);
  	      /* increment number of segments */
  	      loaded++;
-@@ -676,7 +696,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -676,7 +697,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  		  shdr = (Elf32_Shdr *) mbi.syms.e.addr;
  		  cur_addr += tab_size;
  		  
@@ -37219,7 +37601,7 @@ index 4185d23..247b8c9 100644
    		  
  		  for (i = 0; i < mbi.syms.e.num; i++)
  		    {
-@@ -718,7 +738,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -718,7 +739,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  	      
  	      if (symtab_err) 
  		{
@@ -37228,7 +37610,7 @@ index 4185d23..247b8c9 100644
  		  mbi.syms.e.num = 0;
  		  mbi.syms.e.size = 0;
  		  mbi.syms.e.addr = 0;
-@@ -733,7 +753,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -733,7 +754,7 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
  
    if (! errnum)
      {
@@ -37237,7 +37619,7 @@ index 4185d23..247b8c9 100644
        
        /* If the entry address is physically different from that of the ELF
  	 header, correct it here.  */
-@@ -756,8 +776,10 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
+@@ -756,8 +777,10 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
      }
    
    return type;
@@ -37248,7 +37630,7 @@ index 4185d23..247b8c9 100644
  int
  load_module (char *module, char *arg)
  {
-@@ -776,7 +798,7 @@ load_module (char *module, char *arg)
+@@ -776,7 +799,7 @@ load_module (char *module, char *arg)
        return 0;
      }
  
@@ -37257,7 +37639,7 @@ index 4185d23..247b8c9 100644
  
    /* these two simply need to be set if any modules are loaded at all */
    mbi.flags |= MB_INFO_MODS;
-@@ -794,11 +816,19 @@ load_module (char *module, char *arg)
+@@ -794,11 +817,19 @@ load_module (char *module, char *arg)
    grub_close ();
    return 1;
  }
@@ -37278,7 +37660,7 @@ index 4185d23..247b8c9 100644
    unsigned long moveto;
    unsigned long max_addr;
    struct linux_kernel_header *lh
-@@ -807,16 +837,24 @@ load_initrd (char *initrd)
+@@ -807,16 +838,24 @@ load_initrd (char *initrd)
  #ifndef NO_DECOMPRESSION
    no_decompression = 1;
  #endif
@@ -37312,7 +37694,7 @@ index 4185d23..247b8c9 100644
  
    if (linux_mem_size)
      moveto = linux_mem_size;
-@@ -824,8 +862,12 @@ load_initrd (char *initrd)
+@@ -824,8 +863,12 @@ load_initrd (char *initrd)
      moveto = (mbi.mem_upper + 0x400) << 10;
    
    moveto = (moveto - len) & 0xfffff000;
@@ -37325,7 +37707,7 @@ index 4185d23..247b8c9 100644
    if (moveto + len >= max_addr)
      moveto = (max_addr - len) & 0xfffff000;
    
-@@ -836,13 +878,12 @@ load_initrd (char *initrd)
+@@ -836,13 +879,12 @@ load_initrd (char *initrd)
    moveto -= 0x10000;
    memmove ((void *) RAW_ADDR (moveto), (void *) cur_addr, len);
  
@@ -37340,7 +37722,7 @@ index 4185d23..247b8c9 100644
  
   fail:
    
-@@ -851,9 +892,11 @@ load_initrd (char *initrd)
+@@ -851,9 +893,11 @@ load_initrd (char *initrd)
  #endif
  
    return ! errnum;
@@ -37352,14 +37734,14 @@ index 4185d23..247b8c9 100644
  #ifdef GRUB_UTIL
  /* Dummy function to fake the *BSD boot.  */
  static void
-@@ -1018,3 +1061,5 @@ bsd_boot (kernel_t type, int bootdev, char *arg)
+@@ -1018,3 +1062,5 @@ bsd_boot (kernel_t type, int bootdev, char *arg)
  		     extended_memory, mbi.mem_lower);
      }
  }
 +#endif
 +
 diff --git a/stage2/builtins.c b/stage2/builtins.c
-index 3e08a86..c90c527 100644
+index 3e08a86..178c889 100644
 --- a/stage2/builtins.c
 +++ b/stage2/builtins.c
 @@ -56,6 +56,9 @@ static int bootdev;
@@ -37400,7 +37782,7 @@ index 3e08a86..c90c527 100644
      default: 
        /* unsupported password type: be secure */
        return 1;
-@@ -131,62 +155,97 @@ disk_read_print_func (int sector, int offset, int length)
+@@ -131,62 +155,98 @@ disk_read_print_func (int sector, int offset, int length)
  }
  
  
@@ -37444,11 +37826,12 @@ index 3e08a86..c90c527 100644
 +  int *num_sectors = &blocklist_func_context.num_sectors;
 +  int *num_entries = &blocklist_func_context.num_entries;
 +  int *last_length = &blocklist_func_context.last_length;
++  int sector_size = get_sector_size(current_drive);
 +
 +  if (*num_sectors > 0)
 +  {
 +    if (*start_sector + *num_sectors == sector
-+      && offset == 0 && *last_length == SECTOR_SIZE)
++      && offset == 0 && *last_length == sector_size)
 +    {
 +      *num_sectors++;
 +      *last_length = length;
@@ -37456,7 +37839,7 @@ index 3e08a86..c90c527 100644
 +    }
 +    else
 +    {
-+      if (*last_length == SECTOR_SIZE)
++      if (*last_length == sector_size)
 +        grub_printf ("%s%d+%d", *num_entries ? "," : "",
 +          *start_sector - part_start, *num_sectors);
 +      else if (*num_sectors > 1)
@@ -37548,7 +37931,7 @@ index 3e08a86..c90c527 100644
  
    /* Open the file.  */
    if (! grub_open (arg))
-@@ -206,15 +265,15 @@ blocklist_func (char *arg, int flags)
+@@ -206,15 +266,15 @@ blocklist_func (char *arg, int flags)
    grub_printf (")");
  
    /* Read in the whole file to DUMMY.  */
@@ -37568,7 +37951,7 @@ index 3e08a86..c90c527 100644
  
    grub_printf ("\n");
    
-@@ -237,12 +296,25 @@ static struct builtin builtin_blocklist =
+@@ -237,12 +297,25 @@ static struct builtin builtin_blocklist =
  static int
  boot_func (char *arg, int flags)
  {
@@ -37594,7 +37977,7 @@ index 3e08a86..c90c527 100644
  #ifdef SUPPORT_NETBOOT
    /* Shut down the networking.  */
    cleanup_net ();
-@@ -250,11 +322,13 @@ boot_func (char *arg, int flags)
+@@ -250,11 +323,13 @@ boot_func (char *arg, int flags)
    
    switch (kernel_type)
      {
@@ -37608,7 +37991,7 @@ index 3e08a86..c90c527 100644
  
      case KERNEL_TYPE_LINUX:
        /* Linux */
-@@ -296,16 +370,25 @@ boot_func (char *arg, int flags)
+@@ -296,16 +371,25 @@ boot_func (char *arg, int flags)
        chain_stage1 (0, BOOTSEC_LOCATION, boot_part_addr);
        break;
  
@@ -37634,7 +38017,7 @@ index 3e08a86..c90c527 100644
    return 0;
  }
  
-@@ -402,6 +485,10 @@ static struct builtin builtin_cat =
+@@ -402,6 +486,10 @@ static struct builtin builtin_cat =
  static int
  chainloader_func (char *arg, int flags)
  {
@@ -37645,7 +38028,7 @@ index 3e08a86..c90c527 100644
    int force = 0;
    char *file = arg;
  
-@@ -458,6 +545,7 @@ chainloader_func (char *arg, int flags)
+@@ -458,6 +546,7 @@ chainloader_func (char *arg, int flags)
    errnum = ERR_NONE;
    
    return 0;
@@ -37653,7 +38036,7 @@ index 3e08a86..c90c527 100644
  }
  
  static struct builtin builtin_chainloader =
-@@ -564,89 +652,88 @@ static struct builtin builtin_cmp =
+@@ -564,89 +653,88 @@ static struct builtin builtin_cmp =
  /* Set new colors used for the menu interface. Support two methods to
     specify a color name: a direct integer representation and a symbolic
     color name. An example of the latter is "blink-light-gray/blue".  */
@@ -37815,7 +38198,7 @@ index 3e08a86..c90c527 100644
    normal = arg;
    highlight = skip_to (0, arg);
  
-@@ -690,7 +777,6 @@ static struct builtin builtin_color =
+@@ -690,7 +778,6 @@ static struct builtin builtin_color =
    " But only the first eight names can be used for BG. You can prefix"
    " \"blink-\" to FG if you want a blinking foreground color."
  };
@@ -37823,7 +38206,7 @@ index 3e08a86..c90c527 100644
  
  /* configfile */
  static int
-@@ -737,14 +823,18 @@ static struct builtin builtin_configfile =
+@@ -737,14 +824,18 @@ static struct builtin builtin_configfile =
  static int
  debug_func (char *arg, int flags)
  {
@@ -37845,7 +38228,7 @@ index 3e08a86..c90c527 100644
        grub_printf (" Debug mode is turned on\n");
      }
  
-@@ -755,17 +845,61 @@ static struct builtin builtin_debug =
+@@ -755,17 +846,61 @@ static struct builtin builtin_debug =
  {
    "debug",
    debug_func,
@@ -37908,7 +38291,7 @@ index 3e08a86..c90c527 100644
    if (grub_strcmp (arg, "saved") == 0)
      {
        default_entry = saved_entryno;
-@@ -792,7 +926,7 @@ static struct builtin builtin_default =
+@@ -792,7 +927,7 @@ static struct builtin builtin_default =
  };
  
  
@@ -37917,7 +38300,7 @@ index 3e08a86..c90c527 100644
  /* device */
  static int
  device_func (char *arg, int flags)
-@@ -800,16 +934,17 @@ device_func (char *arg, int flags)
+@@ -800,16 +935,17 @@ device_func (char *arg, int flags)
    char *drive = arg;
    char *device;
  
@@ -37940,7 +38323,7 @@ index 3e08a86..c90c527 100644
    if (! *device || ! check_device (device))
      {
        errnum = ERR_FILE_NOT_FOUND;
-@@ -817,7 +952,7 @@ device_func (char *arg, int flags)
+@@ -817,7 +953,7 @@ device_func (char *arg, int flags)
      }
  
    assign_device_name (current_drive, device);
@@ -37949,7 +38332,7 @@ index 3e08a86..c90c527 100644
    return 0;
  }
  
-@@ -828,9 +963,20 @@ static struct builtin builtin_device =
+@@ -828,9 +964,20 @@ static struct builtin builtin_device =
    BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
    "device DRIVE DEVICE",
    "Specify DEVICE as the actual drive for a BIOS drive DRIVE. This command"
@@ -37972,7 +38355,7 @@ index 3e08a86..c90c527 100644
  
  
  #ifdef SUPPORT_NETBOOT
-@@ -852,6 +998,139 @@ static struct builtin builtin_dhcp =
+@@ -852,6 +999,139 @@ static struct builtin builtin_dhcp =
  };
  #endif /* SUPPORT_NETBOOT */
  
@@ -38112,7 +38495,7 @@ index 3e08a86..c90c527 100644
  
  /* displayapm */
  static int
-@@ -893,6 +1172,7 @@ static struct builtin builtin_displayapm =
+@@ -893,6 +1173,7 @@ static struct builtin builtin_displayapm =
    "displayapm",
    "Display APM BIOS information."
  };
@@ -38120,7 +38503,7 @@ index 3e08a86..c90c527 100644
  
  
  /* displaymem */
-@@ -912,11 +1192,11 @@ displaymem_func (char *arg, int flags)
+@@ -912,11 +1193,11 @@ displaymem_func (char *arg, int flags)
    if (mbi.flags & MB_INFO_MEM_MAP)
      {
        struct AddrRangeDesc *map = (struct AddrRangeDesc *) mbi.mmap_addr;
@@ -38134,7 +38517,7 @@ index 3e08a86..c90c527 100644
  	{
  	  char *str;
  
-@@ -924,15 +1204,10 @@ displaymem_func (char *arg, int flags)
+@@ -924,15 +1205,10 @@ displaymem_func (char *arg, int flags)
  	    str = "Usable RAM";
  	  else
  	    str = "Reserved";
@@ -38154,7 +38537,7 @@ index 3e08a86..c90c527 100644
  	}
      }
  
-@@ -1009,6 +1284,7 @@ static struct builtin builtin_dump =
+@@ -1009,6 +1285,7 @@ static struct builtin builtin_dump =
    };
  #endif /* GRUB_UTIL */
  
@@ -38162,7 +38545,7 @@ index 3e08a86..c90c527 100644
  
  static char embed_info[32];
  /* embed */
-@@ -1143,6 +1419,7 @@ static struct builtin builtin_embed =
+@@ -1143,6 +1420,7 @@ static struct builtin builtin_embed =
    " is a drive, or in the \"bootloader\" area if DEVICE is a FFS partition."
    " Print the number of sectors which STAGE1_5 occupies if successful."
  };
@@ -38170,15 +38553,17 @@ index 3e08a86..c90c527 100644
  
  
  /* fallback */
-@@ -1233,14 +1510,15 @@ find_func (char *arg, int flags)
+@@ -1233,14 +1511,16 @@ find_func (char *arg, int flags)
    for (drive = 0x80; drive < 0x88; drive++)
      {
        unsigned long part = 0xFFFFFF;
 -      unsigned long start, len, offset, ext_offset;
 -      int type, entry;
+-      char buf[SECTOR_SIZE];
 +      unsigned long start, len, offset, ext_offset, gpt_offset;
 +      int type, entry, gpt_count, gpt_size;
-       char buf[SECTOR_SIZE];
++      int sector_size = get_sector_size(drive);
++      char buf[sector_size];
  
        current_drive = drive;
        while (next_partition (drive, 0xFFFFFF, &part, &type,
@@ -38189,7 +38574,7 @@ index 3e08a86..c90c527 100644
  	{
  	  if (type != PC_SLICE_TYPE_NONE
  	      && ! IS_PC_SLICE_TYPE_BSD (type)
-@@ -1679,6 +1957,7 @@ static struct builtin builtin_ifconfig =
+@@ -1679,6 +1959,7 @@ static struct builtin builtin_ifconfig =
  };
  #endif /* SUPPORT_NETBOOT */
  
@@ -38197,7 +38582,7 @@ index 3e08a86..c90c527 100644
  
  /* impsprobe */
  static int
-@@ -1706,6 +1985,7 @@ static struct builtin builtin_impsprobe =
+@@ -1706,6 +1987,7 @@ static struct builtin builtin_impsprobe =
    " configuration table and boot the various CPUs which are found into"
    " a tight loop."
  };
@@ -38205,7 +38590,7 @@ index 3e08a86..c90c527 100644
  
  
  /* initrd */
-@@ -1738,8 +2018,82 @@ static struct builtin builtin_initrd =
+@@ -1738,8 +2020,82 @@ static struct builtin builtin_initrd =
    " appropriate parameters in the Linux setup area in memory."
  };
  
@@ -38288,7 +38673,7 @@ index 3e08a86..c90c527 100644
  static int
  install_func (char *arg, int flags)
  {
-@@ -1747,8 +2101,12 @@ install_func (char *arg, int flags)
+@@ -1747,8 +2103,12 @@ install_func (char *arg, int flags)
    char *stage1_buffer = (char *) RAW_ADDR (0x100000);
    char *stage2_buffer = stage1_buffer + SECTOR_SIZE;
    char *old_sect = stage2_buffer + SECTOR_SIZE;
@@ -38303,7 +38688,7 @@ index 3e08a86..c90c527 100644
    /* XXX: Probably SECTOR_SIZE is reasonable.  */
    char *config_filename = stage2_second_buffer + SECTOR_SIZE;
    char *dummy = config_filename + SECTOR_SIZE;
-@@ -1757,10 +2115,11 @@ install_func (char *arg, int flags)
+@@ -1757,10 +2117,11 @@ install_func (char *arg, int flags)
    int src_drive, src_partition, src_part_start;
    int i;
    struct geometry dest_geom, src_geom;
@@ -38317,7 +38702,7 @@ index 3e08a86..c90c527 100644
    /* Point to the location of the name of a configuration file in Stage 2.  */
    char *config_file_location;
    /* If FILE is a Stage 1.5?  */
-@@ -1769,68 +2128,18 @@ install_func (char *arg, int flags)
+@@ -1769,68 +2130,18 @@ install_func (char *arg, int flags)
    int is_open = 0;
    /* If LBA is forced?  */
    int is_force_lba = 0;
@@ -38391,7 +38776,7 @@ index 3e08a86..c90c527 100644
    /* First, check the GNU-style long option.  */
    while (1)
      {
-@@ -1862,10 +2171,10 @@ install_func (char *arg, int flags)
+@@ -1862,10 +2173,10 @@ install_func (char *arg, int flags)
    addr = skip_to (0, file);
  
    /* Get the installation address.  */
@@ -38404,7 +38789,7 @@ index 3e08a86..c90c527 100644
        ptr = addr;
        errnum = 0;
      }
-@@ -1961,17 +2270,17 @@ install_func (char *arg, int flags)
+@@ -1961,17 +2272,17 @@ install_func (char *arg, int flags)
        = 0x9090;
    
    /* Read the first sector of Stage 2.  */
@@ -38426,7 +38811,7 @@ index 3e08a86..c90c527 100644
    
    /* Check for the version of Stage 2.  */
    if (*((short *) (stage2_second_buffer + STAGE2_VER_MAJ_OFFS))
-@@ -1987,27 +2296,27 @@ install_func (char *arg, int flags)
+@@ -1987,27 +2298,27 @@ install_func (char *arg, int flags)
  
    /* If INSTALLADDR is not specified explicitly in the command-line,
       determine it by the Stage 2 id.  */
@@ -38461,7 +38846,7 @@ index 3e08a86..c90c527 100644
  	  || (*((int *) (i - 4)) & 0x80000000)
  	  || *((unsigned short *) i) >= 0xA00
  	  || *((short *) (i + 2)) == 0)
-@@ -2021,13 +2330,13 @@ install_func (char *arg, int flags)
+@@ -2021,13 +2332,13 @@ install_func (char *arg, int flags)
        i -= 8;
      }
  
@@ -38478,7 +38863,7 @@ index 3e08a86..c90c527 100644
    if (! grub_read (dummy, -1))
      goto fail;
    
-@@ -2110,7 +2419,7 @@ install_func (char *arg, int flags)
+@@ -2110,7 +2421,7 @@ install_func (char *arg, int flags)
  	  /* Skip the first sector.  */
  	  grub_seek (SECTOR_SIZE);
  	  
@@ -38487,7 +38872,7 @@ index 3e08a86..c90c527 100644
  	  if (grub_read (stage2_buffer, SECTOR_SIZE) != SECTOR_SIZE)
  	    goto fail;
  	  
-@@ -2180,7 +2489,7 @@ install_func (char *arg, int flags)
+@@ -2180,7 +2491,7 @@ install_func (char *arg, int flags)
  	  else
  #endif /* GRUB_UTIL */
  	    {
@@ -38496,7 +38881,7 @@ index 3e08a86..c90c527 100644
  		goto fail;
  	    }
  	}
-@@ -2202,7 +2511,7 @@ install_func (char *arg, int flags)
+@@ -2202,7 +2513,7 @@ install_func (char *arg, int flags)
  	  goto fail;
  	}
  
@@ -38505,7 +38890,7 @@ index 3e08a86..c90c527 100644
  	{
  	  fclose (fp);
  	  errnum = ERR_WRITE;
-@@ -2229,7 +2538,7 @@ install_func (char *arg, int flags)
+@@ -2229,7 +2540,7 @@ install_func (char *arg, int flags)
  	goto fail;
  
        if (! devwrite (stage2_first_sector - src_part_start, 1,
@@ -38514,7 +38899,7 @@ index 3e08a86..c90c527 100644
  	goto fail;
  
        if (! devwrite (stage2_second_sector - src_part_start, 1,
-@@ -2322,6 +2631,7 @@ static struct builtin builtin_ioprobe =
+@@ -2322,6 +2633,7 @@ static struct builtin builtin_ioprobe =
    "ioprobe DRIVE",
    "Probe I/O ports used for the drive DRIVE."
  };
@@ -38522,7 +38907,7 @@ index 3e08a86..c90c527 100644
  
  
  /* kernel */
-@@ -2456,6 +2766,7 @@ static struct builtin builtin_makeactive =
+@@ -2456,6 +2768,7 @@ static struct builtin builtin_makeactive =
    " This command is limited to _primary_ PC partitions on a hard disk."
  };
  
@@ -38530,7 +38915,7 @@ index 3e08a86..c90c527 100644
  
  /* map */
  /* Map FROM_DRIVE to TO_DRIVE.  */
-@@ -2519,6 +2830,7 @@ static struct builtin builtin_map =
+@@ -2519,6 +2832,7 @@ static struct builtin builtin_map =
    " when you chain-load some operating systems, such as DOS, if such an"
    " OS resides at a non-first drive."
  };
@@ -38538,7 +38923,7 @@ index 3e08a86..c90c527 100644
  
  
  #ifdef USE_MD5_PASSWORDS
-@@ -2579,6 +2891,7 @@ static struct builtin builtin_md5crypt =
+@@ -2579,6 +2893,7 @@ static struct builtin builtin_md5crypt =
  };
  #endif /* USE_MD5_PASSWORDS */
  
@@ -38546,7 +38931,7 @@ index 3e08a86..c90c527 100644
  
  /* module */
  static int
-@@ -2656,6 +2969,7 @@ static struct builtin builtin_modulenounzip =
+@@ -2656,6 +2971,7 @@ static struct builtin builtin_modulenounzip =
    "The same as `module', except that automatic decompression is"
    " disabled."
  };
@@ -38554,18 +38939,56 @@ index 3e08a86..c90c527 100644
  
  
  /* pager [on|off] */
-@@ -2815,8 +3129,8 @@ parttype_func (char *arg, int flags)
+@@ -2698,7 +3014,6 @@ partnew_func (char *arg, int flags)
+   int start_cl, start_ch, start_dh;
+   int end_cl, end_ch, end_dh;
+   int entry;
+-  char mbr[512];
+ 
+   /* Convert a LBA address to a CHS address in the INT 13 format.  */
+   auto void lba_to_chs (int lba, int *cl, int *ch, int *dh);
+@@ -2729,6 +3044,9 @@ partnew_func (char *arg, int flags)
+       return 1;
+     }
+ 
++  int sector_size = get_sector_size(current_drive);
++  char mbr[sector_size];
++
+   /* The partition must a primary partition.  */
+   if ((current_partition >> 16) > 3
+       || (current_partition & 0xFFFF) != 0xFFFF)
+@@ -2762,7 +3080,7 @@ partnew_func (char *arg, int flags)
+     return 1;
+ 
+   /* Read the MBR.  */
+-  if (! rawread (current_drive, 0, 0, SECTOR_SIZE, mbr))
++  if (! rawread (current_drive, 0, 0, sector_size, mbr))
+     return 1;
+ 
+   /* Check if the new partition will fit in the disk.  */
+@@ -2815,9 +3133,8 @@ parttype_func (char *arg, int flags)
  {
    int new_type;
    unsigned long part = 0xFFFFFF;
 -  unsigned long start, len, offset, ext_offset;
 -  int entry, type;
+-  char mbr[512];
 +  unsigned long start, len, offset, ext_offset, gpt_offset;
 +  int entry, type, gpt_count, gpt_size;
-   char mbr[512];
  
    /* Get the drive and the partition.  */
-@@ -2853,8 +3167,15 @@ parttype_func (char *arg, int flags)
+   if (! set_device (arg))
+@@ -2829,6 +3146,9 @@ parttype_func (char *arg, int flags)
+       errnum = ERR_BAD_ARGUMENT;
+       return 1;
+     }
++
++  int sector_size = get_sector_size(current_drive);
++  char mbr[sector_size];
+   
+   /* The partition must be a PC slice.  */
+   if ((current_partition >> 16) == 0xFF
+@@ -2853,8 +3173,15 @@ parttype_func (char *arg, int flags)
    /* Look for the partition.  */
    while (next_partition (current_drive, 0xFFFFFF, &part, &type,
  			 &start, &len, &offset, &entry,
@@ -38582,7 +39005,7 @@ index 3e08a86..c90c527 100644
        if (part == current_partition)
  	{
  	  /* Found.  */
-@@ -2900,6 +3221,11 @@ password_func (char *arg, int flags)
+@@ -2900,6 +3227,11 @@ password_func (char *arg, int flags)
        arg = skip_to (0, arg);
      }
  #endif
@@ -38594,7 +39017,7 @@ index 3e08a86..c90c527 100644
    if (grub_memcmp (arg, "--", 2) == 0)
      {
        type = PASSWORD_UNSUPPORTED;
-@@ -2947,7 +3273,7 @@ static struct builtin builtin_password =
+@@ -2947,7 +3279,7 @@ static struct builtin builtin_password =
    "password",
    password_func,
    BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_NO_ECHO,
@@ -38603,7 +39026,7 @@ index 3e08a86..c90c527 100644
    "If used in the first section of a menu file, disable all"
    " interactive editing control (menu entry editor and"
    " command line). If the password PASSWD is entered, it loads the"
-@@ -2956,7 +3282,8 @@ static struct builtin builtin_password =
+@@ -2956,7 +3288,8 @@ static struct builtin builtin_password =
    " instructions.  You can also use it in the script section, in"
    " which case it will ask for the password, before continueing."
    " The option --md5 tells GRUB that PASSWD is encrypted with"
@@ -38613,7 +39036,7 @@ index 3e08a86..c90c527 100644
  };
  
  
-@@ -2982,8 +3309,8 @@ static struct builtin builtin_pause =
+@@ -2982,8 +3315,8 @@ static struct builtin builtin_pause =
    "Print MESSAGE, then wait until a key is pressed."
  };
  
@@ -38623,7 +39046,7 @@ index 3e08a86..c90c527 100644
  /* quit */
  static int
  quit_func (char *arg, int flags)
-@@ -3002,7 +3329,7 @@ static struct builtin builtin_quit =
+@@ -3002,7 +3335,7 @@ static struct builtin builtin_quit =
    "quit",
    "Exit from the GRUB shell."
  };
@@ -38632,7 +39055,7 @@ index 3e08a86..c90c527 100644
  
  
  #ifdef SUPPORT_NETBOOT
-@@ -3165,7 +3492,8 @@ real_root_func (char *arg, int attempt_mount)
+@@ -3165,7 +3498,8 @@ real_root_func (char *arg, int attempt_mount)
  	return 1;
        
        /* Print the type of the filesystem.  */
@@ -38642,7 +39065,7 @@ index 3e08a86..c90c527 100644
      }
    
    return 0;
-@@ -3217,146 +3545,179 @@ static struct builtin builtin_rootnoverify =
+@@ -3217,146 +3551,181 @@ static struct builtin builtin_rootnoverify =
  };
  
  
@@ -38804,6 +39227,7 @@ index 3e08a86..c90c527 100644
 -	    goto fail;
 -	}
 +#if !defined(SUPPORT_DISKLESS) && defined(GRUB_UTIL)
++#define SECTOR_SIZE 0x200
 +/*
 + * Full implementation of new `savedefault' for GRUB shell.
 + * XXX This needs fixing for stage2 files which aren't accessible
@@ -38916,6 +39340,7 @@ index 3e08a86..c90c527 100644
 +  fclose (fp);
 +  return 0;
 +}
++#undef SECTOR_SIZE
 +#endif
 +
 +/* savedefault */
@@ -38943,7 +39368,7 @@ index 3e08a86..c90c527 100644
  #else /* ! SUPPORT_DISKLESS && ! GRUB_UTIL */
    errnum = ERR_UNRECOGNIZED;
    return 1;
-@@ -3368,10 +3729,14 @@ static struct builtin builtin_savedefault =
+@@ -3368,10 +3737,14 @@ static struct builtin builtin_savedefault =
    "savedefault",
    savedefault_func,
    BUILTIN_CMDLINE,
@@ -38962,7 +39387,7 @@ index 3e08a86..c90c527 100644
  };
  
  
-@@ -3527,6 +3892,7 @@ static struct builtin builtin_serial =
+@@ -3527,6 +3900,7 @@ static struct builtin builtin_serial =
  };
  #endif /* SUPPORT_SERIAL */
  
@@ -38970,7 +39395,7 @@ index 3e08a86..c90c527 100644
  
  /* setkey */
  struct keysym
-@@ -3612,50 +3978,47 @@ static struct keysym keysym_table[] =
+@@ -3612,50 +3986,47 @@ static struct keysym keysym_table[] =
    {"delete",		0,		0x7f,	0,	0x53}
  };
  
@@ -39055,7 +39480,7 @@ index 3e08a86..c90c527 100644
    to_key = arg;
    from_key = skip_to (0, to_key);
  
-@@ -3830,15 +4193,15 @@ setup_func (char *arg, int flags)
+@@ -3830,15 +4201,15 @@ setup_func (char *arg, int flags)
  	{
  	  char tmp[16];
  	  grub_sprintf (tmp, ",%d", (partition >> 16) & 0xFF);
@@ -39074,7 +39499,7 @@ index 3e08a86..c90c527 100644
      }
    
    int embed_stage1_5 (char *stage1_5, int drive, int partition)
-@@ -3973,7 +4336,7 @@ setup_func (char *arg, int flags)
+@@ -3973,7 +4344,7 @@ setup_func (char *arg, int flags)
  
    /* The prefix was determined.  */
    grub_sprintf (stage2, "%s%s", prefix, "/stage2");
@@ -39083,7 +39508,7 @@ index 3e08a86..c90c527 100644
    *real_config_filename = 0;
  
    /* Check if stage2 exists.  */
-@@ -4083,9 +4446,26 @@ static struct builtin builtin_setup =
+@@ -4083,9 +4454,26 @@ static struct builtin builtin_setup =
    " partition where GRUB images reside, specify the option `--stage2'"
    " to tell GRUB the file name under your OS."
  };
@@ -39111,7 +39536,7 @@ index 3e08a86..c90c527 100644
  /* terminal */
  static int
  terminal_func (char *arg, int flags)
-@@ -4244,17 +4624,21 @@ terminal_func (char *arg, int flags)
+@@ -4244,17 +4632,21 @@ terminal_func (char *arg, int flags)
   end:
    current_term = term_table + default_term;
    current_term->flags = term_flags;
@@ -39138,7 +39563,7 @@ index 3e08a86..c90c527 100644
    
    return 0;
  }
-@@ -4264,7 +4648,7 @@ static struct builtin builtin_terminal =
+@@ -4264,7 +4656,7 @@ static struct builtin builtin_terminal =
    "terminal",
    terminal_func,
    BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
@@ -39147,7 +39572,7 @@ index 3e08a86..c90c527 100644
    "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 +4660,7 @@ static struct builtin builtin_terminal =
+@@ -4276,7 +4668,7 @@ static struct builtin builtin_terminal =
    " seconds. The option --lines specifies the maximum number of lines."
    " The option --silent is used to suppress messages."
  };
@@ -39156,7 +39581,7 @@ index 3e08a86..c90c527 100644
  
  
  #ifdef SUPPORT_SERIAL
-@@ -4462,6 +4846,7 @@ static struct builtin builtin_testload =
+@@ -4462,6 +4854,7 @@ static struct builtin builtin_testload =
    " step is to try loading a kernel."
  };
  
@@ -39164,7 +39589,7 @@ index 3e08a86..c90c527 100644
  
  /* testvbe MODE */
  static int
-@@ -4566,6 +4951,7 @@ static struct builtin builtin_testvbe =
+@@ -4566,6 +4959,7 @@ static struct builtin builtin_testvbe =
    "testvbe MODE",
    "Test the VBE mode MODE. Hit any key to return."
  };
@@ -39172,7 +39597,7 @@ index 3e08a86..c90c527 100644
  
  
  #ifdef SUPPORT_NETBOOT
-@@ -4598,6 +4984,15 @@ static struct builtin builtin_tftpserver =
+@@ -4598,6 +4992,15 @@ static struct builtin builtin_tftpserver =
  static int
  timeout_func (char *arg, int flags)
  {
@@ -39188,7 +39613,7 @@ index 3e08a86..c90c527 100644
    if (! safe_parse_maxint (&arg, &grub_timeout))
      return 1;
  
-@@ -4661,6 +5056,7 @@ static struct builtin builtin_unhide =
+@@ -4661,6 +5064,7 @@ static struct builtin builtin_unhide =
    " partition type code."
  };
  
@@ -39196,7 +39621,7 @@ index 3e08a86..c90c527 100644
  
  /* uppermem */
  static int
-@@ -4790,11 +5186,34 @@ static struct builtin builtin_vbeprobe =
+@@ -4790,11 +5194,34 @@ static struct builtin builtin_vbeprobe =
    "Probe VBE information. If the mode number MODE is specified, show only"
    " the information about only the mode."
  };
@@ -39232,7 +39657,7 @@ index 3e08a86..c90c527 100644
    &builtin_blocklist,
    &builtin_boot,
  #ifdef SUPPORT_NETBOOT
-@@ -4802,25 +5221,36 @@ struct builtin *builtin_table[] =
+@@ -4802,25 +5229,36 @@ struct builtin *builtin_table[] =
  #endif /* SUPPORT_NETBOOT */
    &builtin_cat,
    &builtin_chainloader,
@@ -39271,7 +39696,7 @@ index 3e08a86..c90c527 100644
    &builtin_fstest,
    &builtin_geometry,
    &builtin_halt,
-@@ -4830,27 +5260,35 @@ struct builtin *builtin_table[] =
+@@ -4830,27 +5268,35 @@ struct builtin *builtin_table[] =
  #ifdef SUPPORT_NETBOOT
    &builtin_ifconfig,
  #endif /* SUPPORT_NETBOOT */
@@ -39309,7 +39734,7 @@ index 3e08a86..c90c527 100644
  #ifdef SUPPORT_NETBOOT
    &builtin_rarp,
  #endif /* SUPPORT_NETBOOT */
-@@ -4862,23 +5300,35 @@ struct builtin *builtin_table[] =
+@@ -4862,23 +5308,35 @@ struct builtin *builtin_table[] =
  #ifdef SUPPORT_SERIAL
    &builtin_serial,
  #endif /* SUPPORT_SERIAL */
@@ -40258,7 +40683,7 @@ index 09f9e31..e96bec2 100644
    
    /* Start main routine here.  */
 diff --git a/stage2/disk_io.c b/stage2/disk_io.c
-index b9bc526..d54864f 100644
+index b9bc526..09a0b75 100644
 --- a/stage2/disk_io.c
 +++ b/stage2/disk_io.c
 @@ -21,12 +21,17 @@
@@ -40318,6 +40743,82 @@ index b9bc526..d54864f 100644
  	}
  
        /* Make sure that SECTOR is valid.  */
+@@ -297,7 +305,7 @@ devread (int sector, int byte_offset, int byte_len, char *buf)
+    *  Check partition boundaries
+    */
+   if (sector < 0
+-      || ((sector + ((byte_offset + byte_len - 1) >> SECTOR_BITS))
++      || ((sector + ((byte_offset + byte_len - 1) >> get_sector_bits(current_drive)))
+ 	  >= part_length))
+     {
+       errnum = ERR_OUTSIDE_PART;
+@@ -307,8 +315,8 @@ devread (int sector, int byte_offset, int byte_len, char *buf)
+   /*
+    *  Get the read to the beginning of a partition.
+    */
+-  sector += byte_offset >> SECTOR_BITS;
+-  byte_offset &= SECTOR_SIZE - 1;
++  sector += byte_offset >> get_sector_bits(current_drive);
++  byte_offset &= get_sector_size(current_drive) - 1;
+ 
+ #if !defined(STAGE1_5)
+   if (disk_read_hook && debug)
+@@ -347,7 +355,7 @@ rawwrite (int drive, int sector, char *buf)
+ 	sector = 1;
+     }
+   
+-  memmove ((char *) SCRATCHADDR, buf, SECTOR_SIZE);
++  memmove ((char *) SCRATCHADDR, buf, get_sector_size(drive));
+   if (biosdisk (BIOSDISK_WRITE, drive, &buf_geom,
+ 		sector, 1, SCRATCHSEG))
+     {
+@@ -373,23 +381,23 @@ devwrite (int sector, int sector_count, char *buf)
+ 	 embed a Stage 1.5 into a partition instead of a MBR, use system
+ 	 calls directly instead of biosdisk, because of the bug in
+ 	 Linux. *sigh*  */
+-      return write_to_partition (device_map, current_drive, current_partition,
+-				 sector, sector_count, buf);
++      int ret;
++      ret = write_to_partition (device_map, current_drive, current_partition,
++				sector, sector_count, buf);
++      if (ret != -1)
++	return ret;
+     }
+-  else
+ #endif /* GRUB_UTIL && __linux__ */
+-    {
+-      int i;
+-      
+-      for (i = 0; i < sector_count; i++)
+-	{
+-	  if (! rawwrite (current_drive, part_start + sector + i, 
+-			  buf + (i << SECTOR_BITS)))
+-	      return 0;
++    int i;
+ 
+-	}
+-      return 1;
+-    }
++    for (i = 0; i < sector_count; i++)
++      {
++	if (! rawwrite (current_drive, part_start + sector + i,
++			buf + (i << get_sector_bits(current_drive))))
++	    return 0;
++
++      }
++    return 1;
+ }
+ 
+ static int
+@@ -458,7 +466,7 @@ make_saved_active (void)
+ 	}
+ 
+       /* Read the MBR in the scratch space.  */
+-      if (! rawread (saved_drive, 0, 0, SECTOR_SIZE, mbr))
++      if (! rawread (saved_drive, 0, 0, get_sector_size(saved_drive), mbr))
+ 	return 0;
+ 
+       /* If the partition is an extended partition, setting the active
 @@ -502,8 +510,8 @@ int
  set_partition_hidden_flag (int hidden)
  {
@@ -40363,6 +40864,24 @@ index b9bc526..d54864f 100644
  
    /* Get next BSD partition in current PC slice.  */
    int next_bsd_partition (void)
+@@ -601,7 +619,7 @@ next_partition (unsigned long drive, unsigned long dest,
+ 
+ 	  /* Read the BSD label.  */
+ 	  if (! rawread (drive, *start + BSD_LABEL_SECTOR,
+-			 0, SECTOR_SIZE, buf))
++			 0, get_sector_size(drive), buf))
+ 	    return 0;
+ 
+ 	  /* Check if it is valid.  */
+@@ -656,7 +674,7 @@ next_partition (unsigned long drive, unsigned long dest,
+ 	}
+ 
+       /* Read the MBR or the boot sector of the extended partition.  */
+-      if (! rawread (drive, *offset, 0, SECTOR_SIZE, buf))
++      if (! rawread (drive, *offset, 0, get_sector_size(drive), buf))
+ 	return 0;
+ 
+       /* Check if it is valid.  */
 @@ -666,6 +684,40 @@ next_partition (unsigned long drive, unsigned long dest,
  	  return 0;
  	}
@@ -40373,7 +40892,7 @@ index b9bc526..d54864f 100644
 +         struct grub_gpt_header *hdr = (struct grub_gpt_header *) buf;
 +
 +         /* Read in the GPT Partition table header.  */
-+         if (! rawread (drive, 1, 0, SECTOR_SIZE, buf))
++         if (! rawread (drive, 1, 0, get_sector_size(drive), buf))
 +           return 0;
 +
 +         if (hdr->magic == GPT_HEADER_MAGIC && hdr->version == 0x10000)
@@ -40393,7 +40912,7 @@ index b9bc526..d54864f 100644
 +             /* This is not a valid header for a GPT partition table.
 +                Re-read the MBR or the boot sector of the extended
 +                partition.  */
-+             if (! rawread (drive, *offset, 0, SECTOR_SIZE, buf))
++             if (! rawread (drive, *offset, 0, get_sector_size(drive), buf))
 +               return 0;
 +           }
 +       }
@@ -40431,7 +40950,7 @@ index b9bc526..d54864f 100644
 +           return 0;
 +         }
 +       /* Read in the GPT Partition table entry.  */
-+       if (! rawread (drive, (*gpt_offset) + GPT_ENTRY_SECTOR (*gpt_size, *entry), GPT_ENTRY_INDEX (*gpt_size, *entry), *gpt_size, buf))
++       if (! rawread (drive, (*gpt_offset) + GPT_ENTRY_SECTOR (drive, *gpt_size, *entry), GPT_ENTRY_INDEX (drive, *gpt_size, *entry), *gpt_size, buf))
 +         return 0;
 +      } while (! (gptentry->type1 && gptentry->type2));
 +
@@ -40458,7 +40977,7 @@ index b9bc526..d54864f 100644
    /* If previous partition is a BSD partition or a PC slice which
       contains BSD partitions...  */
    if ((*partition != 0xFFFFFF && IS_PC_SLICE_TYPE_BSD (*type & 0xff))
-@@ -755,6 +847,9 @@ real_open_partition (int flags)
+@@ -755,8 +847,11 @@ real_open_partition (int flags)
    unsigned long dest_partition = current_partition;
    unsigned long part_offset;
    unsigned long ext_offset;
@@ -40466,8 +40985,11 @@ index b9bc526..d54864f 100644
 +  int gpt_count;
 +  int gpt_size;
    int entry;
-   char buf[SECTOR_SIZE];
+-  char buf[SECTOR_SIZE];
++  char buf[4096];
    int bsd_part, pc_slice;
+ 
+   /* For simplicity.  */
 @@ -766,7 +861,8 @@ real_open_partition (int flags)
        int ret = next_partition (current_drive, dest_partition,
  				&current_partition, &current_slice,
@@ -40478,7 +41000,25 @@ index b9bc526..d54864f 100644
        bsd_part = (current_partition >> 8) & 0xFF;
        pc_slice = current_partition >> 16;
        return ret;
-@@ -978,7 +1074,7 @@ set_device (char *device)
+@@ -926,6 +1022,17 @@ open_partition (void)
+   return real_open_partition (0);
+ }
+ 
++#if !defined(PLATFORM_EFI) && !defined(GRUB_UTIL)
++int get_sector_size (int drive)
++{
++  return SECTOR_SIZE;
++}
++int get_sector_bits (int drive)
++{
++  return SECTOR_BITS;
++}
++#endif /* !defined(PLATFORM_EFI) && !defined(GRUB_UTIL) */
++
+ 
+ #ifndef STAGE1_5
+ /* XX used for device completion in 'set_device' and 'print_completions' */
+@@ -978,7 +1085,7 @@ set_device (char *device)
        if (*device != ',' && *device != ')')
  	{
  	  char ch = *device;
@@ -40487,7 +41027,7 @@ index b9bc526..d54864f 100644
  	  if (*device == 'f' || *device == 'h'
  	      || (*device == 'n' && network_ready)
  	      || (*device == 'c' && cdrom_drive != GRUB_INVALID_DRIVE))
-@@ -1002,14 +1098,14 @@ set_device (char *device)
+@@ -1002,14 +1109,14 @@ set_device (char *device)
  
  	  if ((*device == 'f'
  	       || *device == 'h'
@@ -40505,7 +41045,16 @@ index b9bc526..d54864f 100644
  	  if (ch == 'n' && network_ready)
  	    current_drive = NETWORK_DRIVE;
  	  else
-@@ -1376,7 +1472,7 @@ print_completions (int is_filename, int is_completion)
+@@ -1131,7 +1238,7 @@ set_bootdev (int hdbias)
+   if ((saved_drive & 0x80) && cur_part_addr)
+     {
+       if (rawread (saved_drive, cur_part_offset,
+-		   0, SECTOR_SIZE, (char *) SCRATCHADDR))
++		   0, get_sector_size(saved_drive), (char *) SCRATCHADDR))
+ 	{
+ 	  char *dst, *src;
+       
+@@ -1376,7 +1483,7 @@ print_completions (int is_filename, int is_completion)
  
  	      if (!ptr
  		  || *(ptr-1) != 'd'
@@ -40514,7 +41063,7 @@ index b9bc526..d54864f 100644
  		  || *(ptr-2) != 'n'
  #endif /* SUPPORT_NETBOOT */
  		  || *(ptr-2) != 'c')
-@@ -1407,7 +1503,7 @@ print_completions (int is_filename, int is_completion)
+@@ -1407,7 +1514,7 @@ print_completions (int is_filename, int is_completion)
  		      || (*(ptr-1) == 'd' && *(ptr-2) == 'c')))
  		print_a_completion ("cd");
  
@@ -40523,6 +41072,49 @@ index b9bc526..d54864f 100644
  	      if (network_ready
  		  && (disk_choice || NETWORK_DRIVE == current_drive)
  		  && (!ptr
+@@ -1596,7 +1703,7 @@ grub_open (char *filename)
+ 
+ 	  BLK_BLKLENGTH (list_addr) = tmp;
+ 
+-	  filemax += (tmp * SECTOR_SIZE);
++	  filemax += (tmp * get_sector_size(current_drive));
+ 	  list_addr += BLK_BLKLIST_INC_VAL;
+ 
+ 	  if (*ptr != ',')
+@@ -1673,6 +1780,7 @@ grub_read (char *buf, int len)
+   if (block_file)
+     {
+       int size, off, ret = 0;
++      int sector_size = get_sector_size(current_drive);
+ 
+       while (len && !errnum)
+ 	{
+@@ -1687,10 +1795,10 @@ grub_read (char *buf, int len)
+ 	  /* run BLK_CUR_FILEPOS up to filepos */
+ 	  while (filepos > BLK_CUR_FILEPOS)
+ 	    {
+-	      if ((filepos - (BLK_CUR_FILEPOS & ~(SECTOR_SIZE - 1)))
+-		  >= SECTOR_SIZE)
++	      if ((filepos - (BLK_CUR_FILEPOS & ~(sector_size - 1)))
++		  >= sector_size)
+ 		{
+-		  BLK_CUR_FILEPOS += SECTOR_SIZE;
++		  BLK_CUR_FILEPOS += sector_size;
+ 		  BLK_CUR_BLKNUM++;
+ 
+ 		  if (BLK_CUR_BLKNUM >= BLK_BLKLENGTH (BLK_CUR_BLKLIST))
+@@ -1703,9 +1811,9 @@ grub_read (char *buf, int len)
+ 		BLK_CUR_FILEPOS = filepos;
+ 	    }
+ 
+-	  off = filepos & (SECTOR_SIZE - 1);
++	  off = filepos & (sector_size - 1);
+ 	  size = ((BLK_BLKLENGTH (BLK_CUR_BLKLIST) - BLK_CUR_BLKNUM)
+-		  * SECTOR_SIZE) - off;
++		  * sector_size) - off;
+ 	  if (size > len)
+ 	    size = len;
+ 
 diff --git a/stage2/efistubs.c b/stage2/efistubs.c
 new file mode 100644
 index 0000000..29b086a
@@ -40606,10 +41198,27 @@ index bbad8b9..4295e45 100644
  #define BLK_BLKLIST_INC_VAL  8
  #endif /* NO_BLOCK_FILES */
 diff --git a/stage2/fsys_ext2fs.c b/stage2/fsys_ext2fs.c
-index 560048f..810ac5f 100644
+index 560048f..01386d1 100644
 --- a/stage2/fsys_ext2fs.c
 +++ b/stage2/fsys_ext2fs.c
-@@ -41,6 +41,7 @@ typedef __signed__ short __s16;
+@@ -25,7 +25,7 @@
+ static int mapblock1, mapblock2;
+ 
+ /* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */
+-#define DEV_BSIZE 512
++#define DEV_BSIZE get_sector_size(current_drive)
+ 
+ /* include/linux/fs.h */
+ #define BLOCK_SIZE 1024		/* initial block size for superblock read */
+@@ -33,6 +33,7 @@ static int mapblock1, mapblock2;
+ #define WHICH_SUPER 1
+ /* kind of from fs/ext2/super.c */
+ #define SBLOCK (WHICH_SUPER * BLOCK_SIZE / DEV_BSIZE)	/* = 2 */
++#define SBOFF ((WHICH_SUPER * BLOCK_SIZE) % DEV_BSIZE)
+ 
+ /* include/asm-i386/types.h */
+ typedef __signed__ char __s8;
+@@ -41,6 +42,7 @@ typedef __signed__ short __s16;
  typedef unsigned short __u16;
  typedef __signed__ int __s32;
  typedef unsigned int __u32;
@@ -40617,7 +41226,7 @@ index 560048f..810ac5f 100644
  
  /*
   * Constants relative to the data blocks, from ext2_fs.h
-@@ -51,7 +52,7 @@ typedef unsigned int __u32;
+@@ -51,7 +53,7 @@ typedef unsigned int __u32;
  #define EXT2_TIND_BLOCK                 (EXT2_DIND_BLOCK + 1)
  #define EXT2_N_BLOCKS                   (EXT2_TIND_BLOCK + 1)
  
@@ -40626,7 +41235,7 @@ index 560048f..810ac5f 100644
  struct ext2_super_block
    {
      __u32 s_inodes_count;	/* Inodes count */
-@@ -61,9 +62,9 @@ struct ext2_super_block
+@@ -61,9 +63,9 @@ struct ext2_super_block
      __u32 s_free_inodes_count;	/* Free inodes count */
      __u32 s_first_data_block;	/* First Data Block */
      __u32 s_log_block_size;	/* Block size */
@@ -40638,7 +41247,7 @@ index 560048f..810ac5f 100644
      __u32 s_inodes_per_group;	/* # Inodes per group */
      __u32 s_mtime;		/* Mount time */
      __u32 s_wtime;		/* Write time */
-@@ -72,17 +73,76 @@ struct ext2_super_block
+@@ -72,17 +74,76 @@ struct ext2_super_block
      __u16 s_magic;		/* Magic signature */
      __u16 s_state;		/* File system state */
      __u16 s_errors;		/* Behaviour when detecting errors */
@@ -40720,7 +41329,7 @@ index 560048f..810ac5f 100644
    {
      __u32 bg_block_bitmap;	/* Blocks bitmap block */
      __u32 bg_inode_bitmap;	/* Inodes bitmap block */
-@@ -90,8 +150,18 @@ struct ext2_group_desc
+@@ -90,8 +151,18 @@ struct ext2_group_desc
      __u16 bg_free_blocks_count;	/* Free blocks count */
      __u16 bg_free_inodes_count;	/* Free inodes count */
      __u16 bg_used_dirs_count;	/* Directories count */
@@ -40741,7 +41350,7 @@ index 560048f..810ac5f 100644
    };
  
  struct ext2_inode
-@@ -129,22 +199,22 @@ struct ext2_inode
+@@ -129,22 +200,22 @@ struct ext2_inode
      __u32 i_block[EXT2_N_BLOCKS];	/* 40: Pointers to blocks */
      __u32 i_version;		/* File version (for NFS) */
      __u32 i_file_acl;		/* File ACL */
@@ -40772,7 +41381,7 @@ index 560048f..810ac5f 100644
  	    __u16 h_i_mode_high;
  	    __u16 h_i_uid_high;
  	    __u16 h_i_gid_high;
-@@ -153,16 +223,36 @@ struct ext2_inode
+@@ -153,16 +224,36 @@ struct ext2_inode
  	hurd2;
  	struct
  	  {
@@ -40812,7 +41421,7 @@ index 560048f..810ac5f 100644
  /* linux/limits.h */
  #define NAME_MAX         255	/* # chars in a file name */
  
-@@ -180,6 +270,57 @@ struct ext2_dir_entry
+@@ -180,6 +271,57 @@ struct ext2_dir_entry
      char name[EXT2_NAME_LEN];	/* File name */
    };
  
@@ -40870,7 +41479,7 @@ index 560048f..810ac5f 100644
  /* linux/ext2fs.h */
  /*
   * EXT2_DIR_PAD defines the directory entries boundaries
-@@ -206,25 +347,37 @@ struct ext2_dir_entry
+@@ -206,25 +348,37 @@ struct ext2_dir_entry
      ((struct ext2_super_block *)(FSYS_BUF))
  #define GROUP_DESC \
      ((struct ext2_group_desc *) \
@@ -40913,7 +41522,7 @@ index 560048f..810ac5f 100644
  /* linux/stat.h */
  #define S_IFMT  00170000
  #define S_IFLNK  0120000
-@@ -239,8 +392,8 @@ struct ext2_dir_entry
+@@ -239,8 +393,8 @@ struct ext2_dir_entry
   * ffz = Find First Zero in word. Undefined if no zero exists,
   * so code should check against ~0UL first..
   */
@@ -40924,7 +41533,16 @@ index 560048f..810ac5f 100644
  {
    __asm__ ("bsfl %1,%0"
  :	   "=r" (word)
-@@ -276,7 +429,7 @@ ext2_rdfsb (int fsblock, int buffer)
+@@ -260,7 +414,7 @@ ext2fs_mount (void)
+        && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_EXT2FS))
+        && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER)))
+       || part_length < (SBLOCK + (sizeof (struct ext2_super_block) / DEV_BSIZE))
+-      || !devread (SBLOCK, 0, sizeof (struct ext2_super_block),
++      || !devread (SBLOCK, SBOFF, sizeof (struct ext2_super_block),
+ 		   (char *) SUPERBLOCK)
+       || SUPERBLOCK->s_magic != EXT2_SUPER_MAGIC)
+       retval = 0;
+@@ -276,7 +430,7 @@ ext2_rdfsb (int fsblock, int buffer)
    printf ("fsblock %d buffer %d\n", fsblock, buffer);
  #endif /* E2DEBUG */
    return devread (fsblock * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), 0,
@@ -40933,7 +41551,7 @@ index 560048f..810ac5f 100644
  }
  
  /* from
-@@ -386,6 +539,122 @@ ext2fs_block_map (int logical_block)
+@@ -386,6 +540,122 @@ ext2fs_block_map (int logical_block)
      [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
  }
  
@@ -41056,7 +41674,7 @@ index 560048f..810ac5f 100644
  /* preconditions: all preconds of ext2fs_block_map */
  int
  ext2fs_read (char *buf, int len)
-@@ -420,6 +689,11 @@ ext2fs_read (char *buf, int len)
+@@ -420,6 +690,11 @@ ext2fs_read (char *buf, int len)
        /* find the (logical) block component of our location */
        logical_block = filepos >> EXT2_BLOCK_SIZE_BITS (SUPERBLOCK);
        offset = filepos & (EXT2_BLOCK_SIZE (SUPERBLOCK) - 1);
@@ -41068,7 +41686,7 @@ index 560048f..810ac5f 100644
        map = ext2fs_block_map (logical_block);
  #ifdef E2DEBUG
        printf ("map=%d\n", map);
-@@ -504,7 +778,7 @@ ext2fs_dir (char *dirname)
+@@ -504,7 +779,7 @@ ext2fs_dir (char *dirname)
    int desc;			/* index within that group */
    int ino_blk;			/* fs pointer of the inode's information */
    int str_chk = 0;		/* used to hold the results of a string compare */
@@ -41077,7 +41695,7 @@ index 560048f..810ac5f 100644
    struct ext2_inode *raw_inode;	/* inode info corresponding to current_ino */
  
    char linkbuf[PATH_MAX];	/* buffer for following symbolic links */
-@@ -546,18 +820,25 @@ ext2fs_dir (char *dirname)
+@@ -546,18 +821,25 @@ ext2fs_dir (char *dirname)
  #endif /* E2DEBUG */
        if (!ext2_rdfsb (
  			(WHICH_SUPER + group_desc + SUPERBLOCK->s_first_data_block),
@@ -41108,7 +41726,7 @@ index 560048f..810ac5f 100644
  	{
  	  return 0;
  	}
-@@ -565,13 +846,12 @@ ext2fs_dir (char *dirname)
+@@ -565,13 +847,12 @@ ext2fs_dir (char *dirname)
        /* reset indirect blocks! */
        mapblock2 = mapblock1 = -1;
  
@@ -41126,7 +41744,7 @@ index 560048f..810ac5f 100644
        printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
        printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
        for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;
-@@ -629,7 +909,10 @@ ext2fs_dir (char *dirname)
+@@ -629,7 +910,10 @@ ext2fs_dir (char *dirname)
  	    }
  	  linkbuf[filemax + len] = '\0';
  
@@ -41138,7 +41756,7 @@ index 560048f..810ac5f 100644
  	  if (! ext2_is_fast_symlink ())
  	    {
  	      /* Read the necessary blocks, and reset the file pointer. */
-@@ -640,7 +923,9 @@ ext2fs_dir (char *dirname)
+@@ -640,7 +924,9 @@ ext2fs_dir (char *dirname)
  	    }
  	  else
  	    {
@@ -41149,7 +41767,7 @@ index 560048f..810ac5f 100644
  	      len = filemax;
  	      memmove (linkbuf, (char *) INODE->i_block, len);
  	    }
-@@ -674,6 +959,13 @@ ext2fs_dir (char *dirname)
+@@ -674,6 +960,13 @@ ext2fs_dir (char *dirname)
  	      errnum = ERR_BAD_FILETYPE;
  	      return 0;
  	    }
@@ -41163,7 +41781,7 @@ index 560048f..810ac5f 100644
  
  	  filemax = (INODE->i_size);
  	  return 1;
-@@ -728,17 +1020,28 @@ ext2fs_dir (char *dirname)
+@@ -728,17 +1021,28 @@ ext2fs_dir (char *dirname)
  	    }
  
  	  /* else, find the (logical) block component of our location */
@@ -41194,12 +41812,20 @@ index 560048f..810ac5f 100644
  	      errnum = ERR_FSYS_CORRUPT;
  	      *rest = ch;
 diff --git a/stage2/fsys_fat.c b/stage2/fsys_fat.c
-index f40e658..266ec03 100644
+index f40e658..f1157f4 100644
 --- a/stage2/fsys_fat.c
 +++ b/stage2/fsys_fat.c
-@@ -54,8 +54,8 @@ struct fat_superblock
- 
- #define FAT_CACHE_SIZE 2048
+@@ -49,13 +49,13 @@ struct fat_superblock
+ /* pointer(s) into filesystem info buffer for DOS stuff */
+ #define FAT_SUPER ( (struct fat_superblock *) \
+  		    ( FSYS_BUF + 32256) )/* 512 bytes long */
+-#define FAT_BUF   ( FSYS_BUF + 30208 )	/* 4 sector FAT buffer */
+-#define NAME_BUF  ( FSYS_BUF + 29184 )	/* Filename buffer (833 bytes) */
++#define FAT_BUF   ( FSYS_BUF + 28160 )	/* 4 sector FAT buffer */
++#define NAME_BUF  ( FSYS_BUF + 27136 )	/* Filename buffer (833 bytes) */
+ 
+-#define FAT_CACHE_SIZE 2048
++#define FAT_CACHE_SIZE 4096
  
 -static __inline__ unsigned long
 -log2 (unsigned long word)
@@ -41208,7 +41834,11 @@ index f40e658..266ec03 100644
  {
    __asm__ ("bsfl %1,%0"
  	   : "=r" (word)
-@@ -71,6 +71,8 @@ fat_mount (void)
+@@ -68,9 +68,12 @@ fat_mount (void)
+ {
+   struct fat_bpb bpb;
+   __u32 magic, first_fat;
++  int sector_size;
    
    /* Check partition type for harddisk */
    if (((current_drive & 0x80) || (current_slice != 0))
@@ -41217,7 +41847,14 @@ index f40e658..266ec03 100644
        && ! IS_PC_SLICE_TYPE_FAT (current_slice)
        && (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_MSDOS)))
      return 0;
-@@ -84,9 +86,9 @@ fat_mount (void)
+@@ -79,14 +82,16 @@ fat_mount (void)
+   if (! devread (0, 0, sizeof (bpb), (char *) &bpb))
+     return 0;
+ 
++  sector_size = get_sector_size(current_drive);
++
+   /* Check if the number of sectors per cluster is zero here, to avoid
+      zero division.  */
    if (bpb.sects_per_clust == 0)
      return 0;
    
@@ -41229,7 +41866,60 @@ index f40e658..266ec03 100644
    
    /* Fill in info about super block */
    FAT_SUPER->num_sectors = FAT_CVT_U16 (bpb.short_sectors) 
-@@ -340,7 +342,8 @@ fat_dir (char *dirname)
+@@ -106,7 +111,7 @@ fat_mount (void)
+   FAT_SUPER->data_offset = 
+     FAT_SUPER->root_offset
+     + ((FAT_SUPER->root_max - 1) >> FAT_SUPER->sectsize_bits) + 1;
+-  FAT_SUPER->num_clust = 
++  FAT_SUPER->num_clust =
+     2 + ((FAT_SUPER->num_sectors - FAT_SUPER->data_offset) 
+ 	 / bpb.sects_per_clust);
+   FAT_SUPER->sects_per_clust = bpb.sects_per_clust;
+@@ -153,11 +158,11 @@ fat_mount (void)
+   /* Now do some sanity checks */
+   
+   if (FAT_CVT_U16(bpb.bytes_per_sect) != (1 << FAT_SUPER->sectsize_bits)
+-      || FAT_CVT_U16(bpb.bytes_per_sect) != SECTOR_SIZE
++      || FAT_CVT_U16(bpb.bytes_per_sect) != sector_size
+       || bpb.sects_per_clust != (1 << (FAT_SUPER->clustsize_bits
+  				       - FAT_SUPER->sectsize_bits))
+       || FAT_SUPER->num_clust <= 2
+-      || (FAT_SUPER->fat_size * FAT_SUPER->num_clust / (2 * SECTOR_SIZE)
++      || (FAT_SUPER->fat_size * FAT_SUPER->num_clust / (2 * sector_size)
+  	  > FAT_SUPER->fat_length))
+     return 0;
+   
+@@ -201,6 +206,7 @@ fat_read (char *buf, int len)
+   int offset;
+   int ret = 0;
+   int size;
++  int sector_size = get_sector_size(current_drive);
+   
+   if (FAT_SUPER->file_cluster < 0)
+     {
+@@ -236,10 +242,10 @@ fat_read (char *buf, int len)
+ 	  if (cached_pos < 0 || 
+ 	      (cached_pos + FAT_SUPER->fat_size) > 2*FAT_CACHE_SIZE)
+ 	    {
+-	      FAT_SUPER->cached_fat = (fat_entry & ~(2*SECTOR_SIZE - 1));
++	      FAT_SUPER->cached_fat = (fat_entry & ~(2*sector_size - 1));
+ 	      cached_pos = (fat_entry - FAT_SUPER->cached_fat);
+ 	      sector = FAT_SUPER->fat_offset
+-		+ FAT_SUPER->cached_fat / (2*SECTOR_SIZE);
++		+ FAT_SUPER->cached_fat / (2*sector_size);
+ 	      if (!devread (sector, 0, FAT_CACHE_SIZE, (char*) FAT_BUF))
+ 		return 0;
+ 	    }
+@@ -257,6 +263,8 @@ fat_read (char *buf, int len)
+ 	    return ret;
+ 	  if (next_cluster < 2 || next_cluster >= FAT_SUPER->num_clust)
+ 	    {
++	      grub_printf("next_cluster: %d FAT_SUPER->num_clust: %d\n",
++		next_cluster, FAT_SUPER->num_clust);
+ 	      errnum = ERR_FSYS_CORRUPT;
+ 	      return 0;
+ 	    }
+@@ -340,7 +348,8 @@ fat_dir (char *dirname)
    /* Directories don't have a file size */
    filemax = MAXINT;
    
@@ -41239,7 +41929,7 @@ index f40e658..266ec03 100644
    
    *rest = 0;
    
-@@ -432,7 +435,7 @@ fat_dir (char *dirname)
+@@ -432,7 +441,7 @@ fat_dir (char *dirname)
  		goto print_filename;
  # endif /* STAGE1_5 */
  	      
@@ -41248,7 +41938,7 @@ index f40e658..266ec03 100644
  		break;
  	    }
  	}
-@@ -459,7 +462,7 @@ fat_dir (char *dirname)
+@@ -459,7 +468,7 @@ fat_dir (char *dirname)
        if (do_possibilities)
  	{
  	print_filename:
@@ -41257,7 +41947,7 @@ index f40e658..266ec03 100644
  	    {
  	      if (print_possibilities > 0)
  		print_possibilities = -print_possibilities;
-@@ -469,7 +472,7 @@ fat_dir (char *dirname)
+@@ -469,7 +478,7 @@ fat_dir (char *dirname)
  	}
  # endif /* STAGE1_5 */
        
@@ -41290,6 +41980,47 @@ index 90e4aa8..4d8a300 100644
  
    /*
     * We have to use own devread() function since BIOS return wrong geometry
+diff --git a/stage2/fsys_jfs.c b/stage2/fsys_jfs.c
+index 307f836..d63b1de 100644
+--- a/stage2/fsys_jfs.c
++++ b/stage2/fsys_jfs.c
+@@ -207,19 +207,20 @@ int
+ jfs_mount (void)
+ {
+ 	struct jfs_superblock super;
++	int sector_bits = get_sector_bits(current_drive);
+ 
+-	if (part_length < MINJFS >> SECTOR_BITS
+-	    || !devread (SUPER1_OFF >> SECTOR_BITS, 0,
++	if (part_length < MINJFS >> sector_bits
++	    || !devread (SUPER1_OFF >> sector_bits, 0,
+ 			 sizeof(struct jfs_superblock), (char *)&super)
+ 	    || (super.s_magic != JFS_MAGIC)
+-	    || !devread ((AITBL_OFF >> SECTOR_BITS) + FILESYSTEM_I,
++	    || !devread ((AITBL_OFF >> sector_bits) + FILESYSTEM_I,
+ 			 0, DISIZE, (char*)fileset)) {
+ 		return 0;
+ 	}
+ 
+ 	jfs.bsize = super.s_bsize;
+ 	jfs.l2bsize = super.s_l2bsize;
+-	jfs.bdlog = jfs.l2bsize - SECTOR_BITS;
++	jfs.bdlog = jfs.l2bsize - sector_bits;
+ 
+ 	return 1;
+ }
+@@ -387,9 +388,10 @@ int
+ jfs_embed (int *start_sector, int needed_sectors)
+ {
+ 	struct jfs_superblock super;
++	int sector_bits = get_sector_bits(current_drive);
+ 
+ 	if (needed_sectors > 63
+-	    || !devread (SUPER1_OFF >> SECTOR_BITS, 0,
++	    || !devread (SUPER1_OFF >> sector_bits, 0,
+ 			 sizeof (struct jfs_superblock),
+ 			 (char *)&super)
+ 	    || (super.s_magic != JFS_MAGIC)) {
 diff --git a/stage2/fsys_minix.c b/stage2/fsys_minix.c
 index 5c76796..175ecf2 100644
 --- a/stage2/fsys_minix.c
@@ -41328,10 +42059,18 @@ index 5c76796..175ecf2 100644
  
        /* reset indirect blocks! */
 diff --git a/stage2/fsys_reiserfs.c b/stage2/fsys_reiserfs.c
-index 93ec5f8..441cb3f 100644
+index 93ec5f8..f46fcb2 100644
 --- a/stage2/fsys_reiserfs.c
 +++ b/stage2/fsys_reiserfs.c
-@@ -341,19 +341,19 @@ struct fsys_reiser_info
+@@ -292,7 +292,6 @@ struct reiserfs_de_head
+ 
+ /* The size of the node cache */
+ #define FSYSREISER_CACHE_SIZE 24*1024
+-#define FSYSREISER_MIN_BLOCKSIZE SECTOR_SIZE
+ #define FSYSREISER_MAX_BLOCKSIZE FSYSREISER_CACHE_SIZE / 3
+ 
+ /* Info about currently opened file */
+@@ -341,19 +340,19 @@ struct fsys_reiser_info
  /* The cached s+tree blocks in FSYS_BUF,  see below
   * for a more detailed description.
   */
@@ -41356,7 +42095,7 @@ index 93ec5f8..441cb3f 100644
  /* 
   * The journal cache.  For each transaction it contains the number of
   * blocks followed by the real block numbers of this transaction.  
-@@ -366,8 +366,8 @@ struct fsys_reiser_info
+@@ -366,8 +365,8 @@ struct fsys_reiser_info
  #define JOURNAL_END      ((__u32 *) (FSYS_BUF + FSYS_BUFLEN))
  
  
@@ -41367,7 +42106,32 @@ index 93ec5f8..441cb3f 100644
  {
    __asm__ ("bsfl %1,%0"
  	   : "=r" (word)
-@@ -594,7 +594,7 @@ reiserfs_mount (void)
+@@ -569,9 +568,11 @@ int
+ reiserfs_mount (void)
+ {
+   struct reiserfs_super_block super;
+-  int superblock = REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS;
++  int sector_bits = get_sector_bits(current_drive);
++  int sector_size = get_sector_size(current_drive);
++  int superblock = REISERFS_DISK_OFFSET_IN_BYTES >> sector_bits;
+ 
+-  if (part_length < superblock + (sizeof (super) >> SECTOR_BITS)
++  if (part_length < superblock + (sizeof (super) >> sector_bits)
+       || ! devread (superblock, 0, sizeof (struct reiserfs_super_block), 
+ 		(char *) &super)
+       || (substring (REISER3FS_SUPER_MAGIC_STRING, super.s_magic) > 0
+@@ -582,8 +583,8 @@ reiserfs_mount (void)
+ 	  <= REISERFS_DISK_OFFSET_IN_BYTES))
+     {
+       /* Try old super block position */
+-      superblock = REISERFS_OLD_DISK_OFFSET_IN_BYTES >> SECTOR_BITS;
+-      if (part_length < superblock + (sizeof (super) >> SECTOR_BITS)
++      superblock = REISERFS_OLD_DISK_OFFSET_IN_BYTES >> sector_bits;
++      if (part_length < superblock + (sizeof (super) >> sector_bits)
+ 	  || ! devread (superblock, 0, sizeof (struct reiserfs_super_block), 
+ 			(char *) &super))
+ 	return 0;
+@@ -594,7 +595,7 @@ reiserfs_mount (void)
  	{
  	  /* pre journaling super block ? */
  	  if (substring (REISERFS_SUPER_MAGIC_STRING, 
@@ -41376,15 +42140,54 @@ index 93ec5f8..441cb3f 100644
  	    return 0;
  	  
  	  super.s_blocksize = REISERFS_OLD_BLOCKSIZE;
-@@ -609,7 +609,7 @@ reiserfs_mount (void)
+@@ -609,8 +610,8 @@ reiserfs_mount (void)
    
    INFO->version = super.s_version;
    INFO->blocksize = super.s_blocksize;
 -  INFO->fullblocksize_shift = log2 (super.s_blocksize);
+-  INFO->blocksize_shift = INFO->fullblocksize_shift - SECTOR_BITS;
 +  INFO->fullblocksize_shift = grub_log2 (super.s_blocksize);
-   INFO->blocksize_shift = INFO->fullblocksize_shift - SECTOR_BITS;
++  INFO->blocksize_shift = INFO->fullblocksize_shift - sector_bits;
    INFO->cached_slots = 
      (FSYSREISER_CACHE_SIZE >> INFO->fullblocksize_shift) - 1;
+ 
+@@ -622,9 +623,9 @@ reiserfs_mount (void)
+   /* Clear node cache. */
+   memset (INFO->blocks, 0, sizeof (INFO->blocks));
+ 
+-  if (super.s_blocksize < FSYSREISER_MIN_BLOCKSIZE
++  if (super.s_blocksize < get_sector_size(current_drive)
+       || super.s_blocksize > FSYSREISER_MAX_BLOCKSIZE
+-      || (SECTOR_SIZE << INFO->blocksize_shift) != super.s_blocksize)
++      || (sector_size << INFO->blocksize_shift) != super.s_blocksize)
+     return 0;
+ 
+   /* Initialize journal code.  If something fails we end with zero
+@@ -1215,9 +1216,10 @@ int
+ reiserfs_embed (int *start_sector, int needed_sectors)
+ {
+   struct reiserfs_super_block super;
++  int sector_bits = get_sector_bits(current_drive);
+   int num_sectors;
+-  
+-  if (! devread (REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS, 0, 
++ 
++  if (! devread (REISERFS_DISK_OFFSET_IN_BYTES >> sector_bits, 0,
+ 		 sizeof (struct reiserfs_super_block), (char *) &super))
+     return 0;
+   
+@@ -1229,9 +1231,9 @@ reiserfs_embed (int *start_sector, int needed_sectors)
+ 	   * the journal log */
+ 	  super.s_journal_block * super.s_blocksize 
+ 	  > REISERFS_DISK_OFFSET_IN_BYTES))
+-    num_sectors = (REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS) - 1;
++    num_sectors = (REISERFS_DISK_OFFSET_IN_BYTES >> sector_bits) - 1;
+   else
+-    num_sectors = (REISERFS_OLD_DISK_OFFSET_IN_BYTES >> SECTOR_BITS) - 1;
++    num_sectors = (REISERFS_OLD_DISK_OFFSET_IN_BYTES >> sector_bits) - 1;
+   
+   return (needed_sectors <= num_sectors);
+ }
 diff --git a/stage2/fsys_vstafs.c b/stage2/fsys_vstafs.c
 index a116717..652e784 100644
 --- a/stage2/fsys_vstafs.c
@@ -41474,7 +42277,7 @@ index a116717..652e784 100644
      }
    
 diff --git a/stage2/fsys_xfs.c b/stage2/fsys_xfs.c
-index 76c4c13..d5214d3 100644
+index 76c4c13..226e343 100644
 --- a/stage2/fsys_xfs.c
 +++ b/stage2/fsys_xfs.c
 @@ -97,19 +97,23 @@ ino2offset (xfs_ino_t ino)
@@ -41530,12 +42333,21 @@ index 76c4c13..d5214d3 100644
  
  	return (tmp - sizeof(xfs_bmdr_block_t) - offsetof(xfs_dinode_t, di_u)) /
  		(sizeof (xfs_bmbt_key_t) + sizeof (xfs_bmbt_ptr_t));
+@@ -465,7 +469,7 @@ xfs_mount (void)
+ 
+ 	xfs.bsize = le32 (super.sb_blocksize);
+ 	xfs.blklog = super.sb_blocklog;
+-	xfs.bdlog = xfs.blklog - SECTOR_BITS;
++	xfs.bdlog = xfs.blklog - get_sector_bits(current_drive);
+ 	xfs.rootino = le64 (super.sb_rootino);
+ 	xfs.isize = le16 (super.sb_inodesize);
+ 	xfs.agblocks = le32 (super.sb_agblocks);
 diff --git a/stage2/gpt.h b/stage2/gpt.h
 new file mode 100644
-index 0000000..71ed0b8
+index 0000000..ad6d8f1
 --- /dev/null
 +++ b/stage2/gpt.h
-@@ -0,0 +1,68 @@
+@@ -0,0 +1,69 @@
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2002,2005,2006   Free Software Foundation, Inc.
@@ -41598,10 +42410,11 @@ index 0000000..71ed0b8
 +
 +#define GPT_HEADER_MAGIC       0x5452415020494645ULL
 +
-+#define        GPT_ENTRY_SECTOR(size,entry)                                    \
-+       ((((entry) * (size) + 1) & ~(SECTOR_SIZE - 1)) >> SECTOR_BITS)
-+#define        GPT_ENTRY_INDEX(size,entry)                                     \
-+       ((((entry) * (size) + 1) & (SECTOR_SIZE - 1)) - 1)
++#define        GPT_ENTRY_SECTOR(drive,size,entry)                      \
++       ((((entry) * (size) + 1) & ~(get_sector_size(drive) - 1))       \
++       >> get_sector_bits(drive))
++#define        GPT_ENTRY_INDEX(drive, size,entry)                      \
++       ((((entry) * (size) + 1) & (get_sector_size(drive) - 1)) - 1)
 +
 +#endif /* _GPT_H */
 diff --git a/stage2/graphics.c b/stage2/graphics.c
@@ -41612,7 +42425,7 @@ index 0000000..81109ae
 @@ -0,0 +1,573 @@
 +/* graphics.c - graphics mode support for GRUB */
 +/* Implemented as a terminal type by Jeremy Katz <katzj at redhat.com> based
-+ * on a patch by Paulo César Pereira de Andrade <pcpa at conectiva.com.br>
++ * on a patch by Paulo César Pereira de Andrade <pcpa at conectiva.com.br>
 + */
 +/*
 + *  GRUB  --  GRand Unified Bootloader
@@ -44005,7 +44818,7 @@ index 0000000..ff6cd26
 +}
 +#endif
 diff --git a/stage2/shared.h b/stage2/shared.h
-index 77eef11..9405556 100644
+index 77eef11..7a77744 100644
 --- a/stage2/shared.h
 +++ b/stage2/shared.h
 @@ -35,9 +35,10 @@
@@ -44022,7 +44835,27 @@ index 77eef11..9405556 100644
  # define RAW_SEG(x) (RAW_ADDR ((x) << 4) >> 4)
  #else
  # define RAW_ADDR(x) (x)
-@@ -160,8 +161,8 @@ extern char *grub_scratch_mem;
+@@ -56,15 +57,15 @@ extern char *grub_scratch_mem;
+ #define NEW_HEAPSIZE 1500
+ 
+ /* 512-byte scratch area */
+-#define SCRATCHADDR  RAW_ADDR (0x77e00)
+-#define SCRATCHSEG   RAW_SEG (0x77e0)
++#define SCRATCHADDR  RAW_ADDR (0x77000)
++#define SCRATCHSEG   RAW_SEG (0x7700)
+ 
+ /*
+- *  This is the location of the raw device buffer.  It is 31.5K
++ *  This is the location of the raw device buffer.  It is 28K
+  *  in size.
+  */
+ 
+-#define BUFFERLEN   0x7e00
++#define BUFFERLEN   0x7000
+ #define BUFFERADDR  RAW_ADDR (0x70000)
+ #define BUFFERSEG   RAW_SEG (0x7000)
+ 
+@@ -160,16 +161,18 @@ extern char *grub_scratch_mem;
  #define LINUX_VID_MODE_ASK		0xFFFD
  
  #define LINUX_CL_OFFSET			0x9000
@@ -44033,7 +44866,17 @@ index 77eef11..9405556 100644
  #define LINUX_CL_MAGIC			0xA33F
  
  /*
-@@ -200,6 +201,8 @@ extern char *grub_scratch_mem;
+  *  General disk stuff
+  */
+ 
++#ifndef PLATFORM_EFI
+ #define SECTOR_SIZE		0x200
+ #define SECTOR_BITS		9
++#endif /* PLATFORM_EFI */
+ #define BIOS_FLAG_FIXED_DISK	0x80
+ 
+ #define BOOTSEC_LOCATION		RAW_ADDR (0x7C00)
+@@ -200,6 +203,8 @@ extern char *grub_scratch_mem;
  #define STAGE2_FORCE_LBA	0x11
  #define STAGE2_VER_STR_OFFS	0x12
  
@@ -44042,7 +44885,7 @@ index 77eef11..9405556 100644
  /* Stage 2 identifiers */
  #define STAGE2_ID_STAGE2		0
  #define STAGE2_ID_FFS_STAGE1_5		1
-@@ -371,14 +374,24 @@ extern char *grub_scratch_mem;
+@@ -371,14 +376,24 @@ extern char *grub_scratch_mem;
  #define tolower grub_tolower
  #define strlen grub_strlen
  #define strcpy grub_strcpy
@@ -44068,7 +44911,7 @@ index 77eef11..9405556 100644
  /* multiboot stuff */
  
  #include "mb_header.h"
-@@ -400,30 +413,33 @@ struct linux_kernel_header
+@@ -400,30 +415,33 @@ struct linux_kernel_header
    unsigned short root_dev;		/* Default root device number */
    unsigned short boot_flag;		/* 0xAA55 magic number */
    unsigned short jump;			/* Jump instruction */
@@ -44112,7 +44955,7 @@ index 77eef11..9405556 100644
  } __attribute__ ((packed));
  
  /* VBE controller information.  */
-@@ -600,6 +616,7 @@ typedef enum
+@@ -600,6 +618,7 @@ typedef enum
  {
    PASSWORD_PLAIN,
    PASSWORD_MD5,
@@ -44120,7 +44963,7 @@ index 77eef11..9405556 100644
    PASSWORD_UNSUPPORTED
  }
  password_t;
-@@ -627,8 +644,16 @@ extern void (*disk_read_func) (int, int, int);
+@@ -627,8 +646,16 @@ extern void (*disk_read_func) (int, int, int);
  #ifndef STAGE1_5
  /* The flag for debug mode.  */
  extern int debug;
@@ -44137,7 +44980,7 @@ index 77eef11..9405556 100644
  extern unsigned long current_drive;
  extern unsigned long current_partition;
  
-@@ -666,6 +691,8 @@ extern struct geometry buf_geom;
+@@ -666,6 +693,8 @@ extern struct geometry buf_geom;
  extern int filepos;
  extern int filemax;
  
@@ -44146,7 +44989,7 @@ index 77eef11..9405556 100644
  /*
   *  Common BIOS/boot data.
   */
-@@ -804,6 +831,10 @@ int getkey (void);
+@@ -804,11 +833,17 @@ int getkey (void);
     available. */
  int checkkey (void);
  
@@ -44157,7 +45000,14 @@ index 77eef11..9405556 100644
  /* Low-level disk I/O */
  int get_diskinfo (int drive, struct geometry *geometry);
  int biosdisk (int subfunc, int drive, struct geometry *geometry,
-@@ -860,17 +891,25 @@ void init_builtins (void);
+ 	      int sector, int nsec, int segment);
+ void stop_floppy (void);
++int get_sector_size (int drive);
++int get_sector_bits (int drive);
+ 
+ /* Command-line interface functions. */
+ #ifndef STAGE1_5
+@@ -860,17 +895,25 @@ void init_builtins (void);
  void init_config (void);
  char *skip_to (int after_equal, char *cmdline);
  struct builtin *find_command (char *command);
@@ -44185,7 +45035,7 @@ index 77eef11..9405556 100644
  void *grub_memmove (void *to, const void *from, int len);
  void *grub_memset (void *start, int c, int len);
  int grub_strncat (char *s1, const char *s2, int n);
-@@ -879,9 +918,19 @@ int grub_memcmp (const char *s1, const char *s2, int n);
+@@ -879,9 +922,19 @@ int grub_memcmp (const char *s1, const char *s2, int n);
  int grub_strcmp (const char *s1, const char *s2);
  int grub_strlen (const char *str);
  char *grub_strcpy (char *dest, const char *src);
@@ -44206,7 +45056,7 @@ index 77eef11..9405556 100644
  #else
  /* In the grub shell, use the libc jmp_buf instead.  */
  # include <setjmp.h>
-@@ -904,10 +953,11 @@ extern grub_jmp_buf restart_cmdline_env;
+@@ -904,10 +957,11 @@ extern grub_jmp_buf restart_cmdline_env;
  /* misc */
  void init_page (void);
  void print_error (void);
@@ -44219,7 +45069,7 @@ index 77eef11..9405556 100644
  int nul_terminate (char *str);
  int get_based_digit (int c, int base);
  int safe_parse_maxint (char **str_ptr, int *myint_ptr);
-@@ -934,7 +984,9 @@ int next_partition (unsigned long drive, unsigned long dest,
+@@ -934,7 +988,9 @@ int next_partition (unsigned long drive, unsigned long dest,
  		    unsigned long *partition, int *type,
  		    unsigned long *start, unsigned long *len,
  		    unsigned long *offset, int *entry,
@@ -44230,7 +45080,7 @@ index 77eef11..9405556 100644
  
  /* Sets device to the one represented by the SAVED_* parameters. */
  int make_saved_active (void);
-@@ -987,10 +1039,22 @@ int load_module (char *module, char *arg);
+@@ -987,10 +1043,22 @@ int load_module (char *module, char *arg);
  int load_initrd (char *initrd);
  
  int check_password(char *entered, char* expected, password_t type);
@@ -44298,7 +45148,7 @@ index 4dbf6f5..cca4332 100644
    char *cur_entry = 0;
 +  struct term_entry *prev_term = NULL;
 +
-+  if (grub_verbose || grub_timeout != 0)
++  if (grub_verbose)
 +    cls();
  
    /*
@@ -44778,6 +45628,19 @@ index 0000000..b182379
 +++ b/test
 @@ -0,0 +1 @@
 +fo of fo
+diff --git a/util/.gitignore b/util/.gitignore
+new file mode 100644
+index 0000000..6687356
+--- /dev/null
++++ b/util/.gitignore
+@@ -0,0 +1,7 @@
++Makefile.in
++Makefile
++.deps
++grub-image
++grub-install
++grub-md5-crypt
++grub-terminfo
 diff --git a/util/Makefile.am b/util/Makefile.am
 index 2e04711..fa545b1 100644
 --- a/util/Makefile.am
@@ -45225,10 +46088,10 @@ index 0000000..e8783c8
 +if __name__ == '__main__':
 +    main()
 diff --git a/util/grub-install.in b/util/grub-install.in
-index 2e598b0..63d6284 100644
+index 2e598b0..12539b8 100644
 --- a/util/grub-install.in
 +++ b/util/grub-install.in
-@@ -21,26 +21,28 @@
+@@ -21,34 +21,36 @@
  prefix=@prefix@
  exec_prefix=@exec_prefix@
  sbindir=@sbindir@
@@ -45244,9 +46107,11 @@ index 2e598b0..63d6284 100644
  
  grub_shell=${sbindir}/grub
 -grub_set_default=${sbindir}/grub-set-default
+-log_file=/tmp/grub-install.log.$$
+-img_file=/tmp/grub-install.img.$$
 +mdadm=${sbindir}/mdadm
- log_file=/tmp/grub-install.log.$$
- img_file=/tmp/grub-install.img.$$
++log_file=${TMPDIR:-/tmp}/grub-install.log.$$
++img_file=${TMPDIR:-/tmp}/grub-install.img.$$
  rootdir=
  grub_prefix=/boot/grub
  
@@ -45260,6 +46125,16 @@ index 2e598b0..63d6284 100644
  
  # look for secure tempfile creation wrappers on this platform
  if test -x /bin/tempfile; then
+     mklog="/bin/tempfile --prefix=grub"
+     mkimg="/bin/tempfile --prefix=grub"
+ elif test -x /bin/mktemp; then
+-    mklog="/bin/mktemp /tmp/grub-install.log.XXXXXX"
+-    mkimg="/bin/mktemp /tmp/grub-install.img.XXXXXX"
++    mklog="/bin/mktemp ${TMPDIR:-/tmp}/grub-install.log.XXXXXX"
++    mkimg="/bin/mktemp ${TMPDIR:-/tmp}/grub-install.img.XXXXXX"
+ else
+     mklog=""
+     mkimg=""
 @@ -70,6 +72,8 @@ Install GRUB on your drive.
    --force-lba             force GRUB to use LBA mode even for a buggy
                            BIOS
diff --git a/grub.spec b/grub.spec
index 8bf66e4..0d90a61 100644
--- a/grub.spec
+++ b/grub.spec
@@ -1,6 +1,6 @@
 Name: grub
 Version: 0.97
-Release: 73%{?dist}
+Release: 74%{?dist}
 Epoch: 1
 Summary: Grand Unified Boot Loader.
 Group: System Environment/Base
@@ -23,14 +23,7 @@ Source0: ftp://alpha.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz
 
 # This is from
 # http://git.kernel.org/?p=boot/grub-fedora/grub-fedora.git;a=summary
-Patch0: grub-fedora-14.patch
-Patch1: grub-0.97-support-4k-sector-size.patch
-
-# https://bugzilla.redhat.com/show_bug.cgi?id=681787
-Patch2: grub-0.97-flat-file-install.patch
-
-# Not in GIT
-Patch3: grub-0.97-uninitialized.patch
+Patch0: grub-fedora-15.patch
 
 %description
 GRUB (Grand Unified Boot Loader) is an experimental boot loader
@@ -111,6 +104,9 @@ fi
 %{_datadir}/grub
 
 %changelog
+* Mon Mar 14 2011 Peter Jones <pjones at redhat.com> - 0.97-74
+- Fix stack alignment in UEFI calls (Patch from Stuart Hayes) (#677468)
+
 * Fri Mar 11 2011 Lubomir Rintel <lkundrak at v3.sk> - 1:0.97-73
 - Support flat file installs (#681787)
 - Fix Rawhide build


More information about the scm-commits mailing list