diff --git a/.gitignore b/.gitignore
index e42c931..0342d81 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
 SOURCES/grub-2.02~beta2.tar.xz
-SOURCES/unifont-5.1.20080820.pcf.gz
 SOURCES/theme.tar.bz2
+SOURCES/unifont-5.1.20080820.pcf.gz
diff --git a/.grub2.metadata b/.grub2.metadata
index 27085b6..261f908 100644
--- a/.grub2.metadata
+++ b/.grub2.metadata
@@ -1,3 +1,3 @@
 1bf580f1e8bce4909a7ac7ca485cee02b00ed383 SOURCES/grub-2.02~beta2.tar.xz
-87f8600ba24e521b5d20bdf6c4b71af8ae861e3a SOURCES/unifont-5.1.20080820.pcf.gz
 cf0b7763c528902da7e8b05cfa248f20c8825ce5 SOURCES/theme.tar.bz2
+87f8600ba24e521b5d20bdf6c4b71af8ae861e3a SOURCES/unifont-5.1.20080820.pcf.gz
diff --git a/SOURCES/0001-Add-GRUB_DISABLE_UUID.patch b/SOURCES/0001-Add-GRUB_DISABLE_UUID.patch
new file mode 100644
index 0000000..e4fd8bd
--- /dev/null
+++ b/SOURCES/0001-Add-GRUB_DISABLE_UUID.patch
@@ -0,0 +1,102 @@
+From c15606e88f9b6a97985febb331d7ee6d0489ba7e Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Thu, 4 Sep 2014 16:49:25 -0400
+Subject: [PATCH] Add GRUB_DISABLE_UUID.
+
+This will cause "search --fs-uuid --set=root ..." not to be generated by
+grub2-mkconfig, and instead simply attempt to use the grub device name
+as it understands it.
+
+Good luck.
+
+Resolves: rhbz#1027833
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ docs/grub.texi            |  7 +++++++
+ util/grub-mkconfig.in     | 12 ++++++++++--
+ util/grub-mkconfig_lib.in |  4 ++--
+ 3 files changed, 19 insertions(+), 4 deletions(-)
+
+diff --git a/docs/grub.texi b/docs/grub.texi
+index 46b9e7f..6b112c1 100644
+--- a/docs/grub.texi
++++ b/docs/grub.texi
+@@ -1409,6 +1409,13 @@ disable the use of UUIDs, set this option to @samp{true}.
+ If this option is set to @samp{true}, disable the generation of recovery
+ mode menu entries.
+ 
++@item GRUB_DISABLE_UUID
++Normally, @command{grub-mkconfig} will generate menu entries that use
++universally-unique identifiers (UUIDs) to identify various filesystems to
++search for files.  This is usually more reliable, but in some cases it may
++not be appropriate.  To disable this use of UUIDs, set this option to
++@samp{true}.
++
+ @item GRUB_VIDEO_BACKEND
+ If graphical video support is required, either because the @samp{gfxterm}
+ graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
+diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
+index beb22de..bc26e7c 100644
+--- a/util/grub-mkconfig.in
++++ b/util/grub-mkconfig.in
+@@ -130,11 +130,11 @@ fi
+ 
+ # Device containing our userland.  Typically used for root= parameter.
+ GRUB_DEVICE="`${grub_probe} --target=device /`"
+-GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
++GRUB_DEVICE_UUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
+ 
+ # Device containing our /boot partition.  Usually the same as GRUB_DEVICE.
+ GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
+-GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
++GRUB_DEVICE_BOOT_UUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
+ 
+ # Filesystem for the device containing our userland.  Used for stuff like
+ # choosing Hurd filesystem module.
+@@ -148,6 +148,13 @@ if test -f ${sysconfdir}/default/grub ; then
+   . ${sysconfdir}/default/grub
+ fi
+ 
++if [ "x$GRUB_DISABLE_UUID" != "xtrue" -a -z "$GRUB_DEVICE_UUID" ]; then
++  GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED"
++fi
++if [ "x$GRUB_DISABLE_UUID" != "xtrue" -a -z "$GRUB_DEVICE_BOOT_UUID" ]; then
++  GRUB_DEVICE_BOOT_UUID="$GRUB_DEVICE_BOOT_UUID_GENERATED"
++fi
++
+ # XXX: should this be deprecated at some point?
+ if [ "x${GRUB_TERMINAL}" != "x" ] ; then
+   GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}"
+@@ -213,6 +220,7 @@ export GRUB_DEFAULT \
+   GRUB_SERIAL_COMMAND \
+   GRUB_DISABLE_LINUX_UUID \
+   GRUB_DISABLE_RECOVERY \
++  GRUB_DISABLE_UUID \
+   GRUB_VIDEO_BACKEND \
+   GRUB_GFXMODE \
+   GRUB_BACKGROUND \
+diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
+index 7ac0bbe..5c9ed84 100644
+--- a/util/grub-mkconfig_lib.in
++++ b/util/grub-mkconfig_lib.in
+@@ -156,7 +156,7 @@ prepare_grub_to_access_device ()
+   if [ "x$fs_hint" != x ]; then
+     echo "set root='$fs_hint'"
+   fi
+-  if fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
++  if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
+     hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints=
+     echo "if [ x\$feature_platform_search_hint = xy ]; then"
+     echo "  search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
+@@ -173,7 +173,7 @@ grub_get_device_id ()
+   IFS='
+ '
+   device="$1"
+-  if fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
++  if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
+     echo "$fs_uuid";
+   else
+     echo $device |sed 's, ,_,g'
+-- 
+1.9.3
+
diff --git a/SOURCES/0001-Allow-fallback-to-include-entries-by-title-not-just-.patch b/SOURCES/0001-Allow-fallback-to-include-entries-by-title-not-just-.patch
new file mode 100644
index 0000000..c5e9341
--- /dev/null
+++ b/SOURCES/0001-Allow-fallback-to-include-entries-by-title-not-just-.patch
@@ -0,0 +1,131 @@
+From fed4e69879282065708ac7cce9e048f0bb90d51c Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Fri, 5 Sep 2014 10:07:04 -0400
+Subject: [PATCH] Allow "fallback" to include entries by title, not just
+ number.
+
+Resolves: rhbz#1026084
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ grub-core/normal/menu.c | 76 +++++++++++++++++++++++++++++++------------------
+ 1 file changed, 49 insertions(+), 27 deletions(-)
+
+diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
+index cc27c37..a446d9a 100644
+--- a/grub-core/normal/menu.c
++++ b/grub-core/normal/menu.c
+@@ -163,12 +163,35 @@ grub_menu_set_timeout (int timeout)
+     }
+ }
+ 
++static int
++menuentry_eq (const char *id, const char *spec)
++{
++  const char *ptr1, *ptr2;
++  ptr1 = id;
++  ptr2 = spec;
++  while (1)
++    {
++      if (*ptr2 == '>' && ptr2[1] != '>' && *ptr1 == 0)
++	return 1;
++      if (*ptr2 == '>' && ptr2[1] != '>')
++	return 0;
++      if (*ptr2 == '>')
++	ptr2++;
++      if (*ptr1 != *ptr2)
++	return 0;
++      if (*ptr1 == 0)
++	return 1;
++      ptr1++;
++      ptr2++;
++    }
++}
++
+ /* Get the first entry number from the value of the environment variable NAME,
+    which is a space-separated list of non-negative integers.  The entry number
+    which is returned is stripped from the value of NAME.  If no entry number
+    can be found, -1 is returned.  */
+ static int
+-get_and_remove_first_entry_number (const char *name)
++get_and_remove_first_entry_number (grub_menu_t menu, const char *name)
+ {
+   const char *val;
+   char *tail;
+@@ -182,9 +205,32 @@ get_and_remove_first_entry_number (const char *name)
+ 
+   entry = (int) grub_strtoul (val, &tail, 0);
+ 
++  if (grub_errno == GRUB_ERR_BAD_NUMBER)
++    {
++      /* See if the variable matches the title of a menu entry.  */
++      grub_menu_entry_t e = menu->entry_list;
++      int i;
++
++      grub_errno = GRUB_ERR_NONE;
++
++      for (i = 0; e; i++)
++	{
++	  if (menuentry_eq (e->title, val)
++	      || menuentry_eq (e->id, val))
++	    {
++	      entry = i;
++	      break;
++	    }
++	  e = e->next;
++	}
++
++      if (! e)
++	entry = -1;
++    }
++
+   if (grub_errno == GRUB_ERR_NONE)
+     {
+-      /* Skip whitespace to find the next digit.  */
++      /* Skip whitespace to find the next entry.  */
+       while (*tail && grub_isspace (*tail))
+ 	tail++;
+       grub_env_set (name, tail);
+@@ -347,7 +393,7 @@ grub_menu_execute_with_fallback (grub_menu_t menu,
+   grub_menu_execute_entry (entry, 1);
+ 
+   /* Deal with fallback entries.  */
+-  while ((fallback_entry = get_and_remove_first_entry_number ("fallback"))
++  while ((fallback_entry = get_and_remove_first_entry_number (menu, "fallback"))
+ 	 >= 0)
+     {
+       grub_print_error ();
+@@ -465,30 +511,6 @@ grub_menu_register_viewer (struct grub_menu_viewer *viewer)
+   viewers = viewer;
+ }
+ 
+-static int
+-menuentry_eq (const char *id, const char *spec)
+-{
+-  const char *ptr1, *ptr2;
+-  ptr1 = id;
+-  ptr2 = spec;
+-  while (1)
+-    {
+-      if (*ptr2 == '>' && ptr2[1] != '>' && *ptr1 == 0)
+-	return 1;
+-      if (*ptr2 == '>' && ptr2[1] != '>')
+-	return 0;
+-      if (*ptr2 == '>')
+-	ptr2++;
+-      if (*ptr1 != *ptr2)
+-	return 0;
+-      if (*ptr1 == 0)
+-	return 1;
+-      ptr1++;
+-      ptr2++;
+-    }
+-}
+-
+-
+ /* Get the entry number from the variable NAME.  */
+ static int
+ get_entry_number (grub_menu_t menu, const char *name)
+-- 
+1.9.3
+
diff --git a/SOURCES/0001-Don-t-emit-Booting-.-message.patch b/SOURCES/0001-Don-t-emit-Booting-.-message.patch
deleted file mode 100644
index ee3ada9..0000000
--- a/SOURCES/0001-Don-t-emit-Booting-.-message.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From f162bc0325b0a015bd62c57d12188a631aa0080f Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Tue, 18 Feb 2014 09:37:49 -0500
-Subject: [PATCH] Don't emit "Booting ..." message.
-
-UI team still hates this stuff, so we're disabling it for RHEL 7.
-
-Resolves: rhbz#1023142
-
-Signed-off-by: Peter Jones <pjones@redhat.com>
----
- grub-core/normal/menu.c       | 2 ++
- grub-core/normal/menu_entry.c | 3 ---
- 2 files changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
-index b47991a..cc27c37 100644
---- a/grub-core/normal/menu.c
-+++ b/grub-core/normal/menu.c
-@@ -810,9 +810,11 @@ static void
- notify_booting (grub_menu_entry_t entry,
- 		void *userdata __attribute__((unused)))
- {
-+#if 0
-   grub_printf ("  ");
-   grub_printf_ (N_("Booting `%s'"), entry->title);
-   grub_printf ("\n\n");
-+#endif
- }
- 
- /* Callback invoked when a default menu entry executed because of a timeout
-diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c
-index b485df8..62e5db1 100644
---- a/grub-core/normal/menu_entry.c
-+++ b/grub-core/normal/menu_entry.c
-@@ -1156,9 +1156,6 @@ run (struct screen *screen)
-   char *dummy[1] = { NULL };
- 
-   grub_cls ();
--  grub_printf ("  ");
--  grub_printf_ (N_("Booting a command list"));
--  grub_printf ("\n\n");
- 
-   errs_before = grub_err_printed_errors;
- 
--- 
-1.8.5.3
-
diff --git a/SOURCES/0001-Don-t-require-a-password-to-boot-entries-generated-b.patch b/SOURCES/0001-Don-t-require-a-password-to-boot-entries-generated-b.patch
deleted file mode 100644
index 794da66..0000000
--- a/SOURCES/0001-Don-t-require-a-password-to-boot-entries-generated-b.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 0e2e1cc36fdf800f897590d40cd40c2f72a72b6b Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Tue, 11 Feb 2014 11:14:50 -0500
-Subject: [PATCH] Don't require a password to boot entries generated by
- grub-mkconfig.
-
-When we set a password, we just want that to mean you can't /edit/ an entry.
-
-Resolves: rhbz#1030176
-
-Signed-off-by: Peter Jones <pjones@redhat.com>
----
- util/grub.d/10_linux.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
-index acf2e0e..136abd7 100644
---- a/util/grub.d/10_linux.in
-+++ b/util/grub.d/10_linux.in
-@@ -26,7 +26,7 @@ datarootdir="@datarootdir@"
- export TEXTDOMAIN=@PACKAGE@
- export TEXTDOMAINDIR="@localedir@"
- 
--CLASS="--class gnu-linux --class gnu --class os"
-+CLASS="--class gnu-linux --class gnu --class os --unrestricted"
- 
- if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
-   OS="$(sed 's, release .*$,,g' /etc/system-release)"
--- 
-1.8.5.3
-
diff --git a/SOURCES/0001-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch b/SOURCES/0001-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch
deleted file mode 100644
index 0b64c87..0000000
--- a/SOURCES/0001-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 5340cad3a76237535b6442001c0289f690f855df Mon Sep 17 00:00:00 2001
-From: Prarit Bhargava <prarit@redhat.com>
-Date: Wed, 12 Mar 2014 10:58:16 -0400
-Subject: [PATCH] Fix bad test on GRUB_DISABLE_SUBMENU.
-
-The file /etc/grub.d/10_linux does
-
-if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
-
-when it should do
-
-if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
-
-which results in submenus in /boot/grub2/grub.cfg when
-GRUB_DISABLE_SUBMENU="yes".
-
-Resolves: rhbz#1063414
----
- util/grub.d/10_linux.in | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
-index 136abd7..767093c 100644
---- a/util/grub.d/10_linux.in
-+++ b/util/grub.d/10_linux.in
-@@ -255,7 +255,11 @@ while [ "x$list" != "x" ] ; do
-     linux_root_device_thisversion=${GRUB_DEVICE}
-   fi
- 
--  if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
-+  if [ "x${GRUB_DISABLE_SUBMENU}" = "xyes" ] || [ "x${GRUB_DISABLE_SUBMENU}" = "xy" ]; then
-+    GRUB_DISABLE_SUBMENU="true"
-+  fi
-+
-+  if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
-     linux_entry "${OS}" "${version}" simple \
-     "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
- 
--- 
-1.8.5.3
-
diff --git a/SOURCES/0001-Fix-convert-function-to-support-NVMe-devices.patch b/SOURCES/0001-Fix-convert-function-to-support-NVMe-devices.patch
deleted file mode 100644
index c9bd68f..0000000
--- a/SOURCES/0001-Fix-convert-function-to-support-NVMe-devices.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From a27a1b8a5c66afb841d5971e3ffaca8769f78f05 Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Tue, 18 Feb 2014 11:34:00 -0500
-Subject: [PATCH] Fix convert function to support NVMe devices
-
-This is adapted from the patch at
-https://bugzilla.redhat.com/show_bug.cgi?id=1019660 , which is against
-the now very old version of convert_system_partition_to_system_disk().
-
-As such, it certainly not the right thing for upstream, but should
-function for now.
-
-Resolves: rhbz#1019660
-
-Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
----
- util/getroot.c | 19 +++++++++++++++++++
- 1 file changed, 19 insertions(+)
-
-diff --git a/util/getroot.c b/util/getroot.c
-index 3958105..0b77a9b 100644
---- a/util/getroot.c
-+++ b/util/getroot.c
-@@ -152,6 +152,7 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part)
- {
- #if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
-   struct stat st;
-+  char *path = xmalloc(PATH_MAX);
- 
-   if (stat (os_dev, &st) < 0)
-     {
-@@ -164,6 +165,24 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part)
- 
-   *is_part = 0;
- 
-+  if (realpath(os_dev, path))
-+    {
-+      if ((strncmp ("/dev/nvme", path, 9) == 0))
-+	{
-+	  char *p = path + 5;
-+	  p = strchr(p, 'p');
-+	  if (p)
-+	    {
-+	      *is_part = 1;
-+	      *p = '\0';
-+	    }
-+	  return path;
-+	}
-+    }
-+
-+  grub_free (path);
-+  *is_part = 0;
-+
-   if (grub_util_device_is_mapped_stat (&st))
-     return grub_util_devmapper_part_to_disk (&st, is_part, os_dev);
- 
--- 
-1.8.5.3
-
diff --git a/SOURCES/0001-Fix-exit-back-to-EFI-firmware.patch b/SOURCES/0001-Fix-exit-back-to-EFI-firmware.patch
new file mode 100644
index 0000000..f8e7595
--- /dev/null
+++ b/SOURCES/0001-Fix-exit-back-to-EFI-firmware.patch
@@ -0,0 +1,52 @@
+From a919488cc979e1c4f5bd468bb97c6e9562af0e5a Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <grub2-owner@fedoraproject.org>
+Date: Fri, 15 Aug 2014 11:29:22 -0400
+Subject: [PATCH] Fix exit back to EFI firmware
+
+Arm/AArch64 machines set up a timer event which is not getting
+canceled when returning to firmware. This is because grub_exit()
+calls grub_efi_fini() instead of grub_machine_fini(). The latter
+will shutdown the timer (and other machine-specific things) as
+well as make the call to grub_efi_fini().
+---
+ grub-core/kern/arm/efi/init.c | 2 +-
+ grub-core/kern/efi/efi.c      | 3 ++-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c
+index 0c17d83..06df60e 100644
+--- a/grub-core/kern/arm/efi/init.c
++++ b/grub-core/kern/arm/efi/init.c
+@@ -67,7 +67,7 @@ grub_machine_fini (int flags)
+ 
+   b = grub_efi_system_table->boot_services;
+ 
+-  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 0);
++  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_CANCEL, 0);
+   efi_call_1 (b->close_event, tmr_evt);
+ 
+   grub_efi_fini ();
+diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
+index 394e9fd..1e96754 100644
+--- a/grub-core/kern/efi/efi.c
++++ b/grub-core/kern/efi/efi.c
+@@ -27,6 +27,7 @@
+ #include <grub/term.h>
+ #include <grub/kernel.h>
+ #include <grub/mm.h>
++#include <grub/loader.h>
+ 
+ /* The handle of GRUB itself. Filled in by the startup code.  */
+ grub_efi_handle_t grub_efi_image_handle;
+@@ -156,7 +157,7 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle)
+ void
+ grub_exit (void)
+ {
+-  grub_efi_fini ();
++  grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
+   efi_call_4 (grub_efi_system_table->boot_services->exit,
+               grub_efi_image_handle, GRUB_EFI_LOAD_ERROR, 0, 0);
+   for (;;) ;
+-- 
+1.9.3
+
diff --git a/SOURCES/0001-Fix-up-some-man-pages-rpmdiff-noticed.patch b/SOURCES/0001-Fix-up-some-man-pages-rpmdiff-noticed.patch
new file mode 100644
index 0000000..f2e555d
--- /dev/null
+++ b/SOURCES/0001-Fix-up-some-man-pages-rpmdiff-noticed.patch
@@ -0,0 +1,153 @@
+From 92faf6ed3b60067fe3fea3a51c62f20880c91b94 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Tue, 23 Sep 2014 09:58:49 -0400
+Subject: [PATCH] Fix up some man pages rpmdiff noticed.
+
+---
+ configure.ac             |  2 ++
+ util/grub-macbless.8     | 26 +++++++++++++++++++
+ util/grub-mkimage.1      |  2 +-
+ util/grub-syslinux2cfg.1 | 65 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 94 insertions(+), 1 deletion(-)
+ create mode 100644 util/grub-macbless.8
+ create mode 100644 util/grub-syslinux2cfg.1
+
+diff --git a/configure.ac b/configure.ac
+index 53fd7c7..048ce7c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -76,6 +76,7 @@ grub_TRANSFORM([grub-fstest.3])
+ grub_TRANSFORM([grub-glue-efi.3])
+ grub_TRANSFORM([grub-install.1])
+ grub_TRANSFORM([grub-kbdcomp.3])
++grub_TRANSFORM([grub-macbless.8])
+ grub_TRANSFORM([grub-menulst2cfg.1])
+ grub_TRANSFORM([grub-mkconfig.1])
+ grub_TRANSFORM([grub-mkfont.3])
+@@ -93,6 +94,7 @@ grub_TRANSFORM([grub-render-label.3])
+ grub_TRANSFORM([grub-script-check.3])
+ grub_TRANSFORM([grub-set-default.1])
+ grub_TRANSFORM([grub-sparc64-setup.3])
++grub_TRANSFORM([grub-syslinux2cfg.1])
+ 
+ # Optimization flag.  Allow user to override.
+ if test "x$TARGET_CFLAGS" = x; then
+diff --git a/util/grub-macbless.8 b/util/grub-macbless.8
+new file mode 100644
+index 0000000..ae842f3
+--- /dev/null
++++ b/util/grub-macbless.8
+@@ -0,0 +1,26 @@
++.TH GRUB-MACBLESS 1 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-macbless\fR \(em Mac-style bless utility for HFS or HFS+
++
++.SH SYNOPSIS
++\fBgrub-macbless\fR [-p | --ppc] [-v | --verbose] [-x | --x86] \fIFILE\fR
++
++.SH DESCRIPTION
++\fBgrub-mkimage\fR blesses a file on an HFS or HFS+ file system, so that it
++can be used to boot a Mac.
++
++.SH OPTIONS
++.TP
++--ppc
++Bless the file for use on PPC-based Macs.
++
++.TP
++--verbose
++Print verbose messages.
++
++.TP
++--x86
++Bless the file for use on x86-based Macs.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-mkimage.1 b/util/grub-mkimage.1
+index 4dea4f5..0eaaafe 100644
+--- a/util/grub-mkimage.1
++++ b/util/grub-mkimage.1
+@@ -17,7 +17,7 @@
+ [-v | --verbose] \fIMODULES\fR
+ 
+ .SH DESCRIPTION
+-\fBgrub-mkimage\fI builds a bootable image of GRUB.
++\fBgrub-mkimage\fR builds a bootable image of GRUB.
+ 
+ .SH OPTIONS
+ .TP
+diff --git a/util/grub-syslinux2cfg.1 b/util/grub-syslinux2cfg.1
+new file mode 100644
+index 0000000..8530948
+--- /dev/null
++++ b/util/grub-syslinux2cfg.1
+@@ -0,0 +1,65 @@
++.TH GRUB-SYSLINUX2CFG 1 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-syslinux2cfg\fR \(em Transform a syslinux config file into a GRUB config.
++
++.SH SYNOPSIS
++\fBgrub-syslinux2cfg\fR [-c | --cwd=\fRDIR\fI] [-r | --root=\fIDIR\fR] [-v | --verbose]
++.RE
++.RS 25
++[-t | --target-root=\fIDIR\fR] [-T | --target-cwd=\fIDIR\fR]
++.RE
++.RS 25
++[-o | --output=\fIFILE\fR] [[-i | --isolinux] |
++.RE
++.RS 46
++ [-s | --syslinux] |
++.RE
++.RS 46
++ [-p | --pxelinux]] \fIFILE\fR
++
++.SH DESCRIPTION
++\fBgrub-syslinux2cfg\fR builds a GRUB configuration file out of an existing
++syslinux configuration file.
++
++.SH OPTIONS
++.TP
++--cwd=\fIDIR\fR
++Set \fIDIR\fR as syslinux's working directory.  The default is to use the
++parent directory of the input file.
++
++.TP
++--root=\fIDIR\fR
++Set \fIDIR\fR as the root directory of the syslinux disk.  The default value
++is "/".
++
++.TP
++--verbose
++Print verbose messages.
++
++.TP
++--target-root=\fIDIR\fR
++Root directory as it will be seen at runtime.  The default value is "/".
++
++.TP
++--target-cwd=\fIDIR\fR
++Working directory of syslinux as it will be seen at runtime.  The default
++value is the parent directory of the input file.
++
++.TP
++--output=\fIFILE\fR
++Write the new config file to \fIFILE\fR.  The default value is standard output.
++
++.TP
++--isolinux
++Assume that the input file is an isolinux configuration file.
++
++.TP
++--pxelinux
++Assume that the input file is a pxelinux configuration file.
++
++.TP
++--syslinux
++Assume that the input file is a syslinux configuration file.
++
++.SH SEE ALSO
++.BR "info grub"
+-- 
+1.9.3
+
diff --git a/SOURCES/0001-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/SOURCES/0001-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch
new file mode 100644
index 0000000..6cff382
--- /dev/null
+++ b/SOURCES/0001-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch
@@ -0,0 +1,32 @@
+From 6c49dab7f960e77a7025cf697b3432bbf480ac96 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Thu, 4 Sep 2014 14:23:23 -0400
+Subject: [PATCH] Generate OS and CLASS in 10_linux from /etc/os-release
+
+This makes us use pretty names in the titles we generate in
+grub2-mkconfig when GRUB_DISTRIBUTOR isn't set.
+
+Resolves: rhbz#996794
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ util/grub.d/10_linux.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 6480cd6..ede7175 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@"
+ CLASS="--class gnu-linux --class gnu --class os --unrestricted"
+ 
+ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
+-  OS="$(sed 's, release .*$,,g' /etc/system-release)"
++  OS="$(eval $(grep PRETTY_NAME /etc/os-release) ; echo ${PRETTY_NAME})"
++  CLASS="--class $(eval $(grep '^ID_LIKE=\|^ID=' /etc/os-release) ; [ -n "${ID_LIKE}" ] && echo ${ID_LIKE} || echo ${ID}) ${CLASS}"
+ else
+   OS="${GRUB_DISTRIBUTOR}"
+   CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
+-- 
+1.9.3
+
diff --git a/SOURCES/0001-Honor-a-symlink-when-generating-configuration-by-gru.patch b/SOURCES/0001-Honor-a-symlink-when-generating-configuration-by-gru.patch
deleted file mode 100644
index 92e3eda..0000000
--- a/SOURCES/0001-Honor-a-symlink-when-generating-configuration-by-gru.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From edb7b596a29cbf2ec88530a552d6a8749e84105b Mon Sep 17 00:00:00 2001
-From: Marcel Kolaja <mkolaja@redhat.com>
-Date: Tue, 21 Jan 2014 10:57:08 -0500
-Subject: [PATCH] Honor a symlink when generating configuration by
- grub2-mkconfig
-
-Honor a symlink when generating configuration by grub2-mkconfig, so that
-the -o option follows it rather than overwriting it with a regular file.
----
- util/grub-mkconfig.in | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
-index ca040dd..b00f9e6 100644
---- a/util/grub-mkconfig.in
-+++ b/util/grub-mkconfig.in
-@@ -272,7 +272,8 @@ and /etc/grub.d/* files or please file a bug report with
-     echo >&2
-   else
-     # none of the children aborted with error, install the new grub.cfg
--    mv -f ${grub_cfg}.new ${grub_cfg}
-+    cat ${grub_cfg}.new > ${grub_cfg}
-+    rm -f ${grub_cfg}.new
-   fi
- fi
- 
--- 
-1.8.4.2
-
diff --git a/SOURCES/0001-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch b/SOURCES/0001-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch
new file mode 100644
index 0000000..9b610b0
--- /dev/null
+++ b/SOURCES/0001-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch
@@ -0,0 +1,134 @@
+From 3cb3d2a07b11c95b3f8a908ae9d43eabef4dcf62 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Wed, 17 Sep 2014 15:13:14 -0500
+Subject: [PATCH 1/2] Initialized initrd_ctx so we don't free a random pointer
+ from the stack.
+
+Currently, if "linux" fails, the "goto fail;" in grub_cmd_initrd sends us
+into grub_initrd_close() without grub_initrd_init() being called, and thus
+it never clears initrd_ctx->components.  grub_initrd_close() then frees that
+address, which is stale data from the stack.  If the stack happens to have a
+stale *address* there that matches a recent allocation, then you'll get a
+double free later.
+
+So initialize the memory up front.
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ grub-core/loader/arm/linux.c              | 2 +-
+ grub-core/loader/arm64/linux.c            | 2 +-
+ grub-core/loader/i386/linux.c             | 2 +-
+ grub-core/loader/i386/pc/linux.c          | 2 +-
+ grub-core/loader/ia64/efi/linux.c         | 2 +-
+ grub-core/loader/mips/linux.c             | 2 +-
+ grub-core/loader/powerpc/ieee1275/linux.c | 2 +-
+ grub-core/loader/sparc64/ieee1275/linux.c | 2 +-
+ 8 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c
+index e6770d9..62cbe75 100644
+--- a/grub-core/loader/arm/linux.c
++++ b/grub-core/loader/arm/linux.c
+@@ -396,7 +396,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+ {
+   grub_file_t file;
+   grub_size_t size = 0;
+-  struct grub_linux_initrd_context initrd_ctx;
++  struct grub_linux_initrd_context initrd_ctx = { 0, };
+ 
+   if (argc == 0)
+     return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
+diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
+index f1d10a1..0dc144e 100644
+--- a/grub-core/loader/arm64/linux.c
++++ b/grub-core/loader/arm64/linux.c
+@@ -328,7 +328,7 @@ static grub_err_t
+ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+ 		 int argc, char *argv[])
+ {
+-  struct grub_linux_initrd_context initrd_ctx;
++  struct grub_linux_initrd_context initrd_ctx = { 0, };
+   int initrd_size, initrd_pages;
+   void *initrd_mem = NULL;
+ 
+diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
+index 31fb91e..2ae1763 100644
+--- a/grub-core/loader/i386/linux.c
++++ b/grub-core/loader/i386/linux.c
+@@ -1050,7 +1050,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+   grub_addr_t addr_min, addr_max;
+   grub_addr_t addr;
+   grub_err_t err;
+-  struct grub_linux_initrd_context initrd_ctx;
++  struct grub_linux_initrd_context initrd_ctx = { 0, };
+ 
+   if (argc == 0)
+     {
+diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
+index 672c013..b481e46 100644
+--- a/grub-core/loader/i386/pc/linux.c
++++ b/grub-core/loader/i386/pc/linux.c
+@@ -388,7 +388,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+   grub_uint8_t *initrd_chunk;
+   grub_addr_t initrd_addr;
+   grub_err_t err;
+-  struct grub_linux_initrd_context initrd_ctx;
++  struct grub_linux_initrd_context initrd_ctx = { 0, };
+ 
+   if (argc == 0)
+     {
+diff --git a/grub-core/loader/ia64/efi/linux.c b/grub-core/loader/ia64/efi/linux.c
+index 87ac49f..eb78e6e 100644
+--- a/grub-core/loader/ia64/efi/linux.c
++++ b/grub-core/loader/ia64/efi/linux.c
+@@ -568,7 +568,7 @@ static grub_err_t
+ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+ 		 int argc, char *argv[])
+ {
+-  struct grub_linux_initrd_context initrd_ctx;
++  struct grub_linux_initrd_context initrd_ctx = { 0, };
+ 
+   if (argc == 0)
+     {
+diff --git a/grub-core/loader/mips/linux.c b/grub-core/loader/mips/linux.c
+index ef64a5b..4a3e8c5 100644
+--- a/grub-core/loader/mips/linux.c
++++ b/grub-core/loader/mips/linux.c
+@@ -415,7 +415,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+   void *initrd_src;
+   grub_addr_t initrd_dest;
+   grub_err_t err;
+-  struct grub_linux_initrd_context initrd_ctx;
++  struct grub_linux_initrd_context initrd_ctx = { 0, };
+ 
+   if (argc == 0)
+     return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
+diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c
+index 4a14f66..787d7dc 100644
+--- a/grub-core/loader/powerpc/ieee1275/linux.c
++++ b/grub-core/loader/powerpc/ieee1275/linux.c
+@@ -333,7 +333,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+   grub_size_t size = 0;
+   grub_addr_t first_addr;
+   grub_addr_t addr;
+-  struct grub_linux_initrd_context initrd_ctx;
++  struct grub_linux_initrd_context initrd_ctx = { 0, };
+ 
+   if (argc == 0)
+     {
+diff --git a/grub-core/loader/sparc64/ieee1275/linux.c b/grub-core/loader/sparc64/ieee1275/linux.c
+index de6ee2f..c5e8dfa 100644
+--- a/grub-core/loader/sparc64/ieee1275/linux.c
++++ b/grub-core/loader/sparc64/ieee1275/linux.c
+@@ -373,7 +373,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+   grub_addr_t paddr;
+   grub_addr_t addr;
+   int ret;
+-  struct grub_linux_initrd_context initrd_ctx;
++  struct grub_linux_initrd_context initrd_ctx = { 0, };
+ 
+   if (argc == 0)
+     {
+-- 
+1.9.3
+
diff --git a/SOURCES/0001-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch b/SOURCES/0001-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch
deleted file mode 100644
index 00074d6..0000000
--- a/SOURCES/0001-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch
+++ /dev/null
@@ -1,304 +0,0 @@
-From 40ded0c9881edfab90421214b5fd6ef38663945e Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Mon, 3 Feb 2014 15:21:46 -0500
-Subject: [PATCH] Make CTRL and ALT keys work as expected on EFI systems
- (version 5).
-
-This is version 4.
-
-Changes from version 1:
-- handles SHIFT as a modifier
-- handles F11 and F12 keys
-- uses the handle provided by the system table to find our _EX protocol.
-
-Changes from version 2:
-- eliminate duplicate keycode translation.
-
-Changes from version 3:
-- Do not add the shift modifier for any ascii character between space
-  (0x20) and DEL (0x7f); the combination of the modifier and many of the
-  keys causes it not to be recognized at all.  Specifically, if we
-  include the modifier on any querty punctuation character, i.e.
-  anything the string "~!@#$%^&*()_+{}|:\"<>?" represents in C, it stops
-  being recognized whatsoever.
-
-Changes from version 4:
-- Always initialize term->data from locate protocol (i.e. make it
-  unconditional.)
-
-Signed-off-by: Peter Jones <pjones@redhat.com>
----
- grub-core/term/efi/console.c | 118 +++++++++++++++++++++++++++++++++++--------
- include/grub/efi/api.h       |  65 +++++++++++++++++++++++-
- 2 files changed, 161 insertions(+), 22 deletions(-)
-
-diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c
-index a37eb84..677eab5 100644
---- a/grub-core/term/efi/console.c
-+++ b/grub-core/term/efi/console.c
-@@ -104,26 +104,12 @@ const unsigned efi_codes[] =
-     GRUB_TERM_KEY_DC, GRUB_TERM_KEY_PPAGE, GRUB_TERM_KEY_NPAGE, GRUB_TERM_KEY_F1,
-     GRUB_TERM_KEY_F2, GRUB_TERM_KEY_F3, GRUB_TERM_KEY_F4, GRUB_TERM_KEY_F5,
-     GRUB_TERM_KEY_F6, GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, GRUB_TERM_KEY_F9,
--    GRUB_TERM_KEY_F10, 0, 0, '\e'
-+    GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, '\e'
-   };
- 
--
- static int
--grub_console_getkey (struct grub_term_input *term __attribute__ ((unused)))
-+grub_efi_translate_key (grub_efi_input_key_t key)
- {
--  grub_efi_simple_input_interface_t *i;
--  grub_efi_input_key_t key;
--  grub_efi_status_t status;
--
--  if (grub_efi_is_finished)
--    return 0;
--
--  i = grub_efi_system_table->con_in;
--  status = efi_call_2 (i->read_key_stroke, i, &key);
--
--  if (status != GRUB_EFI_SUCCESS)
--    return GRUB_TERM_NO_KEY;
--
-   if (key.scan_code == 0)
-     {
-       /* Some firmware implementations use VT100-style codes against the spec.
-@@ -139,9 +125,98 @@ grub_console_getkey (struct grub_term_input *term __attribute__ ((unused)))
-   else if (key.scan_code < ARRAY_SIZE (efi_codes))
-     return efi_codes[key.scan_code];
- 
-+  if (key.unicode_char >= 0x20 && key.unicode_char <= 0x7f)
-+    return key.unicode_char;
-+
-   return GRUB_TERM_NO_KEY;
- }
- 
-+static int
-+grub_console_getkey_con (struct grub_term_input *term __attribute__ ((unused)))
-+{
-+  grub_efi_simple_input_interface_t *i;
-+  grub_efi_input_key_t key;
-+  grub_efi_status_t status;
-+
-+  i = grub_efi_system_table->con_in;
-+  status = efi_call_2 (i->read_key_stroke, i, &key);
-+
-+  if (status != GRUB_EFI_SUCCESS)
-+    return GRUB_TERM_NO_KEY;
-+
-+  return grub_efi_translate_key(key);
-+}
-+
-+static int
-+grub_console_getkey_ex(struct grub_term_input *term)
-+{
-+  grub_efi_key_data_t key_data;
-+  grub_efi_status_t status;
-+  grub_efi_uint32_t kss;
-+  int key = -1;
-+
-+  grub_efi_simple_text_input_ex_interface_t *text_input = term->data;
-+
-+  status = efi_call_2 (text_input->read_key_stroke, text_input, &key_data);
-+
-+  if (status != GRUB_EFI_SUCCESS)
-+    return GRUB_TERM_NO_KEY;
-+
-+  kss = key_data.key_state.key_shift_state;
-+  key = grub_efi_translate_key(key_data.key);
-+
-+  if (key == GRUB_TERM_NO_KEY)
-+    return GRUB_TERM_NO_KEY;
-+
-+  if (kss & GRUB_EFI_SHIFT_STATE_VALID)
-+    {
-+      if ((kss & GRUB_EFI_LEFT_SHIFT_PRESSED
-+	   || kss & GRUB_EFI_RIGHT_SHIFT_PRESSED)
-+	  && !(key >= 0x20 && key <= 0x7f))
-+	key |= GRUB_TERM_SHIFT;
-+      if (kss & GRUB_EFI_LEFT_ALT_PRESSED || kss & GRUB_EFI_RIGHT_ALT_PRESSED)
-+	key |= GRUB_TERM_ALT;
-+      if (kss & GRUB_EFI_LEFT_CONTROL_PRESSED
-+	  || kss & GRUB_EFI_RIGHT_CONTROL_PRESSED)
-+	key |= GRUB_TERM_CTRL;
-+    }
-+
-+  return key;
-+}
-+
-+static grub_err_t
-+grub_efi_console_input_init (struct grub_term_input *term)
-+{
-+  grub_efi_guid_t text_input_ex_guid =
-+    GRUB_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
-+
-+  if (grub_efi_is_finished)
-+    return 0;
-+
-+  grub_efi_simple_text_input_ex_interface_t *text_input = term->data;
-+  if (text_input)
-+    return 0;
-+
-+  text_input = grub_efi_open_protocol(grub_efi_system_table->console_in_handler,
-+				      &text_input_ex_guid,
-+				      GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
-+  term->data = (void *)text_input;
-+
-+  return 0;
-+}
-+
-+static int
-+grub_console_getkey (struct grub_term_input *term)
-+{
-+  if (grub_efi_is_finished)
-+    return 0;
-+
-+  if (term->data)
-+    return grub_console_getkey_ex(term);
-+  else
-+    return grub_console_getkey_con(term);
-+}
-+
- static struct grub_term_coordinate
- grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
- {
-@@ -243,7 +318,7 @@ grub_console_setcursor (struct grub_term_output *term __attribute__ ((unused)),
- }
- 
- static grub_err_t
--grub_efi_console_init (struct grub_term_output *term)
-+grub_efi_console_output_init (struct grub_term_output *term)
- {
-   grub_efi_set_text_mode (1);
-   grub_console_setcursor (term, 1);
-@@ -251,7 +326,7 @@ grub_efi_console_init (struct grub_term_output *term)
- }
- 
- static grub_err_t
--grub_efi_console_fini (struct grub_term_output *term)
-+grub_efi_console_output_fini (struct grub_term_output *term)
- {
-   grub_console_setcursor (term, 0);
-   grub_efi_set_text_mode (0);
-@@ -262,13 +337,14 @@ static struct grub_term_input grub_console_term_input =
-   {
-     .name = "console",
-     .getkey = grub_console_getkey,
-+    .init = grub_efi_console_input_init,
-   };
- 
- static struct grub_term_output grub_console_term_output =
-   {
-     .name = "console",
--    .init = grub_efi_console_init,
--    .fini = grub_efi_console_fini,
-+    .init = grub_efi_console_output_init,
-+    .fini = grub_efi_console_output_fini,
-     .putchar = grub_console_putchar,
-     .getwh = grub_console_getwh,
-     .getxy = grub_console_getxy,
-@@ -291,8 +367,8 @@ grub_console_init (void)
-       return;
-     }
- 
--  grub_term_register_input ("console", &grub_console_term_input);
-   grub_term_register_output ("console", &grub_console_term_output);
-+  grub_term_register_input ("console", &grub_console_term_input);
- }
- 
- void
-diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
-index e5dd543..1423403 100644
---- a/include/grub/efi/api.h
-+++ b/include/grub/efi/api.h
-@@ -111,7 +111,7 @@
-     { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
-   }
- 
--#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
-+#define GRUB_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
-   { 0xdd9e7534, 0x7762, 0x4698, \
-     { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } \
-   }
-@@ -952,6 +952,32 @@ struct grub_efi_input_key
- };
- typedef struct grub_efi_input_key grub_efi_input_key_t;
- 
-+typedef grub_efi_uint8_t grub_efi_key_toggle_state_t;
-+struct grub_efi_key_state
-+{
-+	grub_efi_uint32_t key_shift_state;
-+	grub_efi_key_toggle_state_t key_toggle_state;
-+};
-+typedef struct grub_efi_key_state grub_efi_key_state_t;
-+
-+#define GRUB_EFI_SHIFT_STATE_VALID     0x80000000
-+#define GRUB_EFI_RIGHT_SHIFT_PRESSED   0x00000001
-+#define GRUB_EFI_LEFT_SHIFT_PRESSED    0x00000002
-+#define GRUB_EFI_RIGHT_CONTROL_PRESSED 0x00000004
-+#define GRUB_EFI_LEFT_CONTROL_PRESSED  0x00000008
-+#define GRUB_EFI_RIGHT_ALT_PRESSED     0x00000010
-+#define GRUB_EFI_LEFT_ALT_PRESSED      0x00000020
-+#define GRUB_EFI_RIGHT_LOGO_PRESSED    0x00000040
-+#define GRUB_EFI_LEFT_LOGO_PRESSED     0x00000080
-+#define GRUB_EFI_MENU_KEY_PRESSED      0x00000100
-+#define GRUB_EFI_SYS_REQ_PRESSED       0x00000200
-+
-+#define GRUB_EFI_TOGGLE_STATE_VALID 0x80
-+#define GRUB_EFI_KEY_STATE_EXPOSED  0x40
-+#define GRUB_EFI_SCROLL_LOCK_ACTIVE 0x01
-+#define GRUB_EFI_NUM_LOCK_ACTIVE    0x02
-+#define GRUB_EFI_CAPS_LOCK_ACTIVE   0x04
-+
- struct grub_efi_simple_text_output_mode
- {
-   grub_efi_int32_t max_mode;
-@@ -1294,6 +1320,43 @@ struct grub_efi_simple_input_interface
- };
- typedef struct grub_efi_simple_input_interface grub_efi_simple_input_interface_t;
- 
-+struct grub_efi_key_data {
-+	grub_efi_input_key_t key;
-+	grub_efi_key_state_t key_state;
-+};
-+typedef struct grub_efi_key_data grub_efi_key_data_t;
-+
-+typedef grub_efi_status_t (*grub_efi_key_notify_function_t) (
-+	grub_efi_key_data_t *key_data
-+	);
-+
-+struct grub_efi_simple_text_input_ex_interface
-+{
-+	grub_efi_status_t
-+	(*reset) (struct grub_efi_simple_text_input_ex_interface *this,
-+		  grub_efi_boolean_t extended_verification);
-+
-+	grub_efi_status_t
-+	(*read_key_stroke) (struct grub_efi_simple_text_input_ex_interface *this,
-+			    grub_efi_key_data_t *key_data);
-+
-+	grub_efi_event_t wait_for_key;
-+
-+	grub_efi_status_t
-+	(*set_state) (struct grub_efi_simple_text_input_ex_interface *this,
-+		      grub_efi_key_toggle_state_t *key_toggle_state);
-+
-+	grub_efi_status_t
-+	(*register_key_notify) (struct grub_efi_simple_text_input_ex_interface *this,
-+				grub_efi_key_data_t *key_data,
-+				grub_efi_key_notify_function_t key_notification_function);
-+
-+	grub_efi_status_t
-+	(*unregister_key_notify) (struct grub_efi_simple_text_input_ex_interface *this,
-+				  void *notification_handle);
-+};
-+typedef struct grub_efi_simple_text_input_ex_interface grub_efi_simple_text_input_ex_interface_t;
-+
- struct grub_efi_simple_text_output_interface
- {
-   grub_efi_status_t
--- 
-1.8.5.3
-
diff --git a/SOURCES/0001-May-as-well-try-it.patch b/SOURCES/0001-May-as-well-try-it.patch
deleted file mode 100644
index 88cd0b8..0000000
--- a/SOURCES/0001-May-as-well-try-it.patch
+++ /dev/null
@@ -1,1962 +0,0 @@
-From 6bff689e8781b65a5bcdecc4dbb11c6b9ac48376 Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Tue, 4 Mar 2014 11:00:23 -0500
-Subject: [PATCH] Add man pages (#948847)
-
----
- conf/Makefile.extra-dist          |   1 -
- configure.ac                      |  23 ++++++
- docs/Makefile.am                  |   2 -
- docs/man/grub-bios-setup.h2m      |   6 --
- docs/man/grub-editenv.h2m         |   5 --
- docs/man/grub-emu.h2m             |   6 --
- docs/man/grub-file.h2m            |   2 -
- docs/man/grub-fstest.h2m          |   4 -
- docs/man/grub-glue-efi.h2m        |   4 -
- docs/man/grub-install.h2m         |   6 --
- docs/man/grub-kbdcomp.h2m         |  10 ---
- docs/man/grub-macbless.h2m        |   4 -
- docs/man/grub-macho2img.h2m       |   4 -
- docs/man/grub-menulst2cfg.h2m     |   4 -
- docs/man/grub-mkconfig.h2m        |   4 -
- docs/man/grub-mkfont.h2m          |   4 -
- docs/man/grub-mkimage.h2m         |   6 --
- docs/man/grub-mklayout.h2m        |  10 ---
- docs/man/grub-mknetdir.h2m        |   4 -
- docs/man/grub-mkpasswd-pbkdf2.h2m |   4 -
- docs/man/grub-mkrelpath.h2m       |   4 -
- docs/man/grub-mkrescue.h2m        |   4 -
- docs/man/grub-mkstandalone.h2m    |   4 -
- docs/man/grub-mount.h2m           |   2 -
- docs/man/grub-ofpathname.h2m      |   4 -
- docs/man/grub-pe2elf.h2m          |   4 -
- docs/man/grub-probe.h2m           |   4 -
- docs/man/grub-reboot.h2m          |   5 --
- docs/man/grub-render-label.h2m    |   3 -
- docs/man/grub-script-check.h2m    |   4 -
- docs/man/grub-set-default.h2m     |   5 --
- docs/man/grub-sparc64-setup.h2m   |   6 --
- docs/man/grub-syslinux2cfg.h2m    |   4 -
- gentpl.py                         |   5 +-
- util/grub-bios-setup.8            |  54 +++++++++++++
- util/grub-editenv.1               |  46 +++++++++++
- util/grub-file.1                  | 165 ++++++++++++++++++++++++++++++++++++++
- util/grub-fstest.1                |  99 +++++++++++++++++++++++
- util/grub-glue-efi.1              |  31 +++++++
- util/grub-install.8               | 129 +++++++++++++++++++++++++++++
- util/grub-kbdcomp.1               |  19 +++++
- util/grub-macbless.1              |  22 +++++
- util/grub-menulst2cfg.1           |  12 +++
- util/grub-mkconfig.8              |  17 ++++
- util/grub-mkfont.1                |  87 ++++++++++++++++++++
- util/grub-mkimage.1               |  95 ++++++++++++++++++++++
- util/grub-mklayout.1              |  27 +++++++
- util/grub-mknetdir.1              |  12 +++
- util/grub-mkpasswd-pbkdf2.1       |  27 +++++++
- util/grub-mkrelpath.1             |  12 +++
- util/grub-mkrescue.1              | 123 ++++++++++++++++++++++++++++
- util/grub-mkstandalone.1          | 100 +++++++++++++++++++++++
- util/grub-ofpathname.8            |  12 +++
- util/grub-probe.8                 |  80 ++++++++++++++++++
- util/grub-reboot.8                |  21 +++++
- util/grub-render-label.1          |  51 ++++++++++++
- util/grub-script-check.1          |  21 +++++
- util/grub-set-default.8           |  21 +++++
- util/grub-sparc64-setup.8         |  12 +++
- 60 files changed, 1321 insertions(+), 147 deletions(-)
- delete mode 100644 docs/man/grub-bios-setup.h2m
- delete mode 100644 docs/man/grub-editenv.h2m
- delete mode 100644 docs/man/grub-emu.h2m
- delete mode 100644 docs/man/grub-file.h2m
- delete mode 100644 docs/man/grub-fstest.h2m
- delete mode 100644 docs/man/grub-glue-efi.h2m
- delete mode 100644 docs/man/grub-install.h2m
- delete mode 100644 docs/man/grub-kbdcomp.h2m
- delete mode 100644 docs/man/grub-macbless.h2m
- delete mode 100644 docs/man/grub-macho2img.h2m
- delete mode 100644 docs/man/grub-menulst2cfg.h2m
- delete mode 100644 docs/man/grub-mkconfig.h2m
- delete mode 100644 docs/man/grub-mkfont.h2m
- delete mode 100644 docs/man/grub-mkimage.h2m
- delete mode 100644 docs/man/grub-mklayout.h2m
- delete mode 100644 docs/man/grub-mknetdir.h2m
- delete mode 100644 docs/man/grub-mkpasswd-pbkdf2.h2m
- delete mode 100644 docs/man/grub-mkrelpath.h2m
- delete mode 100644 docs/man/grub-mkrescue.h2m
- delete mode 100644 docs/man/grub-mkstandalone.h2m
- delete mode 100644 docs/man/grub-mount.h2m
- delete mode 100644 docs/man/grub-ofpathname.h2m
- delete mode 100644 docs/man/grub-pe2elf.h2m
- delete mode 100644 docs/man/grub-probe.h2m
- delete mode 100644 docs/man/grub-reboot.h2m
- delete mode 100644 docs/man/grub-render-label.h2m
- delete mode 100644 docs/man/grub-script-check.h2m
- delete mode 100644 docs/man/grub-set-default.h2m
- delete mode 100644 docs/man/grub-sparc64-setup.h2m
- delete mode 100644 docs/man/grub-syslinux2cfg.h2m
- create mode 100644 util/grub-bios-setup.8
- create mode 100644 util/grub-editenv.1
- create mode 100644 util/grub-file.1
- create mode 100644 util/grub-fstest.1
- create mode 100644 util/grub-glue-efi.1
- create mode 100644 util/grub-install.8
- create mode 100644 util/grub-kbdcomp.1
- create mode 100644 util/grub-macbless.1
- create mode 100644 util/grub-menulst2cfg.1
- create mode 100644 util/grub-mkconfig.8
- create mode 100644 util/grub-mkfont.1
- create mode 100644 util/grub-mkimage.1
- create mode 100644 util/grub-mklayout.1
- create mode 100644 util/grub-mknetdir.1
- create mode 100644 util/grub-mkpasswd-pbkdf2.1
- create mode 100644 util/grub-mkrelpath.1
- create mode 100644 util/grub-mkrescue.1
- create mode 100644 util/grub-mkstandalone.1
- create mode 100644 util/grub-ofpathname.8
- create mode 100644 util/grub-probe.8
- create mode 100644 util/grub-reboot.8
- create mode 100644 util/grub-render-label.1
- create mode 100644 util/grub-script-check.1
- create mode 100644 util/grub-set-default.8
- create mode 100644 util/grub-sparc64-setup.8
-
-diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
-index 51f08c1..e914dfd 100644
---- a/conf/Makefile.extra-dist
-+++ b/conf/Makefile.extra-dist
-@@ -10,7 +10,6 @@ EXTRA_DIST += unicode
- EXTRA_DIST += util/import_gcry.py
- EXTRA_DIST += util/import_unicode.py
- 
--EXTRA_DIST += docs/man
- EXTRA_DIST += docs/autoiso.cfg
- EXTRA_DIST += docs/grub.cfg
- EXTRA_DIST += docs/osdetect.cfg
-diff --git a/configure.ac b/configure.ac
-index 7c5d080..e89fc8f 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -70,6 +70,29 @@ grub_TRANSFORM([grub-set-default])
- grub_TRANSFORM([grub-sparc64-setup])
- grub_TRANSFORM([grub-render-label])
- grub_TRANSFORM([grub-file])
-+grub_TRANSFORM([grub-bios-setup.3])
-+grub_TRANSFORM([grub-editenv.1])
-+grub_TRANSFORM([grub-fstest.3])
-+grub_TRANSFORM([grub-glue-efi.3])
-+grub_TRANSFORM([grub-install.1])
-+grub_TRANSFORM([grub-kbdcomp.3])
-+grub_TRANSFORM([grub-menulst2cfg.1])
-+grub_TRANSFORM([grub-mkconfig.1])
-+grub_TRANSFORM([grub-mkfont.3])
-+grub_TRANSFORM([grub-mkimage.1])
-+grub_TRANSFORM([grub-mklayout.3])
-+grub_TRANSFORM([grub-mknetdir.3])
-+grub_TRANSFORM([grub-mkpasswd-pbkdf2.3])
-+grub_TRANSFORM([grub-mkrelpath.3])
-+grub_TRANSFORM([grub-mkrescue.1])
-+grub_TRANSFORM([grub-mkstandalone.3])
-+grub_TRANSFORM([grub-ofpathname.3])
-+grub_TRANSFORM([grub-probe.3])
-+grub_TRANSFORM([grub-reboot.3])
-+grub_TRANSFORM([grub-render-label.3])
-+grub_TRANSFORM([grub-script-check.3])
-+grub_TRANSFORM([grub-set-default.1])
-+grub_TRANSFORM([grub-sparc64-setup.3])
- 
- # Optimization flag.  Allow user to override.
- if test "x$TARGET_CFLAGS" = x; then
-diff --git a/docs/Makefile.am b/docs/Makefile.am
-index 93eb396..ab28f19 100644
---- a/docs/Makefile.am
-+++ b/docs/Makefile.am
-@@ -5,5 +5,3 @@ info_TEXINFOS = grub.texi grub-dev.texi
- grub_TEXINFOS = fdl.texi
- 
- EXTRA_DIST = font_char_metrics.png font_char_metrics.txt
--
--
-diff --git a/docs/man/grub-bios-setup.h2m b/docs/man/grub-bios-setup.h2m
-deleted file mode 100644
-index ac6ede3..0000000
---- a/docs/man/grub-bios-setup.h2m
-+++ /dev/null
-@@ -1,6 +0,0 @@
--[NAME]
--grub-bios-setup \- set up a device to boot using GRUB
--[SEE ALSO]
--.BR grub-install (8),
--.BR grub-mkimage (1),
--.BR grub-mkrescue (1)
-diff --git a/docs/man/grub-editenv.h2m b/docs/man/grub-editenv.h2m
-deleted file mode 100644
-index 3859d3d..0000000
---- a/docs/man/grub-editenv.h2m
-+++ /dev/null
-@@ -1,5 +0,0 @@
--[NAME]
--grub-editenv \- edit GRUB environment block
--[SEE ALSO]
--.BR grub-reboot (8),
--.BR grub-set-default (8)
-diff --git a/docs/man/grub-emu.h2m b/docs/man/grub-emu.h2m
-deleted file mode 100644
-index ef1c000..0000000
---- a/docs/man/grub-emu.h2m
-+++ /dev/null
-@@ -1,6 +0,0 @@
--[NAME]
--grub-emu \- GRUB emulator
--[SEE ALSO]
--If you are trying to install GRUB, then you should use
--.BR grub-install (8)
--rather than this program.
-diff --git a/docs/man/grub-file.h2m b/docs/man/grub-file.h2m
-deleted file mode 100644
-index e09bb4d..0000000
---- a/docs/man/grub-file.h2m
-+++ /dev/null
-@@ -1,2 +0,0 @@
--[NAME]
--grub-file \- check file type
-diff --git a/docs/man/grub-fstest.h2m b/docs/man/grub-fstest.h2m
-deleted file mode 100644
-index 9676b15..0000000
---- a/docs/man/grub-fstest.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-fstest \- debug tool for GRUB filesystem drivers
--[SEE ALSO]
--.BR grub-probe (8)
-diff --git a/docs/man/grub-glue-efi.h2m b/docs/man/grub-glue-efi.h2m
-deleted file mode 100644
-index c1c6ded..0000000
---- a/docs/man/grub-glue-efi.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-glue-efi \- generate a fat binary for EFI
--[DESCRIPTION]
--grub-glue-efi processes ia32 and amd64 EFI images and glues them according to Apple format.
-diff --git a/docs/man/grub-install.h2m b/docs/man/grub-install.h2m
-deleted file mode 100644
-index 8cbbc87..0000000
---- a/docs/man/grub-install.h2m
-+++ /dev/null
-@@ -1,6 +0,0 @@
--[NAME]
--grub-install \- install GRUB to a device
--[SEE ALSO]
--.BR grub-mkconfig (8),
--.BR grub-mkimage (1),
--.BR grub-mkrescue (1)
-diff --git a/docs/man/grub-kbdcomp.h2m b/docs/man/grub-kbdcomp.h2m
-deleted file mode 100644
-index d81f915..0000000
---- a/docs/man/grub-kbdcomp.h2m
-+++ /dev/null
-@@ -1,10 +0,0 @@
--[NAME]
--grub-kbdcomp \- generate a GRUB keyboard layout file
--[DESCRIPTION]
--grub-kbdcomp processes a X keyboard layout description in
--.BR keymaps (5)
--format into a format that can be used by GRUB's
--.B keymap
--command.
--[SEE ALSO]
--.BR grub-mklayout (8)
-diff --git a/docs/man/grub-macbless.h2m b/docs/man/grub-macbless.h2m
-deleted file mode 100644
-index 0197c00..0000000
---- a/docs/man/grub-macbless.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-macbless \- bless a mac file/directory
--[SEE ALSO]
--.BR grub-install (1)
-diff --git a/docs/man/grub-macho2img.h2m b/docs/man/grub-macho2img.h2m
-deleted file mode 100644
-index d79aaee..0000000
---- a/docs/man/grub-macho2img.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-macho2img \- convert Mach-O to raw image
--[SEE ALSO]
--.BR grub-mkimage (1)
-diff --git a/docs/man/grub-menulst2cfg.h2m b/docs/man/grub-menulst2cfg.h2m
-deleted file mode 100644
-index c2e0055..0000000
---- a/docs/man/grub-menulst2cfg.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-menulst2cfg \- transform legacy menu.lst into grub.cfg
--[SEE ALSO]
--.BR grub-mkconfig (8)
-diff --git a/docs/man/grub-mkconfig.h2m b/docs/man/grub-mkconfig.h2m
-deleted file mode 100644
-index 9b42f81..0000000
---- a/docs/man/grub-mkconfig.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-mkconfig \- generate a GRUB configuration file
--[SEE ALSO]
--.BR grub-install (8)
-diff --git a/docs/man/grub-mkfont.h2m b/docs/man/grub-mkfont.h2m
-deleted file mode 100644
-index d46fe60..0000000
---- a/docs/man/grub-mkfont.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-mkfont \- make GRUB font files
--[SEE ALSO]
--.BR grub-mkconfig (8)
-diff --git a/docs/man/grub-mkimage.h2m b/docs/man/grub-mkimage.h2m
-deleted file mode 100644
-index f0fbc2b..0000000
---- a/docs/man/grub-mkimage.h2m
-+++ /dev/null
-@@ -1,6 +0,0 @@
--[NAME]
--grub-mkimage \- make a bootable image of GRUB
--[SEE ALSO]
--.BR grub-install (8),
--.BR grub-mkrescue (1),
--.BR grub-mknetdir (8)
-diff --git a/docs/man/grub-mklayout.h2m b/docs/man/grub-mklayout.h2m
-deleted file mode 100644
-index 1e43409..0000000
---- a/docs/man/grub-mklayout.h2m
-+++ /dev/null
-@@ -1,10 +0,0 @@
--[NAME]
--grub-mklayout \- generate a GRUB keyboard layout file
--[DESCRIPTION]
--grub-mklayout processes a keyboard layout description in
--.BR keymaps (5)
--format into a format that can be used by GRUB's
--.B keymap
--command.
--[SEE ALSO]
--.BR grub-mkconfig (8)
-diff --git a/docs/man/grub-mknetdir.h2m b/docs/man/grub-mknetdir.h2m
-deleted file mode 100644
-index a2ef13e..0000000
---- a/docs/man/grub-mknetdir.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-mknetdir \- prepare a GRUB netboot directory.
--[SEE ALSO]
--.BR grub-mkimage (1)
-diff --git a/docs/man/grub-mkpasswd-pbkdf2.h2m b/docs/man/grub-mkpasswd-pbkdf2.h2m
-deleted file mode 100644
-index 4d202f3..0000000
---- a/docs/man/grub-mkpasswd-pbkdf2.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-mkpasswd-pbkdf2 \- generate hashed password for GRUB
--[SEE ALSO]
--.BR grub-mkconfig (8)
-diff --git a/docs/man/grub-mkrelpath.h2m b/docs/man/grub-mkrelpath.h2m
-deleted file mode 100644
-index d01f396..0000000
---- a/docs/man/grub-mkrelpath.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-mkrelpath \- make a system path relative to its root
--[SEE ALSO]
--.BR grub-probe (8)
-diff --git a/docs/man/grub-mkrescue.h2m b/docs/man/grub-mkrescue.h2m
-deleted file mode 100644
-index a427f02..0000000
---- a/docs/man/grub-mkrescue.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-mkrescue \- make a GRUB rescue image
--[SEE ALSO]
--.BR grub-mkimage (1)
-diff --git a/docs/man/grub-mkstandalone.h2m b/docs/man/grub-mkstandalone.h2m
-deleted file mode 100644
-index c773139..0000000
---- a/docs/man/grub-mkstandalone.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-mkstandalone \- make a memdisk-based GRUB image
--[SEE ALSO]
--.BR grub-mkimage (1)
-diff --git a/docs/man/grub-mount.h2m b/docs/man/grub-mount.h2m
-deleted file mode 100644
-index 8d16898..0000000
---- a/docs/man/grub-mount.h2m
-+++ /dev/null
-@@ -1,2 +0,0 @@
--[NAME]
--grub-mount \- export GRUB filesystem with FUSE
-diff --git a/docs/man/grub-ofpathname.h2m b/docs/man/grub-ofpathname.h2m
-deleted file mode 100644
-index 74b43ee..0000000
---- a/docs/man/grub-ofpathname.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-ofpathname \- find OpenBOOT path for a device
--[SEE ALSO]
--.BR grub-probe (8)
-diff --git a/docs/man/grub-pe2elf.h2m b/docs/man/grub-pe2elf.h2m
-deleted file mode 100644
-index 7ca29bd..0000000
---- a/docs/man/grub-pe2elf.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-pe2elf \- convert PE image to ELF
--[SEE ALSO]
--.BR grub-mkimage (1)
-diff --git a/docs/man/grub-probe.h2m b/docs/man/grub-probe.h2m
-deleted file mode 100644
-index 6e1ffdc..0000000
---- a/docs/man/grub-probe.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-probe \- probe device information for GRUB
--[SEE ALSO]
--.BR grub-fstest (1)
-diff --git a/docs/man/grub-reboot.h2m b/docs/man/grub-reboot.h2m
-deleted file mode 100644
-index e4acace..0000000
---- a/docs/man/grub-reboot.h2m
-+++ /dev/null
-@@ -1,5 +0,0 @@
--[NAME]
--grub-reboot \- set the default boot entry for GRUB, for the next boot only
--[SEE ALSO]
--.BR grub-set-default (8),
--.BR grub-editenv (1)
-diff --git a/docs/man/grub-render-label.h2m b/docs/man/grub-render-label.h2m
-deleted file mode 100644
-index 50ae524..0000000
---- a/docs/man/grub-render-label.h2m
-+++ /dev/null
-@@ -1,3 +0,0 @@
--[NAME]
--grub-render-label \- generate a .disk_label for Apple Macs.
--
-diff --git a/docs/man/grub-script-check.h2m b/docs/man/grub-script-check.h2m
-deleted file mode 100644
-index 3653682..0000000
---- a/docs/man/grub-script-check.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-script-check \- check grub.cfg for syntax errors
--[SEE ALSO]
--.BR grub-mkconfig (8)
-diff --git a/docs/man/grub-set-default.h2m b/docs/man/grub-set-default.h2m
-deleted file mode 100644
-index 7945001..0000000
---- a/docs/man/grub-set-default.h2m
-+++ /dev/null
-@@ -1,5 +0,0 @@
--[NAME]
--grub-set-default \- set the saved default boot entry for GRUB
--[SEE ALSO]
--.BR grub-reboot (8),
--.BR grub-editenv (1)
-diff --git a/docs/man/grub-sparc64-setup.h2m b/docs/man/grub-sparc64-setup.h2m
-deleted file mode 100644
-index 18f803a..0000000
---- a/docs/man/grub-sparc64-setup.h2m
-+++ /dev/null
-@@ -1,6 +0,0 @@
--[NAME]
--grub-sparc64-setup \- set up a device to boot using GRUB
--[SEE ALSO]
--.BR grub-install (8),
--.BR grub-mkimage (1),
--.BR grub-mkrescue (1)
-diff --git a/docs/man/grub-syslinux2cfg.h2m b/docs/man/grub-syslinux2cfg.h2m
-deleted file mode 100644
-index ad25c8a..0000000
---- a/docs/man/grub-syslinux2cfg.h2m
-+++ /dev/null
-@@ -1,4 +0,0 @@
--[NAME]
--grub-syslinux2cfg \- transform syslinux config into grub.cfg
--[SEE ALSO]
--.BR grub-menulst2cfg (8)
-diff --git a/gentpl.py b/gentpl.py
-index bdcae1a..889cc91 100644
---- a/gentpl.py
-+++ b/gentpl.py
-@@ -792,10 +792,7 @@ def manpage(defn, adddeps):
- 
-     output("if COND_MAN_PAGES\n")
-     gvar_add("man_MANS", name + "." + mansection)
--    rule(name + "." + mansection, name + " " + adddeps, """
--chmod a+x """ + name + """
--PATH=$(builddir):$$PATH pkgdatadir=$(builddir) $(HELP2MAN) --section=""" + mansection + """ -i $(top_srcdir)/docs/man/""" + name + """.h2m -o $@ """ + name + """
--""")
-+    rule(name + "." + mansection, name + " " + adddeps, "cat $(top_srcdir)/util/" + name + "." + mansection + " | $(top_builddir)/config.status --file=$@:-")
-     gvar_add("CLEANFILES", name + "." + mansection)
-     output("endif\n")
- 
-diff --git a/util/grub-bios-setup.8 b/util/grub-bios-setup.8
-new file mode 100644
-index 0000000..56f582b
---- /dev/null
-+++ b/util/grub-bios-setup.8
-@@ -0,0 +1,54 @@
-+.TH GRUB-BIOS-SETUP 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-bios-setup\fR \(em Set up images to boot from a device.
-+
-+.SH SYNOPSIS
-+\fBgrub-bios-setup\fR [-a | --allow-floppy] [-b | --boot-image=\fIFILE\fR]
-+.RS 17
-+[-c | --core-image=\fIFILE\fR] [-d | --directory=\fIDIR\fR]
-+.RE
-+.RS 17
-+[-f | --force] [-m | --device-map=\fIFILE\fR]
-+.RE
-+.RS 17
-+[-s | --skip-fs-probe] [-v | --verbose] \fIDEVICE\fR
-+
-+.SH DESCRIPTION
-+You should not normally run this program directly.  Use grub-install instead.
-+
-+.SH OPTIONS
-+.TP
-+\fB--allow-floppy\fR
-+Make the device also bootable as a floppy.  This option is the default for
-+/dev/fdX devices.  Some BIOSes will not boot images created with this option.
-+
-+.TP
-+\fB--boot-image\fR=\fIFILE\fR
-+Use FILE as the boot image.  The default value is \fBboot.img\fR.
-+
-+.TP
-+\fB--core-image\fR=\fIFILE\fR
-+Use FILE as ther core image.  The default value is \fBcore.img\fR.
-+
-+.TP
-+\fB--directory\fR=\fIDIR\fR
-+Use GRUB files in the directory DIR.  The default value is \fB/boot/grub\fR.
-+
-+.TP
-+\fB--force\fR
-+Install even if problems are detected.
-+
-+.TP
-+\fB--device-map\fR=\fIFILE\fR
-+Use FILE as the device map.  The default value is /boot/grub/device.map .
-+
-+.TP
-+\fB--skip-fs-probe\fR
-+Do not probe DEVICE for filesystems.
-+
-+.TP
-+\fB--verbose\fR
-+Print verbose messages.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-editenv.1 b/util/grub-editenv.1
-new file mode 100644
-index 0000000..8dad33f
---- /dev/null
-+++ b/util/grub-editenv.1
-@@ -0,0 +1,46 @@
-+.TH GRUB-EDITENV 1 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-editenv\fR \(em Manage the GRUB environment block.
-+
-+.SH SYNOPSIS
-+\fBgrub-editenv\fR [-v | --verbose] [\fIFILE\fR]
-+.RS 14
-+<create | list | set \fINAME\fR=\fIVALUE\fR | unset \fINAME\fR>
-+
-+.SH DESCRIPTION
-+\fBgrub-editenv\fR is a command line tool to manage GRUB's stored environment.
-+
-+.SH OPTIONS
-+.TP
-+\fB--verbose\fR 
-+Print verbose messages.
-+
-+.TP
-+\fBFILE\fR
-+.RS 7
-+File name to use for grub environment.  Default is /boot/grub/grubenv .
-+.RE
-+
-+.SH COMMANDS
-+.TP
-+\fBcreate\fR
-+.RS 7
-+Create a blank environment block file.
-+.RE
-+
-+.TP
-+\fBlist\fR
-+.RS 7
-+List the current variables.
-+.RE
-+
-+.TP
-+\fBset\fR [\fINAME\fR=\fIVALUE\fR ...]
-+Set variables.
-+
-+.TP
-+\fBunset [\fINAME\fR ...]
-+Delete variables.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-file.1 b/util/grub-file.1
-new file mode 100644
-index 0000000..b29cb32
---- /dev/null
-+++ b/util/grub-file.1
-@@ -0,0 +1,165 @@
-+.TH GRUB-FILE 1 "Web Feb 26 2014"
-+.SH NAME
-+\fBgrub-file\fR \(em Check if FILE is of specified type.
-+
-+.SH SYNOPSIS
-+\fBgrub-file\fR (--is-i386-xen-pae-domu | --is-x86_64-xen-domu |
-+.RS 11
-+--is-x86-xen-dom0 | --is-x86-multiboot |
-+.RE
-+.RS 11
-+--is-x86-multiboot2 | --is-arm-linux | --is-arm64-linux |
-+.RE
-+.RS 11
-+--is-ia64-linux | --is-mips-linux | --is-mipsel-linux |
-+.RE
-+.RS 11
-+--is-sparc64-linux | --is-powerpc-linux | --is-x86-linux |
-+.RE
-+.RS 11
-+--is-x86-linux32 | --is-x86-kfreebsd | --is-i386-kfreebsd |
-+.RE
-+.RS 11
-+--is-x86_64-kfreebsd | --is-x86-knetbsd |
-+.RE
-+.RS 11
-+--is-i386-knetbsd | --is-x86_64-knetbsd | --is-i386-efi |
-+.RE
-+.RS 11
-+--is-x86_64-efi | --is-ia64-efi | --is-arm64-efi |
-+.RE
-+.RS 11
-+--is-arm-efi | --is-hibernated-hiberfil | --is-x86_64-xnu |
-+.RE
-+.RS 11
-+--is-i386-xnu | --is-xnu-hibr | --is-x86-bios-bootsector)
-+.RE
-+.RS 11
-+\fIFILE\fR
-+
-+.SH DESCRIPTION
-+\fBgrub-file\fR is used to check if \fIFILE\fR is of a specified type.
-+
-+.SH OPTIONS
-+.TP
-+--is-i386-xen-pae-domu
-+Check if FILE can be booted as i386 PAE Xen unprivileged guest kernel
-+
-+.TP
-+--is-x86_64-xen-domu
-+Check if FILE can be booted as x86_64 Xen unprivileged guest kernel
-+
-+.TP
-+--is-x86-xen-dom0
-+Check if FILE can be used as Xen x86 privileged guest kernel
-+
-+.TP
-+--is-x86-multiboot
-+Check if FILE can be used as x86 multiboot kernel
-+
-+.TP
-+--is-x86-multiboot2
-+Check if FILE can be used as x86 multiboot2 kernel
-+
-+.TP
-+--is-arm-linux
-+Check if FILE is ARM Linux
-+
-+.TP
-+--is-arm64-linux
-+Check if FILE is ARM64 Linux
-+
-+.TP
-+--is-ia64-linux
-+Check if FILE is IA64 Linux
-+
-+.TP
-+--is-mips-linux
-+Check if FILE is MIPS Linux
-+
-+.TP
-+--is-mipsel-linux
-+Check if FILE is MIPSEL Linux
-+
-+.TP
-+--is-sparc64-linux
-+Check if FILE is SPARC64 Linux
-+
-+.TP
-+--is-powerpc-linux
-+Check if FILE is POWERPC Linux
-+
-+.TP
-+--is-x86-linux
-+Check if FILE is x86 Linux
-+
-+.TP
-+--is-x86-linux32
-+Check if FILE is x86 Linux supporting 32-bit protocol
-+
-+.TP
-+--is-x86-kfreebsd
-+Check if FILE is x86 kFreeBSD
-+
-+.TP
-+--is-i386-kfreebsd
-+Check if FILE is i386 kFreeBSD
-+
-+.TP
-+--is-x86_64-kfreebsd
-+Check if FILE is x86_64 kFreeBSD
-+
-+.TP
-+--is-x86-knetbsd
-+Check if FILE is x86 kNetBSD
-+
-+.TP
-+--is-i386-knetbsd
-+Check if FILE is i386 kNetBSD
-+
-+.TP
-+--is-x86_64-knetbsd
-+Check if FILE is x86_64 kNetBSD
-+
-+.TP
-+--is-i386-efi
-+Check if FILE is i386 EFI file
-+
-+.TP
-+--is-x86_64-efi
-+Check if FILE is x86_64 EFI file
-+
-+.TP
-+--is-ia64-efi
-+Check if FILE is IA64 EFI file
-+
-+.TP
-+--is-arm64-efi
-+Check if FILE is ARM64 EFI file
-+
-+.TP
-+--is-arm-efi
-+Check if FILE is ARM EFI file
-+
-+.TP
-+--is-hibernated-hiberfil
-+Check if FILE is hiberfil.sys in hibernated state
-+
-+.TP
-+--is-x86_64-xnu
-+Check if FILE is x86_64 XNU (Mac OS X kernel)
-+
-+.TP
-+--is-i386-xnu
-+Check if FILE is i386 XNU (Mac OS X kernel)
-+
-+.TP
-+--is-xnu-hibr
-+Check if FILE is XNU (Mac OS X kernel) hibernated image
-+
-+.TP
-+--is-x86-bios-bootsector
-+Check if FILE is BIOS bootsector
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-fstest.1 b/util/grub-fstest.1
-new file mode 100644
-index 0000000..792fa78
---- /dev/null
-+++ b/util/grub-fstest.1
-@@ -0,0 +1,99 @@
-+.TH GRUB-FSTEST 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-fstest\fR — Debug tool for GRUB's filesystem driver.
-+
-+.SH SYNOPSIS
-+\fBgrub-fstest\fR [-c | --diskcount=\fINUM\fR] [-C | --crypto]
-+.RS 13
-+[-d | --debug=\fISTRING\fR] [-K | --zfs-key=\fIFILE\fR|\fIprompt\fR]
-+.RE
-+.RS 13
-+[-n | --length=\fINUM\fR] [-r | --root=\fIDEVICE_NAME\fR]
-+.RE
-+.RS 13
-+[-s | --skip=\fINUM\fR] [-u | --uncompress] [-v | --verbose]
-+.RE
-+.RS 13
-+\fIIMAGE_PATH\fR <blocklist \fIFILE\fR | cat \fIFILE\fR |
-+.RE
-+.RS 13
-+cmp \fIFILE\fR \fILOCAL\fR | cp \fIFILE\fR \fILOCAL\fR | crc \fIFILE\fR |
-+.RE
-+.RS 13
-+hex \fIFILE\fR | ls \fIPATH\fR | xnu_uuid \fIDEVICE\fR>
-+
-+.SH DESCRIPTION
-+\fBgrub-fstest\fR is a tool for testing GRUB's filesystem drivers.  You should not normally need to run this program.
-+
-+.SH OPTIONS
-+.TP
-+\fB--diskcount\fR=\fINUM\fR
-+Specify the number of input files.
-+
-+.TP
-+\fB--crypto\fR
-+Mount cryptographic devices.
-+
-+.TP
-+\fB--debug\fR=\fISTRING\fR
-+Set debug environment variable.
-+
-+.TP
-+\fB--zfs-key\fR=\fIFILE\fR|\fIprompt\fR
-+Load ZFS cryptographic key.
-+
-+.TP
-+\fB--length\fR=\fINUM\fR
-+Handle NUM bytes in output file.
-+
-+.TP
-+\fB--root\fR=\fIDEVICE_NAME\fR
-+Set root device.
-+
-+.TP
-+\fB--skip\fR=\fINUM\fR
-+Skip NUM bytes from output file.
-+
-+.TP
-+\fB--uncompress\fR
-+Uncompress data.
-+
-+.TP
-+\fB--verbose\fR
-+Print verbose messages.
-+
-+.SH COMMANDS
-+.TP
-+\fBblocklist\fR \fIFILE\fR
-+Display block list of \fIFILE\fR.
-+
-+.TP
-+\fBcat\fR \fIFILE\fR
-+Display \fIFILE\fR on standard output.
-+
-+.TP
-+\fBcmp\fR \fIFILE\fR \fILOCAL\fR
-+Compare \fIFILE\fR with local file \fILOCAL\fR.
-+
-+.TP
-+\fBcp\fR \fIFILE\fR \fILOCAL\fR
-+Copy \fIFILE\fR to local file \fILOCAL\fR.
-+
-+.TP
-+\fBcrc\fR \fIFILE\fR
-+Display the CRC-32 checksum of \fIFILE\fR.
-+
-+.TP
-+\fBhex\fR \fIFILE\fR
-+Display contents of \fIFILE\fR in hexidecimal.
-+
-+.TP
-+\fBls\fR \fIPATH\fR
-+List files at \fIPATH\fR.
-+
-+.TP
-+\fBxnu_uuid\fR \fIDEVICE\fR
-+Display the XNU UUID of \fIDEVICE\fR.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-glue-efi.1 b/util/grub-glue-efi.1
-new file mode 100644
-index 0000000..72bd555
---- /dev/null
-+++ b/util/grub-glue-efi.1
-@@ -0,0 +1,31 @@
-+.TH GRUB-GLUE-EFI 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-glue-efi\fR \(em Create an Apple fat EFI binary.
-+
-+.SH SYNOPSIS
-+\fBgrub-glue-efi\fR <-3 | --input32=\fIFILE\fR> <-6 | --input64=\fIFILE\fR>
-+.RS 15
-+<-o | --output=\fIFILE\fR> [-v | --verbose]
-+
-+.SH DESCRIPTION
-+\fBgrub-glue-efi\fR creates an Apple fat EFI binary from two EFI binaries.
-+
-+.SH OPTIONS
-+.TP
-+\fB--input32\fR=\fIFILE\fR
-+Read 32-bit binary from \fIFILE\fR.
-+
-+.TP
-+\fB--input64\fR=\fIFILE\fR
-+Read 64-bit binary from \fIFILE\fR.
-+
-+.TP
-+\fB--output\fR=\fIFILE\fR
-+Write resulting fat binary to \fIFILE\fR.
-+
-+.TP
-+\fB--verbose\fR
-+Print verbose messages.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-install.8 b/util/grub-install.8
-new file mode 100644
-index 0000000..76272a3
---- /dev/null
-+++ b/util/grub-install.8
-@@ -0,0 +1,129 @@
-+.TH GRUB-INSTALL 1 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-install\fR \(em Install GRUB on a device.
-+
-+.SH SYNOPSIS
-+\fBgrub-install\fR [--modules=\fIMODULES\fR] [--install-modules=\fIMODULES\fR]
-+.RS 14
-+[--themes=\fITHEMES\fR] [--fonts=\fIFONTS\fR] [--locales=\fILOCALES\fR]
-+.RE
-+.RS 14
-+[--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]] [-d | --directory=\fIDIR\fR]
-+.RE
-+.RS 14
-+[--grub-mkimage=\fIFILE\fR] [--boot-directory=\fIDIR\fR]
-+.RE
-+.RS 14
-+[--target=\fITARGET\fR] [--grub-setup=\fIFILE\fR]
-+.RE
-+.RS 14
-+[--grub-mkrelpath=\fIFILE\fR] [--grub-probe=\fIFILE\fR]
-+.RE
-+.RS 14
-+[--allow-floppy] [--recheck] [--force] [--force-file-id]
-+.RE
-+.RS 14
-+[--disk-module=\fIMODULE\fR] [--no-nvram] [--removable]
-+.RE
-+.RS 14
-+[--bootloader-id=\fIID\fR] [--efi-directory=\fIDIR\fR] \fIINSTALL_DEVICE\fR
-+
-+.SH DESCRIPTION
-+\fBgrub-install\fR installs GRUB onto a device.  This includes copying GRUB images into the target directory (generally \fI/boot/grub\fR), and on some platforms may also include installing GRUB onto a boot sector.
-+
-+.SH OPTIONS
-+.TP
-+\fB--modules\fR=\fIMODULES\fR\!
-+Pre-load modules specified by \fIMODULES\fR.
-+
-+.TP
-+\fB--install-modules\fR=\fIMODULES\fR
-+Install only \fIMODULES\fR and their dependencies.  The default is to install all available modules.
-+
-+.TP
-+\fB--themes\fR=\fITHEMES\fR
-+Install \fITHEMES\fR.  The default is to install the \fIstarfield\fR theme, if available.
-+
-+.TP
-+\fB--fonts\fR=\fIFONTS\fR
-+Install \fIFONTS\fR.  The default is to install the \fIunicode\fR font.
-+
-+.TP
-+\fB--locales\fR=\fILOCALES\fR
-+Install only locales listed in \fILOCALES\fR.  The default is to install all available locales.
-+
-+.TP
-+\fB--compress\fR=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR
-+Compress GRUB files using the specified compression algorithm.
-+
-+.TP
-+\fB--directory\fR=\fIDIR\fR
-+Use images and modules in \fIDIR\fR.
-+
-+.TP
-+\fB--grub-mkimage\fR=\fIFILE\fR
-+Use \fIFILE\fR as \fBgrub-mkimage\fR.  The default is \fI/usr/bin/grub-mkimage\fR.
-+
-+.TP
-+\fB--boot-directory\fR=\fIDIR\fR
-+Use \fIDIR\fR as the boot directory.  The default is \fI/boot\fR.  GRUB will put its files in a subdirectory of this directory named \fIgrub\fR.
-+
-+.TP
-+\fB--target\fR=\fITARGET\fR
-+Install GRUB for \fITARGET\fR platform.  The default is the platform \fBgrub-install\fR is running on.
-+
-+.TP
-+\fB--grub-setup\fR=\fIFILE\fR
-+Use \fIFILE\fR as \fBgrub-setup\fR.  The default is \fI/usr/bin/grub-setup\fR.
-+
-+.TP
-+\fB--grub-mkrelpath\fR=\fIFILE\fR
-+Use \fIFILE\fR as \fBgrub-mkrelpath\fR.  The default is \fI/usr/bin/grub-mkrelpath\fR.
-+
-+.TP
-+\fB--grub-probe\fR=\fIFILE\fR
-+Use \fIFILE\fR as \fBgrub-probe\fR.  The default is \fI/usr/bin/grub-mkrelpath\fR.
-+
-+.TP
-+\fB--allow-floppy
-+Make the device also bootable as a floppy.  This option is the default for /dev/fdX devices. Some BIOSes will not boot images created with this option.
-+
-+.TP
-+\fB--recheck
-+Delete any existing device map and create a new one if necessary.
-+
-+.TP
-+\fB--force
-+Install even if problems are detected.
-+
-+.TP
-+\fB--force-file-id
-+Use identifier file even if UUID is available.
-+
-+.TP
-+\fB--disk-module\fR=\fIMODULE\fR
-+Use \fIMODULE\fR for disk access.  This allows you to manually specify either \fIbiosdisk\fR or \fInative\fR disk access.  This option is only available on the BIOS target platform.
-+
-+.TP
-+\fB--no-nvram
-+Do not update the \fIboot-device\fR NVRAM variable.  This option is only available on IEEE1275 target platforms.
-+
-+.TP
-+\fB--removable
-+Treat the target device as if it is removeable.  This option is only available on the EFI target platform.
-+
-+.TP
-+\fB--bootloader-id\fR=\fIID\fR
-+Use \fIID\fR as the bootloader ID.  This opption is only available on the EFI target platform.
-+
-+.TP
-+\fB--efi-directory\fR=\fIDIR\fR
-+Use \fIDIR\fR as the EFI System Partition root.  This opption is only available on the EFI ta
-+rget platform.
-+
-+.TP
-+\fIINSTALL_DEVICE\fR
-+Install GRUB to the block device \fIINSTALL_DEVICE\fR.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-kbdcomp.1 b/util/grub-kbdcomp.1
-new file mode 100644
-index 0000000..0bb969a
---- /dev/null
-+++ b/util/grub-kbdcomp.1
-@@ -0,0 +1,19 @@
-+.TH GRUB-KBDCOMP 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-kbdcomp\fR \(em Generate a GRUB keyboard layout file.
-+
-+.SH SYNOPSIS
-+\fBgrub-kbdcomp\fR <-o | --output=\fIFILE\fR> \fICKBMAP_ARGUMENTS\fR
-+
-+.SH DESCRIPTION
-+\fBgrub-kbdcomp\fR processes an X keyboard layout description in
-+\fBkeymaps\fR(5) format into a format that can be used by GRUB's \fBkeymap\fR
-+command.
-+
-+.SH OPTIONS
-+.TP
-+\fB--output\fR=\fIFILE\fR
-+Write output to \fIFILE\fR.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-macbless.1 b/util/grub-macbless.1
-new file mode 100644
-index 0000000..41a9618
---- /dev/null
-+++ b/util/grub-macbless.1
-@@ -0,0 +1,22 @@
-+.TH GRUB-MACBLESS 1 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-macbless\fR \(em Mac-style bless on HFS or HFS+
-+
-+.SH SYNOPSIS
-+\fBgrub-macbless\fR [-v | --verbose] [-p | --ppc] \fIFILE\fR | [-x | --x86] \fIFILE\fR
-+
-+.SH OPTIONS
-+.TP
-+--x86
-+Bless for x86 based Macs.
-+
-+.TP
-+--ppc
-+Bless for PPC based Macs.
-+
-+.TP
-+--verbose
-+Print verbose messages.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-menulst2cfg.1 b/util/grub-menulst2cfg.1
-new file mode 100644
-index 0000000..91e2ef8
---- /dev/null
-+++ b/util/grub-menulst2cfg.1
-@@ -0,0 +1,12 @@
-+.TH GRUB-MENULST2CFG 1 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-menulst2cfg\fR \(em Convert a configuration file from GRUB 0.xx to GRUB 2.xx format.
-+
-+.SH SYNOPSIS
-+\fBgrub-menulst2cfg\fR [\fIINFILE\fR [\fIOUTFILE\fR]]
-+
-+.SH DESCRIPTION
-+\fBgrub-menulst2cfg\fR converts a configuration file from GRUB 0.xx to the current format.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8
-new file mode 100644
-index 0000000..a2d1f57
---- /dev/null
-+++ b/util/grub-mkconfig.8
-@@ -0,0 +1,17 @@
-+.TH GRUB-MKCONFIG 1 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-mkconfig\fR \(em Generate a GRUB configuration file.
-+
-+.SH SYNOPSIS
-+\fBgrub-mkconfig\fR [-o | --output=\fIFILE\fR]
-+
-+.SH DESCRIPTION
-+\fBgrub-mkconfig\fR generates a configuration file for GRUB.
-+
-+.SH OPTIONS
-+.TP
-+\fB--output\fR=\fIFILE\fR
-+Write generated output to \fIFILE\fR.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-mkfont.1 b/util/grub-mkfont.1
-new file mode 100644
-index 0000000..3494857
---- /dev/null
-+++ b/util/grub-mkfont.1
-@@ -0,0 +1,87 @@
-+.TH GRUB-MKFONT 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-mkfont\fR \(em Convert common font file formats into the PF2 format.
-+
-+.SH SYNOPSIS
-+\fBgrub-mkfont\fR [--ascii-bitmaps] [-a | --force-autohint]
-+.RS 13
-+[-b | --bold] [-c | --asce=\fINUM\fR] [-d | --desc=\fINUM\fR]
-+.RE
-+.RS 13
-+[-i | --index=\fINUM\fR] [-n | --name=\fINAME\fR] [--no-bitmap]
-+.RE
-+.RS 13
-+[--no-hinting] <-o | --output=\fIFILE\fR>
-+.RE
-+.RS 13
-+[-r | --range=\fIFROM-TO\fR[\fI,FROM-TO\fR]] [-s | --size=\fISIZE\fR]
-+.RE
-+.RS 13
-+[-v | --verbose] [--width-spec] \fIFONT_FILES\fR
-+
-+.SH DESCRIPTION
-+\fBgrub-mkfont\fR converts font files from common formats into the PF2 format used by GRUB.
-+
-+.SH OPTIONS
-+.TP
-+--ascii-bitmaps
-+Save only bitmaps for ASCII characters.
-+
-+.TP
-+--force-autohint
-+Force generation of automatic hinting.
-+
-+.TP
-+--bold
-+Convert font to bold.
-+
-+.TP
-+--asce=\fINUM\fR
-+Set font ascent to \fINUM\fR.
-+
-+.TP
-+--desc=\fINUM\fR
-+Set font descent to \fINUM\fR.
-+
-+.TP
-+--index=\fINUM\fR
-+Select face index \fINUM\fR.
-+
-+.TP
-+--name=\fINAME\fR
-+Set font family to \fINAME\fR.
-+
-+.TP
-+--no-bitmap
-+Ignore bitmap strikes when loading.
-+
-+.TP
-+--no-hinting
-+Disable hinting.
-+
-+.TP
-+--output=\fIFILE\fR
-+Save ouptut to \fIFILE\fR.  This argument is required.
-+
-+.TP
-+--range=\fIFROM-TO\fR\fI,FROM-TO\fR
-+Set the font ranges to each pair of \fIFROM\fR,\fITO\fR.
-+
-+.TP
-+--size=\fISIZE\fR
-+Set font size to \fISIZE\fR.
-+
-+.TP
-+--verbose
-+Print verbose messages.
-+
-+.TP
-+--width-spec
-+Create a width summary file.
-+
-+.TP
-+\fIFONT_FILES\fR
-+The input files to be converted.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-mkimage.1 b/util/grub-mkimage.1
-new file mode 100644
-index 0000000..4dea4f5
---- /dev/null
-+++ b/util/grub-mkimage.1
-@@ -0,0 +1,95 @@
-+.TH GRUB-MKIMAGE 1 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-mkimage\fR \(em Make a bootable GRUB image.
-+
-+.SH SYNOPSIS
-+\fBgrub-mkimage\fR [-c | --config=\fRFILE\fI] [-C | --compression=(\fIxz\fR,\fInone\fR,\fIauto\fR)]
-+.RS 14
-+[-d | --directory=\fRDIR\fR] [-k | --pubkey=\fIFILE\fR]
-+.RE
-+.RS 14
-+[-m | --memdisk=\fIFILE\fR] [-n | --note] [-o | --output=\fIFILE\fR]
-+.RE
-+.RS 14
-+[-O | --format=\fIFORMAT\fR] [-p | --prefix=\fIDIR\fR]
-+.RE
-+.RS 14
-+[-v | --verbose] \fIMODULES\fR
-+
-+.SH DESCRIPTION
-+\fBgrub-mkimage\fI builds a bootable image of GRUB.
-+
-+.SH OPTIONS
-+.TP
-+--config=\fIFILE\fR
-+Embed \fIFILE\fR as the image's initial configuration file.
-+
-+.TP
-+--compression=(\fIxz\fR,\fInone\fR,\fIauto\fR)
-+Use one of \fIxz\fR, \fInone\fR, or \fIauto\fR as the compression method for the core image.
-+
-+.TP
-+--directory=\fIDIR\fR
-+Use images and modules from \fIDIR\fR.  The default value is \fB/usr/lib/grub/<platform>\fR.
-+
-+.TP
-+--pubkey=\fIFILE\fR
-+Embed the public key \fIFILE\fR for signature checking.
-+
-+.TP
-+--memdisk=\fIFILE\fR
-+Embed the memdisk image \fIFILE\fR.  If no \fB-p\fR option is also specified, this implies \fI-p (memdisk)/boot/grub\fR.
-+
-+.TP
-+--note
-+Add a CHRP \fINOTE\fR section.  This option is only valid on IEEE1275 platforms.
-+
-+.TP
-+--output=\fIFILE\fR
-+Write the generated file to \fIFILE\fR.  The default is to write to standard output.
-+
-+.TP
-+--format=\fIFORMAT\fR
-+Generate an image in the specified \fIFORMAT\fR.  Valid values are:
-+.RS
-+.RS 4
-+.P
-+i386-coreboot,
-+i386-multiboot,
-+i386-pc,
-+i386-pc-pxe,
-+i386-efi,
-+i386-ieee1275,
-+i386-qemu,
-+x86_64-efi,
-+mipsel-yeeloong-flash,
-+mipsel-fuloong2f-flash,
-+mipself-loongson-elf,
-+powerpc-ieee1275,
-+sparc64-ieee1275-raw,
-+sparc64-ieee1275-cdcore,
-+sparc64-ieee1275-aout,
-+ia64-efi,
-+mips-arc,
-+mipsel-arc,
-+mipsel-qemu_mips-elf,
-+mips-qemu_mips-flash,
-+mipsel-qemu_mips-flash,
-+mips-qemu_mips-elf
-+.RE
-+.RE
-+
-+.TP
-+--prefix=\fIDIR\fR
-+Set prefix directory.  The default value is \fI/boot/grub\fR.
-+
-+.TP
-+--verbose
-+Print verbose messages.
-+
-+.TP
-+\fIMODULES\fR
-+Include \fIMODULES\fR.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-mklayout.1 b/util/grub-mklayout.1
-new file mode 100644
-index 0000000..d1bbc2e
---- /dev/null
-+++ b/util/grub-mklayout.1
-@@ -0,0 +1,27 @@
-+.TH GRUB-MKLAYOUT 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-mklayout\fR \(em Generate a GRUB keyboard layout file.
-+
-+.SH SYNOPSIS
-+\fBgrub-mklayout\fR [-i | --input=\fIFILE\fR] [-o | --output=\fIFILE\fR]
-+.RS 15
-+[-v | --verbose]
-+
-+.SH DESCRIPTION
-+\fBgrub-mklayout\fR generates a GRUB keyboard layout description which corresponds with the Linux console layout description given as input.
-+
-+.SH OPTIONS
-+.TP
-+--input=\fIFILE\fR
-+Use \fIFILE\fR as the input.  The default value is the standard input device.
-+
-+.TP
-+--output=\fIFILE\fR
-+Use \fIFILE\fR as the output.  The default value is the standard output device.
-+
-+.TP
-+--verbose
-+Print verbose messages.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-mknetdir.1 b/util/grub-mknetdir.1
-new file mode 100644
-index 0000000..69c2262
---- /dev/null
-+++ b/util/grub-mknetdir.1
-@@ -0,0 +1,12 @@
-+.TH GRUB-MKNETDIR 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-mknetdir\fR \(em Prepare a GRUB netboot directory.
-+
-+.SH SYNOPSIS
-+\fBgrub-mknetdir\fR 
-+
-+.SH DESCRIPTION
-+\fBgrub-mknetdir\fR prepares a directory for GRUB to be netbooted from.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-mkpasswd-pbkdf2.1 b/util/grub-mkpasswd-pbkdf2.1
-new file mode 100644
-index 0000000..73c437c
---- /dev/null
-+++ b/util/grub-mkpasswd-pbkdf2.1
-@@ -0,0 +1,27 @@
-+.TH GRUB-MKPASSWD-PBKDF2 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-mkpasswd-pbkdf2\fR \(em Generate a PBKDF2 password hash.
-+
-+.SH SYNOPSIS
-+\fBgrub-mkpasswd-pbkdf2\fR [-c | --iteration-count=\fINUM\fR] [-l | --buflen=\fINUM\fR]
-+.RS 22
-+[-s | --salt=\fINUM\fR]
-+
-+.SH DESCRIPTION
-+\fBgrub-mkpasswd-pbkdf2\fR generates a PBKDF2 password string suitable for use in a GRUB configuration file.
-+
-+.SH OPTIONS
-+.TP
-+--iteration-count=\fINUM\fR
-+Number of PBKDF2 iterations.
-+
-+.TP
-+--buflen=\fINUM\fR
-+Length of generated hash.
-+
-+.TP
-+--salt=\fINUM\fR
-+Length of salt to use.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-mkrelpath.1 b/util/grub-mkrelpath.1
-new file mode 100644
-index 0000000..85f1113
---- /dev/null
-+++ b/util/grub-mkrelpath.1
-@@ -0,0 +1,12 @@
-+.TH GRUB-MKRELPATH 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-mkrelpath\fR \(em Generate a relative GRUB path given an OS path.
-+
-+.SH SYNOPSIS
-+\fBgrub-mkrelpath\fR \fIFILE\fR
-+
-+.SH DESCRIPTION
-+\fBgrub-mkrelpath\fR takes an OS filesystem path for \fIFILE\fR and returns a relative path suitable for use in a GRUB configuration file.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-mkrescue.1 b/util/grub-mkrescue.1
-new file mode 100644
-index 0000000..4ed9fc7
---- /dev/null
-+++ b/util/grub-mkrescue.1
-@@ -0,0 +1,123 @@
-+.TH GRUB-MKRESCUE 3 "Wed Feb 26 2014"
-+.SH NAME
-+grub-mkrescue \(em Generate a GRUB rescue image using GNU Xorriso.
-+
-+.SH SYNOPSIS
-+\fBgrub-mkrescue\fR [-o | --output=\fIFILE\fR] [--modules=\fIMODULES\fR]
-+.RS 15
-+[--install-modules=\fIMODULES\fR] [--themes=\fITHEMES\fR]
-+.RE
-+.RS 15
-+[--fonts=\fIFONTS\fR] [--locales=\fILOCALES\fR]
-+.RE
-+.RS 15
-+[--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]] [-d | --directory=\fIDIR\fR]
-+.RE
-+.RS 15
-+[--grub-mkimage=\fIFILE\fR] [--rom-directory=\fIDIR\fR]
-+.RE
-+.RS 15
-+[--xorriso=\fIFILE\fR] [--grub-glue-efi=\fIFILE\fR]
-+.RE
-+.RS 15
-+[--grub-render-label=\fIFILE\fR] [--label-font=\fIFILE\fR]
-+.RE
-+.RS 15
-+[--label-color=\fICOLOR\fR] [--label-bgcolor=\fIFILE\fR]
-+.RE
-+.RS 15
-+[--product-name=\fISTRING\fR] [--product-version=\fISTRING\fR]
-+.RE
-+.RS 15
-+[--sparc-boot] [--arcs-boot]
-+
-+.SH DESCRIPTION
-+\fBgrub-mkrescue\fR can be used to generate a rescue image with the GRUB bootloader.
-+
-+.SH OPTIONS
-+.TP
-+\fB--output\fR=\fIFILE\fR
-+Write the generated file to \fIFILE\fR.  The default is to write to standard output.
-+
-+.TP
-+\fB--modules\fR=\fIMODULES\fR
-+Pre-load modules specified by \fIMODULES\fR.
-+
-+.TP
-+\fB--install-modules\fR=\fIMODULES\fR
-+Install only \fIMODULES\fR and their dependencies.  The default is to install all available modules.
-+
-+.TP
-+\fB--themes\fR=\fITHEMES\fR
-+Install \fITHEMES\fR.  The default is to install the \fIstarfield\fR theme, if available.
-+
-+.TP
-+\fB--fonts\fR=\fIFONTS\fR
-+Install \fIFONTS\fR.  The default is to install the \fIunicode\fR font.
-+
-+.TP
-+\fB--locales\fR=\fILOCALES\fR
-+Install only locales listed in \fILOCALES\fR.  The default is to install all available locales.
-+
-+.TP
-+\fB--compress\fR[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]
-+Compress GRUB files using the specified compression algorithm.
-+
-+.TP
-+\fB--directory\fR=\fIDIR\fR
-+Use images and modules in \fIDIR\fR.
-+
-+.TP
-+\fB--grub-mkimage\fR=\fIFILE\fR
-+Use \fIFILE\fR as \fBgrub-mkimage\fR(1).  The default is \fI/usr/bin/grub-mkimage\fR.
-+
-+.TP
-+\fB--rom-directory\fR=\fIDIR\fR
-+Save ROM images in \fIDIR\fR.
-+
-+.TP
-+\fB--xorriso\fR=\fIFILE\fR
-+Use \fIFILE\fR as \fBxorriso\fI.
-+
-+.TP
-+\fB--grub-glue-efi\fR=\fIFILE\fR
-+Use \fIFILE\fR as \fBgrub-glue-efi\fR(3).
-+
-+.TP
-+\fB--grub-render-label\fR=\fIFILE\fR
-+Use \fIFILE\fR as \fBgrub-render-label\fR(3).
-+
-+.TP
-+\fB--label-font\fR=\fIFILE\fR
-+Use \fIFILE\fR as the font file for generated labels.
-+
-+.TP
-+\fB--label-color\fR=\fICOLOR\fR
-+Use \fICOLOR\fI as the color for generated labels.
-+
-+.TP
-+\fB--label-bgcolor\fR=\fICOLOR\fR
-+Use \fICOLOR\fR as the background color for generated labels.
-+
-+.TP
-+\fB--product-name\fR=\fISTRING\fR
-+Use \fISTRING\fR as the product name in generated labels.
-+
-+.TP
-+\fB--product-version\fR=\fISTRING\fR
-+Use \fISTRING\fR as the product version in generated labels.
-+
-+.TP
-+\fB--sparc-boot\fR
-+Enable booting the SPARC platform.  This disables HFS+, APM, ARCS, and "boot as disk image" on the \fIi386-pc\fR target platform.
-+
-+.TP
-+\fB--arcs-boot\fR
-+Enable ARCS booting.  This is typically for big-endian MIPS machines, and disables HFS+, APM, sparc64, and "boot as disk image" on the \fIi386-pc\fR target platform.
-+
-+.TP
-+\fB--\fR
-+All options after a \fB--\fR will be passed directly to xorriso's command line when generating the image.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-mkstandalone.1 b/util/grub-mkstandalone.1
-new file mode 100644
-index 0000000..ba2d2bd
---- /dev/null
-+++ b/util/grub-mkstandalone.1
-@@ -0,0 +1,100 @@
-+.TH GRUB-MKSTANDALONE 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-mkstandalone\fR \(em Generate a standalone image in the selected format.
-+
-+.SH SYNOPSIS
-+\fBgrub-mkstandalone\fR [-o | --output=\fIFILE\fR] [-O | --format=\fIFORMAT\fR]
-+.RS 19
-+[-C | --compression=(\fIxz\fR|\fInone\fR|\fIauto\fR)]
-+.RE
-+.RS 19
-+[--modules=\fIMODULES\fR] [--install-modules=\fIMODULES\fR]
-+.RE
-+.RS 19
-+[--themes=\fITHEMES\fR] [--fonts=\fIFONTS\fR]
-+.RE
-+.RS 19
-+[--locales=\fILOCALES\fR] [--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]]
-+.RE
-+.RS 19
-+[-d | --directory=\fIDIR\fR] [--grub-mkimage=\fIFILE\fR]
-+.RE
-+.RS 19
-+\fISOURCE...\fR
-+
-+.SH DESCRIPTION
-+
-+.SH OPTIONS
-+.TP
-+--output=\fIFILE\fR
-+Write the generated file to \fIFILE\fR.  The default is to write to standard output.
-+
-+.TP
-+--format=\fIFORMAT\fR
-+Generate an image in the specified \fIFORMAT\fR.  Valid values are:
-+.RS
-+.RS 4
-+.P
-+i386-coreboot,
-+i386-multiboot,
-+i386-pc,
-+i386-pc-pxe,
-+i386-efi,
-+i386-ieee1275,
-+i386-qemu,
-+x86_64-efi,
-+mipsel-yeeloong-flash,
-+mipsel-fuloong2f-flash,
-+mipself-loongson-elf,
-+powerpc-ieee1275,
-+sparc64-ieee1275-raw,
-+sparc64-ieee1275-cdcore,
-+sparc64-ieee1275-aout,
-+ia64-efi,
-+mips-arc,
-+mipsel-arc,
-+mipsel-qemu_mips-elf,
-+mips-qemu_mips-flash,
-+mipsel-qemu_mips-flash,
-+mips-qemu_mips-elf
-+.RE
-+.RE
-+
-+.TP
-+--compression=(\fIxz\fR|\fInone\fR|\fIauto\fR)
-+Use one of \fIxz\fR, \fInone\fR, or \fIauto\fR as the compression method for the core image.
-+
-+.TP
-+--modules=\fIMODULES\fR
-+Pre-load modules specified by \fIMODULES\fR.
-+
-+.TP
-+--install-modules=\fIMODULES\fR
-+Install only \fIMODULES\fR and their dependencies.  The default is to install all available modules.
-+
-+.TP
-+--themes=\fITHEMES\fR
-+Install \fITHEMES\fR.  The default is to install the \fIstarfield\fR theme, if available.
-+
-+.TP
-+--fonts=\fIFONTS\fR
-+Install \fIFONTS\fR.  The default is to install the \fIunicode\fR font.
-+
-+.TP
-+--locales=\fILOCALES\fR
-+Install only locales listed in \fILOCALES\fR.  The default is to install all available locales.
-+
-+.TP
-+--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]
-+Compress GRUB files using the specified compression algorithm.
-+
-+.TP
-+--directory=\fIDIR\fR
-+Use images and modules in \fIDIR\fR.
-+
-+.TP
-+--grub-mkimage=\fIFILE\fR
-+Use \fIFILE\fR as \fBgrub-mkimage\fR.  The default is \fI/usr/bin/grub-mkimage\fR.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-ofpathname.8 b/util/grub-ofpathname.8
-new file mode 100644
-index 0000000..bf3743a
---- /dev/null
-+++ b/util/grub-ofpathname.8
-@@ -0,0 +1,12 @@
-+.TH GRUB-OFPATHNAME 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-ofpathname\fR \(em Generate an IEEE-1275 device path for a specified device.
-+
-+.SH SYNOPSIS
-+\fBgrub-ofpathname\fR \fIDEVICE\fR
-+
-+.SH DESCRIPTION
-+\fBgrub-ofpathname\fR generates an IEEE-1275 device path for the specified \fIDEVICE\fR.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-probe.8 b/util/grub-probe.8
-new file mode 100644
-index 0000000..04e26c8
---- /dev/null
-+++ b/util/grub-probe.8
-@@ -0,0 +1,80 @@
-+.TH GRUB-PROBE 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-probe\fR \(em Probe device information for a given path.
-+
-+.SH SYNOPSIS
-+\fBgrub-probe\fR \[-d | --device] [-m | --device-map=\fIFILE\fR]
-+.RS 12
-+[-t | --target=(fs|fs_uuid|fs_label|drive|device|partmap|
-+.RE
-+.RS 28
-+abstraction|cryptodisk_uuid|
-+.RE
-+.RS 28
-+msdos_parttype)]
-+.RE
-+.RS 12
-+[-v | --verbose] (PATH|DEVICE)
-+
-+.SH DESCRIPTION
-+\fBgrub-probe\fR probes a path or device for filesystem and related information.
-+
-+.SH OPTIONS
-+.TP
-+--device
-+Final option represents a \fIDEVICE\fR, rather than a filesystem \fIPATH\fR.
-+.TP
-+--device-map=\fIFILE\fR
-+Use \fIFILE\fR as the device map.  The default value is \fI/boot/grub/device.map\fR.
-+
-+.TP
-+--target=(fs|fs_uuid|fs_label|drive|device|partmap|msdos_parttype)
-+Select among various output definitions.  The default is \fIfs\fR.
-+.RS
-+.TP
-+\fIfs\fR
-+filesystem module
-+
-+.TP
-+\fIfs_uuid\fR
-+filesystem UUID
-+
-+.TP
-+\fIfs_label\fR
-+filesystem label
-+
-+.TP
-+\fIdrive\fR
-+GRUB drive name
-+
-+.TP
-+\fIdevice\fR
-+System device
-+
-+.TP
-+\fIpartmap\fR
-+partition map module
-+
-+.TP
-+\fIabstraction\fR
-+abstraction module
-+
-+.TP
-+\fIcryptodisk_uuid\fR
-+cryptographic container
-+
-+.TP
-+\fImsdos_partmap\fR
-+MS-DOS partition map
-+.RE
-+
-+.TP
-+--verbose
-+Print verbose output.
-+
-+.TP
-+(\fIPATH\fR|\fIDEVICE\fR)
-+If --device is passed, a block \fIDEVICE\fR.  Otherwise, the \fIPATH\fR of a file on the filesystem.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-reboot.8 b/util/grub-reboot.8
-new file mode 100644
-index 0000000..faa5e4e
---- /dev/null
-+++ b/util/grub-reboot.8
-@@ -0,0 +1,21 @@
-+.TH GRUB-REBOOT 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-reboot\fR \(em Set the default boot menu entry for the next boot only.
-+
-+.SH SYNOPSIS
-+\fBgrub-reboot\fR [--boot-directory=\fIDIR\fR] \fIMENU_ENTRY\fR
-+
-+.SH DESCRIPTION
-+\fBgrub-reboot\fR sets the default boot menu entry for the next boot, but not further boots after that.  This command only works for GRUB configuration files created with \fIGRUB_DEFAULT=saved\fR in \fI/etc/default/grub\fR.
-+
-+.SH OPTIONS
-+.TP
-+--boot-directory=\fIDIR\fR
-+Find GRUB images under \fIDIR/grub\fR.  The default value is \fI/boot\fR, resulting in grub images being search for at \fI/boot/grub\fR.
-+
-+.TP
-+\fIMENU_ENTRY\fR
-+A number, a menu item title or a menu item identifier.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-render-label.1 b/util/grub-render-label.1
-new file mode 100644
-index 0000000..4d51c8a
---- /dev/null
-+++ b/util/grub-render-label.1
-@@ -0,0 +1,51 @@
-+.TH GRUB-RENDER-LABEL 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-render-label\fR \(em Render an Apple disk label.
-+
-+.SH SYNOPSIS
-+\fBgrub-render-label\fR [-b | --bgcolor=\fICOLOR\fR] [-c | --color=\fICOLOR\fR]
-+.RS 19
-+[-f | --font=\fIFILE\fR] [-i | --input=\fIFILE\fR]
-+.RE
-+.RS 19
-+[-o | --output=\fIFILE\fR] [-t | --text=\fISTRING\fR]
-+.RE
-+.RS 19
-+[-v | --verbose]
-+
-+.SH DESCRIPTION
-+\fBgrub-render-label\fR renders an Apple disk label (.disk_label) file.
-+
-+
-+.SH OPTIONS
-+.TP
-+\fB--color\fR=\fICOLOR\fR
-+Use \fICOLOR\fI as the color for generated labels.
-+
-+.TP
-+\fB--bgcolor\fR=\fICOLOR\fR
-+Use \fICOLOR\fR as the background color for generated labels.
-+
-+.TP
-+\fB--font\fR=\fIFILE\fR
-+Use \fIFILE\fR as the font file for generated labels.
-+
-+.TP
-+--input=\fIFILE\fR
-+Read input text from \fIFILE\fR.
-+
-+.TP
-+--output=\fIFILE\fR
-+Render output to \fIFILE\fR.
-+
-+.TP
-+--text=\fISTRING\fR
-+Use \fISTRING\fR as input text.
-+
-+.TP
-+--verbose
-+Print verbose output.
-+
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-script-check.1 b/util/grub-script-check.1
-new file mode 100644
-index 0000000..0f1f625
---- /dev/null
-+++ b/util/grub-script-check.1
-@@ -0,0 +1,21 @@
-+.TH GRUB-SCRIPT-CHECK 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-script-check\fR \(em Check GRUB configuration file for syntax errors.
-+
-+.SH SYNOPSIS
-+\fBgrub-script-check\fR [-v | --verbose] \fIPATH\fR
-+
-+.SH DESCRIPTION
-+\fBgrub-script-check\fR verifies that a specified GRUB configuration file does not contain syntax errors.
-+
-+.SH OPTIONS
-+.TP
-+--verbose
-+Print verbose output.
-+
-+.TP
-+\fIPATH\fR
-+Path of the file to use as input.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-set-default.8 b/util/grub-set-default.8
-new file mode 100644
-index 0000000..a96265a
---- /dev/null
-+++ b/util/grub-set-default.8
-@@ -0,0 +1,21 @@
-+.TH GRUB-SET-DEFAULT 1 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-set-default\fR \(em Set the default boot menu entry for GRUB.
-+
-+.SH SYNOPSIS
-+\fBgrub-set-default\fR [--boot-directory=\fIDIR\fR] \fIMENU_ENTRY\fR
-+
-+.SH DESCRIPTION
-+\fBgrub-set-default\fR sets the default boot menu entry for all subsequent boots.  This command only works for GRUB configuration files created with \fIGRUB_DEFAULT=saved\fR in \fI/etc/default/grub\fR.
-+
-+.SH OPTIONS
-+.TP
-+--boot-directory=\fIDIR\fR
-+Find GRUB images under \fIDIR/grub\fR.  The default value is \fI/boot\fR, resulting in grub images being search for at \fI/boot/grub\fR.
-+
-+.TP
-+\fIMENU_ENTRY\fR
-+A number, a menu item title or a menu item identifier.
-+
-+.SH SEE ALSO
-+.BR "info grub"
-diff --git a/util/grub-sparc64-setup.8 b/util/grub-sparc64-setup.8
-new file mode 100644
-index 0000000..37ea2dd
---- /dev/null
-+++ b/util/grub-sparc64-setup.8
-@@ -0,0 +1,12 @@
-+.TH GRUB-SPARC64-SETUP 3 "Wed Feb 26 2014"
-+.SH NAME
-+\fBgrub-sparc64-setup\fR \(em Set up a device to boot a sparc64 GRUB image.
-+
-+.SH SYNOPSIS
-+\fBgrub-sparc64-setup\fR [OPTIONS].
-+
-+.SH DESCRIPTION
-+You should not normally run this program directly.  Use grub-install instead.
-+
-+.SH SEE ALSO
-+.BR "info grub"
--- 
-1.8.5.3
-
diff --git a/SOURCES/0001-Migrate-PPC-from-Yaboot-to-Grub2.patch b/SOURCES/0001-Migrate-PPC-from-Yaboot-to-Grub2.patch
deleted file mode 100644
index d55ac45..0000000
--- a/SOURCES/0001-Migrate-PPC-from-Yaboot-to-Grub2.patch
+++ /dev/null
@@ -1,154 +0,0 @@
-From be4a014a8024153e201eb1f79069ec1584001305 Mon Sep 17 00:00:00 2001
-From: Mark Hamzy <hamzy@us.ibm.com>
-Date: Wed, 28 Mar 2012 14:46:41 -0500
-Subject: [PATCH 01/34] Migrate PPC from Yaboot to Grub2
-
-Add configuration support for serial terminal consoles.  This will set the
-maximum screen size so that text is not overwritten.
----
- Makefile.util.def              |   7 +++
- util/grub.d/20_ppc_terminfo.in | 114 +++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 121 insertions(+)
- create mode 100644 util/grub.d/20_ppc_terminfo.in
-
-diff --git a/Makefile.util.def b/Makefile.util.def
-index 985e76c..b88ce42 100644
---- a/Makefile.util.def
-+++ b/Makefile.util.def
-@@ -485,6 +485,13 @@ script = {
- };
- 
- script = {
-+  name = '20_ppc_terminfo';
-+  common = util/grub.d/20_ppc_terminfo.in;
-+  installdir = grubconf;
-+  condition = COND_HOST_LINUX;
-+};
-+
-+script = {
-   name = '30_os-prober';
-   common = util/grub.d/30_os-prober.in;
-   installdir = grubconf;
-diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in
-new file mode 100644
-index 0000000..10d6658
---- /dev/null
-+++ b/util/grub.d/20_ppc_terminfo.in
-@@ -0,0 +1,114 @@
-+#! /bin/sh
-+set -e
-+
-+# grub-mkconfig helper script.
-+# Copyright (C) 2006,2007,2008,2009,2010  Free Software Foundation, Inc.
-+#
-+# GRUB is free software: you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation, either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# GRUB is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
-+
-+prefix=@prefix@
-+exec_prefix=@exec_prefix@
-+bindir=@bindir@
-+libdir=@libdir@
-+. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
-+
-+export TEXTDOMAIN=@PACKAGE@
-+export TEXTDOMAINDIR=@localedir@
-+
-+X=80
-+Y=24
-+TERMINAL=ofconsole
-+
-+argument () {
-+  opt=$1
-+  shift
-+
-+  if test $# -eq 0; then
-+      echo "$0: option requires an argument -- '$opt'" 1>&2
-+      exit 1
-+  fi
-+  echo $1
-+}
-+
-+check_terminfo () {
-+
-+  while test $# -gt 0
-+  do
-+    option=$1
-+    shift
-+
-+    case "$option" in
-+    terminfo | TERMINFO)
-+        ;;
-+
-+    -g)
-+        NEWXY=`argument $option "$@"`
-+        NEWX=`echo $NEWXY | cut -d x -f 1`
-+        NEWY=`echo $NEWXY | cut -d x -f 2`
-+
-+        if [ ${NEWX} -ge 80 ] ; then
-+          X=${NEWX}
-+        else
-+          echo "Warning: ${NEWX} is less than the minimum size of 80"
-+        fi
-+
-+        if [ ${NEWY} -ge 24 ] ; then
-+          Y=${NEWY}
-+        else
-+          echo "Warning: ${NEWY} is less than the minimum size of 24"
-+        fi
-+
-+        shift
-+        ;;
-+
-+    *)
-+#       # accept console or ofconsole
-+#       if [ "$option" != "console" -a "$option" != "ofconsole" ] ; then
-+#         echo "Error: GRUB_TERMINFO unknown console: $option"
-+#         exit 1
-+#       fi
-+#       # perfer console
-+#       TERMINAL=console
-+        # accept ofconsole
-+        if [ "$option" != "ofconsole" ] ; then
-+          echo "Error: GRUB_TERMINFO unknown console: $option"
-+          exit 1
-+        fi
-+        # perfer console
-+        TERMINAL=ofconsole
-+        ;;
-+    esac
-+
-+  done
-+
-+}
-+
-+if ! uname -m | grep -q ppc ; then
-+  exit 0
-+fi
-+
-+if [ "x${GRUB_TERMINFO}" != "x" ] ; then
-+  F1=`echo ${GRUB_TERMINFO} | cut -d " " -f 1`
-+
-+  if [ "${F1}" != "terminfo" ] ; then
-+    echo "Error: GRUB_TERMINFO is set to \"${GRUB_TERMINFO}\" The first word should be terminfo."
-+    exit 1
-+  fi
-+
-+  check_terminfo ${GRUB_TERMINFO}
-+fi
-+
-+cat << EOF
-+  terminfo -g ${X}x${Y} ${TERMINAL}
-+EOF
--- 
-1.8.4.2
-
diff --git a/SOURCES/0001-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/SOURCES/0001-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch
new file mode 100644
index 0000000..96a33e7
--- /dev/null
+++ b/SOURCES/0001-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch
@@ -0,0 +1,33 @@
+From de35b045e49e54a3823cfa2edbd35e131d266304 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Thu, 4 Sep 2014 15:52:08 -0400
+Subject: [PATCH] Minimize the sort ordering for .debug and -rescue- kernels.
+
+Resolves: rhbz#1065360
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ util/grub-mkconfig_lib.in | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
+index 14fadbc..e9a71b4 100644
+--- a/util/grub-mkconfig_lib.in
++++ b/util/grub-mkconfig_lib.in
+@@ -248,6 +248,14 @@ version_test_gt ()
+     *.old:*.old) ;;
+     *.old:*) version_test_gt_a="`echo -n "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
+     *:*.old) version_test_gt_b="`echo -n "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;
++    *-rescue-*:*-rescue-*) ;;
++    *.debug:*.debug) ;;
++    *-rescue-*:*.debug) return 1 ;;
++    *.debug:*-rescue-*) return 0 ;;
++    *-rescue-*:*) return 1 ;;
++    *:*-rescue-*) return 0 ;;
++    *.debug:*) return 1 ;;
++    *:*.debug) return 0 ;;
+   esac
+   version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b"
+   return "$?"
+-- 
+1.9.3
+
diff --git a/SOURCES/0001-Try-prefix-if-fw_path-doesn-t-work.patch b/SOURCES/0001-Try-prefix-if-fw_path-doesn-t-work.patch
new file mode 100644
index 0000000..56c6774
--- /dev/null
+++ b/SOURCES/0001-Try-prefix-if-fw_path-doesn-t-work.patch
@@ -0,0 +1,211 @@
+From b5adb83344dfeb6ff142dc41bd2a82d29029c1c2 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Fri, 3 Oct 2014 11:08:03 -0400
+Subject: [PATCH] Try $prefix if $fw_path doesn't work.
+
+Related: rhbz#1148652
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ grub-core/kern/ieee1275/init.c |  30 ++++++-----
+ grub-core/net/net.c            |   2 +-
+ grub-core/normal/main.c        | 118 ++++++++++++++++++++---------------------
+ 3 files changed, 75 insertions(+), 75 deletions(-)
+
+diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
+index 8191f8c..8ca4bf7 100644
+--- a/grub-core/kern/ieee1275/init.c
++++ b/grub-core/kern/ieee1275/init.c
+@@ -131,23 +131,25 @@ grub_machine_get_bootlocation (char **device, char **path)
+       grub_free (canon);
+     }
+   else
+-    *device = grub_ieee1275_encode_devname (bootpath);
+-  grub_free (type);
+-
+-  filename = grub_ieee1275_get_filename (bootpath);
+-  if (filename)
+     {
+-      char *lastslash = grub_strrchr (filename, '\\');
+-
+-      /* Truncate at last directory.  */
+-      if (lastslash)
++      filename = grub_ieee1275_get_filename (bootpath);
++      if (filename)
+         {
+-	  *lastslash = '\0';
+-	  grub_translate_ieee1275_path (filename);
+-
+-	  *path = filename;
+-	}
++          char *lastslash = grub_strrchr (filename, '\\');
++
++          /* Truncate at last directory.  */
++          if (lastslash)
++            {
++              *lastslash = '\0';
++              grub_translate_ieee1275_path (filename);
++
++              *path = filename;
++            }
++        }
++      *device = grub_ieee1275_encode_devname (bootpath);
+     }
++
++  grub_free (type);
+   grub_free (bootpath);
+ }
+ 
+diff --git a/grub-core/net/net.c b/grub-core/net/net.c
+index 578e057..10bfed3 100644
+--- a/grub-core/net/net.c
++++ b/grub-core/net/net.c
+@@ -1817,7 +1817,7 @@ grub_net_search_configfile (char *config)
+   /* Remove the remaining minus sign at the end. */
+   config[config_len] = '\0';
+ 
+-  return GRUB_ERR_NONE;
++  return GRUB_ERR_FILE_NOT_FOUND;
+ }
+ 
+ static struct grub_preboot *fini_hnd;
+diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
+index 4190985..aa14499 100644
+--- a/grub-core/normal/main.c
++++ b/grub-core/normal/main.c
+@@ -331,74 +331,72 @@ grub_enter_normal_mode (const char *config)
+   grub_boot_time ("Exiting normal mode");
+ }
+ 
++static grub_err_t
++grub_try_normal (const char *variable)
++{
++    char *config;
++    const char *prefix;
++    grub_err_t err = GRUB_ERR_FILE_NOT_FOUND;
++
++    prefix = grub_env_get (variable);
++    if (!prefix)
++      return GRUB_ERR_FILE_NOT_FOUND;
++
++    if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
++      {
++	grub_size_t config_len;
++	config_len = grub_strlen (prefix) +
++	  sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
++	config = grub_malloc (config_len);
++
++	if (! config)
++	  return GRUB_ERR_FILE_NOT_FOUND;
++
++	grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
++	err = grub_net_search_configfile (config);
++      }
++
++    if (err != GRUB_ERR_NONE)
++      {
++	config = grub_xasprintf ("%s/grub.cfg", prefix);
++	if (config)
++	  {
++	    grub_file_t file;
++	    file = grub_file_open (config);
++	    if (file)
++	      {
++		grub_file_close (file);
++		err = GRUB_ERR_NONE;
++	      }
++	  }
++      }
++
++    if (err == GRUB_ERR_NONE)
++      grub_enter_normal_mode (config);
++
++    grub_errno = 0;
++    grub_free (config);
++    return err;
++}
++
+ /* Enter normal mode from rescue mode.  */
+ static grub_err_t
+ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
+ 		 int argc, char *argv[])
+ {
+-  if (argc == 0)
++  if (argc)
++    grub_enter_normal_mode (argv[0]);
++  else
+     {
+-      /* Guess the config filename. It is necessary to make CONFIG static,
+-	 so that it won't get broken by longjmp.  */
+-      char *config;
+-      const char *prefix;
+-
+-      prefix = grub_env_get ("fw_path");
+-      if (! prefix)
+-	      prefix = grub_env_get ("prefix");
+-
+-      if (prefix)
+-	{
+-	  if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
+-	    {
+-	      grub_size_t config_len;
+-	      config_len = grub_strlen (prefix) +
+-		sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
+-	      config = grub_malloc (config_len);
+-
+-	      if (! config)
+-		goto quit;
+-
+-	      grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
+-
+-	      grub_net_search_configfile (config);
+-
+-	      grub_enter_normal_mode (config);
+-	      grub_free (config);
+-	      config = NULL;
+-	    }
+-
+-	  if (!config)
+-	    {
+-	      config = grub_xasprintf ("%s/grub.cfg", prefix);
+-	      if (config)
+-		{
+-		  grub_file_t file;
+-
+-		  file = grub_file_open (config);
+-		  if (file)
+-		    {
+-		      grub_file_close (file);
+-		      grub_enter_normal_mode (config);
+-		    }
+-		  else
+-		    {
+-		      /*  Ignore all errors.  */
+-		      grub_errno = 0;
+-		    }
+-		  grub_free (config);
+-		}
+-	    }
+-	}
+-      else
+-	{
+-	  grub_enter_normal_mode (0);
+-	}
++      /* Guess the config filename. */
++      grub_err_t err;
++      err = grub_try_normal ("fw_path");
++      if (err == GRUB_ERR_FILE_NOT_FOUND)
++        err = grub_try_normal ("prefix");
++      if (err == GRUB_ERR_FILE_NOT_FOUND)
++        grub_enter_normal_mode (0);
+     }
+-  else
+-    grub_enter_normal_mode (argv[0]);
+ 
+-quit:
+   return 0;
+ }
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0001-change-stop-condition-to-avoid-infinite-loops.patch b/SOURCES/0001-change-stop-condition-to-avoid-infinite-loops.patch
deleted file mode 100644
index 7542b5c..0000000
--- a/SOURCES/0001-change-stop-condition-to-avoid-infinite-loops.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From d99d2f84166b0f60673d5c0714605a153946c0fc Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 21 Jan 2014 10:49:39 -0200
-Subject: [PATCH] change stop condition to avoid infinite loops
-
-In net/net.c there is a while (1) that only exits if there is a stop
-condition and more then 10 packages or if there is no package received.
-
-If GRUB is idle and enter in this loop, the only condition to leave is
-if it doesn't have incoming packages. In a network with heavy traffic
-this never happens.
----
- ChangeLog           | 12 ++++++++++++
- grub-core/net/net.c |  2 +-
- 2 files changed, 13 insertions(+), 1 deletion(-)
-
-diff --git a/grub-core/net/net.c b/grub-core/net/net.c
-index 0e57e93..56355f3 100644
---- a/grub-core/net/net.c
-+++ b/grub-core/net/net.c
-@@ -1453,7 +1453,7 @@ receive_packets (struct grub_net_card *card, int *stop_condition)
- 	}
-       card->opened = 1;
-     }
--  while (1)
-+  while (received < 100)
-     {
-       /* Maybe should be better have a fixed number of packets for each card
- 	 and just mark them as used and not used.  */ 
--- 
-1.8.5.3
-
diff --git a/SOURCES/0001-fix-EFI-detection-on-Windows.patch b/SOURCES/0001-fix-EFI-detection-on-Windows.patch
new file mode 100644
index 0000000..0a6daba
--- /dev/null
+++ b/SOURCES/0001-fix-EFI-detection-on-Windows.patch
@@ -0,0 +1,43 @@
+From a6e7719bbe05993613a8de69dba14fa092144925 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Wed, 25 Dec 2013 22:36:28 +0400
+Subject: [PATCH 001/143] fix EFI detection on Windows
+
+We are on legacy BIOS if GetFirmwareEnvironmentVariable fails (returns
+zero) *and* extended error information is ERROR_INVALID_FUNCTION.
+
+Cf. http://msdn.microsoft.com/en-us/library/windows/desktop/ms724325%28v=vs.85%29.aspx
+---
+ ChangeLog                          | 5 +++++
+ grub-core/osdep/windows/platform.c | 2 +-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 41bcebf..21ec1c7 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2013-12-25  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* grub-core/osdep/windows/platform.c (get_platform): Fix EFI
++	detection.
++
+ 2013-12-24  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* configure.ac: Set version to 2.02~beta2.
+diff --git a/grub-core/osdep/windows/platform.c b/grub-core/osdep/windows/platform.c
+index f2b9d71..d217efe 100644
+--- a/grub-core/osdep/windows/platform.c
++++ b/grub-core/osdep/windows/platform.c
+@@ -100,7 +100,7 @@ get_platform (void)
+ 
+   if (!func_GetFirmwareEnvironmentVariableW (L"BootOrder", GRUB_EFI_GLOBAL_VARIABLE_GUID_WINDOWS_STR,
+ 					     buffer, sizeof (buffer))
+-      && GetLastError () != ERROR_INVALID_FUNCTION)
++      && GetLastError () == ERROR_INVALID_FUNCTION)
+     {
+       platform = PLAT_BIOS;
+       return;
+-- 
+1.9.3
+
diff --git a/SOURCES/0001-increase-network-try-interval-gradually.patch b/SOURCES/0001-increase-network-try-interval-gradually.patch
deleted file mode 100644
index 93f66ab..0000000
--- a/SOURCES/0001-increase-network-try-interval-gradually.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 6f65e36cc4f92fe40672181eccf12eac4afb6738 Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 21 Jan 2014 11:03:51 -0200
-Subject: [PATCH] increase network try interval gradually
-
-* grub-core/net/arp.c (grub_net_arp_send_request): Increase network try
-interval gradually.
-* grub-core/net/icmp6.c (grub_net_icmp6_send_request): Likewise.
-* grub-core/net/net.c (grub_net_fs_read_real): Likewise.
-* grub-core/net/tftp.c (tftp_open): Likewise.
-* include/grub/net.h (GRUB_NET_INTERVAL_ADDITION): New define.
----
- ChangeLog             | 9 +++++++++
- grub-core/net/arp.c   | 3 ++-
- grub-core/net/icmp6.c | 3 ++-
- grub-core/net/net.c   | 5 +++--
- grub-core/net/tftp.c  | 3 ++-
- include/grub/net.h    | 1 +
- 6 files changed, 19 insertions(+), 5 deletions(-)
-
-diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
-index e92c7e7..d62d0cc 100644
---- a/grub-core/net/arp.c
-+++ b/grub-core/net/arp.c
-@@ -110,7 +110,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
- 	return GRUB_ERR_NONE;
-       pending_req = proto_addr->ipv4;
-       have_pending = 0;
--      grub_net_poll_cards (GRUB_NET_INTERVAL, &have_pending);
-+      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
-+                           &have_pending);
-       if (grub_net_link_layer_resolve_check (inf, proto_addr))
- 	return GRUB_ERR_NONE;
-       nb.data = nbd;
-diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c
-index 2741e6f..bbc9020 100644
---- a/grub-core/net/icmp6.c
-+++ b/grub-core/net/icmp6.c
-@@ -518,7 +518,8 @@ grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf,
-     {
-       if (grub_net_link_layer_resolve_check (inf, proto_addr))
- 	break;
--      grub_net_poll_cards (GRUB_NET_INTERVAL, 0);
-+      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
-+                           0);
-       if (grub_net_link_layer_resolve_check (inf, proto_addr))
- 	break;
-       nb->data = nbd;
-diff --git a/grub-core/net/net.c b/grub-core/net/net.c
-index 56355f3..1521d8d 100644
---- a/grub-core/net/net.c
-+++ b/grub-core/net/net.c
-@@ -1558,8 +1558,9 @@ grub_net_fs_read_real (grub_file_t file, char *buf, grub_size_t len)
-       if (!net->eof)
- 	{
- 	  try++;
--	  grub_net_poll_cards (GRUB_NET_INTERVAL, &net->stall);
--	}
-+	  grub_net_poll_cards (GRUB_NET_INTERVAL +
-+                               (try * GRUB_NET_INTERVAL_ADDITION), &net->stall);
-+        }
-       else
- 	return total;
-     }
-diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
-index 9c489f1..5173614 100644
---- a/grub-core/net/tftp.c
-+++ b/grub-core/net/tftp.c
-@@ -398,7 +398,8 @@ tftp_open (struct grub_file *file, const char *filename)
- 	  destroy_pq (data);
- 	  return err;
- 	}
--      grub_net_poll_cards (GRUB_NET_INTERVAL, &data->have_oack);
-+      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
-+                           &data->have_oack);
-       if (data->have_oack)
- 	break;
-     }
-diff --git a/include/grub/net.h b/include/grub/net.h
-index de6259e..0e0a605 100644
---- a/include/grub/net.h
-+++ b/include/grub/net.h
-@@ -534,6 +534,7 @@ extern char *grub_net_default_server;
- 
- #define GRUB_NET_TRIES 40
- #define GRUB_NET_INTERVAL 400
-+#define GRUB_NET_INTERVAL_ADDITION 20
- 
- #define VLANTAG_IDENTIFIER 0x8100
- 
--- 
-1.8.5.3
-
diff --git a/SOURCES/0001-trim-arp-packets-with-abnormal-size.patch b/SOURCES/0001-trim-arp-packets-with-abnormal-size.patch
deleted file mode 100644
index 1f7cf87..0000000
--- a/SOURCES/0001-trim-arp-packets-with-abnormal-size.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 966de06476d17e525b843d3af679835b8a4b346a Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Wed, 5 Feb 2014 09:42:42 -0200
-Subject: [PATCH] trim arp packets with abnormal size
-
-GRUB uses arp request to create the arp response. If the incoming packet
-is foobared, GRUB needs to trim the arp response packet before sending it.
----
- grub-core/net/arp.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
-index d62d0cc..77581f4 100644
---- a/grub-core/net/arp.c
-+++ b/grub-core/net/arp.c
-@@ -162,6 +162,12 @@ grub_net_arp_receive (struct grub_net_buff *nb,
-     if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
- 	&& grub_be_to_cpu16 (arp_header->op) == ARP_REQUEST)
-       {
-+        if ((nb->tail - nb->data) > 50)
-+          {
-+            grub_dprintf ("net", "arp packet with abnormal size (%ld bytes).\n",
-+                         nb->tail - nb->data);
-+            nb->tail = nb->data + 50;
-+          }
- 	grub_net_link_level_address_t target;
- 	/* We've already checked that pln is either 4 or 16.  */
- 	char tmp[16];
--- 
-1.8.1.4
diff --git a/SOURCES/0002-Add-fw_path-variable-revised.patch b/SOURCES/0002-Add-fw_path-variable-revised.patch
deleted file mode 100644
index ec6c296..0000000
--- a/SOURCES/0002-Add-fw_path-variable-revised.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From 6759845abe79871a4241041915b56f617679e0b5 Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Wed, 19 Sep 2012 21:22:55 -0300
-Subject: [PATCH 02/34] Add fw_path variable (revised)
-
-This patch makes grub look for its config file on efi where the app was
-found. It was originally written by Matthew Garrett, and adapted to fix the
-"No modules are loaded on grub2 network boot" issue:
-
-https://bugzilla.redhat.com/show_bug.cgi?id=857936
----
- grub-core/kern/main.c   | 13 ++++++-------
- grub-core/normal/main.c | 25 ++++++++++++++++++++++++-
- 2 files changed, 30 insertions(+), 8 deletions(-)
-
-diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
-index 9cad0c4..8ab7794 100644
---- a/grub-core/kern/main.c
-+++ b/grub-core/kern/main.c
-@@ -127,16 +127,15 @@ grub_set_prefix_and_root (void)
- 
-   grub_machine_get_bootlocation (&fwdevice, &fwpath);
- 
--  if (fwdevice)
-+  if (fwdevice && fwpath)
-     {
--      char *cmdpath;
-+      char *fw_path;
- 
--      cmdpath = grub_xasprintf ("(%s)%s", fwdevice, fwpath ? : "");
--      if (cmdpath)
-+      fw_path = grub_xasprintf ("(%s)/%s", fwdevice, fwpath);
-+      if (fw_path)
- 	{
--	  grub_env_set ("cmdpath", cmdpath);
--	  grub_env_export ("cmdpath");
--	  grub_free (cmdpath);
-+	  grub_env_set ("fw_path", fw_path);
-+	  grub_free (fw_path);
- 	}
-     }
- 
-diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
-index c36663f..243b9d6 100644
---- a/grub-core/normal/main.c
-+++ b/grub-core/normal/main.c
-@@ -311,7 +311,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
-       /* Guess the config filename. It is necessary to make CONFIG static,
- 	 so that it won't get broken by longjmp.  */
-       char *config;
--      const char *prefix;
-+      const char *prefix, *fw_path;
-+
-+      fw_path = grub_env_get ("fw_path");
-+      if (fw_path)
-+	{
-+	  config = grub_xasprintf ("%s/grub.cfg", fw_path);
-+	  if (config)
-+	    {
-+	      grub_file_t file;
-+
-+	      file = grub_file_open (config);
-+	      if (file)
-+		{
-+		  grub_file_close (file);
-+		  grub_enter_normal_mode (config);
-+		}
-+              else
-+                {
-+                  /*  Ignore all errors.  */
-+                  grub_errno = 0;
-+                }
-+	      grub_free (config);
-+	    }
-+	}
- 
-       prefix = grub_env_get ("prefix");
-       if (prefix)
--- 
-1.8.4.2
-
diff --git a/SOURCES/0002-Load-arm-with-SB-enabled.patch b/SOURCES/0002-Load-arm-with-SB-enabled.patch
new file mode 100644
index 0000000..e77569f
--- /dev/null
+++ b/SOURCES/0002-Load-arm-with-SB-enabled.patch
@@ -0,0 +1,436 @@
+From e396fd48c78901459f39926fe28c9fbc38ffdddb Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Thu, 18 Sep 2014 11:26:14 -0400
+Subject: [PATCH] Load arm with SB enabled.
+
+Make sure we actually try to validate secure boot on this platform (even
+though we're not shipping it enabled by default.)
+
+This means giving the kernel grub's loaded image as the vehicle for the
+kernel command line, because we can't call systab->bs->LoadImage() if SB
+is enabled.
+---
+ grub-core/Makefile.core.def       |   2 +
+ grub-core/loader/arm64/linux.c    | 108 ++++++++++++++++++++------------------
+ grub-core/loader/efi/linux.c      |  65 +++++++++++++++++++++++
+ grub-core/loader/i386/efi/linux.c |  39 ++------------
+ include/grub/arm64/linux.h        |   8 +++
+ include/grub/efi/linux.h          |  31 +++++++++++
+ 6 files changed, 166 insertions(+), 87 deletions(-)
+ create mode 100644 grub-core/loader/efi/linux.c
+ create mode 100644 include/grub/efi/linux.h
+
+diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
+index 9ff9ae5..9378c73 100644
+--- a/grub-core/Makefile.core.def
++++ b/grub-core/Makefile.core.def
+@@ -1682,6 +1682,7 @@ module = {
+   ia64_efi = loader/ia64/efi/linux.c;
+   arm = loader/arm/linux.c;
+   arm64 = loader/arm64/linux.c;
++  arm64 = loader/efi/linux.c;
+   fdt = lib/fdt.c;
+   common = loader/linux.c;
+   common = lib/cmdline.c;
+@@ -1718,6 +1719,7 @@ module = {
+   name = linuxefi;
+   efi = loader/i386/efi/linux.c;
+   efi = lib/cmdline.c;
++  efi = loader/efi/linux.c;
+   enable = i386_efi;
+   enable = x86_64_efi;
+ };
+diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
+index 0dc144e..bdd9c9b 100644
+--- a/grub-core/loader/arm64/linux.c
++++ b/grub-core/loader/arm64/linux.c
+@@ -27,6 +27,7 @@
+ #include <grub/types.h>
+ #include <grub/cpu/linux.h>
+ #include <grub/efi/efi.h>
++#include <grub/efi/linux.h>
+ #include <grub/efi/pe32.h>
+ #include <grub/i18n.h>
+ #include <grub/lib/cmdline.h>
+@@ -44,6 +45,7 @@ static int loaded;
+ 
+ static void *kernel_addr;
+ static grub_uint64_t kernel_size;
++static grub_uint32_t handover_offset;
+ 
+ static char *linux_args;
+ static grub_uint32_t cmdline_size;
+@@ -135,7 +137,9 @@ finalize_params (void)
+ {
+   grub_efi_boot_services_t *b;
+   grub_efi_status_t status;
++  grub_efi_loaded_image_t *loaded_image = NULL;
+   int node, retval;
++  int len;
+ 
+   get_fdt ();
+   if (!fdt)
+@@ -172,6 +176,23 @@ finalize_params (void)
+   grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n",
+ 		fdt);
+ 
++  /* Convert command line to UCS-2 */
++  loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle);
++  if (!loaded_image)
++    goto failure;
++
++  loaded_image->load_options_size = len =
++    (grub_strlen (linux_args) + 1) * sizeof (grub_efi_char16_t);
++  loaded_image->load_options =
++    grub_efi_allocate_pages (0,
++			     BYTES_TO_PAGES (loaded_image->load_options_size));
++  if (!loaded_image->load_options)
++    return grub_error(GRUB_ERR_BAD_OS, "failed to create kernel parameters");
++
++  loaded_image->load_options_size =
++    2 * grub_utf8_to_utf16 (loaded_image->load_options, len,
++			    (grub_uint8_t *) linux_args, len, NULL);
++
+   return GRUB_ERR_NONE;
+ 
+ failure:
+@@ -181,6 +202,23 @@ failure:
+   return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
+ }
+ 
++static void
++free_params (void)
++{
++  grub_efi_loaded_image_t *loaded_image = NULL;
++
++  loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle);
++  if (loaded_image)
++    {
++      if (loaded_image->load_options)
++	grub_efi_free_pages ((grub_efi_physical_address_t)
++			      loaded_image->load_options,
++			     BYTES_TO_PAGES (loaded_image->load_options_size));
++      loaded_image->load_options = NULL;
++      loaded_image->load_options_size = 0;
++    }
++}
++
+ static grub_err_t
+ grub_cmd_devicetree (grub_command_t cmd __attribute__ ((unused)),
+ 		     int argc, char *argv[])
+@@ -199,6 +237,10 @@ grub_cmd_devicetree (grub_command_t cmd __attribute__ ((unused)),
+   if (argc != 1)
+     return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
+ 
++  if (grub_efi_secure_boot ())
++    return grub_error (GRUB_ERR_INVALID_COMMAND,
++		       N_("Not loading devicetree - Secure Boot is enabled"));
++
+   if (loaded_fdt)
+     grub_free (loaded_fdt);
+   loaded_fdt = NULL;
+@@ -243,65 +285,20 @@ out:
+ static grub_err_t
+ grub_linux_boot (void)
+ {
+-  grub_efi_memory_mapped_device_path_t *mempath;
+-  grub_efi_handle_t image_handle;
+-  grub_efi_boot_services_t *b;
+-  grub_efi_status_t status;
+   grub_err_t retval;
+-  grub_efi_loaded_image_t *loaded_image;
+-  int len;
+ 
+   retval = finalize_params();
+   if (retval != GRUB_ERR_NONE)
+     return retval;
+ 
+-  mempath = grub_malloc (2 * sizeof (grub_efi_memory_mapped_device_path_t));
+-  if (!mempath)
+-    return grub_errno;
+-
+-  mempath[0].header.type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE;
+-  mempath[0].header.subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE;
+-  mempath[0].header.length = grub_cpu_to_le16_compile_time (sizeof (*mempath));
+-  mempath[0].memory_type = GRUB_EFI_LOADER_DATA;
+-  mempath[0].start_address = (grub_addr_t) kernel_addr;
+-  mempath[0].end_address = (grub_addr_t) kernel_addr + kernel_size;
+-
+-  mempath[1].header.type = GRUB_EFI_END_DEVICE_PATH_TYPE;
+-  mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
+-  mempath[1].header.length = sizeof (grub_efi_device_path_t);
+-
+-  b = grub_efi_system_table->boot_services;
+-  status = b->load_image (0, grub_efi_image_handle,
+-			  (grub_efi_device_path_t *) mempath,
+-                          kernel_addr, kernel_size, &image_handle);
+-  if (status != GRUB_EFI_SUCCESS)
+-    return grub_error (GRUB_ERR_BAD_OS, "cannot load image");
+-
+   grub_dprintf ("linux", "linux command line: '%s'\n", linux_args);
+ 
+-  /* Convert command line to UCS-2 */
+-  loaded_image = grub_efi_get_loaded_image (image_handle);
+-  loaded_image->load_options_size = len =
+-    (grub_strlen (linux_args) + 1) * sizeof (grub_efi_char16_t);
+-  loaded_image->load_options =
+-    grub_efi_allocate_pages (0,
+-			     BYTES_TO_PAGES (loaded_image->load_options_size));
+-  if (!loaded_image->load_options)
+-    return grub_errno;
++  retval = grub_efi_linux_boot ((char *)kernel_addr, handover_offset,
++				kernel_addr);
+ 
+-  loaded_image->load_options_size =
+-    2 * grub_utf8_to_utf16 (loaded_image->load_options, len,
+-			    (grub_uint8_t *) linux_args, len, NULL);
+-
+-  grub_dprintf("linux", "starting image %p\n", image_handle);
+-  status = b->start_image (image_handle, 0, NULL);
+-
+-  /* When successful, not reached */
+-  b->unload_image (image_handle);
+-  grub_efi_free_pages ((grub_efi_physical_address_t) loaded_image->load_options,
+-		       BYTES_TO_PAGES (loaded_image->load_options_size));
+-
+-  return grub_errno;
++  /* Never reached... */
++  free_params();
++  return retval;
+ }
+ 
+ static grub_err_t
+@@ -382,6 +379,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
+ {
+   grub_file_t file = 0;
+   struct grub_arm64_linux_kernel_header lh;
++  struct grub_arm64_linux_pe_header *pe;
+ 
+   grub_dl_ref (my_mod);
+ 
+@@ -426,6 +424,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
+ 
+   grub_dprintf ("linux", "kernel @ %p\n", kernel_addr);
+ 
++  if (!grub_linuxefi_secure_validate (kernel_addr, kernel_size))
++    {
++      grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]);
++      goto fail;
++    }
++
++  pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset);
++  handover_offset = pe->opt.entry_addr;
++
+   cmdline_size = grub_loader_cmdline_size (argc, argv) + sizeof (LINUX_IMAGE);
+   linux_args = grub_malloc (cmdline_size);
+   if (!linux_args)
+@@ -464,7 +471,6 @@ fail:
+   return grub_errno;
+ }
+ 
+-
+ static grub_command_t cmd_linux, cmd_initrd, cmd_devicetree;
+ 
+ GRUB_MOD_INIT (linux)
+diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
+new file mode 100644
+index 0000000..aea378a
+--- /dev/null
++++ b/grub-core/loader/efi/linux.c
+@@ -0,0 +1,65 @@
++/*
++ *  GRUB  --  GRand Unified Bootloader
++ *  Copyright (C) 2014 Free Software Foundation, Inc.
++ *
++ *  GRUB is free software: you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation, either version 3 of the License, or
++ *  (at your option) any later version.
++ *
++ *  GRUB is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include <grub/err.h>
++#include <grub/mm.h>
++#include <grub/types.h>
++#include <grub/cpu/linux.h>
++#include <grub/efi/efi.h>
++#include <grub/efi/pe32.h>
++#include <grub/efi/linux.h>
++
++#define SHIM_LOCK_GUID \
++ { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
++
++struct grub_efi_shim_lock
++{
++  grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size);
++};
++typedef struct grub_efi_shim_lock grub_efi_shim_lock_t;
++
++grub_efi_boolean_t
++grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
++{
++  grub_efi_guid_t guid = SHIM_LOCK_GUID;
++  grub_efi_shim_lock_t *shim_lock;
++
++  shim_lock = grub_efi_locate_protocol(&guid, NULL);
++
++  if (!shim_lock)
++    return 1;
++
++  if (shim_lock->verify(data, size) == GRUB_EFI_SUCCESS)
++    return 1;
++
++  return 0;
++}
++
++typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *);
++
++grub_err_t
++grub_efi_linux_boot (void *kernel_addr, grub_off_t offset,
++		     void *kernel_params)
++{
++  handover_func hf;
++
++  hf = (handover_func)((char *)kernel_addr + offset);
++  hf (grub_efi_image_handle, grub_efi_system_table, kernel_params);
++
++  return GRUB_ERR_BUG;
++}
+diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
+index b79e632..e5b7785 100644
+--- a/grub-core/loader/i386/efi/linux.c
++++ b/grub-core/loader/i386/efi/linux.c
+@@ -26,6 +26,7 @@
+ #include <grub/i18n.h>
+ #include <grub/lib/cmdline.h>
+ #include <grub/efi/efi.h>
++#include <grub/efi/linux.h>
+ 
+ GRUB_MOD_LICENSE ("GPLv3+");
+ 
+@@ -40,52 +41,18 @@ static char *linux_cmdline;
+ 
+ #define BYTES_TO_PAGES(bytes)   (((bytes) + 0xfff) >> 12)
+ 
+-#define SHIM_LOCK_GUID \
+-  { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
+-
+-struct grub_efi_shim_lock
+-{
+-  grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size);
+-};
+-typedef struct grub_efi_shim_lock grub_efi_shim_lock_t;
+-
+-static grub_efi_boolean_t
+-grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
+-{
+-  grub_efi_guid_t guid = SHIM_LOCK_GUID;
+-  grub_efi_shim_lock_t *shim_lock;
+-
+-  shim_lock = grub_efi_locate_protocol(&guid, NULL);
+-
+-  if (!shim_lock)
+-    return 1;
+-
+-  if (shim_lock->verify(data, size) == GRUB_EFI_SUCCESS)
+-    return 1;
+-
+-  return 0;
+-}
+-
+-typedef void(*handover_func)(void *, grub_efi_system_table_t *, struct linux_kernel_params *);
+-
+ static grub_err_t
+ grub_linuxefi_boot (void)
+ {
+-  handover_func hf;
+   int offset = 0;
+ 
+ #ifdef __x86_64__
+   offset = 512;
+ #endif
+-
+-  hf = (handover_func)((char *)kernel_mem + handover_offset + offset);
+-
+   asm volatile ("cli");
+ 
+-  hf (grub_efi_image_handle, grub_efi_system_table, params);
+-
+-  /* Not reached */
+-  return GRUB_ERR_NONE;
++  return grub_efi_linux_boot ((char *)kernel_mem, handover_offset + offset,
++			      params);
+ }
+ 
+ static grub_err_t
+diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h
+index 864e5dc..2cbd64f 100644
+--- a/include/grub/arm64/linux.h
++++ b/include/grub/arm64/linux.h
+@@ -20,6 +20,7 @@
+ #define GRUB_LINUX_CPU_HEADER 1
+ 
+ #include <grub/efi/efi.h>
++#include <grub/efi/pe32.h>
+ 
+ #define GRUB_ARM64_LINUX_MAGIC 0x644d5241 /* 'ARM\x64' */
+ 
+@@ -38,4 +39,11 @@ struct grub_arm64_linux_kernel_header
+   grub_uint32_t hdr_offset;	/* Offset of PE/COFF header */
+ };
+ 
++struct grub_arm64_linux_pe_header
++{
++  grub_uint32_t magic;
++  struct grub_pe32_coff_header coff;
++  struct grub_pe64_optional_header opt;
++};
++
+ #endif /* ! GRUB_LINUX_CPU_HEADER */
+diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h
+new file mode 100644
+index 0000000..d9ede36
+--- /dev/null
++++ b/include/grub/efi/linux.h
+@@ -0,0 +1,31 @@
++/*
++ *  GRUB  --  GRand Unified Bootloader
++ *  Copyright (C) 2014  Free Software Foundation, Inc.
++ *
++ *  GRUB is free software: you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation, either version 3 of the License, or
++ *  (at your option) any later version.
++ *
++ *  GRUB is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
++ */
++#ifndef GRUB_EFI_LINUX_HEADER
++#define GRUB_EFI_LINUX_HEADER	1
++
++#include <grub/efi/api.h>
++#include <grub/err.h>
++#include <grub/symbol.h>
++
++grub_efi_boolean_t
++EXPORT_FUNC(grub_linuxefi_secure_validate) (void *data, grub_uint32_t size);
++grub_err_t
++EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset,
++				  void *kernel_param);
++
++#endif /* ! GRUB_EFI_LINUX_HEADER */
+-- 
+1.9.3
+
diff --git a/SOURCES/0002-grub-core-kern-arm-cache_armv6.S-Remove-.arch-direct.patch b/SOURCES/0002-grub-core-kern-arm-cache_armv6.S-Remove-.arch-direct.patch
new file mode 100644
index 0000000..f1371c2
--- /dev/null
+++ b/SOURCES/0002-grub-core-kern-arm-cache_armv6.S-Remove-.arch-direct.patch
@@ -0,0 +1,43 @@
+From 5bda44d7f98c36f87144869ec58b518f80a69b56 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Wed, 25 Dec 2013 23:31:42 +0100
+Subject: [PATCH 002/143] 	* grub-core/kern/arm/cache_armv6.S: Remove
+ .arch directive.
+
+	As these functions are used on pre-ARMv6 CPUs as well we don't want
+	to make assembler assume that architecture is higher than default one.
+---
+ ChangeLog                        | 7 +++++++
+ grub-core/kern/arm/cache_armv6.S | 1 -
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 21ec1c7..153bc43 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,10 @@
++2013-12-25  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/kern/arm/cache_armv6.S: Remove .arch directive.
++
++	As these functions are used on pre-ARMv6 CPUs as well we don't want
++	to make assembler assume that architecture is higher than default one.
++
+ 2013-12-25  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* grub-core/osdep/windows/platform.c (get_platform): Fix EFI
+diff --git a/grub-core/kern/arm/cache_armv6.S b/grub-core/kern/arm/cache_armv6.S
+index 39da1df..dfaded0 100644
+--- a/grub-core/kern/arm/cache_armv6.S
++++ b/grub-core/kern/arm/cache_armv6.S
+@@ -22,7 +22,6 @@
+ 	.text
+ 	.syntax	unified
+ 	.arm
+-	.arch	armv6
+ 
+ # define DMB	mcr	p15, 0, r0, c7, c10, 5
+ # define DSB	mcr	p15, 0, r0, c7, c10, 4
+-- 
+1.9.3
+
diff --git a/SOURCES/0003-Add-support-for-linuxefi.patch b/SOURCES/0003-Add-support-for-linuxefi.patch
deleted file mode 100644
index 64dbace..0000000
--- a/SOURCES/0003-Add-support-for-linuxefi.patch
+++ /dev/null
@@ -1,482 +0,0 @@
-From c17e307b40695b73fd972a6a4526424e9a591310 Mon Sep 17 00:00:00 2001
-From: Matthew Garrett <mjg@redhat.com>
-Date: Tue, 10 Jul 2012 11:58:52 -0400
-Subject: [PATCH 03/34] Add support for linuxefi
-
----
- grub-core/Makefile.core.def       |   8 +
- grub-core/kern/efi/mm.c           |  32 ++++
- grub-core/loader/i386/efi/linux.c | 371 ++++++++++++++++++++++++++++++++++++++
- include/grub/efi/efi.h            |   3 +
- include/grub/i386/linux.h         |   1 +
- 5 files changed, 415 insertions(+)
- create mode 100644 grub-core/loader/i386/efi/linux.c
-
-diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
-index c916246..8c246c6 100644
---- a/grub-core/Makefile.core.def
-+++ b/grub-core/Makefile.core.def
-@@ -1706,6 +1706,14 @@ module = {
- };
- 
- module = {
-+  name = linuxefi;
-+  efi = loader/i386/efi/linux.c;
-+  efi = lib/cmdline.c;
-+  enable = i386_efi;
-+  enable = x86_64_efi;
-+};
-+
-+module = {
-   name = chain;
-   efi = loader/efi/chainloader.c;
-   i386_pc = loader/i386/pc/chainloader.c;
-diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
-index be37afd..ddeca60 100644
---- a/grub-core/kern/efi/mm.c
-+++ b/grub-core/kern/efi/mm.c
-@@ -49,6 +49,38 @@ static grub_efi_uintn_t finish_desc_size;
- static grub_efi_uint32_t finish_desc_version;
- int grub_efi_is_finished = 0;
- 
-+/* Allocate pages below a specified address */
-+void *
-+grub_efi_allocate_pages_max (grub_efi_physical_address_t max,
-+			     grub_efi_uintn_t pages)
-+{
-+  grub_efi_status_t status;
-+  grub_efi_boot_services_t *b;
-+  grub_efi_physical_address_t address = max;
-+
-+  if (max > 0xffffffff)
-+    return 0;
-+
-+  b = grub_efi_system_table->boot_services;
-+  status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
-+
-+  if (status != GRUB_EFI_SUCCESS)
-+    return 0;
-+
-+  if (address == 0)
-+    {
-+      /* Uggh, the address 0 was allocated... This is too annoying,
-+	 so reallocate another one.  */
-+      address = max;
-+      status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
-+      grub_efi_free_pages (0, pages);
-+      if (status != GRUB_EFI_SUCCESS)
-+	return 0;
-+    }
-+
-+  return (void *) ((grub_addr_t) address);
-+}
-+
- /* Allocate pages. Return the pointer to the first of allocated pages.  */
- void *
- grub_efi_allocate_pages (grub_efi_physical_address_t address,
-diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
-new file mode 100644
-index 0000000..b79e632
---- /dev/null
-+++ b/grub-core/loader/i386/efi/linux.c
-@@ -0,0 +1,371 @@
-+/*
-+ *  GRUB  --  GRand Unified Bootloader
-+ *  Copyright (C) 2012  Free Software Foundation, Inc.
-+ *
-+ *  GRUB is free software: you can redistribute it and/or modify
-+ *  it under the terms of the GNU General Public License as published by
-+ *  the Free Software Foundation, either version 3 of the License, or
-+ *  (at your option) any later version.
-+ *
-+ *  GRUB is distributed in the hope that it will be useful,
-+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *  GNU General Public License for more details.
-+ *
-+ *  You should have received a copy of the GNU General Public License
-+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
-+ */
-+
-+#include <grub/loader.h>
-+#include <grub/file.h>
-+#include <grub/err.h>
-+#include <grub/types.h>
-+#include <grub/mm.h>
-+#include <grub/cpu/linux.h>
-+#include <grub/command.h>
-+#include <grub/i18n.h>
-+#include <grub/lib/cmdline.h>
-+#include <grub/efi/efi.h>
-+
-+GRUB_MOD_LICENSE ("GPLv3+");
-+
-+static grub_dl_t my_mod;
-+static int loaded;
-+static void *kernel_mem;
-+static grub_uint64_t kernel_size;
-+static grub_uint8_t *initrd_mem;
-+static grub_uint32_t handover_offset;
-+struct linux_kernel_params *params;
-+static char *linux_cmdline;
-+
-+#define BYTES_TO_PAGES(bytes)   (((bytes) + 0xfff) >> 12)
-+
-+#define SHIM_LOCK_GUID \
-+  { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
-+
-+struct grub_efi_shim_lock
-+{
-+  grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size);
-+};
-+typedef struct grub_efi_shim_lock grub_efi_shim_lock_t;
-+
-+static grub_efi_boolean_t
-+grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
-+{
-+  grub_efi_guid_t guid = SHIM_LOCK_GUID;
-+  grub_efi_shim_lock_t *shim_lock;
-+
-+  shim_lock = grub_efi_locate_protocol(&guid, NULL);
-+
-+  if (!shim_lock)
-+    return 1;
-+
-+  if (shim_lock->verify(data, size) == GRUB_EFI_SUCCESS)
-+    return 1;
-+
-+  return 0;
-+}
-+
-+typedef void(*handover_func)(void *, grub_efi_system_table_t *, struct linux_kernel_params *);
-+
-+static grub_err_t
-+grub_linuxefi_boot (void)
-+{
-+  handover_func hf;
-+  int offset = 0;
-+
-+#ifdef __x86_64__
-+  offset = 512;
-+#endif
-+
-+  hf = (handover_func)((char *)kernel_mem + handover_offset + offset);
-+
-+  asm volatile ("cli");
-+
-+  hf (grub_efi_image_handle, grub_efi_system_table, params);
-+
-+  /* Not reached */
-+  return GRUB_ERR_NONE;
-+}
-+
-+static grub_err_t
-+grub_linuxefi_unload (void)
-+{
-+  grub_dl_unref (my_mod);
-+  loaded = 0;
-+  if (initrd_mem)
-+    grub_efi_free_pages((grub_efi_physical_address_t)initrd_mem, BYTES_TO_PAGES(params->ramdisk_size));
-+  if (linux_cmdline)
-+    grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(params->cmdline_size + 1));
-+  if (kernel_mem)
-+    grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size));
-+  if (params)
-+    grub_efi_free_pages((grub_efi_physical_address_t)params, BYTES_TO_PAGES(16384));
-+  return GRUB_ERR_NONE;
-+}
-+
-+static grub_err_t
-+grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
-+                 int argc, char *argv[])
-+{
-+  grub_file_t *files = 0;
-+  int i, nfiles = 0;
-+  grub_size_t size = 0;
-+  grub_uint8_t *ptr;
-+
-+  if (argc == 0)
-+    {
-+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
-+      goto fail;
-+    }
-+
-+  if (!loaded)
-+    {
-+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
-+      goto fail;
-+    }
-+
-+  files = grub_zalloc (argc * sizeof (files[0]));
-+  if (!files)
-+    goto fail;
-+
-+  for (i = 0; i < argc; i++)
-+    {
-+      grub_file_filter_disable_compression ();
-+      files[i] = grub_file_open (argv[i]);
-+      if (! files[i])
-+        goto fail;
-+      nfiles++;
-+      size += ALIGN_UP (grub_file_size (files[i]), 4);
-+    }
-+
-+  initrd_mem = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(size));
-+
-+  if (!initrd_mem)
-+    {
-+      grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate initrd"));
-+      goto fail;
-+    }
-+
-+  params->ramdisk_size = size;
-+  params->ramdisk_image = (grub_uint32_t)(grub_uint64_t) initrd_mem;
-+
-+  ptr = initrd_mem;
-+
-+  for (i = 0; i < nfiles; i++)
-+    {
-+      grub_ssize_t cursize = grub_file_size (files[i]);
-+      if (grub_file_read (files[i], ptr, cursize) != cursize)
-+        {
-+          if (!grub_errno)
-+            grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
-+                        argv[i]);
-+          goto fail;
-+        }
-+      ptr += cursize;
-+      grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
-+      ptr += ALIGN_UP_OVERHEAD (cursize, 4);
-+    }
-+
-+  params->ramdisk_size = size;
-+
-+ fail:
-+  for (i = 0; i < nfiles; i++)
-+    grub_file_close (files[i]);
-+  grub_free (files);
-+
-+  if (initrd_mem && grub_errno)
-+    grub_efi_free_pages((grub_efi_physical_address_t)initrd_mem, BYTES_TO_PAGES(size));
-+
-+  return grub_errno;
-+}
-+
-+static grub_err_t
-+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
-+		int argc, char *argv[])
-+{
-+  grub_file_t file = 0;
-+  struct linux_kernel_header lh;
-+  grub_ssize_t len, start, filelen;
-+  void *kernel;
-+
-+  grub_dl_ref (my_mod);
-+
-+  if (argc == 0)
-+    {
-+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
-+      goto fail;
-+    }
-+
-+  file = grub_file_open (argv[0]);
-+  if (! file)
-+    goto fail;
-+
-+  filelen = grub_file_size (file);
-+
-+  kernel = grub_malloc(filelen);
-+
-+  if (!kernel)
-+    {
-+      grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel buffer"));
-+      goto fail;
-+    }
-+
-+  if (grub_file_read (file, kernel, filelen) != filelen)
-+    {
-+      grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), argv[0]);
-+      goto fail;
-+    }
-+
-+  if (! grub_linuxefi_secure_validate (kernel, filelen))
-+    {
-+      grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]);
-+      grub_free (kernel);
-+      goto fail;
-+    }
-+
-+  grub_file_seek (file, 0);
-+
-+  grub_free(kernel);
-+
-+  params = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(16384));
-+
-+  if (! params)
-+    {
-+      grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate kernel parameters");
-+      goto fail;
-+    }
-+
-+  memset (params, 0, 16384);
-+
-+  if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
-+    {
-+      if (!grub_errno)
-+	grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
-+		    argv[0]);
-+      goto fail;
-+    }
-+
-+  if (lh.boot_flag != grub_cpu_to_le16 (0xaa55))
-+    {
-+      grub_error (GRUB_ERR_BAD_OS, N_("invalid magic number"));
-+      goto fail;
-+    }
-+
-+  if (lh.setup_sects > GRUB_LINUX_MAX_SETUP_SECTS)
-+    {
-+      grub_error (GRUB_ERR_BAD_OS, N_("too many setup sectors"));
-+      goto fail;
-+    }
-+
-+  if (lh.version < grub_cpu_to_le16 (0x020b))
-+    {
-+      grub_error (GRUB_ERR_BAD_OS, N_("kernel too old"));
-+      goto fail;
-+    }
-+
-+  if (!lh.handover_offset)
-+    {
-+      grub_error (GRUB_ERR_BAD_OS, N_("kernel doesn't support EFI handover"));
-+      goto fail;
-+    }
-+
-+  linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff,
-+					 BYTES_TO_PAGES(lh.cmdline_size + 1));
-+
-+  if (!linux_cmdline)
-+    {
-+      grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate cmdline"));
-+      goto fail;
-+    }
-+
-+  grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
-+  grub_create_loader_cmdline (argc, argv,
-+                              linux_cmdline + sizeof (LINUX_IMAGE) - 1,
-+			      lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1));
-+
-+  lh.cmd_line_ptr = (grub_uint32_t)(grub_uint64_t)linux_cmdline;
-+
-+  handover_offset = lh.handover_offset;
-+
-+  start = (lh.setup_sects + 1) * 512;
-+  len = grub_file_size(file) - start;
-+
-+  kernel_mem = grub_efi_allocate_pages(lh.pref_address,
-+				       BYTES_TO_PAGES(lh.init_size));
-+
-+  if (!kernel_mem)
-+    kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
-+					     BYTES_TO_PAGES(lh.init_size));
-+
-+  if (!kernel_mem)
-+    {
-+      grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel"));
-+      goto fail;
-+    }
-+
-+  if (grub_file_seek (file, start) == (grub_off_t) -1)
-+    {
-+      grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
-+		  argv[0]);
-+      goto fail;
-+    }
-+
-+  if (grub_file_read (file, kernel_mem, len) != len && !grub_errno)
-+    {
-+      grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
-+		  argv[0]);
-+    }
-+
-+  if (grub_errno == GRUB_ERR_NONE)
-+    {
-+      grub_loader_set (grub_linuxefi_boot, grub_linuxefi_unload, 0);
-+      loaded = 1;
-+      lh.code32_start = (grub_uint32_t)(grub_uint64_t) kernel_mem;
-+    }
-+
-+  memcpy(params, &lh, 2 * 512);
-+
-+  params->type_of_loader = 0x21;
-+
-+ fail:
-+
-+  if (file)
-+    grub_file_close (file);
-+
-+  if (grub_errno != GRUB_ERR_NONE)
-+    {
-+      grub_dl_unref (my_mod);
-+      loaded = 0;
-+    }
-+
-+  if (linux_cmdline && !loaded)
-+    grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(lh.cmdline_size + 1));
-+
-+  if (kernel_mem && !loaded)
-+    grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size));
-+
-+  if (params && !loaded)
-+    grub_efi_free_pages((grub_efi_physical_address_t)params, BYTES_TO_PAGES(16384));
-+
-+  return grub_errno;
-+}
-+
-+static grub_command_t cmd_linux, cmd_initrd;
-+
-+GRUB_MOD_INIT(linuxefi)
-+{
-+  cmd_linux =
-+    grub_register_command ("linuxefi", grub_cmd_linux,
-+                           0, N_("Load Linux."));
-+  cmd_initrd =
-+    grub_register_command ("initrdefi", grub_cmd_initrd,
-+                           0, N_("Load initrd."));
-+  my_mod = mod;
-+}
-+
-+GRUB_MOD_FINI(linuxefi)
-+{
-+  grub_unregister_command (cmd_linux);
-+  grub_unregister_command (cmd_initrd);
-+}
-diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
-index 489cf9e..9370fd5 100644
---- a/include/grub/efi/efi.h
-+++ b/include/grub/efi/efi.h
-@@ -40,6 +40,9 @@ void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
- void *
- EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address,
- 				      grub_efi_uintn_t pages);
-+void *
-+EXPORT_FUNC(grub_efi_allocate_pages_max) (grub_efi_physical_address_t max,
-+					  grub_efi_uintn_t pages);
- void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
- 				       grub_efi_uintn_t pages);
- int
-diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h
-index da0ca3b..fc36bda 100644
---- a/include/grub/i386/linux.h
-+++ b/include/grub/i386/linux.h
-@@ -139,6 +139,7 @@ struct linux_kernel_header
-   grub_uint64_t setup_data;
-   grub_uint64_t pref_address;
-   grub_uint32_t init_size;
-+  grub_uint32_t handover_offset;
- } GRUB_PACKED;
- 
- /* Boot parameters for Linux based on 2.6.12. This is used by the setup
--- 
-1.8.4.2
-
diff --git a/SOURCES/0003-INSTALL-Cross-compiling-the-GRUB-Fix-some-spelling-m.patch b/SOURCES/0003-INSTALL-Cross-compiling-the-GRUB-Fix-some-spelling-m.patch
new file mode 100644
index 0000000..3e99253
--- /dev/null
+++ b/SOURCES/0003-INSTALL-Cross-compiling-the-GRUB-Fix-some-spelling-m.patch
@@ -0,0 +1,88 @@
+From 8ebe593c564edc8ae62086df8a1448e898ef259b Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Fri, 27 Dec 2013 03:03:32 +0000
+Subject: [PATCH 003/143] * INSTALL (Cross-compiling the GRUB): Fix some
+ spelling mistakes. * docs/grub.texi (Getting the source code): Likewise.
+
+---
+ ChangeLog          |  5 +++++
+ INSTALL            | 10 +++++-----
+ docs/grub-dev.texi |  8 ++++----
+ 3 files changed, 14 insertions(+), 9 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 153bc43..bbb0f31 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2013-12-27  Colin Watson  <cjwatson@ubuntu.com>
++
++	* INSTALL (Cross-compiling the GRUB): Fix some spelling mistakes.
++	* docs/grub.texi (Getting the source code): Likewise.
++
+ 2013-12-25  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/kern/arm/cache_armv6.S: Remove .arch directive.
+diff --git a/INSTALL b/INSTALL
+index afc957c..db12530 100644
+--- a/INSTALL
++++ b/INSTALL
+@@ -140,7 +140,7 @@ If build and host are different make check isn't available.
+ If build and host are different man pages are not generated.
+ 
+ As an example imagine you have a build system running on FreeBSD on sparc
+-which prepares packages for developpers running amd64 GNU/Linux laptop and
++which prepares packages for developers running amd64 GNU/Linux laptop and
+ they need to make images for ARM board running U-boot. In this case:
+ 
+ build=sparc64-freebsd
+@@ -149,7 +149,7 @@ target=arm-uboot
+ 
+ For this example the configure line might look like (more details below)
+ (some options are optional and included here for completeness but some rarely
+-used options are omited):
++used options are omitted):
+ 
+ ./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
+ CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
+@@ -196,9 +196,9 @@ corresponding platform are not needed for the platform in question.
+     11. TARGET_RANLIB= for ranlib for target.
+ 
+   - Additionally for emu, for host and target.
+-    1. SDL is looked for in stadard linker directories (-lSDL) (optional)
+-    2. libpciaccess is looked for in stadard linker directories (-lpciaccess) (optional)
+-    3. libusb is looked for in stadard linker directories (-lusb) (optional)
++    1. SDL is looked for in standard linker directories (-lSDL) (optional)
++    2. libpciaccess is looked for in standard linker directories (-lpciaccess) (optional)
++    3. libusb is looked for in standard linker directories (-lusb) (optional)
+ 
+   - Platform-agnostic tools and data.
+     1. make is the tool you execute after ./configure.
+diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
+index c796850..7c6244c 100644
+--- a/docs/grub-dev.texi
++++ b/docs/grub-dev.texi
+@@ -108,16 +108,16 @@ The branches available are:
+ 
+ @table @samp
+ @item master
+-      Main developpement branch.
++      Main development branch.
+ @item grub-legacy
+       GRUB 0.97 codebase. Kept for reference and legal reasons
+ @item multiboot
+       Multiboot specfication
+ @item multiboot2
+       Multiboot2 specfication
+-@item developper branches
+-      Prefixed with developper name. Every developper of a team manages his own branches.
+-      Developper branches do not need changelog entries.
++@item developer branches
++      Prefixed with developer name. Every developer of a team manages his own branches.
++      Developer branches do not need changelog entries.
+ @end table
+ 
+ Once you have used @kbd{git clone} to fetch an initial copy of a branch, you
+-- 
+1.9.3
+
diff --git a/SOURCES/0004-NEWS-First-draft-of-2.02-entry.patch b/SOURCES/0004-NEWS-First-draft-of-2.02-entry.patch
new file mode 100644
index 0000000..8da2fba
--- /dev/null
+++ b/SOURCES/0004-NEWS-First-draft-of-2.02-entry.patch
@@ -0,0 +1,154 @@
+From c0e2febef52139e0e580e52f553bf3aa521e390c Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Fri, 27 Dec 2013 03:05:38 +0000
+Subject: [PATCH 004/143] * NEWS: First draft of 2.02 entry.
+
+---
+ ChangeLog |   4 +++
+ NEWS      | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 123 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index bbb0f31..82dc61d 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,9 @@
+ 2013-12-27  Colin Watson  <cjwatson@ubuntu.com>
+ 
++	* NEWS: First draft of 2.02 entry.
++
++2013-12-27  Colin Watson  <cjwatson@ubuntu.com>
++
+ 	* INSTALL (Cross-compiling the GRUB): Fix some spelling mistakes.
+ 	* docs/grub.texi (Getting the source code): Likewise.
+ 
+diff --git a/NEWS b/NEWS
+index 4bb5f98..577d9fd 100644
+--- a/NEWS
++++ b/NEWS
+@@ -1,3 +1,122 @@
++New in 2.02:
++
++* New/improved filesystem and disk support:
++  * Big-endian UFS1.
++  * Experimental 64-bit ext2 support.
++  * Various fixes for non-512-byte sector devices.
++  * New `proc' filesystem framework, used by LUKS disks.
++  * Fix DM-RAID partition handling.
++  * New `nativedisk' command to switch from firmware to native disk drivers.
++  * Compressed HFS+.
++  * DragonFly BSD labels.
++  * CBFS (coreboot).
++  * Handle partitioned LVM properly.
++  * Use LVM UUIDs whenever possible.
++  * GPT PReP.
++  * New `progress' module that shows progress information while reading
++    files.
++
++* New/improved terminal and video support:
++  * Monochrome text (matching `hercules' in GRUB Legacy).
++  * Morse code output using system speaker.
++  * `spkmodem' output (simple data protocol using system speaker).
++  * Handle Japanese special keys.
++  * coreboot framebuffer.
++  * Serial on ARC.
++  * Native vt100 handling for grub-emu, replacing the use of the curses
++    library.
++  * New gfxmenu options for terminal window positioning, theme background
++    image handling, and scrollbar padding, plus `item_pixmap_style' and
++    `highlight_overlay'.
++  * Support several more image types (paletted and greyscale).
++
++* Boot protocol improvements:
++  * Support Apple FAT binaries on non-Apple platforms.
++  * Improve FreeDOS direct loading support compatibility.
++  * Enable `linux16' on all x86 platforms, not just BIOS.
++  * New TrueCrypt ISO loader.
++
++* New/improved network support:
++  * New variables `net_default_*' containing properties of the default
++    interface.
++  * Autoload `http' and `tftp' modules if necessary.
++  * Improve TFTP robustness.
++  * Parse `nd' disk names in GRUB Legacy configuration files.
++  * Issue separate DNS queries for IPv4 and IPv6.
++
++* New/improved platform support:
++  * New `efifwsetup' and `lsefi' commands on EFI platforms.
++  * New `cmosclean', `cmosdump', and `cmosset' commands on platforms with
++    CMOS support.
++  * New `cbmemc', `coreboot_boottime', and `lscoreboot' commands on
++    coreboot.
++  * Improve opcode parsing in ACPI halt implementation.
++  * Use the TSC as a possible time source on i386-ieee1275.
++  * Merge PowerPC grub-mkrescue implementation with the common one.
++  * Support grub-mkrescue on i386-ieee1275, sparc64, bootinfo machines such
++    as pSeries, and mips-arc.
++  * Make grub-mkrescue better support Apple Intel Macs on CD.
++  * Enable GRUB Legacy configuration file parsing on EFI.
++  * Support halt for Loongson 2E.
++  * ARM U-Boot and EFI ports.
++  * Reorganise platform-dependent code in utilities to avoid #ifdef mess.
++  * AROS and Haiku support for userspace utilities.
++  * Xen PV port.
++  * Fix EFI stack alignment.
++  * ARM64 EFI port.
++  * On Linux, read partition start offsets from sysfs if possible.
++  * New grub-macbless utility, and better integration with Mac firmware in
++    grub-install.
++  * Support Yeeloong 3A.
++  * Add `cpuid --pae' option to detect Physical Address Extension on x86.
++
++* Security:
++  * Add optional facility to enforce that all files read by the core image
++    from disk have a valid detached digital signature.
++
++* Performance:
++  * Avoid costly division operations in many places.
++  * New boot time analysis framework (`./configure --enable-boot-time').
++  * Initialise USB ports in parallel.
++  * New `testspeed' command to test file read speed.
++
++* Scripting:
++  * New `eval' and `tr' commands.
++  * grub-script-check fails on scripts containing no commands.
++
++* Installation and other utility improvements:
++  * Add option to compress files on installation or image creation.
++  * Using grub-reboot no longer requires setting `GRUB_DEFAULT=saved'.
++  * Support probing EFI System Partition (requires os-prober >= 1.58).
++  * Fix inconsistent use of `GRUB_CRYPTODISK_ENABLE' and
++    `GRUB_ENABLE_CRYPTODISK'; the latter is now used consistently.
++  * grub-mount handles symbolic links to directories.
++  * Support disabling submenus with `GRUB_DISABLE_SUBMENU' configuration key
++    for grub-mkconfig.
++  * grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone
++    rewritten in C.  They should now work in supported non-Unix-like
++    environments.
++  * Reorganise timeout handling using new `timeout_style' environment
++    variable and `GRUB_TIMEOUT_STYLE' configuration key for grub-mkconfig.
++    Menu hotkeys pressed during a hidden timeout now boot the corresponding
++    menu entry immediately.
++  * New `file' command and grub-file utility to check file types.
++  * New syslinux configuration file parser.
++
++* Build system:
++  * Remove all uses of nested functions; GRUB no longer requires an
++    executable stack.
++  * Fix documentation build with Texinfo >= 5.1.
++  * More robust and documented cross-compiling support.
++  * Partial clang support for some platforms.
++  * Eliminate the use of AutoGen.  This allowed some performance
++    improvements to the build system.
++  * Fix build with FreeType >= 2.5.1.
++  * Make gentpl.py compatible with Python 3.  It now requires at least
++    Python 2.6.
++
++* Revision control moved to git.
++
+ New in 2.00:
+ 
+ * Appearance:
+-- 
+1.9.3
+
diff --git a/SOURCES/0004-Use-linuxefi-and-initrdefi-where-appropriate.patch b/SOURCES/0004-Use-linuxefi-and-initrdefi-where-appropriate.patch
deleted file mode 100644
index 5b5cf24..0000000
--- a/SOURCES/0004-Use-linuxefi-and-initrdefi-where-appropriate.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 9309e5ea7f0c65e9c575508de59c09a0ff732fcb Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Mon, 16 Jul 2012 18:57:11 -0400
-Subject: [PATCH 04/34] Use "linuxefi" and "initrdefi" where appropriate.
-
----
- util/grub.d/10_linux.in | 18 ++++++++++++++++--
- 1 file changed, 16 insertions(+), 2 deletions(-)
-
-diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
-index 00d1931..ad34cc0 100644
---- a/util/grub.d/10_linux.in
-+++ b/util/grub.d/10_linux.in
-@@ -127,17 +127,31 @@ linux_entry ()
-     printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
-   fi
-   message="$(gettext_printf "Loading Linux %s ..." ${version})"
--  sed "s/^/$submenu_indentation/" << EOF
-+  if [ -d /sys/firmware/efi ]; then
-+    sed "s/^/$submenu_indentation/" << EOF
-+	echo	'$(echo "$message" | grub_quote)'
-+	linuxefi ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
-+EOF
-+  else
-+    sed "s/^/$submenu_indentation/" << EOF
- 	echo	'$(echo "$message" | grub_quote)'
- 	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
- EOF
-+  fi
-   if test -n "${initrd}" ; then
-     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
-     message="$(gettext_printf "Loading initial ramdisk ...")"
--    sed "s/^/$submenu_indentation/" << EOF
-+    if [ -d /sys/firmware/efi ]; then
-+      sed "s/^/$submenu_indentation/" << EOF
- 	echo	'$(echo "$message" | grub_quote)'
-+	initrdefi ${rel_dirname}/${initrd}
-+EOF
-+    else
-+      sed "s/^/$submenu_indentation/" << EOF
-+	echo	'$message'
- 	initrd	${rel_dirname}/${initrd}
- EOF
-+    fi
-   fi
-   sed "s/^/$submenu_indentation/" << EOF
- }
--- 
-1.8.4.2
-
diff --git a/SOURCES/0005-Don-t-allow-insmod-when-secure-boot-is-enabled.patch b/SOURCES/0005-Don-t-allow-insmod-when-secure-boot-is-enabled.patch
deleted file mode 100644
index 9616e98..0000000
--- a/SOURCES/0005-Don-t-allow-insmod-when-secure-boot-is-enabled.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-From 926684b8498a820b2e1446b697ab9c746f5302ba Mon Sep 17 00:00:00 2001
-From: Colin Watson <cjwatson@ubuntu.com>
-Date: Tue, 23 Oct 2012 10:40:49 -0400
-Subject: [PATCH 05/34] Don't allow insmod when secure boot is enabled.
-
-Hi,
-
-Fedora's patch to forbid insmod in UEFI Secure Boot environments is fine
-as far as it goes.  However, the insmod command is not the only way that
-modules can be loaded.  In particular, the 'normal' command, which
-implements the usual GRUB menu and the fully-featured command prompt,
-will implicitly load commands not currently loaded into memory.  This
-permits trivial Secure Boot violations by writing commands implementing
-whatever you want to do and pointing $prefix at the malicious code.
-
-I'm currently test-building this patch (replacing your current
-grub-2.00-no-insmod-on-sb.patch), but this should be more correct.  It
-moves the check into grub_dl_load_file.
----
- grub-core/kern/dl.c      | 21 +++++++++++++++++++++
- grub-core/kern/efi/efi.c | 28 ++++++++++++++++++++++++++++
- include/grub/efi/efi.h   |  1 +
- 3 files changed, 50 insertions(+)
-
-diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
-index 6850e04..b0b0405 100644
---- a/grub-core/kern/dl.c
-+++ b/grub-core/kern/dl.c
-@@ -38,6 +38,14 @@
- #define GRUB_MODULES_MACHINE_READONLY
- #endif
- 
-+#ifdef GRUB_MACHINE_EMU
-+#include <sys/mman.h>
-+#endif
-+
-+#ifdef GRUB_MACHINE_EFI
-+#include <grub/efi/efi.h>
-+#endif
-+
- 
- 
- #pragma GCC diagnostic ignored "-Wcast-align"
-@@ -680,6 +688,19 @@ grub_dl_load_file (const char *filename)
-   void *core = 0;
-   grub_dl_t mod = 0;
- 
-+#ifdef GRUB_MACHINE_EFI
-+  if (grub_efi_secure_boot ())
-+    {
-+#if 0
-+      /* This is an error, but grub2-mkconfig still generates a pile of
-+       * insmod commands, so emitting it would be mostly just obnoxious. */
-+      grub_error (GRUB_ERR_ACCESS_DENIED,
-+		  "Secure Boot forbids loading module from %s", filename);
-+#endif
-+      return 0;
-+    }
-+#endif
-+
-   grub_boot_time ("Loading module %s", filename);
- 
-   file = grub_file_open (filename);
-diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
-index b253141..aa81322 100644
---- a/grub-core/kern/efi/efi.c
-+++ b/grub-core/kern/efi/efi.c
-@@ -259,6 +259,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
-   return NULL;
- }
- 
-+grub_efi_boolean_t
-+grub_efi_secure_boot (void)
-+{
-+  grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
-+  grub_size_t datasize;
-+  char *secure_boot = NULL;
-+  char *setup_mode = NULL;
-+  grub_efi_boolean_t ret = 0;
-+
-+  secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize);
-+
-+  if (datasize != 1 || !secure_boot)
-+    goto out;
-+
-+  setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize);
-+
-+  if (datasize != 1 || !setup_mode)
-+    goto out;
-+
-+  if (*secure_boot && !*setup_mode)
-+    ret = 1;
-+
-+ out:
-+  grub_free (secure_boot);
-+  grub_free (setup_mode);
-+  return ret;
-+}
-+
- #pragma GCC diagnostic ignored "-Wcast-align"
- 
- /* Search the mods section from the PE32/PE32+ image. This code uses
-diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
-index 9370fd5..a000c38 100644
---- a/include/grub/efi/efi.h
-+++ b/include/grub/efi/efi.h
-@@ -72,6 +72,7 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var,
- 				     const grub_efi_guid_t *guid,
- 				     void *data,
- 				     grub_size_t datasize);
-+grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void);
- int
- EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
- 					     const grub_efi_device_path_t *dp2);
--- 
-1.8.4.2
-
diff --git a/SOURCES/0005-Merge-branch-master-of-git.sv.gnu.org-srv-git-grub.patch b/SOURCES/0005-Merge-branch-master-of-git.sv.gnu.org-srv-git-grub.patch
new file mode 100644
index 0000000..8c4bf80
--- /dev/null
+++ b/SOURCES/0005-Merge-branch-master-of-git.sv.gnu.org-srv-git-grub.patch
@@ -0,0 +1,43 @@
+From 9ee79da5bf54babe11178ced48470b5f09d3dda3 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 27 Dec 2013 11:20:37 +0100
+Subject: [PATCH 005/143] Merge branch 'master' of git.sv.gnu.org:/srv/git/grub
+
+Conflicts:
+    ChangeLog
+---
+ ChangeLog | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 82dc61d..da3c2df 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,10 @@
++2013-12-27  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/kern/arm/cache_armv6.S: Remove .arch directive.
++
++	As these functions are used on pre-ARMv6 CPUs as well we don't want
++	to make assembler assume that architecture is higher than default one.
++
+ 2013-12-27  Colin Watson  <cjwatson@ubuntu.com>
+ 
+ 	* NEWS: First draft of 2.02 entry.
+@@ -7,13 +14,6 @@
+ 	* INSTALL (Cross-compiling the GRUB): Fix some spelling mistakes.
+ 	* docs/grub.texi (Getting the source code): Likewise.
+ 
+-2013-12-25  Vladimir Serbinenko  <phcoder@gmail.com>
+-
+-	* grub-core/kern/arm/cache_armv6.S: Remove .arch directive.
+-
+-	As these functions are used on pre-ARMv6 CPUs as well we don't want
+-	to make assembler assume that architecture is higher than default one.
+-
+ 2013-12-25  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* grub-core/osdep/windows/platform.c (get_platform): Fix EFI
+-- 
+1.9.3
+
diff --git a/SOURCES/0006-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch b/SOURCES/0006-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch
new file mode 100644
index 0000000..c9fb0c3
--- /dev/null
+++ b/SOURCES/0006-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch
@@ -0,0 +1,41 @@
+From 94763697f5f33614b7bd6da91707a27b6872b750 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Sat, 28 Dec 2013 02:20:27 +0000
+Subject: [PATCH 006/143] * NEWS: The cmosclean command in fact dates back to
+ 1.99.  Remove mention of it from 2.02.
+
+---
+ ChangeLog | 5 +++++
+ NEWS      | 3 +--
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index da3c2df..c33856e 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2013-12-28  Colin Watson  <cjwatson@ubuntu.com>
++
++	* NEWS: The cmosclean command in fact dates back to 1.99.  Remove
++	mention of it from 2.02.
++
+ 2013-12-27  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/kern/arm/cache_armv6.S: Remove .arch directive.
+diff --git a/NEWS b/NEWS
+index 577d9fd..b74c05f 100644
+--- a/NEWS
++++ b/NEWS
+@@ -46,8 +46,7 @@ New in 2.02:
+ 
+ * New/improved platform support:
+   * New `efifwsetup' and `lsefi' commands on EFI platforms.
+-  * New `cmosclean', `cmosdump', and `cmosset' commands on platforms with
+-    CMOS support.
++  * New `cmosdump' and `cmosset' commands on platforms with CMOS support.
+   * New `cbmemc', `coreboot_boottime', and `lscoreboot' commands on
+     coreboot.
+   * Improve opcode parsing in ACPI halt implementation.
+-- 
+1.9.3
+
diff --git a/SOURCES/0006-Pass-x-hex-hex-straight-through-unmolested.patch b/SOURCES/0006-Pass-x-hex-hex-straight-through-unmolested.patch
deleted file mode 100644
index b2bf5cd..0000000
--- a/SOURCES/0006-Pass-x-hex-hex-straight-through-unmolested.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-From 0e470ac45edd8c3e6cd06d2c6bdd5cdcf389af34 Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Mon, 1 Oct 2012 13:24:37 -0400
-Subject: [PATCH 06/34] Pass "\x[[:hex:]][[:hex:]]" straight through
- unmolested.
-
----
- grub-core/commands/wildcard.c | 16 +++++++++++++++-
- grub-core/lib/cmdline.c       | 34 ++++++++++++++++++++++++++++++++--
- grub-core/script/execute.c    | 43 +++++++++++++++++++++++++++++++++++++------
- 3 files changed, 84 insertions(+), 9 deletions(-)
-
-diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c
-index 2807f80..0f40e04 100644
---- a/grub-core/commands/wildcard.c
-+++ b/grub-core/commands/wildcard.c
-@@ -458,6 +458,12 @@ check_file (const char *dir, const char *basename)
-   return ctx.found;
- }
- 
-+static int
-+is_hex(char c)
-+{
-+  return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
-+}
-+
- static void
- unescape (char *out, const char *in, const char *end)
- {
-@@ -466,7 +472,15 @@ unescape (char *out, const char *in, const char *end)
- 
-   for (optr = out, iptr = in; iptr < end;)
-     {
--      if (*iptr == '\\' && iptr + 1 < end)
-+      if (*iptr == '\\' && iptr + 3 < end && iptr[1] == 'x' && is_hex(iptr[2]) && is_hex(iptr[3]))
-+	{
-+	  *optr++ = *iptr++;
-+	  *optr++ = *iptr++;
-+	  *optr++ = *iptr++;
-+	  *optr++ = *iptr++;
-+	  continue;
-+	}
-+      else if (*iptr == '\\' && iptr + 1 < end)
- 	{
- 	  *optr++ = iptr[1];
- 	  iptr += 2;
-diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
-index d5e10ee..0a5b2af 100644
---- a/grub-core/lib/cmdline.c
-+++ b/grub-core/lib/cmdline.c
-@@ -20,6 +20,12 @@
- #include <grub/lib/cmdline.h>
- #include <grub/misc.h>
- 
-+static int
-+is_hex(char c)
-+{
-+  return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
-+}
-+
- static unsigned int check_arg (char *c, int *has_space)
- {
-   int space = 0;
-@@ -27,7 +33,13 @@ static unsigned int check_arg (char *c, int *has_space)
- 
-   while (*c)
-     {
--      if (*c == '\\' || *c == '\'' || *c == '"')
-+      if (*c == '\\' && *(c+1) == 'x' && is_hex(*(c+2)) && is_hex(*(c+3)))
-+	{
-+	  size += 4;
-+	  c += 4;
-+	  continue;
-+	}
-+      else if (*c == '\\' || *c == '\'' || *c == '"')
- 	size++;
-       else if (*c == ' ')
- 	space = 1;
-@@ -85,7 +97,25 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
- 
-       while (*c)
- 	{
--	  if (*c == '\\' || *c == '\'' || *c == '"')
-+	  if (*c == ' ')
-+	    {
-+	      *buf++ = '\\';
-+	      *buf++ = 'x';
-+	      *buf++ = '2';
-+	      *buf++ = '0';
-+	      c++;
-+	      continue;
-+	    }
-+	  else if (*c == '\\' && *(c+1) == 'x' &&
-+		   is_hex(*(c+2)) && is_hex(*(c+3)))
-+	    {
-+	      *buf++ = *c++;
-+	      *buf++ = *c++;
-+	      *buf++ = *c++;
-+	      *buf++ = *c++;
-+	      continue;
-+	    }
-+	  else if (*c == '\\' || *c == '\'' || *c == '"')
- 	    *buf++ = '\\';
- 
- 	  *buf++ = *c;
-diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
-index afd5513..8f01c1b 100644
---- a/grub-core/script/execute.c
-+++ b/grub-core/script/execute.c
-@@ -52,6 +52,12 @@ static struct grub_script_scope *scope = 0;
- /* Wildcard translator for GRUB script.  */
- struct grub_script_wildcard_translator *grub_wildcard_translator;
- 
-+static int
-+is_hex(char c)
-+{
-+  return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
-+}
-+
- static char*
- wildcard_escape (const char *s)
- {
-@@ -68,7 +74,15 @@ wildcard_escape (const char *s)
-   i = 0;
-   while ((ch = *s++))
-     {
--      if (ch == '*' || ch == '\\' || ch == '?')
-+      if (ch == '\\' && s[0] == 'x' && is_hex(s[1]) && is_hex(s[2]))
-+	{
-+	  p[i++] = ch;
-+	  p[i++] = *s++;
-+	  p[i++] = *s++;
-+	  p[i++] = *s++;
-+	  continue;
-+	}
-+      else if (ch == '*' || ch == '\\' || ch == '?')
- 	p[i++] = '\\';
-       p[i++] = ch;
-     }
-@@ -92,7 +106,14 @@ wildcard_unescape (const char *s)
-   i = 0;
-   while ((ch = *s++))
-     {
--      if (ch == '\\')
-+      if (ch == '\\' && s[0] == 'x' && is_hex(s[1]) && is_hex(s[2]))
-+	{
-+	  p[i++] = '\\';
-+	  p[i++] = *s++;
-+	  p[i++] = *s++;
-+	  p[i++] = *s++;
-+	}
-+      else if (ch == '\\')
- 	p[i++] = *s++;
-       else
- 	p[i++] = ch;
-@@ -394,10 +415,20 @@ parse_string (const char *str,
-     switch (*ptr)
-       {
-       case '\\':
--	escaped = !escaped;
--	if (!escaped && put)
--	  *(put++) = '\\';
--	ptr++;
-+	if (!escaped && put && *(ptr+1) == 'x' && is_hex(*(ptr+2)) && is_hex(*(ptr+3)))
-+	  {
-+	    *(put++) = *ptr++;
-+	    *(put++) = *ptr++;
-+	    *(put++) = *ptr++;
-+	    *(put++) = *ptr++;
-+	  }
-+	else
-+	  {
-+	    escaped = !escaped;
-+	    if (!escaped && put)
-+	      *(put++) = '\\';
-+	    ptr++;
-+	  }
- 	break;
-       case '$':
- 	if (escaped)
--- 
-1.8.4.2
-
diff --git a/SOURCES/0007-Fix-crash-on-http.patch b/SOURCES/0007-Fix-crash-on-http.patch
deleted file mode 100644
index 7d4045e..0000000
--- a/SOURCES/0007-Fix-crash-on-http.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 24dd7353a3c7691714661ddfdc1de1c0d8386d7f Mon Sep 17 00:00:00 2001
-From: Gustavo Luiz Duarte <gustavold@linux.vnet.ibm.com>
-Date: Tue, 25 Sep 2012 18:40:55 -0400
-Subject: [PATCH 07/34] Fix crash on http
-
-Don't free file->data on receiving FIN flag since it is used all over without
-checking. http_close() will be called later to free that memory.
-https://bugzilla.redhat.com/show_bug.cgi?id=860834
----
- grub-core/net/http.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/grub-core/net/http.c b/grub-core/net/http.c
-index 4684f8b..ef9538c 100644
---- a/grub-core/net/http.c
-+++ b/grub-core/net/http.c
-@@ -393,7 +393,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
- 
-   data->sock = grub_net_tcp_open (file->device->net->server,
- 				  HTTP_PORT, http_receive,
--				  http_err, http_err,
-+				  http_err, NULL,
- 				  file);
-   if (!data->sock)
-     {
--- 
-1.8.4.2
-
diff --git a/SOURCES/0007-remove-unused-error.h-from-kern-emu-misc.c.patch b/SOURCES/0007-remove-unused-error.h-from-kern-emu-misc.c.patch
new file mode 100644
index 0000000..51973fa
--- /dev/null
+++ b/SOURCES/0007-remove-unused-error.h-from-kern-emu-misc.c.patch
@@ -0,0 +1,39 @@
+From 904bd6b3cb12977def4f940e90aca3fe557c3bb5 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sat, 28 Dec 2013 09:01:20 +0400
+Subject: [PATCH 007/143] remove unused error.h from kern/emu/misc.c
+
+Fixes compilation on mingw32, where include is apparently missing.
+---
+ ChangeLog                 | 5 +++++
+ grub-core/kern/emu/misc.c | 1 -
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index c33856e..0401f61 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2013-12-28  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* grub-core/kern/emu/misc.c: Remove unused error.h; fixes compilation
++	on mingw.
++
+ 2013-12-28  Colin Watson  <cjwatson@ubuntu.com>
+ 
+ 	* NEWS: The cmosclean command in fact dates back to 1.99.  Remove
+diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
+index 43471b4..bb606da 100644
+--- a/grub-core/kern/emu/misc.c
++++ b/grub-core/kern/emu/misc.c
+@@ -20,7 +20,6 @@
+ #include <config.h>
+ 
+ #include <errno.h>
+-#include <error.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <stdint.h>
+-- 
+1.9.3
+
diff --git a/SOURCES/0008-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch b/SOURCES/0008-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch
new file mode 100644
index 0000000..0cc4a19
--- /dev/null
+++ b/SOURCES/0008-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch
@@ -0,0 +1,70 @@
+From 23cd074c57ee6f35776fd5122a050bcef6c9eef5 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sat, 28 Dec 2013 17:25:14 +0100
+Subject: [PATCH 008/143] 	Don't abort() on unavailable coreboot tables
+ if not running on coreboot.
+
+---
+ ChangeLog                              | 4 ++++
+ grub-core/kern/i386/coreboot/cbtable.c | 2 +-
+ grub-core/kern/i386/coreboot/init.c    | 5 +++++
+ 3 files changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 0401f61..ed6d77c 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2013-12-28  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	Don't abort() on unavailable coreboot tables if not running on coreboot.
++
+ 2013-12-28  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* grub-core/kern/emu/misc.c: Remove unused error.h; fixes compilation
+diff --git a/grub-core/kern/i386/coreboot/cbtable.c b/grub-core/kern/i386/coreboot/cbtable.c
+index e3bb7b2..1669bc0 100644
+--- a/grub-core/kern/i386/coreboot/cbtable.c
++++ b/grub-core/kern/i386/coreboot/cbtable.c
+@@ -55,7 +55,7 @@ grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t,
+     if (check_signature (table_header))
+       goto signature_found;
+ 
+-  grub_fatal ("Could not find coreboot table\n");
++  return 0;
+ 
+ signature_found:
+ 
+diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c
+index 6b150b4..3314f02 100644
+--- a/grub-core/kern/i386/coreboot/init.c
++++ b/grub-core/kern/i386/coreboot/init.c
+@@ -51,6 +51,7 @@ grub_exit (void)
+ 
+ grub_addr_t grub_modbase = GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR;
+ static grub_uint64_t modend;
++static int have_memory = 0;
+ 
+ /* Helper for grub_machine_init.  */
+ static int
+@@ -82,6 +83,8 @@ heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type,
+ 
+   grub_mm_init_region ((void *) (grub_addr_t) begin, (grub_size_t) (end - begin));
+ 
++  have_memory = 1;
++
+   return 0;
+ }
+ 
+@@ -97,6 +100,8 @@ grub_machine_init (void)
+   grub_vga_text_init ();
+ 
+   grub_machine_mmap_iterate (heap_init, NULL);
++  if (!have_memory)
++    grub_fatal ("No memory found");
+ 
+   grub_video_coreboot_fb_late_init ();
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0008-IBM-client-architecture-CAS-reboot-support.patch b/SOURCES/0008-IBM-client-architecture-CAS-reboot-support.patch
deleted file mode 100644
index d3ceb67..0000000
--- a/SOURCES/0008-IBM-client-architecture-CAS-reboot-support.patch
+++ /dev/null
@@ -1,175 +0,0 @@
-From 51d201f7a26bba103408e83e872678835c70f7d6 Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Thu, 20 Sep 2012 18:07:39 -0300
-Subject: [PATCH 08/34] IBM client architecture (CAS) reboot support
-
-This is an implementation of IBM client architecture (CAS) reboot for GRUB.
-
-There are cases where the POWER firmware must reboot in order to support
-specific features requested by a kernel. The kernel calls
-ibm,client-architecture-support and it may either return or reboot with the new
-feature set. eg:
-
-Calling ibm,client-architecture-support.../
-Elapsed time since release of system processors: 70959 mins 50 secs
-Welcome to GRUB!
-
-Instead of return to the GRUB menu, it will check if the flag for CAS reboot is
-set. If so, grub will automatically boot the last booted kernel using the same
-parameters
----
- grub-core/kern/ieee1275/openfw.c | 63 ++++++++++++++++++++++++++++++++++++++++
- grub-core/normal/main.c          | 19 ++++++++++++
- grub-core/script/execute.c       |  7 +++++
- include/grub/ieee1275/ieee1275.h |  2 ++
- 4 files changed, 91 insertions(+)
-
-diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
-index ddb7783..2f7fbda 100644
---- a/grub-core/kern/ieee1275/openfw.c
-+++ b/grub-core/kern/ieee1275/openfw.c
-@@ -561,3 +561,66 @@ grub_ieee1275_canonicalise_devname (const char *path)
-   return NULL;
- }
- 
-+/* Check if it's a CAS reboot. If so, set the script to be executed.  */
-+int
-+grub_ieee1275_cas_reboot (char *script)
-+{
-+  grub_uint32_t ibm_ca_support_reboot;
-+  grub_uint32_t ibm_fw_nbr_reboots;
-+  char property_value[10];
-+  grub_ssize_t actual;
-+  grub_ieee1275_ihandle_t options;
-+
-+  if (grub_ieee1275_finddevice ("/options", &options) < 0)
-+    return -1;
-+
-+  /* Check two properties, one is enough to get cas reboot value */
-+  ibm_ca_support_reboot = 0;
-+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen,
-+                                          "ibm,client-architecture-support-reboot",
-+                                          &ibm_ca_support_reboot,
-+                                          sizeof (ibm_ca_support_reboot),
-+                                          &actual) >= 0)
-+    grub_dprintf("ieee1275", "ibm,client-architecture-support-reboot: %u\n",
-+                 ibm_ca_support_reboot);
-+
-+  ibm_fw_nbr_reboots = 0;
-+  if (grub_ieee1275_get_property (options, "ibm,fw-nbr-reboots",
-+                                  property_value, sizeof (property_value),
-+                                  &actual) >= 0)
-+    {
-+      property_value[sizeof (property_value) - 1] = 0;
-+      ibm_fw_nbr_reboots = (grub_uint8_t) grub_strtoul (property_value, 0, 10);
-+      grub_dprintf("ieee1275", "ibm,fw-nbr-reboots: %u\n", ibm_fw_nbr_reboots);
-+    }
-+
-+  if (ibm_ca_support_reboot || ibm_fw_nbr_reboots)
-+    {
-+      if (! grub_ieee1275_get_property_length (options, "boot-last-label", &actual))
-+        {
-+          if (actual > 1024)
-+            script = grub_realloc (script, actual + 1);
-+          grub_ieee1275_get_property (options, "boot-last-label", script, actual,
-+                                      &actual);
-+          return 0;
-+        }
-+    }
-+
-+  grub_ieee1275_set_boot_last_label ("");
-+
-+  return -1;
-+}
-+
-+int grub_ieee1275_set_boot_last_label (const char *text)
-+{
-+  grub_ieee1275_ihandle_t options;
-+  grub_ssize_t actual;
-+
-+  grub_dprintf("ieee1275", "set boot_last_label (size: %u)\n", grub_strlen(text));
-+  if (! grub_ieee1275_finddevice ("/options", &options) &&
-+      options != (grub_ieee1275_ihandle_t) -1)
-+    grub_ieee1275_set_property (options, "boot-last-label", text,
-+                                grub_strlen (text), &actual);
-+  return 0;
-+}
-+
-diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
-index 243b9d6..4ce71fc 100644
---- a/grub-core/normal/main.c
-+++ b/grub-core/normal/main.c
-@@ -32,6 +32,9 @@
- #include <grub/i18n.h>
- #include <grub/charset.h>
- #include <grub/script_sh.h>
-+#ifdef GRUB_MACHINE_IEEE1275
-+#include <grub/ieee1275/ieee1275.h>
-+#endif
- 
- GRUB_MOD_LICENSE ("GPLv3+");
- 
-@@ -267,6 +270,22 @@ grub_normal_execute (const char *config, int nested, int batch)
-     {
-       menu = read_config_file (config);
- 
-+#ifdef GRUB_MACHINE_IEEE1275
-+      int boot;
-+      boot = 0;
-+      char *script;
-+      script = grub_malloc (1024);
-+      if (! grub_ieee1275_cas_reboot (script))
-+        {
-+          char *dummy[1] = { NULL };
-+          if (! grub_script_execute_sourcecode (script, 0, dummy))
-+            boot = 1;
-+        }
-+      grub_free (script);
-+      if (boot)
-+        grub_command_execute ("boot", 0, 0);
-+#endif
-+
-       /* Ignore any error.  */
-       grub_errno = GRUB_ERR_NONE;
-     }
-diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
-index 8f01c1b..cec9539 100644
---- a/grub-core/script/execute.c
-+++ b/grub-core/script/execute.c
-@@ -27,6 +27,9 @@
- #include <grub/normal.h>
- #include <grub/extcmd.h>
- #include <grub/i18n.h>
-+#ifdef GRUB_MACHINE_IEEE1275
-+#include <grub/ieee1275/ieee1275.h>
-+#endif
- 
- /* Max digits for a char is 3 (0xFF is 255), similarly for an int it
-    is sizeof (int) * 3, and one extra for a possible -ve sign.  */
-@@ -892,6 +895,10 @@ grub_script_execute_sourcecode (const char *source)
-   grub_err_t ret = 0;
-   struct grub_script *parsed_script;
- 
-+#ifdef GRUB_MACHINE_IEEE1275
-+  grub_ieee1275_set_boot_last_label (source);
-+#endif
-+
-   while (source)
-     {
-       char *line;
-diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
-index dc54bea..35618f4 100644
---- a/include/grub/ieee1275/ieee1275.h
-+++ b/include/grub/ieee1275/ieee1275.h
-@@ -233,6 +233,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali
- void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias);
- void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
- 						struct grub_ieee1275_devalias *alias);
-+int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char *script);
-+int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text);
- 
- #define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));)
- 
--- 
-1.8.4.2
-
diff --git a/SOURCES/0009-Add-vlan-tag-support.patch b/SOURCES/0009-Add-vlan-tag-support.patch
deleted file mode 100644
index 270682e..0000000
--- a/SOURCES/0009-Add-vlan-tag-support.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-From e8b23062cac51d90f94971779bd69a1305ef3421 Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 30 Oct 2012 15:19:39 -0200
-Subject: [PATCH 09/34] Add vlan-tag support
-
-This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows
-multiple VLANs in a bridged network to share the same physical network link but
-maintain isolation:
-
-http://en.wikipedia.org/wiki/IEEE_802.1Q
-
-This patch should fix this bugzilla:
-https://bugzilla.redhat.com/show_bug.cgi?id=871563
----
- grub-core/kern/ieee1275/init.c   |  1 +
- grub-core/kern/ieee1275/openfw.c | 30 ++++++++++++++++++++++++++++
- grub-core/net/ethernet.c         | 42 +++++++++++++++++++++++++++++++++++++---
- include/grub/ieee1275/ieee1275.h |  1 +
- include/grub/net.h               |  2 ++
- 5 files changed, 73 insertions(+), 3 deletions(-)
-
-diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
-index 89b2822..f43f6b9 100644
---- a/grub-core/kern/ieee1275/init.c
-+++ b/grub-core/kern/ieee1275/init.c
-@@ -118,6 +118,7 @@ grub_machine_get_bootlocation (char **device, char **path)
-       char *dev, *canon;
-       char *ptr;
-       dev = grub_ieee1275_get_aliasdevname (bootpath);
-+      grub_ieee1275_parse_net_options (bootpath);
-       canon = grub_ieee1275_canonicalise_devname (dev);
-       ptr = canon + grub_strlen (canon) - 1;
-       while (ptr > canon && (*ptr == ',' || *ptr == ':'))
-diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
-index 2f7fbda..086f119 100644
---- a/grub-core/kern/ieee1275/openfw.c
-+++ b/grub-core/kern/ieee1275/openfw.c
-@@ -23,6 +23,7 @@
- #include <grub/mm.h>
- #include <grub/ieee1275/ieee1275.h>
- #include <grub/net.h>
-+#include <grub/env.h>
- 
- enum grub_ieee1275_parse_type
- {
-@@ -451,6 +452,35 @@ fail:
-   return ret;
- }
- 
-+int
-+grub_ieee1275_parse_net_options (const char *path)
-+{
-+  char *comma;
-+  char *args;
-+  char *option = 0;
-+
-+  args = grub_ieee1275_get_devargs (path);
-+  if (!args)
-+    /* There is no option.  */
-+    return -1;
-+
-+  do
-+    {
-+      comma = grub_strchr (args, ',');
-+      if (! comma)
-+        option = grub_strdup (args);
-+      else
-+        option = grub_strndup (args, (grub_size_t)(comma - args));
-+      args = comma + 1;
-+
-+      if (! grub_strncmp(option, "vtag", 4))
-+          grub_env_set ("vlan-tag", option + grub_strlen("vtag="));
-+
-+    } while (comma);
-+
-+  return 0;
-+}
-+
- char *
- grub_ieee1275_get_device_type (const char *path)
- {
-diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c
-index c397b1b..faaca67 100644
---- a/grub-core/net/ethernet.c
-+++ b/grub-core/net/ethernet.c
-@@ -23,6 +23,7 @@
- #include <grub/net/arp.h>
- #include <grub/net/netbuff.h>
- #include <grub/net.h>
-+#include <grub/env.h>
- #include <grub/time.h>
- #include <grub/net/arp.h>
- 
-@@ -56,10 +57,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
- {
-   struct etherhdr *eth;
-   grub_err_t err;
-+  grub_uint32_t vlantag = 0;
-+  grub_uint8_t etherhdr_size;
- 
--  COMPILE_TIME_ASSERT (sizeof (*eth) < GRUB_NET_MAX_LINK_HEADER_SIZE);
-+  etherhdr_size = sizeof (*eth);
-+  COMPILE_TIME_ASSERT (sizeof (*eth) + 4 < GRUB_NET_MAX_LINK_HEADER_SIZE);
- 
--  err = grub_netbuff_push (nb, sizeof (*eth));
-+  const char *vlantag_text = grub_env_get ("vlan-tag");
-+  if (vlantag_text != 0) {
-+      etherhdr_size += 4;
-+      vlantag = grub_strtoul (vlantag_text, 0, 16);
-+  }
-+
-+  err = grub_netbuff_push (nb, etherhdr_size);
-   if (err)
-     return err;
-   eth = (struct etherhdr *) nb->data;
-@@ -76,6 +86,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
- 	return err;
-       inf->card->opened = 1;
-     }
-+
-+  /* Check if a vlan-tag is needed. */
-+  if (vlantag != 0)
-+    {
-+      /* Move eth type to the right */
-+      grub_memcpy((char *) nb->data + etherhdr_size - 2,
-+                  (char *) nb->data + etherhdr_size - 6, 2);
-+
-+      /* Add the tag in the middle */
-+      grub_memcpy((char *) nb->data + etherhdr_size - 6,
-+                  &vlantag, 4);
-+    }
-+
-   return inf->card->driver->send (inf->card, nb);
- }
- 
-@@ -90,10 +113,23 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
-   grub_net_link_level_address_t hwaddress;
-   grub_net_link_level_address_t src_hwaddress;
-   grub_err_t err;
-+  grub_uint8_t etherhdr_size = sizeof (*eth);
-+
-+  grub_uint16_t vlantag_identifier = 0;
-+  grub_memcpy (&vlantag_identifier, nb->data + etherhdr_size - 2, 2);
-+
-+  /* Check if a vlan-tag is present. */
-+  if (vlantag_identifier == VLANTAG_IDENTIFIER)
-+    {
-+      etherhdr_size += 4;
-+      /* Move eth type to the original position */
-+      grub_memcpy((char *) nb->data + etherhdr_size - 6,
-+                  (char *) nb->data + etherhdr_size - 2, 2);
-+    }
- 
-   eth = (struct etherhdr *) nb->data;
-   type = grub_be_to_cpu16 (eth->type);
--  err = grub_netbuff_pull (nb, sizeof (*eth));
-+  err = grub_netbuff_pull (nb, etherhdr_size);
-   if (err)
-     return err;
- 
-diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
-index 35618f4..2b64a92 100644
---- a/include/grub/ieee1275/ieee1275.h
-+++ b/include/grub/ieee1275/ieee1275.h
-@@ -235,6 +235,7 @@ void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
- 						struct grub_ieee1275_devalias *alias);
- int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char *script);
- int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text);
-+int EXPORT_FUNC(grub_ieee1275_parse_net_options) (const char *path);
- 
- #define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));)
- 
-diff --git a/include/grub/net.h b/include/grub/net.h
-index de6259e..c8ce8db 100644
---- a/include/grub/net.h
-+++ b/include/grub/net.h
-@@ -533,4 +533,6 @@ extern char *grub_net_default_server;
- #define GRUB_NET_TRIES 40
- #define GRUB_NET_INTERVAL 400
- 
-+#define VLANTAG_IDENTIFIER 0x8100
-+
- #endif /* ! GRUB_NET_HEADER */
--- 
-1.8.4.2
-
diff --git a/SOURCES/0009-NEWS-Add-few-missing-entries.-Correct-existing-ones.patch b/SOURCES/0009-NEWS-Add-few-missing-entries.-Correct-existing-ones.patch
new file mode 100644
index 0000000..5d4fbd5
--- /dev/null
+++ b/SOURCES/0009-NEWS-Add-few-missing-entries.-Correct-existing-ones.patch
@@ -0,0 +1,121 @@
+From 3eff91e86e4df2cf8a5e1b26f98e96bf4731f526 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Mon, 30 Dec 2013 06:49:15 +0100
+Subject: [PATCH 009/143] 	* NEWS: Add few missing entries. Correct
+ existing ones.
+
+---
+ ChangeLog |  4 ++++
+ NEWS      | 27 ++++++++++++++++++++++-----
+ 2 files changed, 26 insertions(+), 5 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index ed6d77c..db84300 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2013-12-30  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* NEWS: Add few missing entries. Correct existing ones.
++
+ 2013-12-28  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	Don't abort() on unavailable coreboot tables if not running on coreboot.
+diff --git a/NEWS b/NEWS
+index b74c05f..49a2459 100644
+--- a/NEWS
++++ b/NEWS
+@@ -35,6 +35,8 @@ New in 2.02:
+   * Improve FreeDOS direct loading support compatibility.
+   * Enable `linux16' on all x86 platforms, not just BIOS.
+   * New TrueCrypt ISO loader.
++  * multiboot2 boot-services EFI specification.
++  * multiboot2 full-file specfication.
+ 
+ * New/improved network support:
+   * New variables `net_default_*' containing properties of the default
+@@ -44,11 +46,17 @@ New in 2.02:
+   * Parse `nd' disk names in GRUB Legacy configuration files.
+   * Issue separate DNS queries for IPv4 and IPv6.
+ 
++* Coreboot improvements:
++  * CBFS support both in on-disk images (loopback) and flash.
++  * Ability to launch another payload from flash or disk
++  * Coreboot framebuffer
++  * CBMEMC support (both logging and inspecting logs)
++  * Inspecting coreboot timestamps.
++  * Inspecting coreboot tables.
++
+ * New/improved platform support:
+   * New `efifwsetup' and `lsefi' commands on EFI platforms.
+   * New `cmosdump' and `cmosset' commands on platforms with CMOS support.
+-  * New `cbmemc', `coreboot_boottime', and `lscoreboot' commands on
+-    coreboot.
+   * Improve opcode parsing in ACPI halt implementation.
+   * Use the TSC as a possible time source on i386-ieee1275.
+   * Merge PowerPC grub-mkrescue implementation with the common one.
+@@ -68,6 +76,7 @@ New in 2.02:
+     grub-install.
+   * Support Yeeloong 3A.
+   * Add `cpuid --pae' option to detect Physical Address Extension on x86.
++  * Support for USB debug dongles.
+ 
+ * Security:
+   * Add optional facility to enforce that all files read by the core image
+@@ -78,6 +87,7 @@ New in 2.02:
+   * New boot time analysis framework (`./configure --enable-boot-time').
+   * Initialise USB ports in parallel.
+   * New `testspeed' command to test file read speed.
++  * Speed-up gfxterm by storing intermediate results in more compact format.
+ 
+ * Scripting:
+   * New `eval' and `tr' commands.
+@@ -95,6 +105,7 @@ New in 2.02:
+   * grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone
+     rewritten in C.  They should now work in supported non-Unix-like
+     environments.
++  * Native mingw support, including ability to install on EFI under windows.
+   * Reorganise timeout handling using new `timeout_style' environment
+     variable and `GRUB_TIMEOUT_STYLE' configuration key for grub-mkconfig.
+     Menu hotkeys pressed during a hidden timeout now boot the corresponding
+@@ -107,12 +118,19 @@ New in 2.02:
+     executable stack.
+   * Fix documentation build with Texinfo >= 5.1.
+   * More robust and documented cross-compiling support.
+-  * Partial clang support for some platforms.
++  * Partial clang support for some platforms (experimental).
++  * Partial mingw64 x86_64-efi compile support (highly experimental).
++  * Partial mingw32 i386-* (other than already present i386-pc)
++    compile support (highly experimental).
+   * Eliminate the use of AutoGen.  This allowed some performance
+     improvements to the build system.
++  * Remove variable length arrays.
++  * OpenBSD compile and tools support (NetBSD and FreeBSD were already supported).
+   * Fix build with FreeType >= 2.5.1.
+   * Make gentpl.py compatible with Python 3.  It now requires at least
+     Python 2.6.
++  * modinfo.sh contains build information now.
++  * Added many new tests to improve robustness.
+ 
+ * Revision control moved to git.
+ 
+@@ -142,7 +160,6 @@ New in 2.00:
+   * IEEE1275 serial.
+   * EFI serial.
+   * Network stack for BIOS, IEEE1275, EMU and EFI, including TFTP, HTTP and DNS.
+-  * VBE on coreboot support.
+ 
+ * New filesystem, filters and disks formats:
+   * DVH partition map.
+@@ -166,7 +183,7 @@ New in 2.00:
+   * multidevice, mirrored and raidz(2,3) ZFS support.
+   * RAID LVM (internal RAIDing) support.
+   * ZFS crypto support.
+-  * ZLE and GZIP on ZFS support.
++  * ZLE, LZ4 and GZIP on ZFS support.
+   * Support ZFS up to 33.
+   * HFS string is now treated like mac-roman and not UTF-8
+   * HFS mtime support.
+-- 
+1.9.3
+
diff --git a/SOURCES/0010-Add-X-option-to-printf-functions.patch b/SOURCES/0010-Add-X-option-to-printf-functions.patch
deleted file mode 100644
index fe4f04d..0000000
--- a/SOURCES/0010-Add-X-option-to-printf-functions.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From 57d2bab2505883efe87bab31a80c42984671e4ac Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 27 Nov 2012 16:58:39 -0200
-Subject: [PATCH 10/34] Add %X option to printf functions.
-
----
- grub-core/kern/misc.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
-index 54db2e1..50f7f53 100644
---- a/grub-core/kern/misc.c
-+++ b/grub-core/kern/misc.c
-@@ -759,7 +759,7 @@ __umoddi3 (grub_uint64_t a, grub_uint64_t b)
- static inline char *
- grub_lltoa (char *str, int c, unsigned long long n)
- {
--  unsigned base = (c == 'x') ? 16 : 10;
-+  unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
-   char *p;
- 
-   if ((long long) n < 0 && c == 'd')
-@@ -774,7 +774,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
-     do
-       {
- 	unsigned d = (unsigned) (n & 0xf);
--	*p++ = (d > 9) ? d + 'a' - 10 : d + '0';
-+	*p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
-       }
-     while (n >>= 4);
-   else
-@@ -847,6 +847,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
- 	{
- 	case 'p':
- 	case 'x':
-+	case 'X':
- 	case 'u':
- 	case 'd':
- 	case 'c':
-@@ -927,6 +928,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
-       switch (c)
- 	{
- 	case 'x':
-+	case 'X':
- 	case 'u':
- 	  args->ptr[curn].type = UNSIGNED_INT + longfmt;
- 	  break;
-@@ -1064,6 +1066,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
- 	  c = 'x';
- 	  /* Fall through. */
- 	case 'x':
-+	case 'X':
- 	case 'u':
- 	case 'd':
- 	  {
--- 
-1.8.4.2
-
diff --git a/SOURCES/0010-strip-.eh_frame-section-from-arm64-efi-kernel.patch b/SOURCES/0010-strip-.eh_frame-section-from-arm64-efi-kernel.patch
new file mode 100644
index 0000000..991cf81
--- /dev/null
+++ b/SOURCES/0010-strip-.eh_frame-section-from-arm64-efi-kernel.patch
@@ -0,0 +1,39 @@
+From 9e9507d2e1eaed4fc2ebe2959c5405687485f613 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Mon, 30 Dec 2013 12:56:19 +0000
+Subject: [PATCH 010/143] strip .eh_frame section from arm64-efi kernel
+
+Fixes grub-mkimage error "relocation 0x105 is not implemented yet."
+---
+ ChangeLog                   | 4 ++++
+ grub-core/Makefile.core.def | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index db84300..8c1ecec 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2013-12-30  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* grub-core/Makefile.core.def: strip .eh_frame section for arm64-efi.
++
+ 2013-12-30  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* NEWS: Add few missing entries. Correct existing ones.
+diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
+index c916246..42443bc 100644
+--- a/grub-core/Makefile.core.def
++++ b/grub-core/Makefile.core.def
+@@ -66,7 +66,7 @@ kernel = {
+   arm_efi_stripflags       = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
+ 
+   arm64_efi_ldflags          = '-Wl,-r,-d';
+-  arm64_efi_stripflags       = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
++  arm64_efi_stripflags       = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version -R .eh_frame';
+ 
+   i386_pc_ldflags          = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags          = '$(TARGET_IMG_BASE_LDOPT),0x9000';
+-- 
+1.9.3
+
diff --git a/SOURCES/0011-DHCP-client-ID-and-UUID-options-added.patch b/SOURCES/0011-DHCP-client-ID-and-UUID-options-added.patch
deleted file mode 100644
index 013a20d..0000000
--- a/SOURCES/0011-DHCP-client-ID-and-UUID-options-added.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From 1c9b8bec85cd2600da2f8a16ed08820300c02bee Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 27 Nov 2012 17:18:53 -0200
-Subject: [PATCH 11/34] DHCP client ID and UUID options added.
-
----
- grub-core/net/bootp.c | 52 +++++++++++++++++++++++++++++++++++++++++++--------
- include/grub/net.h    |  2 ++
- 2 files changed, 46 insertions(+), 8 deletions(-)
-
-diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
-index c14e9de..656bb71 100644
---- a/grub-core/net/bootp.c
-+++ b/grub-core/net/bootp.c
-@@ -60,6 +60,14 @@ set_env_limn_ro (const char *intername, const char *suffix,
-   grub_free (varvalue);
- }
- 
-+static char
-+hexdigit (grub_uint8_t val)
-+{
-+  if (val < 10)
-+    return val + '0';
-+  return val + 'a' - 10;
-+}
-+
- static void
- parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
- {
-@@ -90,6 +98,9 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
- 
-       taglength = *ptr++;
- 
-+      grub_dprintf("net", "DHCP option %u (0x%02x) found with length %u.\n",
-+                   tagtype, tagtype, taglength);
-+
-       switch (tagtype)
- 	{
- 	case GRUB_NET_BOOTP_NETMASK:
-@@ -151,6 +162,39 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
- 	  set_env_limn_ro (name, "extensionspath", (const char *) ptr, taglength);
- 	  break;
- 
-+        case GRUB_NET_BOOTP_CLIENT_ID:
-+	  set_env_limn_ro (name, "clientid", (char *) ptr, taglength);
-+          break;
-+
-+        case GRUB_NET_BOOTP_CLIENT_UUID:
-+            {
-+              if (taglength != 17)
-+                break;
-+
-+              /* The format is 9cfe245e-d0c8-bd45-a79f-54ea5fbd3d97 */
-+
-+              ptr += 1;
-+              taglength -= 1;
-+
-+              char *val = grub_malloc (2 * taglength + 4 + 1);
-+              int i = 0;
-+              int j = 0;
-+              for (i = 0; i < taglength; i++)
-+                {
-+                  val[2 * i + j] = hexdigit (ptr[i] >> 4);
-+                  val[2 * i + 1 + j] = hexdigit (ptr[i] & 0xf);
-+
-+                  if ((i == 3) || (i == 5) || (i == 7) || (i == 9))
-+                    {
-+                      j++;
-+                      val[2 * i + 1+ j] = '-';
-+                    }
-+                }
-+
-+              set_env_limn_ro (name, "clientuuid", (char *) val, 2 * taglength + 4);
-+            }
-+          break;
-+
- 	  /* If you need any other options please contact GRUB
- 	     development team.  */
- 	}
-@@ -319,14 +363,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
-     }
- }
- 
--static char
--hexdigit (grub_uint8_t val)
--{
--  if (val < 10)
--    return val + '0';
--  return val + 'a' - 10;
--}
--
- static grub_err_t
- grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
- 		  int argc, char **args)
-diff --git a/include/grub/net.h b/include/grub/net.h
-index c8ce8db..ea4978d 100644
---- a/include/grub/net.h
-+++ b/include/grub/net.h
-@@ -433,6 +433,8 @@ enum
-     GRUB_NET_BOOTP_DOMAIN = 0x0f,
-     GRUB_NET_BOOTP_ROOT_PATH = 0x11,
-     GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12,
-+    GRUB_NET_BOOTP_CLIENT_ID = 0x3d,
-+    GRUB_NET_BOOTP_CLIENT_UUID = 0x61,
-     GRUB_NET_BOOTP_END = 0xff
-   };
- 
--- 
-1.8.4.2
-
diff --git a/SOURCES/0011-use-grub-boot-aa64.efi-for-boot-images-on-AArch64.patch b/SOURCES/0011-use-grub-boot-aa64.efi-for-boot-images-on-AArch64.patch
new file mode 100644
index 0000000..d48f82e
--- /dev/null
+++ b/SOURCES/0011-use-grub-boot-aa64.efi-for-boot-images-on-AArch64.patch
@@ -0,0 +1,37 @@
+From 7e782c6996ee433c94fb378cbc8db0fa0f663c84 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Tue, 7 Jan 2014 10:38:54 +0400
+Subject: [PATCH 011/143] use {grub,boot}aa64.efi for boot images on AArch64
+
+According to UEFI 2.4 specification, default boot file name on AArch64
+is BOOTAA64.EFI (3.4.1.1 Removable Media Boot Behavior). Also set default
+GRUB image name to grubaa64.efi to match it.
+---
+ util/grub-install.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/util/grub-install.c b/util/grub-install.c
+index 8cfe0ea..4608b80 100644
+--- a/util/grub-install.c
++++ b/util/grub-install.c
+@@ -1091,7 +1091,7 @@ main (int argc, char *argv[])
+ 	      efi_file = "BOOTARM.EFI";
+ 	      break;
+ 	    case GRUB_INSTALL_PLATFORM_ARM64_EFI:
+-	      efi_file = "BOOTAARCH64.EFI";
++	      efi_file = "BOOTAA64.EFI";
+ 	      break;
+ 	    default:
+ 	      grub_util_error ("%s", _("You've found a bug"));
+@@ -1118,7 +1118,7 @@ main (int argc, char *argv[])
+ 	      efi_file = "grubarm.efi";
+ 	      break;
+ 	    case GRUB_INSTALL_PLATFORM_ARM64_EFI:
+-	      efi_file = "grubarm64.efi";
++	      efi_file = "grubaa64.efi";
+ 	      break;
+ 	    default:
+ 	      efi_file = "grub.efi";
+-- 
+1.9.3
+
diff --git a/SOURCES/0012-Search-for-specific-config-file-for-netboot.patch b/SOURCES/0012-Search-for-specific-config-file-for-netboot.patch
deleted file mode 100644
index f951036..0000000
--- a/SOURCES/0012-Search-for-specific-config-file-for-netboot.patch
+++ /dev/null
@@ -1,203 +0,0 @@
-From 981b0dc6adaf2686f84fd90afcea28e841661ed2 Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 27 Nov 2012 17:22:07 -0200
-Subject: [PATCH 12/34] Search for specific config file for netboot
-
-This patch implements a search for a specific configuration when the config
-file is on a remoteserver. It uses the following order:
-   1) DHCP client UUID option.
-   2) MAC address (in lower case hexadecimal with dash separators);
-   3) IP (in upper case hexadecimal) or IPv6;
-   4) The original grub.cfg file.
-
-This procedure is similar to what is used by pxelinux and yaboot:
-http://www.syslinux.org/wiki/index.php/PXELINUX#config
-
-This should close the bugzilla:
-https://bugzilla.redhat.com/show_bug.cgi?id=873406
----
- grub-core/net/net.c     | 118 ++++++++++++++++++++++++++++++++++++++++++++++++
- grub-core/normal/main.c |  18 ++++++--
- include/grub/net.h      |   3 ++
- 3 files changed, 135 insertions(+), 4 deletions(-)
-
-diff --git a/grub-core/net/net.c b/grub-core/net/net.c
-index 0e57e93..f1eefe0 100644
---- a/grub-core/net/net.c
-+++ b/grub-core/net/net.c
-@@ -1663,6 +1663,124 @@ grub_net_restore_hw (void)
-   return GRUB_ERR_NONE;
- }
- 
-+grub_err_t
-+grub_net_search_configfile (char *config)
-+{
-+  grub_size_t config_len;
-+  char *suffix;
-+
-+  auto int search_through (grub_size_t num_tries, grub_size_t slice_size);
-+  int search_through (grub_size_t num_tries, grub_size_t slice_size)
-+    {
-+      while (num_tries-- > 0)
-+        {
-+	  grub_dprintf ("net", "probe %s\n", config);
-+
-+          grub_file_t file;
-+          file = grub_file_open (config);
-+
-+          if (file)
-+            {
-+              grub_file_close (file);
-+              grub_dprintf ("net", "found!\n");
-+              return 0;
-+            }
-+          else
-+            {
-+              if (grub_errno == GRUB_ERR_IO)
-+                grub_errno = GRUB_ERR_NONE;
-+            }
-+
-+          if (grub_strlen (suffix) < slice_size)
-+            break;
-+
-+          config[grub_strlen (config) - slice_size] = '\0';
-+        }
-+
-+      return 1;
-+    }
-+
-+  config_len = grub_strlen (config);
-+  config[config_len] = '-';
-+  suffix = config + config_len + 1;
-+
-+  struct grub_net_network_level_interface *inf;
-+  FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
-+    {
-+      /* By the Client UUID. */
-+
-+      char client_uuid_var[sizeof ("net_") + grub_strlen (inf->name) +
-+                           sizeof ("_clientuuid") + 1];
-+      grub_snprintf (client_uuid_var, sizeof (client_uuid_var),
-+                     "net_%s_clientuuid", inf->name);
-+
-+      const char *client_uuid;
-+      client_uuid = grub_env_get (client_uuid_var);
-+
-+      if (client_uuid)
-+        {
-+          grub_strcpy (suffix, client_uuid);
-+          if (search_through (1, 0) == 0) return GRUB_ERR_NONE;
-+        }
-+
-+      /* By the MAC address. */
-+
-+      /* Add ethernet type */
-+      grub_strcpy (suffix, "01-");
-+
-+      grub_net_hwaddr_to_str (&inf->hwaddress, suffix + 3);
-+
-+      char *ptr;
-+      for (ptr = suffix; *ptr; ptr++)
-+        if (*ptr == ':')
-+          *ptr = '-';
-+
-+      if (search_through (1, 0) == 0) return GRUB_ERR_NONE;
-+
-+      /* By IP address */
-+
-+      switch ((&inf->address)->type)
-+        {
-+        case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4:
-+            {
-+              grub_uint32_t n = grub_be_to_cpu32 ((&inf->address)->ipv4);
-+              grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%02X%02X%02X%02X", \
-+                             ((n >> 24) & 0xff), ((n >> 16) & 0xff), \
-+                             ((n >> 8) & 0xff), ((n >> 0) & 0xff));
-+
-+              if (search_through (8, 1) == 0) return GRUB_ERR_NONE;
-+              break;
-+            }
-+        case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6:
-+            {
-+              char buf[GRUB_NET_MAX_STR_ADDR_LEN];
-+              struct grub_net_network_level_address base;
-+              base.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
-+              grub_memcpy (&base.ipv6, ((&inf->address)->ipv6), 16);
-+              grub_net_addr_to_str (&base, buf);
-+
-+              for (ptr = buf; *ptr; ptr++)
-+                if (*ptr == ':')
-+                  *ptr = '-';
-+
-+              grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%s", buf);
-+              if (search_through (1, 0) == 0) return GRUB_ERR_NONE;
-+              break;
-+            }
-+        case GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV:
-+          return grub_error (GRUB_ERR_BUG, "shouldn't reach here");
-+        default:
-+          return grub_error (GRUB_ERR_BUG,
-+                             "unsupported address type %d", (&inf->address)->type);
-+        }
-+    }
-+
-+  /* Remove the remaining minus sign at the end. */
-+  config[config_len] = '\0';
-+
-+  return GRUB_ERR_NONE;
-+}
-+
- static struct grub_preboot *fini_hnd;
- 
- static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
-diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
-index 4ce71fc..ac4ee63 100644
---- a/grub-core/normal/main.c
-+++ b/grub-core/normal/main.c
-@@ -32,6 +32,7 @@
- #include <grub/i18n.h>
- #include <grub/charset.h>
- #include <grub/script_sh.h>
-+#include <grub/net.h>
- #ifdef GRUB_MACHINE_IEEE1275
- #include <grub/ieee1275/ieee1275.h>
- #endif
-@@ -357,10 +358,19 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
- 
-       prefix = grub_env_get ("prefix");
-       if (prefix)
--	{
--	  config = grub_xasprintf ("%s/grub.cfg", prefix);
--	  if (! config)
--	    goto quit;
-+        {
-+          grub_size_t config_len;
-+          config_len = grub_strlen (prefix) +
-+                      sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
-+          config = grub_malloc (config_len);
-+
-+          if (! config)
-+            goto quit;
-+
-+          grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
-+
-+          if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
-+            grub_net_search_configfile (config);
- 
- 	  grub_enter_normal_mode (config);
- 	  grub_free (config);
-diff --git a/include/grub/net.h b/include/grub/net.h
-index ea4978d..314a610 100644
---- a/include/grub/net.h
-+++ b/include/grub/net.h
-@@ -537,4 +537,7 @@ extern char *grub_net_default_server;
- 
- #define VLANTAG_IDENTIFIER 0x8100
- 
-+grub_err_t
-+grub_net_search_configfile (char *config);
-+
- #endif /* ! GRUB_NET_HEADER */
--- 
-1.8.4.2
-
diff --git a/SOURCES/0012-fix-32-bit-compilation-on-MinGW-w64.patch b/SOURCES/0012-fix-32-bit-compilation-on-MinGW-w64.patch
new file mode 100644
index 0000000..7a9bb92
--- /dev/null
+++ b/SOURCES/0012-fix-32-bit-compilation-on-MinGW-w64.patch
@@ -0,0 +1,45 @@
+From afda7f47601f36a98074d8d21ffb640256f02267 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Tue, 7 Jan 2014 18:43:02 +0400
+Subject: [PATCH 012/143] fix 32 bit compilation on MinGW-w64
+
+Use _FILE_OFFSET_BITS macro to distinguish between native MinGW and
+32 bit under MinGW-64. The latter does not require fseeko/ftello
+redefinition which it already does in case of _FILE_OFFSET_BITS=64.
+---
+ ChangeLog                             | 5 +++++
+ include/grub/osdep/hostfile_windows.h | 3 +++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index 8c1ecec..e87f0a7 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-01-07  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* include/grub/osdep/hostfile_windows.h: Do not redefine fseeko/ftello
++	on MinGW-64 when compiling for 32 bits.
++
+ 2013-12-30  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* grub-core/Makefile.core.def: strip .eh_frame section for arm64-efi.
+diff --git a/include/grub/osdep/hostfile_windows.h b/include/grub/osdep/hostfile_windows.h
+index 36615b2..79efcfa 100644
+--- a/include/grub/osdep/hostfile_windows.h
++++ b/include/grub/osdep/hostfile_windows.h
+@@ -69,8 +69,11 @@ enum grub_util_fd_open_flags_t
+ 
+ #if defined (__MINGW32__) && !defined (__MINGW64__)
+ 
++/* 32 bit on MinGW-64 already redefines them if _FILE_OFFSET_BITS=64 */
++#if !defined(_FILE_OFFSET_BITS)
+ #define fseeko fseeko64
+ #define ftello ftello64
++#endif
+ 
+ #endif
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0013-Change-grub-mkrescue-to-use-bootaa64.efi-too.patch b/SOURCES/0013-Change-grub-mkrescue-to-use-bootaa64.efi-too.patch
new file mode 100644
index 0000000..059475c
--- /dev/null
+++ b/SOURCES/0013-Change-grub-mkrescue-to-use-bootaa64.efi-too.patch
@@ -0,0 +1,44 @@
+From 9981c4e3f366b4795655368a78baa058b18711c6 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Tue, 7 Jan 2014 20:34:25 +0400
+Subject: [PATCH 013/143] Change grub-mkrescue to use bootaa64.efi too
+
+Also add ChangeLog entry for previous change.
+---
+ ChangeLog            | 7 +++++++
+ util/grub-mkrescue.c | 2 +-
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index e87f0a7..0b9fa05 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,12 @@
+ 2014-01-07  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
++	* util/grub-install.c: Use bootaa64.efi instead of bootaarch64.efi on
++	arm64 to comply with EFI specification. Also use grubaa64.efi for
++	consistency.
++	* util/grub-mkrescue.c: Change to use bootaa64.efi too.
++
++2014-01-07  Andrey Borzenkov <arvidjaar@gmail.com>
++
+ 	* include/grub/osdep/hostfile_windows.h: Do not redefine fseeko/ftello
+ 	on MinGW-64 when compiling for 32 bits.
+ 
+diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c
+index 317879d..0d03e55 100644
+--- a/util/grub-mkrescue.c
++++ b/util/grub-mkrescue.c
+@@ -663,7 +663,7 @@ main (int argc, char *argv[])
+       make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_ARM_EFI, "arm-efi", imgname);
+       free (imgname);
+ 
+-      imgname = grub_util_path_concat (2, efidir_efi_boot, "bootaarch64.efi");
++      imgname = grub_util_path_concat (2, efidir_efi_boot, "bootaa64.efi");
+       make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_ARM64_EFI, "arm64-efi",
+ 			     imgname);
+       free (imgname);
+-- 
+1.9.3
+
diff --git a/SOURCES/0013-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/SOURCES/0013-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch
deleted file mode 100644
index 54db0e2..0000000
--- a/SOURCES/0013-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch
+++ /dev/null
@@ -1,251 +0,0 @@
-From d36fd225cab91b4f33fe9217f79951ac5a626811 Mon Sep 17 00:00:00 2001
-From: Fedora Ninjas <grub2-owner@fedoraproject.org>
-Date: Tue, 22 Jan 2013 06:31:38 +0100
-Subject: [PATCH 13/34] blscfg: add blscfg module to parse Boot Loader
- Specification snippets
-
-http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
-
-Works like this:
-
- insmod blscfg
- bls_import
-
-Done! You should now have menu items for your snippets in place.
-
-Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
----
- grub-core/Makefile.core.def |   8 ++
- grub-core/commands/blscfg.c | 201 ++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 209 insertions(+)
- create mode 100644 grub-core/commands/blscfg.c
-
-diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
-index 8c246c6..25d80ee 100644
---- a/grub-core/Makefile.core.def
-+++ b/grub-core/Makefile.core.def
-@@ -747,6 +747,14 @@ module = {
- };
- 
- module = {
-+  name = blscfg;
-+  common = commands/blscfg.c;
-+  enable = i386_efi;
-+  enable = x86_64_efi;
-+  enable = i386_pc;
-+};
-+
-+module = {
-   name = boot;
-   common = commands/boot.c;
-   i386_pc = lib/i386/pc/biosnum.c;
-diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
-new file mode 100644
-index 0000000..4274aca
---- /dev/null
-+++ b/grub-core/commands/blscfg.c
-@@ -0,0 +1,201 @@
-+/*-*- Mode: C; c-basic-offset: 2; indent-tabs-mode: t -*-*/
-+
-+/* bls.c - implementation of the boot loader spec */
-+
-+/*
-+ *  GRUB  --  GRand Unified Bootloader
-+ *
-+ *  GRUB is free software: you can redistribute it and/or modify
-+ *  it under the terms of the GNU General Public License as published by
-+ *  the Free Software Foundation, either version 3 of the License, or
-+ *  (at your option) any later version.
-+ *
-+ *  GRUB is distributed in the hope that it will be useful,
-+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *  GNU General Public License for more details.
-+ *
-+ *  You should have received a copy of the GNU General Public License
-+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
-+ */
-+
-+#include <grub/types.h>
-+#include <grub/misc.h>
-+#include <grub/mm.h>
-+#include <grub/err.h>
-+#include <grub/dl.h>
-+#include <grub/extcmd.h>
-+#include <grub/i18n.h>
-+#include <grub/fs.h>
-+#include <grub/env.h>
-+#include <grub/file.h>
-+#include <grub/normal.h>
-+
-+GRUB_MOD_LICENSE ("GPLv3+");
-+
-+#ifdef GRUB_MACHINE_EFI
-+#define GRUB_LINUX_CMD "linuxefi"
-+#define GRUB_INITRD_CMD "initrdefi"
-+#define GRUB_BLS_CONFIG_PATH "/EFI/fedora/loader/entries/"
-+#define GRUB_BOOT_DEVICE "($boot)"
-+#else
-+#define GRUB_LINUX_CMD "linux"
-+#define GRUB_INITRD_CMD "initrd"
-+#define GRUB_BLS_CONFIG_PATH "/loader/entries/"
-+#define GRUB_BOOT_DEVICE "($root)"
-+#endif
-+
-+static int parse_entry (
-+    const char *filename,
-+    const struct grub_dirhook_info *info __attribute__ ((unused)),
-+    void *data __attribute__ ((unused)))
-+{
-+  grub_size_t n;
-+  char *p;
-+  grub_file_t f = NULL;
-+  grub_off_t sz;
-+  char *title = NULL, *options = NULL, *clinux = NULL, *initrd = NULL, *src = NULL;
-+  const char *args[2] = { NULL, NULL };
-+
-+  if (filename[0] == '.')
-+    return 0;
-+
-+  n = grub_strlen (filename);
-+  if (n <= 5)
-+    return 0;
-+
-+  if (grub_strcmp (filename + n - 5, ".conf") != 0)
-+    return 0;
-+
-+  p = grub_xasprintf (GRUB_BLS_CONFIG_PATH "%s", filename);
-+
-+  f = grub_file_open (p);
-+  if (!f)
-+    goto finish;
-+
-+  sz = grub_file_size (f);
-+  if (sz == GRUB_FILE_SIZE_UNKNOWN || sz > 1024*1024)
-+    goto finish;
-+
-+  for (;;)
-+    {
-+      char *buf;
-+
-+      buf = grub_file_getline (f);
-+      if (!buf)
-+	break;
-+
-+      if (grub_strncmp (buf, "title ", 6) == 0)
-+	{
-+	  grub_free (title);
-+	  title = grub_strdup (buf + 6);
-+	  if (!title)
-+	    goto finish;
-+	}
-+      else if (grub_strncmp (buf, "options ", 8) == 0)
-+	{
-+	  grub_free (options);
-+	  options = grub_strdup (buf + 8);
-+	  if (!options)
-+	    goto finish;
-+	}
-+      else if (grub_strncmp (buf, "linux ", 6) == 0)
-+	{
-+	  grub_free (clinux);
-+	  clinux = grub_strdup (buf + 6);
-+	  if (!clinux)
-+	    goto finish;
-+	}
-+      else if (grub_strncmp (buf, "initrd ", 7) == 0)
-+	{
-+	  grub_free (initrd);
-+	  initrd = grub_strdup (buf + 7);
-+	  if (!initrd)
-+	    goto finish;
-+	}
-+
-+      grub_free(buf);
-+    }
-+
-+  if (!linux)
-+    {
-+      grub_printf ("Skipping file %s with no 'linux' key.", p);
-+      goto finish;
-+    }
-+
-+  args[0] = title ? title : filename;
-+
-+  src = grub_xasprintf ("load_video\n"
-+			"set gfx_payload=keep\n"
-+			"insmod gzio\n"
-+			GRUB_LINUX_CMD " %s%s%s%s\n"
-+			"%s%s%s%s",
-+			GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "",
-+			initrd ? GRUB_INITRD_CMD " " : "", initrd ? GRUB_BOOT_DEVICE : "", initrd ? initrd : "", initrd ? "\n" : "");
-+
-+  grub_normal_add_menu_entry (1, args, NULL, NULL, "bls", NULL, NULL, src, 0);
-+
-+finish:
-+  grub_free (p);
-+  grub_free (title);
-+  grub_free (options);
-+  grub_free (clinux);
-+  grub_free (initrd);
-+  grub_free (src);
-+
-+  if (f)
-+    grub_file_close (f);
-+
-+  return 0;
-+}
-+
-+static grub_err_t
-+grub_cmd_bls_import (grub_extcmd_context_t ctxt __attribute__ ((unused)),
-+		     int argc __attribute__ ((unused)),
-+		     char **args __attribute__ ((unused)))
-+{
-+  grub_fs_t fs;
-+  grub_device_t dev;
-+  static grub_err_t r;
-+  const char *devid;
-+
-+  devid = grub_env_get ("root");
-+  if (!devid)
-+    return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "root");
-+
-+  dev = grub_device_open (devid);
-+  if (!dev)
-+    return grub_errno;
-+
-+  fs = grub_fs_probe (dev);
-+  if (!fs)
-+    {
-+      r = grub_errno;
-+      goto finish;
-+    }
-+
-+  r = fs->dir (dev, GRUB_BLS_CONFIG_PATH, parse_entry, NULL);
-+
-+finish:
-+  if (dev)
-+    grub_device_close (dev);
-+
-+  return r;
-+}
-+
-+static grub_extcmd_t cmd;
-+
-+GRUB_MOD_INIT(bls)
-+{
-+  cmd = grub_register_extcmd ("bls_import",
-+			      grub_cmd_bls_import,
-+			      0,
-+			      NULL,
-+			      N_("Import Boot Loader Specification snippets."),
-+			      NULL);
-+}
-+
-+GRUB_MOD_FINI(bls)
-+{
-+  grub_unregister_extcmd (cmd);
-+}
--- 
-1.8.4.2
-
diff --git a/SOURCES/0014-Move-bash-completion-script-922997.patch b/SOURCES/0014-Move-bash-completion-script-922997.patch
deleted file mode 100644
index a86ab2d..0000000
--- a/SOURCES/0014-Move-bash-completion-script-922997.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 2de33dbfb9f5b2a471e546d10c2ddf578aacdf32 Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Wed, 3 Apr 2013 14:35:34 -0400
-Subject: [PATCH 14/34] Move bash completion script (#922997)
-
-Apparently these go in a new place now.
----
- util/bash-completion.d/Makefile.am | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/util/bash-completion.d/Makefile.am b/util/bash-completion.d/Makefile.am
-index 136287c..0bcdb06 100644
---- a/util/bash-completion.d/Makefile.am
-+++ b/util/bash-completion.d/Makefile.am
-@@ -6,7 +6,7 @@ EXTRA_DIST = $(bash_completion_source)
- 
- CLEANFILES = $(bash_completion_script) config.log
- 
--bashcompletiondir = $(sysconfdir)/bash_completion.d
-+bashcompletiondir = $(datarootdir)/bash-completion/completions
- bashcompletion_DATA = $(bash_completion_script)
- 
- $(bash_completion_script): $(bash_completion_source) $(top_builddir)/config.status
--- 
-1.8.4.2
-
diff --git a/SOURCES/0014-arm64-set-correct-length-of-device-path-end-entry.patch b/SOURCES/0014-arm64-set-correct-length-of-device-path-end-entry.patch
new file mode 100644
index 0000000..d75c4d5
--- /dev/null
+++ b/SOURCES/0014-arm64-set-correct-length-of-device-path-end-entry.patch
@@ -0,0 +1,43 @@
+From f493e0d352e1e8ff8cbafee69878d00487a04808 Mon Sep 17 00:00:00 2001
+From: Leif Lindholm <leif.lindholm@linaro.org>
+Date: Tue, 7 Jan 2014 17:52:50 +0000
+Subject: [PATCH 014/143] arm64: set correct length of device path end entry
+
+The length of the Device Path End entry in the grub_linux_boot()
+function was incorrectly set to 0. This triggers an assert failure
+in debug builds of Tianocore.
+
+Set it to sizeof (grub_efi_device_path_t).
+---
+ ChangeLog                      | 4 ++++
+ grub-core/loader/arm64/linux.c | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 0b9fa05..4ec5517 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-07  Leif Lindholm <leif.lindholm@linaro.org>
++
++	* grub-core/loader/arm64/linux.c: correctly set device path end length.
++
+ 2014-01-07  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* util/grub-install.c: Use bootaa64.efi instead of bootaarch64.efi on
+diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
+index 9d15aad..75ad871 100644
+--- a/grub-core/loader/arm64/linux.c
++++ b/grub-core/loader/arm64/linux.c
+@@ -268,7 +268,7 @@ grub_linux_boot (void)
+ 
+   mempath[1].header.type = GRUB_EFI_END_DEVICE_PATH_TYPE;
+   mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
+-  mempath[1].header.length = 0;
++  mempath[1].header.length = sizeof (grub_efi_device_path_t);
+ 
+   b = grub_efi_system_table->boot_services;
+   status = b->load_image (0, grub_efi_image_handle,
+-- 
+1.9.3
+
diff --git a/SOURCES/0015-Makefile.util.def-grub-macbless-Change-mansection-to.patch b/SOURCES/0015-Makefile.util.def-grub-macbless-Change-mansection-to.patch
new file mode 100644
index 0000000..01bee9d
--- /dev/null
+++ b/SOURCES/0015-Makefile.util.def-grub-macbless-Change-mansection-to.patch
@@ -0,0 +1,39 @@
+From 1c0db34a9597ecccb3ad4899892fb6ff6e22304d Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Wed, 8 Jan 2014 11:05:20 +0000
+Subject: [PATCH 015/143] * Makefile.util.def (grub-macbless): Change
+ mansection to 8.
+
+---
+ ChangeLog         | 4 ++++
+ Makefile.util.def | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 4ec5517..b445f12 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-08  Colin Watson  <cjwatson@ubuntu.com>
++
++	* Makefile.util.def (grub-macbless): Change mansection to 8.
++
+ 2014-01-07  Leif Lindholm <leif.lindholm@linaro.org>
+ 
+ 	* grub-core/loader/arm64/linux.c: correctly set device path end length.
+diff --git a/Makefile.util.def b/Makefile.util.def
+index 985e76c..3c99be2 100644
+--- a/Makefile.util.def
++++ b/Makefile.util.def
+@@ -405,7 +405,7 @@ program = {
+ program = {
+   name = grub-macbless;
+   installdir = sbin;
+-  mansection = 1;
++  mansection = 8;
+   common = util/grub-macbless.c;
+   common = grub-core/osdep/init.c;
+   common = grub-core/kern/emu/argp_common.c;
+-- 
+1.9.3
+
diff --git a/SOURCES/0015-for-ppc-reset-console-display-attr-when-clear-screen.patch b/SOURCES/0015-for-ppc-reset-console-display-attr-when-clear-screen.patch
deleted file mode 100644
index 5d8cb97..0000000
--- a/SOURCES/0015-for-ppc-reset-console-display-attr-when-clear-screen.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 89157f2a9b9c270bd6f2d4bc231cb6713c02128b Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Wed, 24 Apr 2013 10:51:48 -0300
-Subject: [PATCH 15/34] for ppc, reset console display attr when clear screen
-
-This should fix this bugzilla:
-https://bugzilla.redhat.com/show_bug.cgi?id=908519
----
- grub-core/term/terminfo.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
-index 3d48b19..0825ca2 100644
---- a/grub-core/term/terminfo.c
-+++ b/grub-core/term/terminfo.c
-@@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term,
-       /* Clear the screen.  Using serial console, screen(1) only recognizes the
-        * ANSI escape sequence.  Using video console, Apple Open Firmware
-        * (version 3.1.1) only recognizes the literal ^L.  So use both.  */
--      data->cls               = grub_strdup ("\e[2J");
-+      data->cls               = grub_strdup ("\e[2J\e[m");
-       data->reverse_video_on  = grub_strdup ("\e[7m");
-       data->reverse_video_off = grub_strdup ("\e[m");
-       if (grub_strcmp ("ieee1275", str) == 0)
--- 
-1.8.4.2
-
diff --git a/SOURCES/0016-Don-t-write-messages-to-the-screen.patch b/SOURCES/0016-Don-t-write-messages-to-the-screen.patch
deleted file mode 100644
index 574e476..0000000
--- a/SOURCES/0016-Don-t-write-messages-to-the-screen.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-From dbd8d3b9c616bf5a9e2b825a25bc441f092a11a2 Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Wed, 15 May 2013 13:30:20 -0400
-Subject: [PATCH 16/34] Don't write messages to the screen
-
-Writing messages to the screen before the menus or boot splash
-happens so quickly it looks like something is wrong and isn't
-very appealing.
----
- grub-core/boot/i386/pc/boot.S     |  3 ---
- grub-core/boot/i386/pc/diskboot.S |  5 -----
- grub-core/gettext/gettext.c       | 15 ---------------
- grub-core/kern/main.c             |  5 -----
- util/grub.d/10_linux.in           |  7 -------
- 5 files changed, 35 deletions(-)
-
-diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S
-index b4975e2..432a472 100644
---- a/grub-core/boot/i386/pc/boot.S
-+++ b/grub-core/boot/i386/pc/boot.S
-@@ -249,9 +249,6 @@ real_start:
- 	/* save drive reference first thing! */
- 	pushw	%dx
- 
--	/* print a notification message on the screen */
--	MSG(notification_string)
--
- 	/* set %si to the disk address packet */
- 	movw	$disk_address_packet, %si
- 
-diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S
-index d030a14..a494d02 100644
---- a/grub-core/boot/i386/pc/diskboot.S
-+++ b/grub-core/boot/i386/pc/diskboot.S
-@@ -50,11 +50,6 @@ _start:
- 	/* save drive reference first thing! */
- 	pushw	%dx
- 
--	/* print a notification message on the screen */
--	pushw	%si
--	MSG(notification_string)
--	popw	%si
--
- 	/* this sets up for the first run through "bootloop" */
- 	movw	$LOCAL(firstlist), %di
- 
-diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c
-index 4880cef..1e5c21d 100644
---- a/grub-core/gettext/gettext.c
-+++ b/grub-core/gettext/gettext.c
-@@ -437,13 +437,9 @@ grub_gettext_env_write_lang (struct grub_env_var *var
-   grub_err_t err;
-   err = grub_gettext_init_ext (&main_context, val, grub_env_get ("locale_dir"),
- 			       grub_env_get ("prefix"));
--  if (err)
--    grub_print_error ();
- 
-   err = grub_gettext_init_ext (&secondary_context, val,
- 			       grub_env_get ("secondary_locale_dir"), 0);
--  if (err)
--    grub_print_error ();
- 
-   return grub_strdup (val);
- }
-@@ -455,8 +451,6 @@ grub_gettext_reread_prefix (const char *val)
-   err = grub_gettext_init_ext (&main_context, grub_env_get ("lang"), 
- 			       grub_env_get ("locale_dir"),
- 			       val);
--  if (err)
--    grub_print_error ();
- }
- 
- static char *
-@@ -466,8 +460,6 @@ read_main (struct grub_env_var *var
-   grub_err_t err;
-   err = grub_gettext_init_ext (&main_context, grub_env_get ("lang"), val,
- 			       grub_env_get ("prefix"));
--  if (err)
--    grub_print_error ();
-   return grub_strdup (val);
- }
- 
-@@ -478,9 +470,6 @@ read_secondary (struct grub_env_var *var
-   grub_err_t err;
-   err = grub_gettext_init_ext (&secondary_context, grub_env_get ("lang"), val,
- 			       0);
--  if (err)
--    grub_print_error ();
--
-   return grub_strdup (val);
- }
- 
-@@ -506,12 +495,8 @@ GRUB_MOD_INIT (gettext)
- 
-   err = grub_gettext_init_ext (&main_context, lang, grub_env_get ("locale_dir"),
- 			       grub_env_get ("prefix"));
--  if (err)
--    grub_print_error ();
-   err = grub_gettext_init_ext (&secondary_context, lang,
- 			       grub_env_get ("secondary_locale_dir"), 0);
--  if (err)
--    grub_print_error ();
- 
-   grub_register_variable_hook ("locale_dir", NULL, read_main);
-   grub_register_variable_hook ("secondary_locale_dir", NULL, read_secondary);
-diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
-index 8ab7794..da47b18 100644
---- a/grub-core/kern/main.c
-+++ b/grub-core/kern/main.c
-@@ -268,11 +268,6 @@ grub_main (void)
- 
-   grub_boot_time ("After machine init.");
- 
--  /* Hello.  */
--  grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
--  grub_printf ("Welcome to GRUB!\n\n");
--  grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
--
-   grub_load_config ();
- 
-   grub_boot_time ("Before loading embedded modules.");
-diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
-index ad34cc0..e762e1f 100644
---- a/util/grub.d/10_linux.in
-+++ b/util/grub.d/10_linux.in
-@@ -126,29 +126,22 @@ linux_entry ()
-     fi
-     printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
-   fi
--  message="$(gettext_printf "Loading Linux %s ..." ${version})"
-   if [ -d /sys/firmware/efi ]; then
-     sed "s/^/$submenu_indentation/" << EOF
--	echo	'$(echo "$message" | grub_quote)'
- 	linuxefi ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
- EOF
-   else
-     sed "s/^/$submenu_indentation/" << EOF
--	echo	'$(echo "$message" | grub_quote)'
- 	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
- EOF
-   fi
-   if test -n "${initrd}" ; then
--    # TRANSLATORS: ramdisk isn't identifier. Should be translated.
--    message="$(gettext_printf "Loading initial ramdisk ...")"
-     if [ -d /sys/firmware/efi ]; then
-       sed "s/^/$submenu_indentation/" << EOF
--	echo	'$(echo "$message" | grub_quote)'
- 	initrdefi ${rel_dirname}/${initrd}
- EOF
-     else
-       sed "s/^/$submenu_indentation/" << EOF
--	echo	'$message'
- 	initrd	${rel_dirname}/${initrd}
- EOF
-     fi
--- 
-1.8.4.2
-
diff --git a/SOURCES/0016-add-part_apple-to-EFI-rescue-image-to-fix-missing-pr.patch b/SOURCES/0016-add-part_apple-to-EFI-rescue-image-to-fix-missing-pr.patch
new file mode 100644
index 0000000..8e6278f
--- /dev/null
+++ b/SOURCES/0016-add-part_apple-to-EFI-rescue-image-to-fix-missing-pr.patch
@@ -0,0 +1,48 @@
+From 3aea6cc46177a90056ba60381e6387377fe40c99 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sun, 12 Jan 2014 15:29:21 +0400
+Subject: [PATCH 016/143] add part_apple to EFI rescue image to fix missing
+ prefix
+
+On Mac rescue image is booted from HFS+ partition, so bootpath looks like
+/ACPI(a0341d0,0)/PCI(1,1f)/ATAPI(0,0,0)/HD(3,5d1,ca3,0000000000000000,20,0)/EndEntire
+
+grub fails to find device for this path because it cannot scan partition
+table. The simplest fix is to add part_apple by default.
+---
+ util/grub-mkrescue.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c
+index 0d03e55..34e0b7a 100644
+--- a/util/grub-mkrescue.c
++++ b/util/grub-mkrescue.c
+@@ -653,11 +653,15 @@ main (int argc, char *argv[])
+       make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64-efi", imgname);
+       free (imgname);
+ 
++      grub_install_push_module ("part_apple");
+       img64 = grub_util_path_concat (2, efidir_efi_boot, "bootx64.efi");
+       make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_X86_64_EFI, "x86_64-efi", img64);
++      grub_install_pop_module ();
+ 
++      grub_install_push_module ("part_apple");
+       img32 = grub_util_path_concat (2, efidir_efi_boot, "bootia32.efi");
+       make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_I386_EFI, "i386-efi", img32);
++      grub_install_pop_module ();
+ 
+       imgname = grub_util_path_concat (2, efidir_efi_boot, "bootarm.efi");
+       make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_ARM_EFI, "arm-efi", imgname);
+@@ -707,7 +711,9 @@ main (int argc, char *argv[])
+       free (efidir);
+     }
+ 
++  grub_install_push_module ("part_apple");
+   make_image_fwdisk (GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275, "powerpc-ieee1275", "powerpc-ieee1275/core.elf");
++  grub_install_pop_module ();
+ 
+   if (source_dirs[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275])
+     {
+-- 
+1.9.3
+
diff --git a/SOURCES/0017-Don-t-print-GNU-GRUB-header.patch b/SOURCES/0017-Don-t-print-GNU-GRUB-header.patch
deleted file mode 100644
index 92c3026..0000000
--- a/SOURCES/0017-Don-t-print-GNU-GRUB-header.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 71aab2b998c1c0c7e4b599f90f01adf754829c76 Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Wed, 15 May 2013 13:53:48 -0400
-Subject: [PATCH 17/34] Don't print GNU GRUB header
-
-No one cares.
----
- grub-core/normal/main.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
-index ac4ee63..3edb687 100644
---- a/grub-core/normal/main.c
-+++ b/grub-core/normal/main.c
-@@ -204,6 +204,7 @@ grub_normal_init_page (struct grub_term_output *term,
-  
-   grub_term_cls (term);
- 
-+#if 0
-   msg_formatted = grub_xasprintf (_("GNU GRUB  version %s"), PACKAGE_VERSION);
-   if (!msg_formatted)
-     return;
-@@ -227,6 +228,7 @@ grub_normal_init_page (struct grub_term_output *term,
-   grub_putcode ('\n', term);
-   grub_putcode ('\n', term);
-   grub_free (unicode_msg);
-+#endif
- }
- 
- static void
--- 
-1.8.4.2
-
diff --git a/SOURCES/0017-freebsd-hostdisk.c-is-only-ever-compiled-on-FreeBSD.patch b/SOURCES/0017-freebsd-hostdisk.c-is-only-ever-compiled-on-FreeBSD.patch
new file mode 100644
index 0000000..232b518
--- /dev/null
+++ b/SOURCES/0017-freebsd-hostdisk.c-is-only-ever-compiled-on-FreeBSD.patch
@@ -0,0 +1,48 @@
+From a433d177585c8355c6ede67469a521d05cf1e9d7 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Fri, 17 Jan 2014 02:30:52 +0000
+Subject: [PATCH 017/143] freebsd/hostdisk.c is only ever compiled on FreeBSD
+
+* grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Remove
+redundant preprocessor conditional.
+---
+ ChangeLog                          | 5 +++++
+ grub-core/osdep/freebsd/hostdisk.c | 2 --
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index b445f12..6613b4e 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-01-17  Colin Watson  <cjwatson@debian.org>
++
++	* grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Remove
++	redundant preprocessor conditional.
++
+ 2014-01-08  Colin Watson  <cjwatson@ubuntu.com>
+ 
+ 	* Makefile.util.def (grub-macbless): Change mansection to 8.
+diff --git a/grub-core/osdep/freebsd/hostdisk.c b/grub-core/osdep/freebsd/hostdisk.c
+index bd5fddb..eb202dc 100644
+--- a/grub-core/osdep/freebsd/hostdisk.c
++++ b/grub-core/osdep/freebsd/hostdisk.c
+@@ -108,7 +108,6 @@ grub_util_fd_open (const char *os_dev, int flags)
+ 
+   ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
+ 
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+   if (! (sysctl_oldflags & 0x10)
+       && sysctlbyname ("kern.geom.debugflags", NULL , 0, &sysctl_oldflags, sysctl_size))
+     {
+@@ -116,7 +115,6 @@ grub_util_fd_open (const char *os_dev, int flags)
+       close (ret);
+       return GRUB_UTIL_FD_INVALID;
+     }
+-#endif
+ 
+   return ret;
+ }
+-- 
+1.9.3
+
diff --git a/SOURCES/0018-Don-t-add-to-highlighted-row.patch b/SOURCES/0018-Don-t-add-to-highlighted-row.patch
deleted file mode 100644
index 94c399e..0000000
--- a/SOURCES/0018-Don-t-add-to-highlighted-row.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From f69af9256a85c2f63ebce23957fa70cdabe0c3ee Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Wed, 15 May 2013 17:49:45 -0400
-Subject: [PATCH 18/34] Don't add '*' to highlighted row
-
-It is already highlighted.
----
- grub-core/normal/menu_text.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
-index 2ff2941..daf92b5 100644
---- a/grub-core/normal/menu_text.c
-+++ b/grub-core/normal/menu_text.c
-@@ -242,7 +242,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
-       unicode_title[i] = ' ';
- 
-   if (data->geo.num_entries > 1)
--    grub_putcode (highlight ? '*' : ' ', data->term);
-+    grub_putcode (' ', term);
- 
-   grub_print_ucs4_menu (unicode_title,
- 			unicode_title + len,
--- 
-1.8.4.2
-
diff --git a/SOURCES/0018-Prefer-more-portable-test-1-constructs.patch b/SOURCES/0018-Prefer-more-portable-test-1-constructs.patch
new file mode 100644
index 0000000..dc4fc53
--- /dev/null
+++ b/SOURCES/0018-Prefer-more-portable-test-1-constructs.patch
@@ -0,0 +1,109 @@
+From 4ec08b960f6de1190dea9fe7e6ab3b4b249840e5 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Fri, 17 Jan 2014 15:24:50 +0000
+Subject: [PATCH 018/143] Prefer more portable test(1) constructs
+
+* util/grub.d/00_header.in (make_timeout): Use && rather than test
+-a.
+* util/grub.d/10_windows.in: Likewise.
+* util/grub.d/10_netbsd.in (netbsd_load_fs_module): Use || rather
+than test -o.
+* util/grub.d/30_os-prober.in: Use && rather than test -a, and ||
+rather than test -o.
+---
+ ChangeLog                   | 12 +++++++++++-
+ util/grub.d/00_header.in    |  2 +-
+ util/grub.d/10_netbsd.in    |  2 +-
+ util/grub.d/10_windows.in   |  4 ++--
+ util/grub.d/30_os-prober.in |  4 ++--
+ 5 files changed, 17 insertions(+), 7 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 6613b4e..c8e95a6 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,4 +1,14 @@
+-2014-01-17  Colin Watson  <cjwatson@debian.org>
++2014-01-17  Colin Watson  <cjwatson@ubuntu.com>
++
++	* util/grub.d/00_header.in (make_timeout): Use && rather than test
++	-a.
++	* util/grub.d/10_windows.in: Likewise.
++	* util/grub.d/10_netbsd.in (netbsd_load_fs_module): Use || rather
++	than test -o.
++	* util/grub.d/30_os-prober.in: Use && rather than test -a, and ||
++	rather than test -o.
++
++2014-01-17  Colin Watson  <cjwatson@ubuntu.com>
+ 
+ 	* grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Remove
+ 	redundant preprocessor conditional.
+diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
+index 0c82f23..ce2ec81 100644
+--- a/util/grub.d/00_header.in
++++ b/util/grub.d/00_header.in
+@@ -285,7 +285,7 @@ make_timeout ()
+     if [ "x${3}" != "x" ] ; then
+ 	timeout="${2}"
+ 	style="${3}"
+-    elif [ "x${1}" != "x" -a "x${1}" != "x0" ] ; then
++    elif [ "x${1}" != "x" ] && [ "x${1}" != "x0" ] ; then
+ 	# Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.
+ 	timeout="${1}"
+ 	if [ "x${2}" != "x0" ] ; then
+diff --git a/util/grub.d/10_netbsd.in b/util/grub.d/10_netbsd.in
+index 29a0e41..9988a42 100644
+--- a/util/grub.d/10_netbsd.in
++++ b/util/grub.d/10_netbsd.in
+@@ -69,7 +69,7 @@ netbsd_load_fs_module ()
+   kversion=$(zcat -f "${kernel}" | strings | sed -n -e '/^@(#)NetBSD/ { s/^@(#)NetBSD \([0-9\.]*\) .*$/\1/g ; p ; q ; }')
+   kmodule="/stand/${karch}/${kversion}/modules/${kmod}/${kmod}.kmod"
+ 
+-  if test -z "$karch" -o -z "$kversion" -o ! -f "${kmodule}"; then
++  if test -z "$karch" || test -z "$kversion" || test ! -f "${kmodule}"; then
+     return
+   fi
+ 
+diff --git a/util/grub.d/10_windows.in b/util/grub.d/10_windows.in
+index 9025914..48bd955 100644
+--- a/util/grub.d/10_windows.in
++++ b/util/grub.d/10_windows.in
+@@ -66,11 +66,11 @@ for drv in $drives ; do
+   osid=
+ 
+   # Check for Vista bootmgr.
+-  if [ -f "$dir"/bootmgr -a -f "$dir"/boot/bcd ] ; then
++  if [ -f "$dir"/bootmgr ] && [ -f "$dir"/boot/bcd ] ; then
+     OS="$(gettext "Windows Vista/7 (loader)")"
+     osid=bootmgr
+   # Check for NTLDR.
+-  elif [ -f "$dir"/ntldr -a -f "$dir"/ntdetect.com -a -f "$dir"/boot.ini ] ; then
++  elif [ -f "$dir"/ntldr ] && [ -f "$dir"/ntdetect.com ] && [ -f "$dir"/boot.ini ] ; then
+     OS=`get_os_name_from_boot_ini "$dir"/boot.ini` || OS="$(gettext "Windows NT/2000/XP (loader)")"
+     osid=ntldr
+     needmap=t
+diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
+index 0470e66..7cf8487 100644
+--- a/util/grub.d/30_os-prober.in
++++ b/util/grub.d/30_os-prober.in
+@@ -30,7 +30,7 @@ if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
+   exit 0
+ fi
+ 
+-if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
++if [ -z "`which os-prober 2> /dev/null`" ] || [ -z "`which linux-boot-prober 2> /dev/null`" ] ; then
+   # missing os-prober and/or linux-boot-prober
+   exit 0
+ fi
+@@ -119,7 +119,7 @@ for OS in ${OSPROBED} ; do
+       EXPUUID="${EXPUUID}@${DEVICE#*@}"
+   fi
+ 
+-  if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" -a "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
++  if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
+     echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
+     continue
+   fi
+-- 
+1.9.3
+
diff --git a/SOURCES/0019-Don-t-add-to-highlighted-row.patch b/SOURCES/0019-Don-t-add-to-highlighted-row.patch
deleted file mode 100644
index ff67da3..0000000
--- a/SOURCES/0019-Don-t-add-to-highlighted-row.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 4dc5d2ee1a2cfe0fe120dd83b69fbdeee63b6c1e Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Wed, 15 May 2013 17:49:45 -0400
-Subject: [PATCH 19/34] Don't add '*' to highlighted row
-
-It is already highlighted.
----
- grub-core/normal/menu_text.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
-index daf92b5..2f84fcc 100644
---- a/grub-core/normal/menu_text.c
-+++ b/grub-core/normal/menu_text.c
-@@ -242,7 +242,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
-       unicode_title[i] = ' ';
- 
-   if (data->geo.num_entries > 1)
--    grub_putcode (' ', term);
-+    grub_putcode (' ', data->term);
- 
-   grub_print_ucs4_menu (unicode_title,
- 			unicode_title + len,
--- 
-1.8.4.2
-
diff --git a/SOURCES/0019-NEWS-Add-few-missing-entries.patch b/SOURCES/0019-NEWS-Add-few-missing-entries.patch
new file mode 100644
index 0000000..260d72b
--- /dev/null
+++ b/SOURCES/0019-NEWS-Add-few-missing-entries.patch
@@ -0,0 +1,100 @@
+From e18da008f74a3c5f27a191e4f7be80c02a49f2fe Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sat, 18 Jan 2014 16:31:10 +0100
+Subject: [PATCH 019/143] 	* NEWS: Add few missing entries.
+
+---
+ ChangeLog |  4 ++++
+ NEWS      | 18 +++++++++++++++---
+ 2 files changed, 19 insertions(+), 3 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index c8e95a6..6a19f85 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* NEWS: Add few missing entries.
++
+ 2014-01-17  Colin Watson  <cjwatson@ubuntu.com>
+ 
+ 	* util/grub.d/00_header.in (make_timeout): Use && rather than test
+diff --git a/NEWS b/NEWS
+index 49a2459..a61df94 100644
+--- a/NEWS
++++ b/NEWS
+@@ -15,6 +15,8 @@ New in 2.02:
+   * GPT PReP.
+   * New `progress' module that shows progress information while reading
+     files.
++  * ZFS features support.
++  * ZFS LZ4 support.
+ 
+ * New/improved terminal and video support:
+   * Monochrome text (matching `hercules' in GRUB Legacy).
+@@ -36,6 +38,7 @@ New in 2.02:
+   * Enable `linux16' on all x86 platforms, not just BIOS.
+   * New TrueCrypt ISO loader.
+   * multiboot2 boot-services EFI specification.
++  * multiboot2 EFI memory map specification.
+   * multiboot2 full-file specfication.
+ 
+ * New/improved network support:
+@@ -51,12 +54,15 @@ New in 2.02:
+   * Ability to launch another payload from flash or disk
+   * Coreboot framebuffer
+   * CBMEMC support (both logging and inspecting logs)
+-  * Inspecting coreboot timestamps.
+-  * Inspecting coreboot tables.
++  * Command for inspecting coreboot timestamps (`coreboot_boottime').
++  * Command for inspecting coreboot tables (`lscoreboot').
++  * New target default_payload.elf.
++  * Increased maximal core size.
+ 
+ * New/improved platform support:
+   * New `efifwsetup' and `lsefi' commands on EFI platforms.
+   * New `cmosdump' and `cmosset' commands on platforms with CMOS support.
++  * New command `pcidump' for PCI platforms.
+   * Improve opcode parsing in ACPI halt implementation.
+   * Use the TSC as a possible time source on i386-ieee1275.
+   * Merge PowerPC grub-mkrescue implementation with the common one.
+@@ -77,6 +83,8 @@ New in 2.02:
+   * Support Yeeloong 3A.
+   * Add `cpuid --pae' option to detect Physical Address Extension on x86.
+   * Support for USB debug dongles.
++  * Support for *-emu on all platforms (previously only i386/x86_64 worked).
++  * Support *-emu on Windows.
+ 
+ * Security:
+   * Add optional facility to enforce that all files read by the core image
+@@ -88,6 +96,8 @@ New in 2.02:
+   * Initialise USB ports in parallel.
+   * New `testspeed' command to test file read speed.
+   * Speed-up gfxterm by storing intermediate results in more compact format.
++  * Lazy LVM/mdraid scan.
++  * Disk hints.
+ 
+ * Scripting:
+   * New `eval' and `tr' commands.
+@@ -105,7 +115,8 @@ New in 2.02:
+   * grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone
+     rewritten in C.  They should now work in supported non-Unix-like
+     environments.
+-  * Native mingw support, including ability to install on EFI under windows.
++  * Native mingw support.
++  * Ability to install on EFI under windows.
+   * Reorganise timeout handling using new `timeout_style' environment
+     variable and `GRUB_TIMEOUT_STYLE' configuration key for grub-mkconfig.
+     Menu hotkeys pressed during a hidden timeout now boot the corresponding
+@@ -122,6 +133,7 @@ New in 2.02:
+   * Partial mingw64 x86_64-efi compile support (highly experimental).
+   * Partial mingw32 i386-* (other than already present i386-pc)
+     compile support (highly experimental).
++  * Support for grub-mkpasswd on Windows.
+   * Eliminate the use of AutoGen.  This allowed some performance
+     improvements to the build system.
+   * Remove variable length arrays.
+-- 
+1.9.3
+
diff --git a/SOURCES/0020-Message-string-cleanups.patch b/SOURCES/0020-Message-string-cleanups.patch
deleted file mode 100644
index d4051fd..0000000
--- a/SOURCES/0020-Message-string-cleanups.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 8236dcd99b7e259d40317cafce236c8e77e2d9c5 Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Fri, 7 Jun 2013 11:09:04 -0400
-Subject: [PATCH 20/34] Message string cleanups
-
-Make use of terminology consistent. Remove jargon.
----
- grub-core/normal/menu_text.c | 21 +++++++++------------
- 1 file changed, 9 insertions(+), 12 deletions(-)
-
-diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
-index 2f84fcc..9d20c6b 100644
---- a/grub-core/normal/menu_text.c
-+++ b/grub-core/normal/menu_text.c
-@@ -157,9 +157,8 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
- 
-   if (edit)
-     {
--      ret += grub_print_message_indented_real (_("Minimum Emacs-like screen editing is \
--supported. TAB lists completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a \
--command-line or ESC to discard edits and return to the GRUB menu."),
-+      ret += grub_print_message_indented_real (_("Press Ctrl-x or F10 to start, Ctrl-c or F2 for a \
-+command prompt or Escape to discard edits and return to the menu. Pressing Tab lists possible completions."),
- 					       STANDARD_MARGIN, STANDARD_MARGIN,
- 					       term, dry_run);
-     }
-@@ -167,8 +166,8 @@ command-line or ESC to discard edits and return to the GRUB menu."),
-     {
-       char *msg_translated;
- 
--      msg_translated = grub_xasprintf (_("Use the %C and %C keys to select which "
--					 "entry is highlighted."),
-+      msg_translated = grub_xasprintf (_("Use the %C and %C keys to change the "
-+					 "selection."),
- 				       GRUB_UNICODE_UPARROW,
- 				       GRUB_UNICODE_DOWNARROW);
-       if (!msg_translated)
-@@ -181,17 +180,15 @@ command-line or ESC to discard edits and return to the GRUB menu."),
-       if (nested)
- 	{
- 	  ret += grub_print_message_indented_real
--	    (_("Press enter to boot the selected OS, "
--	       "`e' to edit the commands before booting "
--	       "or `c' for a command-line. ESC to return previous menu."),
-+	    (_("Press 'e' to edit the selected item, "
-+	       "or 'c' for a command prompt. Press Escape to return to the previous menu."),
- 	     STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
- 	}
-       else
- 	{
- 	  ret += grub_print_message_indented_real
--	    (_("Press enter to boot the selected OS, "
--	       "`e' to edit the commands before booting "
--	       "or `c' for a command-line."),
-+	    (_("Press 'e' to edit the selected item, "
-+	       "or 'c' for a command prompt."),
- 	     STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
- 	}	
-     }
-@@ -440,7 +437,7 @@ menu_text_print_timeout (int timeout, void *dataptr)
-       || data->timeout_msg == TIMEOUT_TERSE_NO_MARGIN)
-     msg_translated = grub_xasprintf (_("%ds"), timeout);
-   else
--    msg_translated = grub_xasprintf (_("The highlighted entry will be executed automatically in %ds."), timeout);
-+    msg_translated = grub_xasprintf (_("The selected entry will be started automatically in %ds."), timeout);
-   if (!msg_translated)
-     {
-       grub_print_error ();
--- 
-1.8.4.2
-
diff --git a/SOURCES/0020-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch b/SOURCES/0020-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch
new file mode 100644
index 0000000..92794b8
--- /dev/null
+++ b/SOURCES/0020-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch
@@ -0,0 +1,90 @@
+From 29c96f00677e1dd2a9df4de645a7f5fab7b736a1 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sat, 18 Jan 2014 16:41:47 +0100
+Subject: [PATCH 020/143] 	* grub-core/kern/efi/efi.c: Ensure that the
+ result starts with / 	and has no //.
+
+---
+ ChangeLog                |  5 +++++
+ grub-core/kern/efi/efi.c | 25 +++++++++++++++++--------
+ 2 files changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 6a19f85..b04a4ef 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* grub-core/kern/efi/efi.c: Ensure that the result starts with /
++	and has no //.
++
++2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* NEWS: Add few missing entries.
+ 
+ 2014-01-17  Colin Watson  <cjwatson@ubuntu.com>
+diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
+index b253141..b9eb1ab 100644
+--- a/grub-core/kern/efi/efi.c
++++ b/grub-core/kern/efi/efi.c
+@@ -309,7 +309,7 @@ grub_efi_modules_addr (void)
+ char *
+ grub_efi_get_filename (grub_efi_device_path_t *dp0)
+ {
+-  char *name = 0, *p;
++  char *name = 0, *p, *pi;
+   grub_size_t filesize = 0;
+   grub_efi_device_path_t *dp;
+ 
+@@ -328,7 +328,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
+ 	  grub_efi_uint16_t len;
+ 	  len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
+ 		 / sizeof (grub_efi_char16_t));
+-	  filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 1;
++	  filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 2;
+ 	}
+ 
+       dp = GRUB_EFI_NEXT_DEVICE_PATH (dp);
+@@ -356,12 +356,12 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
+ 	  grub_efi_file_path_device_path_t *fp;
+ 	  grub_efi_uint16_t len;
+ 
+-	  if (p != name)
+-	    *p++ = '/';
++	  *p++ = '/';
+ 
+ 	  len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
+ 		 / sizeof (grub_efi_char16_t));
+ 	  fp = (grub_efi_file_path_device_path_t *) dp;
++
+ 	  p = (char *) grub_utf16_to_utf8 ((unsigned char *) p, fp->path_name, len);
+ 	}
+ 
+@@ -370,10 +370,19 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
+ 
+   *p = '\0';
+ 
+-  /* EFI breaks paths with backslashes.  */
+-  for (p = name; *p; p++)
+-    if (*p == '\\')
+-      *p = '/';
++  for (pi = name, p = name; *pi;)
++    {
++      /* EFI breaks paths with backslashes.  */
++      if (*pi == '\\' || *pi == '/')
++	{
++	  *p++ = '/';
++	  while (*pi == '\\' || *pi == '/')
++	    pi++;
++	  continue;
++	}
++      *p++ = *pi++;
++    }
++  *p = '\0';
+ 
+   return name;
+ }
+-- 
+1.9.3
+
diff --git a/SOURCES/0021-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch b/SOURCES/0021-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch
deleted file mode 100644
index dc0a59a..0000000
--- a/SOURCES/0021-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 8724eb81bc2549c66e02a90da3e969e5e37d55d1 Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Fri, 7 Jun 2013 14:08:23 -0400
-Subject: [PATCH 21/34] Fix border spacing now that we aren't displaying it
-
----
- grub-core/normal/menu_text.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
-index 9d20c6b..aa3454f 100644
---- a/grub-core/normal/menu_text.c
-+++ b/grub-core/normal/menu_text.c
-@@ -331,12 +331,12 @@ grub_menu_init_page (int nested, int edit,
-   int empty_lines = 1;
-   int version_msg = 1;
- 
--  geo->border = 1;
--  geo->first_entry_x = 1 /* margin */ + 1 /* border */;
-+  geo->border = 0;
-+  geo->first_entry_x = 0 /* margin */ + 0 /* border */;
-   geo->entry_width = grub_term_width (term) - 5;
- 
-   geo->first_entry_y = 2 /* two empty lines*/
--    + 1 /* GNU GRUB version text  */ + 1 /* top border */;
-+    + 0 /* GNU GRUB version text  */ + 1 /* top border */;
- 
-   geo->timeout_lines = 2;
- 
--- 
-1.8.4.2
-
diff --git a/SOURCES/0021-util-grub-mount.c-Extend-GCC-warning-workaround-to-g.patch b/SOURCES/0021-util-grub-mount.c-Extend-GCC-warning-workaround-to-g.patch
new file mode 100644
index 0000000..b62d429
--- /dev/null
+++ b/SOURCES/0021-util-grub-mount.c-Extend-GCC-warning-workaround-to-g.patch
@@ -0,0 +1,47 @@
+From fa9e3a9aa30988c2339e9d05c81b5d91534f4049 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sat, 18 Jan 2014 16:43:29 +0100
+Subject: [PATCH 021/143] 	* util/grub-mount.c: Extend GCC warning
+ workaround to grub-mount.
+
+---
+ ChangeLog         | 4 ++++
+ util/grub-mount.c | 7 ++++++-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index b04a4ef..8534158 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,9 @@
+ 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* util/grub-mount.c: Extend GCC warning workaround to grub-mount.
++
++2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/kern/efi/efi.c: Ensure that the result starts with /
+ 	and has no //.
+ 
+diff --git a/util/grub-mount.c b/util/grub-mount.c
+index 118881e..19de2e6 100644
+--- a/util/grub-mount.c
++++ b/util/grub-mount.c
+@@ -41,8 +41,13 @@
+ #include <string.h>
+ #include <stdlib.h>
+ 
++#pragma GCC diagnostic ignored "-Wmissing-prototypes"
++#pragma GCC diagnostic ignored "-Wmissing-declarations"
++#include <argp.h>
++#pragma GCC diagnostic error "-Wmissing-prototypes"
++#pragma GCC diagnostic error "-Wmissing-declarations"
++
+ #include "progname.h"
+-#include "argp.h"
+ 
+ static const char *root = NULL;
+ grub_device_t dev = NULL;
+-- 
+1.9.3
+
diff --git a/SOURCES/0022-Use-the-correct-indentation-for-the-term-help-text.patch b/SOURCES/0022-Use-the-correct-indentation-for-the-term-help-text.patch
deleted file mode 100644
index 6a4c702..0000000
--- a/SOURCES/0022-Use-the-correct-indentation-for-the-term-help-text.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 177935794addb8b5161f8f59375965e6b5e9eae9 Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Fri, 7 Jun 2013 14:08:49 -0400
-Subject: [PATCH 22/34] Use the correct indentation for the term help text
-
-That is consistent with the menu help text
----
- grub-core/normal/main.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
-index 3edb687..6c24a07 100644
---- a/grub-core/normal/main.c
-+++ b/grub-core/normal/main.c
-@@ -418,8 +418,8 @@ grub_normal_reader_init (int nested)
-     grub_normal_init_page (term, 1);
-     grub_term_setcursor (term, 1);
- 
--    if (grub_term_width (term) > 3 + STANDARD_MARGIN + 20)
--      grub_print_message_indented (msg_formatted, 3, STANDARD_MARGIN, term);
-+    if (grub_term_width (term) > 2 * STANDARD_MARGIN + 20)
-+      grub_print_message_indented (msg_formatted, STANDARD_MARGIN, STANDARD_MARGIN, term);
-     else
-       grub_print_message_indented (msg_formatted, 0, 0, term);
-     grub_putcode ('\n', term);
--- 
-1.8.4.2
-
diff --git a/SOURCES/0022-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch b/SOURCES/0022-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch
new file mode 100644
index 0000000..d46ca9d
--- /dev/null
+++ b/SOURCES/0022-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch
@@ -0,0 +1,153 @@
+From 3bea802b45b9c98f70753370522fa6e47ba8966b Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sat, 18 Jan 2014 19:50:54 +0400
+Subject: [PATCH 022/143] reintroduce BUILD_LDFLAGS for the cross-compile case
+
+This allows providing separate LDFLAGS for build and host environments, which
+are not necessary the same for cross-compile case. In particular, it allows
+building host programs statically to not depend on presence of libraries at
+run-time (e.g. MinGW DLLs on Windows) while continue to use default dynamic
+linking at build time.
+
+Also fix obsolete comments in confgure.ac - we do use different environment
+for build and host now.
+---
+ ChangeLog             |  7 +++++++
+ INSTALL               |  3 ++-
+ Makefile.am           |  8 ++++----
+ configure.ac          | 13 ++++++++-----
+ grub-core/Makefile.am |  6 +++---
+ 5 files changed, 24 insertions(+), 13 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 8534158..9c3ef2e 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,10 @@
++2014-01-07  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* configure.ac: Add support for BUILD_LDFLAGS.
++	* Makefile.am: Use BUILD_LDFLAGS for build time programs here ...
++	* grub-core/Makefile.am: ... and here.
++	* INSTALL: Mention BUILD_LDFLAGS.
++
+ 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* util/grub-mount.c: Extend GCC warning workaround to grub-mount.
+diff --git a/INSTALL b/INSTALL
+index db12530..b67cd7f 100644
+--- a/INSTALL
++++ b/INSTALL
+@@ -168,7 +168,8 @@ corresponding platform are not needed for the platform in question.
+        generate sin and cos tables.
+     2. BUILD_CFLAGS= for C options for build.
+     3. BUILD_CPPFLAGS= for C preprocessor options for build.
+-    4. BUILD_FREETYPE= for freetype-config for build (optional).
++    4. BUILD_LDFLAGS= for linker options for build.
++    5. BUILD_FREETYPE= for freetype-config for build (optional).
+ 
+   - For host
+     1. --host= to autoconf name of host.
+diff --git a/Makefile.am b/Makefile.am
+index 320e86f..1bbec0e 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -67,20 +67,20 @@ endif
+ starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
+ 
+ build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
+-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
++	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
+ CLEANFILES += build-grub-mkfont
+ 
+ garbage-gen: util/garbage-gen.c
+-	$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS)  $^
++	$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS)  $^
+ CLEANFILES += garbage-gen
+ EXTRA_DIST += util/garbage-gen.c
+ 
+ build-grub-gen-asciih: util/grub-gen-asciih.c
+-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
++	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
+ CLEANFILES += build-grub-gen-asciih
+ 
+ build-grub-gen-widthspec: util/grub-gen-widthspec.c
+-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
++	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
+ CLEANFILES += build-grub-gen-widthspec
+ 
+ if COND_STARFIELD
+diff --git a/configure.ac b/configure.ac
+index 7c5d080..2e4cf3c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -26,11 +26,10 @@ dnl This is necessary because the target type in autoconf does not
+ dnl describe such a system very well.
+ dnl
+ dnl The current strategy is to use variables with no prefix (such as
+-dnl CC, CFLAGS, etc.) for the host type as well as the build type,
+-dnl because GRUB does not need to use those variables for the build
+-dnl type, so there is no conflict. Variables with the prefix "TARGET_"
+-dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
+-dnl type.
++dnl CC, CFLAGS, etc.) for the host type, variables with prefix "BUILD_"
++dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables
++dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are
++dnl used for the target type. See INSTALL for full list of variables.
+ 
+ AC_INIT([GRUB],[2.02~beta2],[bug-grub@gnu.org])
+ 
+@@ -477,6 +476,7 @@ AC_SUBST(HOST_CC)
+ AC_SUBST(BUILD_CC)
+ AC_SUBST(BUILD_CFLAGS)
+ AC_SUBST(BUILD_CPPFLAGS)
++AC_SUBST(BUILD_LDFLAGS)
+ AC_SUBST(TARGET_CC)
+ AC_SUBST(TARGET_NM)
+ AC_SUBST(TARGET_RANLIB)
+@@ -1290,10 +1290,12 @@ SAVED_CC="$CC"
+ SAVED_CPP="$CPP"
+ SAVED_CFLAGS="$CFLAGS"
+ SAVED_CPPFLAGS="$CPPFLAGS"
++SAVED_LDFLAGS="$LDFLAGS"
+ CC="$BUILD_CC"
+ CPP="$BUILD_CPP"
+ CFLAGS="$BUILD_CFLAGS"
+ CPPFLAGS="$BUILD_CPPFLAGS"
++LDFLAGS="$BUILD_LDFAGS"
+ 
+ unset ac_cv_c_bigendian
+ unset ac_cv_header_ft2build_h
+@@ -1356,6 +1358,7 @@ CC="$SAVED_CC"
+ CPP="$SAVED_CPP"
+ CFLAGS="$SAVED_CFLAGS"
+ CPPFLAGS="$SAVED_CPPFLAGS"
++LDFLAGS="$SAVED_LDFLAGS"
+ 
+ 
+ DJVU_FONT_SOURCE=
+diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
+index 1b3142d..13b7979 100644
+--- a/grub-core/Makefile.am
++++ b/grub-core/Makefile.am
+@@ -27,14 +27,14 @@ CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
+ CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
+ 
+ build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
+-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
++	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
+ 
+ build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
+-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
++	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
+ 
+ # gentrigtables
+ gentrigtables: gentrigtables.c
+-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< $(BUILD_LIBM)
++	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
+ CLEANFILES += gentrigtables
+ 
+ # trigtables.c
+-- 
+1.9.3
+
diff --git a/SOURCES/0023-Indent-menu-entries.patch b/SOURCES/0023-Indent-menu-entries.patch
deleted file mode 100644
index 63991ae..0000000
--- a/SOURCES/0023-Indent-menu-entries.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 2a7f555009e4b66e9143fc2cea020c97c5eaf253 Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Fri, 7 Jun 2013 14:30:55 -0400
-Subject: [PATCH 23/34] Indent menu entries
-
----
- grub-core/normal/menu_text.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
-index aa3454f..01b6f1c 100644
---- a/grub-core/normal/menu_text.c
-+++ b/grub-core/normal/menu_text.c
-@@ -239,7 +239,8 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
-       unicode_title[i] = ' ';
- 
-   if (data->geo.num_entries > 1)
--    grub_putcode (' ', data->term);
-+    for (i = 0; i < STANDARD_MARGIN; i++)
-+      grub_putcode (' ', data->term);
- 
-   grub_print_ucs4_menu (unicode_title,
- 			unicode_title + len,
--- 
-1.8.4.2
-
diff --git a/SOURCES/0023-grub-core-term-terminfo.c-Recognize-keys-F1-F12.patch b/SOURCES/0023-grub-core-term-terminfo.c-Recognize-keys-F1-F12.patch
new file mode 100644
index 0000000..ecd6686
--- /dev/null
+++ b/SOURCES/0023-grub-core-term-terminfo.c-Recognize-keys-F1-F12.patch
@@ -0,0 +1,155 @@
+From ac660e42875162e599f50c085cb646c633cf376d Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sat, 18 Jan 2014 16:57:35 +0100
+Subject: [PATCH 023/143] 	* grub-core/term/terminfo.c: Recognize keys
+ F1-F12.
+
+---
+ ChangeLog                 |  4 +++
+ grub-core/term/terminfo.c | 86 +++++++++++++++++++++++++++--------------------
+ 2 files changed, 54 insertions(+), 36 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 9c3ef2e..bdfbf44 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/term/terminfo.c: Recognize keys F1-F12.
++
+ 2014-01-07  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* configure.ac: Add support for BUILD_LDFLAGS.
+diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
+index 3d48b19..f0d3e3d 100644
+--- a/grub-core/term/terminfo.c
++++ b/grub-core/term/terminfo.c
+@@ -460,28 +460,31 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
+ 	{'@', GRUB_TERM_KEY_INSERT},
+       };
+ 
+-    static struct
+-    {
+-      char key;
+-      unsigned ascii;
+-    }
+-    four_code_table[] =
++    static unsigned four_code_table[] =
+       {
+-	{'1', GRUB_TERM_KEY_HOME},
+-	{'3', GRUB_TERM_KEY_DC},
+-	{'5', GRUB_TERM_KEY_PPAGE},
+-	{'6', GRUB_TERM_KEY_NPAGE},
+-	{'7', GRUB_TERM_KEY_HOME},
+-	{'8', GRUB_TERM_KEY_END}
++	[1] = GRUB_TERM_KEY_HOME,
++	[3] = GRUB_TERM_KEY_DC,
++	[5] = GRUB_TERM_KEY_PPAGE,
++	[6] = GRUB_TERM_KEY_NPAGE,
++	[7] = GRUB_TERM_KEY_HOME,
++	[8] = GRUB_TERM_KEY_END,
++	[17] = GRUB_TERM_KEY_F6,
++	[18] = GRUB_TERM_KEY_F7,
++	[19] = GRUB_TERM_KEY_F8,
++	[20] = GRUB_TERM_KEY_F9,
++	[21] = GRUB_TERM_KEY_F10,
++	[23] = GRUB_TERM_KEY_F11,
++	[24] = GRUB_TERM_KEY_F12,
+       };
+     char fx_key[] = 
+       { 'P', 'Q', 'w', 'x', 't', 'u',
+-        'q', 'r', 'p', 'M', 'A', 'B' };
++        'q', 'r', 'p', 'M', 'A', 'B', 'H', 'F' };
+     unsigned fx_code[] = 
+ 	{ GRUB_TERM_KEY_F1, GRUB_TERM_KEY_F2, GRUB_TERM_KEY_F3,
+ 	  GRUB_TERM_KEY_F4, GRUB_TERM_KEY_F5, GRUB_TERM_KEY_F6,
+ 	  GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, GRUB_TERM_KEY_F9,
+-	  GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12 };
++	  GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12,
++	  GRUB_TERM_KEY_HOME, GRUB_TERM_KEY_END };
+     unsigned i;
+ 
+     if (c == '\e')
+@@ -492,19 +495,13 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
+ 	  {
+ 	    CONTINUE_READ;
+ 
+-	    switch (c)
+-	      {
+-	      case 'H':
+-		keys[0] = GRUB_TERM_KEY_HOME;
+-		*len = 1;
+-		return;
+-	      case 'F':
+-		keys[0] = GRUB_TERM_KEY_END;
+-		*len = 1;
+-		return;
+-	      default:
+-		return;
+-	      }
++	    for (i = 0; i < ARRAY_SIZE (fx_key); i++)
++	      if (fx_key[i] == c)
++		{
++		  keys[0] = fx_code[i];
++		  *len = 1;
++		  return;
++		}
+ 	  }
+ 
+ 	if (c != '[')
+@@ -523,6 +520,15 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
+ 
+     switch (c)
+       {
++      case '[':
++	CONTINUE_READ;
++	if (c >= 'A' && c <= 'E')
++	  {
++	    keys[0] = GRUB_TERM_KEY_F1 + c - 'A';
++	    *len = 1;
++	    return;
++	  }
++	return;
+       case 'O':
+ 	CONTINUE_READ;
+ 	for (i = 0; i < ARRAY_SIZE (fx_key); i++)
+@@ -555,18 +561,26 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
+ 	  return;
+ 	}	  
+ 
+-      default:
+-	for (i = 0; i < ARRAY_SIZE (four_code_table); i++)
+-	  if (four_code_table[i].key == c)
++      case '1' ... '9':
++	{
++	  unsigned val = c - '0';
++	  CONTINUE_READ;
++	  if (c >= '0' && c <= '9')
+ 	    {
++	      val = val * 10 + (c - '0');
+ 	      CONTINUE_READ;
+-	      if (c != '~')
+-		return;
+-	      keys[0] = four_code_table[i].ascii;
+-	      *len = 1;
+-	      return;
+ 	    }
+-	return;
++	  if (c != '~')
++	    return;
++	  if (val >= ARRAY_SIZE (four_code_table)
++	      || four_code_table[val] == 0)
++	    return;
++	  keys[0] = four_code_table[val];
++	  *len = 1;
++	  return;
++	}
++	default:
++	  return;
+       }
+   }
+ #undef CONTINUE_READ
+-- 
+1.9.3
+
diff --git a/SOURCES/0024-Fix-ChangeLog-date.patch b/SOURCES/0024-Fix-ChangeLog-date.patch
new file mode 100644
index 0000000..7663147
--- /dev/null
+++ b/SOURCES/0024-Fix-ChangeLog-date.patch
@@ -0,0 +1,25 @@
+From 6e5cf6b00fa82e5a02135ea5e21230ee44c72087 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sat, 18 Jan 2014 20:01:16 +0400
+Subject: [PATCH 024/143] Fix ChangeLog date
+
+---
+ ChangeLog | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index bdfbf44..fcbf220 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -2,7 +2,7 @@
+ 
+ 	* grub-core/term/terminfo.c: Recognize keys F1-F12.
+ 
+-2014-01-07  Andrey Borzenkov <arvidjaar@gmail.com>
++2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* configure.ac: Add support for BUILD_LDFLAGS.
+ 	* Makefile.am: Use BUILD_LDFLAGS for build time programs here ...
+-- 
+1.9.3
+
diff --git a/SOURCES/0024-Fix-margins.patch b/SOURCES/0024-Fix-margins.patch
deleted file mode 100644
index 1898659..0000000
--- a/SOURCES/0024-Fix-margins.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From b506c9c46234afdf142a4bfa32d159916193f720 Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Fri, 7 Jun 2013 14:59:36 -0400
-Subject: [PATCH 24/34] Fix margins
-
----
- grub-core/normal/menu_text.c | 8 +++-----
- 1 file changed, 3 insertions(+), 5 deletions(-)
-
-diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
-index 01b6f1c..ead3391 100644
---- a/grub-core/normal/menu_text.c
-+++ b/grub-core/normal/menu_text.c
-@@ -333,17 +333,15 @@ grub_menu_init_page (int nested, int edit,
-   int version_msg = 1;
- 
-   geo->border = 0;
--  geo->first_entry_x = 0 /* margin */ + 0 /* border */;
--  geo->entry_width = grub_term_width (term) - 5;
-+  geo->first_entry_x = 0; /* no margin */
-+  geo->entry_width = grub_term_width (term) - 1;
- 
--  geo->first_entry_y = 2 /* two empty lines*/
--    + 0 /* GNU GRUB version text  */ + 1 /* top border */;
-+  geo->first_entry_y = 3; /* three empty lines*/
- 
-   geo->timeout_lines = 2;
- 
-   /* 3 lines for timeout message and bottom margin.  2 lines for the border.  */
-   geo->num_entries = grub_term_height (term) - geo->first_entry_y
--    - 1 /* bottom border */
-     - 1 /* empty line before info message*/
-     - geo->timeout_lines /* timeout */
-     - 1 /* empty final line  */;
--- 
-1.8.4.2
-
diff --git a/SOURCES/0025-Add-support-for-UEFI-operating-systems-returned-by-o.patch b/SOURCES/0025-Add-support-for-UEFI-operating-systems-returned-by-o.patch
deleted file mode 100644
index ad04b48..0000000
--- a/SOURCES/0025-Add-support-for-UEFI-operating-systems-returned-by-o.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From c0ed0f4c72c02ce90fd4a4a775b14b7510018216 Mon Sep 17 00:00:00 2001
-From: Matthew Garrett <matthew.garrett@nebula.com>
-Date: Wed, 12 Jun 2013 11:51:49 -0400
-Subject: [PATCH 25/34] Add support for UEFI operating systems returned by
- os-prober
-
-os-prober returns UEFI operating systems in the form:
-
-path:long-name:name
-
-where path is the path under the EFI directory on the ESP. This is in
-contrast to legacy OSes, where path is the device string. Handle this case.
----
- util/grub.d/30_os-prober.in | 22 ++++++++++++++++++----
- 1 file changed, 18 insertions(+), 4 deletions(-)
-
-diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
-index 0470e66..8650a79 100644
---- a/util/grub.d/30_os-prober.in
-+++ b/util/grub.d/30_os-prober.in
-@@ -319,9 +319,23 @@ EOF
- EOF
-     ;;
-     *)
--      echo -n "  "
--      # TRANSLATORS: %s is replaced by OS name.
--      gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2
--    ;;
-+      case ${DEVICE} in
-+	*.efi)
-+	  cat << EOF
-+menuentry '$(echo "${LONGNAME}" | grub_quote)' {
-+EOF
-+	  save_default_entry | grub_add_tab
-+	  cat << EOF
-+	  chainloader /EFI/${DEVICE}
-+	  boot
-+}
-+EOF
-+	  ;;
-+	*)
-+          echo -n "  "
-+          # TRANSLATORS: %s is replaced by OS name.
-+          gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2
-+        ;;
-+      esac
-   esac
- done
--- 
-1.8.4.2
-
diff --git a/SOURCES/0025-Use-_W64-to-detect-MinGW-W64-32-instead-of-_FILE_OFF.patch b/SOURCES/0025-Use-_W64-to-detect-MinGW-W64-32-instead-of-_FILE_OFF.patch
new file mode 100644
index 0000000..04f7e73
--- /dev/null
+++ b/SOURCES/0025-Use-_W64-to-detect-MinGW-W64-32-instead-of-_FILE_OFF.patch
@@ -0,0 +1,47 @@
+From bb3e1a1e8448f3ea9489b5ebfcec799196bc862f Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sat, 18 Jan 2014 20:04:11 +0400
+Subject: [PATCH 025/143] Use _W64 to detect MinGW W64-32 instead of
+ _FILE_OFFSET_BITS
+
+In 94cee4a4c201bb506377b2c26e072eee8cb19d6f I overlooked that config.h
+unconditionally sets _FILE_OFFSET_BITS, so it cannot be used to detect
+MinGW W64 environment. It looks like Emacs folks already found
+solution; instead of _FILE_OFFSET_BITS use _W64 as suggested in
+http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00723.html
+---
+ ChangeLog                             | 5 +++++
+ include/grub/osdep/hostfile_windows.h | 4 ++--
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index fcbf220..5aac7c1 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* include/grub/osdep/hostfile_windows.h: Use _W64 instead of
++	FILE_OFFSET_BITS to differentiate between native MinGW and Mingw W64.
++
+ 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/term/terminfo.c: Recognize keys F1-F12.
+diff --git a/include/grub/osdep/hostfile_windows.h b/include/grub/osdep/hostfile_windows.h
+index 79efcfa..bf6451b 100644
+--- a/include/grub/osdep/hostfile_windows.h
++++ b/include/grub/osdep/hostfile_windows.h
+@@ -69,8 +69,8 @@ enum grub_util_fd_open_flags_t
+ 
+ #if defined (__MINGW32__) && !defined (__MINGW64__)
+ 
+-/* 32 bit on MinGW-64 already redefines them if _FILE_OFFSET_BITS=64 */
+-#if !defined(_FILE_OFFSET_BITS)
++/* 32 bit on Mingw-w64 already redefines them if _FILE_OFFSET_BITS=64 */
++#ifndef _W64
+ #define fseeko fseeko64
+ #define ftello ftello64
+ #endif
+-- 
+1.9.3
+
diff --git a/SOURCES/0026-Disable-GRUB-video-support-for-IBM-power-machines.patch b/SOURCES/0026-Disable-GRUB-video-support-for-IBM-power-machines.patch
deleted file mode 100644
index ab81756..0000000
--- a/SOURCES/0026-Disable-GRUB-video-support-for-IBM-power-machines.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 5cd617fb2727a545de7a22439bd7d1a8e712e85a Mon Sep 17 00:00:00 2001
-From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
-Date: Tue, 11 Jun 2013 15:14:05 -0300
-Subject: [PATCH 26/34] Disable GRUB video support for IBM power machines
-
-Should fix the problem in bugzilla:
-https://bugzilla.redhat.com/show_bug.cgi?id=973205
----
- grub-core/kern/ieee1275/cmain.c  | 5 ++++-
- grub-core/video/ieee1275.c       | 9 ++++++---
- include/grub/ieee1275/ieee1275.h | 2 ++
- 3 files changed, 12 insertions(+), 4 deletions(-)
-
-diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c
-index d92ae14..409c922 100644
---- a/grub-core/kern/ieee1275/cmain.c
-+++ b/grub-core/kern/ieee1275/cmain.c
-@@ -88,7 +88,10 @@ grub_ieee1275_find_options (void)
-     is_qemu = 1;
- 
-   if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0)
--    grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS);
-+    {
-+      grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS);
-+      grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT);
-+    }
- 
-   /* Old Macs have no key repeat, newer ones have fully working one.
-      The ones inbetween when repeated key generates an escaoe sequence
-diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c
-index 0b150ec..813ab38 100644
---- a/grub-core/video/ieee1275.c
-+++ b/grub-core/video/ieee1275.c
-@@ -351,9 +351,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter =
- 
- GRUB_MOD_INIT(ieee1275_fb)
- {
--  find_display ();
--  if (display)
--    grub_video_register (&grub_video_ieee1275_adapter);
-+  if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT))
-+    {
-+      find_display ();
-+      if (display)
-+        grub_video_register (&grub_video_ieee1275_adapter);
-+    }
- }
- 
- GRUB_MOD_FINI(ieee1275_fb)
-diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
-index 2b64a92..29f3a1d 100644
---- a/include/grub/ieee1275/ieee1275.h
-+++ b/include/grub/ieee1275/ieee1275.h
-@@ -145,6 +145,8 @@ enum grub_ieee1275_flag
-   GRUB_IEEE1275_FLAG_BROKEN_REPEAT,
- 
-   GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN,
-+
-+  GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT
- };
- 
- extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
--- 
-1.8.4.2
-
diff --git a/SOURCES/0026-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch b/SOURCES/0026-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch
new file mode 100644
index 0000000..744c2a8
--- /dev/null
+++ b/SOURCES/0026-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch
@@ -0,0 +1,174 @@
+From 5ac7afd762d11b4c91d5756222c3abf5862203de Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sat, 18 Jan 2014 20:41:24 +0400
+Subject: [PATCH 026/143] add BUILD_EXEEXT support to fix make clean on Windows
+
+Add $(BUILD_EXEEXT) to ensure files are removed. Also add CLEANFILES where
+appropriate.
+---
+ ChangeLog             |  7 +++++++
+ Makefile.am           | 16 ++++++++--------
+ Makefile.util.def     |  2 +-
+ configure.ac          | 21 ++++++++++++++++-----
+ grub-core/Makefile.am | 14 ++++++++------
+ 5 files changed, 40 insertions(+), 20 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 5aac7c1..dad2da2 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,12 @@
+ 2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
++	* configure.ac: Add support for BUILD_EXEEXT and use it ...
++	* Makefile.am: ... here.
++	* Makefile.util.def: ... and here.
++	* grub-core/Makefile.am: ... and here.
++
++2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
++
+ 	* include/grub/osdep/hostfile_windows.h: Use _W64 instead of
+ 	FILE_OFFSET_BITS to differentiate between native MinGW and Mingw W64.
+ 
+diff --git a/Makefile.am b/Makefile.am
+index 1bbec0e..aa526f5 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -66,22 +66,22 @@ endif
+ 
+ starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
+ 
+-build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
++build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
+ 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
+-CLEANFILES += build-grub-mkfont
++CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
+ 
+-garbage-gen: util/garbage-gen.c
++garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
+ 	$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS)  $^
+-CLEANFILES += garbage-gen
++CLEANFILES += garbage-gen$(BUILD_EXEEXT)
+ EXTRA_DIST += util/garbage-gen.c
+ 
+-build-grub-gen-asciih: util/grub-gen-asciih.c
++build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
+ 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
+-CLEANFILES += build-grub-gen-asciih
++CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
+ 
+-build-grub-gen-widthspec: util/grub-gen-widthspec.c
++build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
+ 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
+-CLEANFILES += build-grub-gen-widthspec
++CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
+ 
+ if COND_STARFIELD
+ starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
+diff --git a/Makefile.util.def b/Makefile.util.def
+index 3c99be2..83df212 100644
+--- a/Makefile.util.def
++++ b/Makefile.util.def
+@@ -708,7 +708,7 @@ script = {
+   name = grub-fs-tester;
+   common = tests/util/grub-fs-tester.in;
+   installdir = noinst;
+-  dependencies = garbage-gen;
++  dependencies = 'garbage-gen$(BUILD_EXEEXT)';
+ };
+ 
+ script = {
+diff --git a/configure.ac b/configure.ac
+index 2e4cf3c..cf3de3b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -38,7 +38,8 @@ AC_CONFIG_AUX_DIR([build-aux])
+ # We don't want -g -O2 by default in CFLAGS
+ : ${CFLAGS=""}
+ 
+-# Checks for host and target systems.
++# Checks for build, host and target systems.
++AC_CANONICAL_BUILD
+ AC_CANONICAL_HOST
+ save_program_prefix="${program_prefix}"
+ AC_CANONICAL_TARGET
+@@ -422,6 +423,16 @@ case "$build_os" in
+   haiku*)				BUILD_LIBM= ;;
+   *) 					BUILD_LIBM=-lm ;;
+ esac
++
++dnl FIXME proper test seems to require too deep dive into Autoconf internals.
++dnl For now just list known platforms that we support.
++
++case "$build_os" in
++  cygwin*|mingw32*|mingw64*)		BUILD_EXEEXT=.exe ;;
++  *)					BUILD_EXEEXT= ;;
++esac
++AC_SUBST(BUILD_EXEEXT)
++
+ # For gnulib.
+ gl_INIT
+ 
+@@ -765,11 +776,11 @@ if test x"$platform" = xemu ; then
+     *windows* | *cygwin* | *mingw*)
+       if test x${target_cpu} = xi386 ; then
+         grub_cv_target_cc_link_format=-mi386pe;
+-	TARGET_OBJ2ELF='./build-grub-pe2elf';
++	TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
+       fi
+       if test x${target_cpu} = xx86_64 ; then
+         grub_cv_target_cc_link_format=-mi386pep;
+-	TARGET_OBJ2ELF='./build-grub-pep2elf';
++	TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)';
+       fi
+       TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
+       ;;
+@@ -803,10 +814,10 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
+   fi
+   TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
+   if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then
+-    TARGET_OBJ2ELF='./build-grub-pe2elf';
++    TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
+   fi
+   if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
+-    TARGET_OBJ2ELF='./build-grub-pep2elf';
++    TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)';
+   fi
+ fi
+ 
+diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
+index 13b7979..826b3dd 100644
+--- a/grub-core/Makefile.am
++++ b/grub-core/Makefile.am
+@@ -26,20 +26,22 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
+ CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
+ CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
+ 
+-build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
++build-grub-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
+ 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
++CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT)
+ 
+-build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
++build-grub-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
+ 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
++CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT)
+ 
+ # gentrigtables
+-gentrigtables: gentrigtables.c
++gentrigtables$(BUILD_EXEEXT): gentrigtables.c
+ 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
+-CLEANFILES += gentrigtables
++CLEANFILES += gentrigtables$(BUILD_EXEEXT)
+ 
+ # trigtables.c
+-trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac
+-	./gentrigtables > $@
++trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac
++	./gentrigtables$(BUILD_EXEEXT) > $@
+ CLEANFILES += trigtables.c
+ 
+ # XXX Use Automake's LEX & YACC support
+-- 
+1.9.3
+
diff --git a/SOURCES/0027-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch b/SOURCES/0027-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch
deleted file mode 100644
index 54dae2d..0000000
--- a/SOURCES/0027-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From af7ac4e7b446061fd865b61b90df37871984421b Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Fri, 21 Jun 2013 14:44:08 -0400
-Subject: [PATCH 27/34] Use -2 instead of -1 for our right-hand margin, so
- linewrapping works (#976643).
-
-Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
----
- grub-core/normal/menu_text.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
-index ead3391..bc1fc71 100644
---- a/grub-core/normal/menu_text.c
-+++ b/grub-core/normal/menu_text.c
-@@ -334,7 +334,7 @@ grub_menu_init_page (int nested, int edit,
- 
-   geo->border = 0;
-   geo->first_entry_x = 0; /* no margin */
--  geo->entry_width = grub_term_width (term) - 1;
-+  geo->entry_width = grub_term_width (term) - 2;
- 
-   geo->first_entry_y = 3; /* three empty lines*/
- 
--- 
-1.8.4.2
-
diff --git a/SOURCES/0027-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch b/SOURCES/0027-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch
new file mode 100644
index 0000000..76918fd
--- /dev/null
+++ b/SOURCES/0027-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch
@@ -0,0 +1,281 @@
+From 09194ac15b3c348cbf147e8ea27b982b57a7a778 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sat, 18 Jan 2014 21:22:57 +0400
+Subject: [PATCH 027/143] fix include loop on MinGW due to libintl.h pulling
+ stdio.h
+
+In file included from ./include/grub/dl.h:23:0,
+                 from grub-core/lib/libgcrypt-grub/cipher/rfc2268.c:3:
+./include/grub/list.h:34:18: warning: conflicting types for 'grub_list_push' [en
+abled by default]
+ void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
+                  ^
+./include/grub/symbol.h:68:25: note: in definition of macro 'EXPORT_FUNC'
+ # define EXPORT_FUNC(x) x
+                         ^
+In file included from ./include/grub/fs.h:30:0,
+                 from ./include/grub/file.h:25,
+                 from ./grub-core/lib/posix_wrap/stdio.h:23,
+                 from c:\mingw\include\libintl.h:314,
+                 from ./include/grub/i18n.h:33,
+                 from ./include/grub/misc.h:27,
+                 from ./include/grub/list.h:25,
+                 from ./include/grub/dl.h:28,
+                 from grub-core/lib/libgcrypt-grub/cipher/rfc2268.c:3:
+./include/grub/partition.h:106:3: note: previous implicit declaration of 'grub_l
+ist_push' was here
+   grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list),
+   ^
+list.h needs just ATTRIBUTE_ERROR from misc.h; split compiler features
+into separate file grub/compiler.h and include it instead.
+---
+ ChangeLog                          | 14 +++++++++++
+ grub-core/commands/fileXX.c        |  1 +
+ grub-core/efiemu/prepare.c         |  1 +
+ grub-core/loader/i386/xen_file.c   |  1 +
+ grub-core/loader/i386/xen_fileXX.c |  1 +
+ grub-core/video/capture.c          |  1 +
+ include/grub/command.h             |  1 +
+ include/grub/compiler.h            | 51 ++++++++++++++++++++++++++++++++++++++
+ include/grub/dl.h                  |  1 +
+ include/grub/list.h                |  4 +--
+ include/grub/misc.h                | 29 +---------------------
+ include/grub/procfs.h              |  1 +
+ 12 files changed, 76 insertions(+), 30 deletions(-)
+ create mode 100644 include/grub/compiler.h
+
+diff --git a/ChangeLog b/ChangeLog
+index dad2da2..dad469b 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,19 @@
+ 2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
++	* include/grub/misc.h: Move macros for compiler features to ...
++	* include/grub/compiler.h: ... new file.
++	* include/grub/list.h: Include <grub/compiler.h> instead of <grub/misc.h>.
++	* grub-core/commands/fileXX.c: Include <grub/misc.h>.
++	* grub-core/efiemu/prepare.c: Include <grub/misc.h>.
++	* grub-core/loader/i386/xen_file.c: Include <grub/misc.h>.
++	* grub-core/loader/i386/xen_fileXX.c: Include <grub/misc.h>.
++	* grub-core/video/capture.c: Include <grub/misc.h>.
++	* include/grub/command.h: Include <grub/misc.h>.
++	* include/grub/dl.h: Include <grub/misc.h>.
++	* include/grub/procfs.h: Include <grub/misc.h>.
++
++2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
++
+ 	* configure.ac: Add support for BUILD_EXEEXT and use it ...
+ 	* Makefile.am: ... here.
+ 	* Makefile.util.def: ... and here.
+diff --git a/grub-core/commands/fileXX.c b/grub-core/commands/fileXX.c
+index c9857ff..58e1094 100644
+--- a/grub-core/commands/fileXX.c
++++ b/grub-core/commands/fileXX.c
+@@ -18,6 +18,7 @@
+ 
+ #include <grub/fileid.h>
+ #include <grub/elfload.h>
++#include <grub/misc.h>
+ 
+ #pragma GCC diagnostic ignored "-Wcast-align"
+ 
+diff --git a/grub-core/efiemu/prepare.c b/grub-core/efiemu/prepare.c
+index fb1b25d..84c3368 100644
+--- a/grub-core/efiemu/prepare.c
++++ b/grub-core/efiemu/prepare.c
+@@ -21,6 +21,7 @@
+ #include <grub/err.h>
+ #include <grub/mm.h>
+ #include <grub/types.h>
++#include <grub/misc.h>
+ #include <grub/efiemu/efiemu.h>
+ #include <grub/crypto.h>
+ 
+diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c
+index ebbf6aa..ff23235 100644
+--- a/grub-core/loader/i386/xen_file.c
++++ b/grub-core/loader/i386/xen_file.c
+@@ -18,6 +18,7 @@
+ 
+ #include <grub/xen_file.h>
+ #include <grub/i386/linux.h>
++#include <grub/misc.h>
+ 
+ grub_elf_t
+ grub_xen_file (grub_file_t file)
+diff --git a/grub-core/loader/i386/xen_fileXX.c b/grub-core/loader/i386/xen_fileXX.c
+index 6df0015..73a5f90 100644
+--- a/grub-core/loader/i386/xen_fileXX.c
++++ b/grub-core/loader/i386/xen_fileXX.c
+@@ -17,6 +17,7 @@
+  */
+ 
+ #include <grub/xen_file.h>
++#include <grub/misc.h>
+ 
+ static grub_err_t
+ parse_xen_guest (grub_elf_t elf, struct grub_xen_file_info *xi,
+diff --git a/grub-core/video/capture.c b/grub-core/video/capture.c
+index 67c8edd..4f83c74 100644
+--- a/grub-core/video/capture.c
++++ b/grub-core/video/capture.c
+@@ -4,6 +4,7 @@
+ #include <grub/video.h>
+ #include <grub/video_fb.h>
+ #include <grub/mm.h>
++#include <grub/misc.h>
+ 
+ static struct
+ {
+diff --git a/include/grub/command.h b/include/grub/command.h
+index 8705a63..eee4e84 100644
+--- a/include/grub/command.h
++++ b/include/grub/command.h
+@@ -22,6 +22,7 @@
+ #include <grub/symbol.h>
+ #include <grub/err.h>
+ #include <grub/list.h>
++#include <grub/misc.h>
+ 
+ typedef enum grub_command_flags
+   {
+diff --git a/include/grub/compiler.h b/include/grub/compiler.h
+new file mode 100644
+index 0000000..c9e1d7a
+--- /dev/null
++++ b/include/grub/compiler.h
+@@ -0,0 +1,51 @@
++/* compiler.h - macros for various compiler features */
++/*
++ *  GRUB  --  GRand Unified Bootloader
++ *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010,2014  Free Software Foundation, Inc.
++ *
++ *  GRUB is free software: you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation, either version 3 of the License, or
++ *  (at your option) any later version.
++ *
++ *  GRUB is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifndef GRUB_COMPILER_HEADER
++#define GRUB_COMPILER_HEADER	1
++
++/* GCC version checking borrowed from glibc. */
++#if defined(__GNUC__) && defined(__GNUC_MINOR__)
++#  define GNUC_PREREQ(maj,min) \
++	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
++#else
++#  define GNUC_PREREQ(maj,min) 0
++#endif
++
++/* Does this compiler support compile-time error attributes? */
++#if GNUC_PREREQ(4,3)
++#  define ATTRIBUTE_ERROR(msg) \
++	__attribute__ ((__error__ (msg)))
++#else
++#  define ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn))
++#endif
++
++#if GNUC_PREREQ(4,4)
++#  define GNU_PRINTF gnu_printf
++#else
++#  define GNU_PRINTF printf
++#endif
++
++#if GNUC_PREREQ(3,4)
++#  define WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
++#else
++#  define WARN_UNUSED_RESULT
++#endif
++
++#endif /* ! GRUB_COMPILER_HEADER */
+diff --git a/include/grub/dl.h b/include/grub/dl.h
+index d29a899..9562fa6 100644
+--- a/include/grub/dl.h
++++ b/include/grub/dl.h
+@@ -26,6 +26,7 @@
+ #include <grub/types.h>
+ #include <grub/elf.h>
+ #include <grub/list.h>
++#include <grub/misc.h>
+ #endif
+ 
+ /*
+diff --git a/include/grub/list.h b/include/grub/list.h
+index edd20ad..d170ff6 100644
+--- a/include/grub/list.h
++++ b/include/grub/list.h
+@@ -21,8 +21,8 @@
+ #define GRUB_LIST_HEADER 1
+ 
+ #include <grub/symbol.h>
+-#include <grub/types.h>
+-#include <grub/misc.h>
++#include <grub/err.h>
++#include <grub/compiler.h>
+ 
+ struct grub_list
+ {
+diff --git a/include/grub/misc.h b/include/grub/misc.h
+index 2cf74b5..c6cd456 100644
+--- a/include/grub/misc.h
++++ b/include/grub/misc.h
+@@ -25,34 +25,7 @@
+ #include <grub/symbol.h>
+ #include <grub/err.h>
+ #include <grub/i18n.h>
+-
+-/* GCC version checking borrowed from glibc. */
+-#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+-#  define GNUC_PREREQ(maj,min) \
+-	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+-#else
+-#  define GNUC_PREREQ(maj,min) 0
+-#endif
+-
+-/* Does this compiler support compile-time error attributes? */
+-#if GNUC_PREREQ(4,3)
+-#  define ATTRIBUTE_ERROR(msg) \
+-	__attribute__ ((__error__ (msg)))
+-#else
+-#  define ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn))
+-#endif
+-
+-#if GNUC_PREREQ(4,4)
+-#  define GNU_PRINTF gnu_printf
+-#else
+-#  define GNU_PRINTF printf
+-#endif
+-
+-#if GNUC_PREREQ(3,4)
+-#  define WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
+-#else
+-#  define WARN_UNUSED_RESULT
+-#endif
++#include <grub/compiler.h>
+ 
+ #define ALIGN_UP(addr, align) \
+ 	((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
+diff --git a/include/grub/procfs.h b/include/grub/procfs.h
+index d393da7..8cc331d 100644
+--- a/include/grub/procfs.h
++++ b/include/grub/procfs.h
+@@ -20,6 +20,7 @@
+ #define GRUB_PROCFS_HEADER	1
+ 
+ #include <grub/list.h>
++#include <grub/types.h>
+ 
+ struct grub_procfs_entry
+ {
+-- 
+1.9.3
+
diff --git a/SOURCES/0028-Use-linux16-when-appropriate-880840.patch b/SOURCES/0028-Use-linux16-when-appropriate-880840.patch
deleted file mode 100644
index e8900d9..0000000
--- a/SOURCES/0028-Use-linux16-when-appropriate-880840.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From fbcb0b99d3a4ee0c1d38c965b0dc7cda22d04f28 Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Mon, 28 Oct 2013 10:05:07 -0400
-Subject: [PATCH 28/34] Use linux16 when appropriate (#880840)
-
-The kernel group really would prefer that we use the 16 bit entry point
-on x86 bios machines.
-
-Resolves: rhbz#880840
-
-Signed-off-by: Peter Jones <pjones@redhat.com>
----
- util/grub.d/10_linux.in | 9 +++++++--
- 1 file changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
-index e762e1f..600bfd2 100644
---- a/util/grub.d/10_linux.in
-+++ b/util/grub.d/10_linux.in
-@@ -74,6 +74,11 @@ linux_entry ()
-   type="$3"
-   args="$4"
- 
-+  sixteenbit=""
-+  case "$machine" in
-+    i?86|x86_64) sixteenbit="16" ;;
-+  esac
-+
-   if [ -z "$boot_device_id" ]; then
-       boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
-   fi
-@@ -132,7 +137,7 @@ linux_entry ()
- EOF
-   else
-     sed "s/^/$submenu_indentation/" << EOF
--	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
-+	linux${sixteenbit} ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
- EOF
-   fi
-   if test -n "${initrd}" ; then
-@@ -142,7 +147,7 @@ EOF
- EOF
-     else
-       sed "s/^/$submenu_indentation/" << EOF
--	initrd	${rel_dirname}/${initrd}
-+	initrd${sixteenbit} ${rel_dirname}/${initrd}
- EOF
-     fi
-   fi
--- 
-1.8.4.2
-
diff --git a/SOURCES/0028-grub-core-commands-macbless.c-Rename-FILE-and-DIR-to.patch b/SOURCES/0028-grub-core-commands-macbless.c-Rename-FILE-and-DIR-to.patch
new file mode 100644
index 0000000..8180ce2
--- /dev/null
+++ b/SOURCES/0028-grub-core-commands-macbless.c-Rename-FILE-and-DIR-to.patch
@@ -0,0 +1,61 @@
+From 9cbb9fc3d79e449affe7ed5e104aa828b72ad2cd Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sat, 18 Jan 2014 19:26:40 +0100
+Subject: [PATCH 028/143] 	* grub-core/commands/macbless.c: Rename FILE
+ and DIR to avoid 	conflicts.
+
+	Reported by: Andrey Borzenkov.
+---
+ ChangeLog                     | 7 +++++++
+ grub-core/commands/macbless.c | 6 +++---
+ 2 files changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index dad469b..9d1a3f0 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,10 @@
++2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/commands/macbless.c: Rename FILE and DIR to avoid
++	conflicts.
++
++	Reported by: Andrey Borzenkov.
++
+ 2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* include/grub/misc.h: Move macros for compiler features to ...
+diff --git a/grub-core/commands/macbless.c b/grub-core/commands/macbless.c
+index c521083..4724edd 100644
+--- a/grub-core/commands/macbless.c
++++ b/grub-core/commands/macbless.c
+@@ -37,7 +37,7 @@ struct find_node_context
+   grub_uint64_t inode_found;
+   char *dirname;
+   enum
+-  { NONE, FILE, DIR } found;
++  { FOUND_NONE, FOUND_FILE, FOUND_DIR } found;
+ };
+ 
+ static int
+@@ -53,7 +53,7 @@ find_inode (const char *filename,
+ 	   && grub_strcasecmp (ctx->dirname, filename) == 0)))
+     {
+       ctx->inode_found = info->inode;
+-      ctx->found = info->dir ? DIR : FILE;
++      ctx->found = info->dir ? FOUND_DIR : FOUND_FILE;
+     }
+   return 0;
+ }
+@@ -175,7 +175,7 @@ grub_mac_bless_file (grub_device_t dev, const char *path_in, int intel)
+   grub_free (path);
+ 
+   return grub_mac_bless_inode (dev, (grub_uint32_t) ctx.inode_found,
+-			       (ctx.found == DIR), intel);
++			       (ctx.found == FOUND_DIR), intel);
+ }
+ 
+ static grub_err_t
+-- 
+1.9.3
+
diff --git a/SOURCES/0029-Enable-pager-by-default.-985860.patch b/SOURCES/0029-Enable-pager-by-default.-985860.patch
deleted file mode 100644
index 947009c..0000000
--- a/SOURCES/0029-Enable-pager-by-default.-985860.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 6e1e5aef1da65e05561995ef449a9d9acefc086c Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Mon, 28 Oct 2013 10:09:27 -0400
-Subject: [PATCH 29/34] Enable pager by default. (#985860)
-
-Signed-off-by: Peter Jones <pjones@redhat.com>
----
- util/grub.d/00_header.in | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
-index 0c82f23..dc6bbbb 100644
---- a/util/grub.d/00_header.in
-+++ b/util/grub.d/00_header.in
-@@ -43,6 +43,8 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_
- if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi
- 
- cat << EOF
-+set pager=1
-+
- if [ -s \$prefix/grubenv ]; then
-   load_env
- fi
--- 
-1.8.4.2
-
diff --git a/SOURCES/0029-Makefile.util.def-Link-grub-ofpathname-with-zfs-libs.patch b/SOURCES/0029-Makefile.util.def-Link-grub-ofpathname-with-zfs-libs.patch
new file mode 100644
index 0000000..fcc5013
--- /dev/null
+++ b/SOURCES/0029-Makefile.util.def-Link-grub-ofpathname-with-zfs-libs.patch
@@ -0,0 +1,39 @@
+From 6c3fa2da4fd22c3ebda0c6cf69f97d578c04e704 Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Sat, 18 Jan 2014 19:41:15 +0100
+Subject: [PATCH 029/143] 	* Makefile.util.def: Link grub-ofpathname with
+ zfs libs.
+
+---
+ ChangeLog         | 4 ++++
+ Makefile.util.def | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 9d1a3f0..edceb66 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-01  Mike Gilbert <floppym@gentoo.org>
++
++	* Makefile.util.def: Link grub-ofpathname with zfs libs.
++
+ 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/commands/macbless.c: Rename FILE and DIR to avoid
+diff --git a/Makefile.util.def b/Makefile.util.def
+index 83df212..a286a89 100644
+--- a/Makefile.util.def
++++ b/Makefile.util.def
+@@ -384,7 +384,7 @@ program = {
+   ldadd = libgrubgcry.a;
+   ldadd = libgrubkern.a;
+   ldadd = grub-core/gnulib/libgnu.a;
+-  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBGEOM)';
++  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
+ };
+ 
+ program = {
+-- 
+1.9.3
+
diff --git a/SOURCES/0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch b/SOURCES/0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch
deleted file mode 100644
index 0be7015..0000000
--- a/SOURCES/0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 172b22b0179a2e01b18a0c2ae2336ce05663abbc Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Mon, 28 Oct 2013 10:13:27 -0400
-Subject: [PATCH 30/34] F10 doesn't work on serial, so don't tell the user to
- hit it (#987443)
-
-Signed-off-by: Peter Jones <pjones@redhat.com>
----
- grub-core/normal/menu_text.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
-index bc1fc71..6202c2a 100644
---- a/grub-core/normal/menu_text.c
-+++ b/grub-core/normal/menu_text.c
-@@ -157,7 +157,7 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
- 
-   if (edit)
-     {
--      ret += grub_print_message_indented_real (_("Press Ctrl-x or F10 to start, Ctrl-c or F2 for a \
-+      ret += grub_print_message_indented_real (_("Press Ctrl-x to start, Ctrl-c for a \
- command prompt or Escape to discard edits and return to the menu. Pressing Tab lists possible completions."),
- 					       STANDARD_MARGIN, STANDARD_MARGIN,
- 					       term, dry_run);
--- 
-1.8.4.2
-
diff --git a/SOURCES/0030-Makefile.am-default_payload.elf-Add-modules.patch b/SOURCES/0030-Makefile.am-default_payload.elf-Add-modules.patch
new file mode 100644
index 0000000..1f6c382
--- /dev/null
+++ b/SOURCES/0030-Makefile.am-default_payload.elf-Add-modules.patch
@@ -0,0 +1,42 @@
+From 3f6bd432acbf2244e6f4b83dd3a259392b10afb6 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sat, 18 Jan 2014 19:43:19 +0100
+Subject: [PATCH 030/143] 	* Makefile.am (default_payload.elf): Add
+ modules 	multiboot cbmemc linux16 gzio echo help.
+
+---
+ ChangeLog   | 7 ++++++-
+ Makefile.am | 2 +-
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index edceb66..cff9386 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,4 +1,9 @@
+-2014-01-01  Mike Gilbert <floppym@gentoo.org>
++2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* Makefile.am (default_payload.elf): Add modules
++	multiboot cbmemc linux16 gzio echo help.
++
++2014-01-18  Mike Gilbert <floppym@gentoo.org>
+ 
+ 	* Makefile.util.def: Link grub-ofpathname with zfs libs.
+ 
+diff --git a/Makefile.am b/Makefile.am
+index aa526f5..97c062d 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -399,7 +399,7 @@ bootcheck: $(BOOTCHECKS)
+ 
+ if COND_i386_coreboot
+ default_payload.elf: grub-mkstandalone grub-mkimage
+-	pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
++	pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
+ endif
+ 
+ windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows
+-- 
+1.9.3
+
diff --git a/SOURCES/0031-Don-t-say-GNU-Linux-in-generated-menus.patch b/SOURCES/0031-Don-t-say-GNU-Linux-in-generated-menus.patch
deleted file mode 100644
index dff5741..0000000
--- a/SOURCES/0031-Don-t-say-GNU-Linux-in-generated-menus.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From b08547f24825204674a1ef4dcbc5ce638ef99a12 Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Mon, 14 Mar 2011 14:27:42 -0400
-Subject: [PATCH 31/34] Don't say "GNU/Linux" in generated menus.
-
----
- util/grub.d/10_linux.in     | 4 ++--
- util/grub.d/20_linux_xen.in | 4 ++--
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
-index 600bfd2..c943a1e 100644
---- a/util/grub.d/10_linux.in
-+++ b/util/grub.d/10_linux.in
-@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
- CLASS="--class gnu-linux --class gnu --class os"
- 
- if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
--  OS=GNU/Linux
-+  OS="$(sed 's, release .*$,,g' /etc/system-release)"
- else
--  OS="${GRUB_DISTRIBUTOR} GNU/Linux"
-+  OS="${GRUB_DISTRIBUTOR}"
-   CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
- fi
- 
-diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
-index a608435..79d4e38 100644
---- a/util/grub.d/20_linux_xen.in
-+++ b/util/grub.d/20_linux_xen.in
-@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
- CLASS="--class gnu-linux --class gnu --class os --class xen"
- 
- if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
--  OS=GNU/Linux
-+  OS="$(sed 's, release .*$,,g' /etc/system-release)"
- else
--  OS="${GRUB_DISTRIBUTOR} GNU/Linux"
-+  OS="${GRUB_DISTRIBUTOR}"
-   CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
- fi
- 
--- 
-1.8.4.2
-
diff --git a/SOURCES/0031-fix-removal-of-cpu-machine-links-on-mingw-msys.patch b/SOURCES/0031-fix-removal-of-cpu-machine-links-on-mingw-msys.patch
new file mode 100644
index 0000000..3b1a8c0
--- /dev/null
+++ b/SOURCES/0031-fix-removal-of-cpu-machine-links-on-mingw-msys.patch
@@ -0,0 +1,55 @@
+From d0cf0d7dcd4813a168d2bd94ec77ee0ae8ff860e Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sat, 18 Jan 2014 22:48:04 +0400
+Subject: [PATCH 031/143] fix removal of {cpu,machine} links on mingw/msys
+
+At least on Windows 2003 using "ln -s dir1 dir2" in msys shell succeeds,
+but results in what looks like hard link. Subsequent "rm -f dir2" (e.g.
+during second config.status invocation) fails. Check that we also can
+remove link to directory.
+
+Make it more clear in message that we are checking "ln -s".
+---
+ ChangeLog    | 5 +++++
+ acinclude.m4 | 6 +++---
+ 2 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index cff9386..c3bfa9f 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* acinclude.m4 (grub_CHECK_LINK_DIR): Check that we can also remove
++	symbolic link to directory. It fails in Msys shell on Windows 2003.
++
+ 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* Makefile.am (default_payload.elf): Add modules
+diff --git a/acinclude.m4 b/acinclude.m4
+index 32d5477..b2bb88d 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -418,15 +418,15 @@ else
+ [fi]
+ ])
+ 
+-dnl Check if ln can handle directories properly (mingw).
++dnl Check if ln -s can handle directories properly (mingw).
+ AC_DEFUN([grub_CHECK_LINK_DIR],[
+-AC_MSG_CHECKING([whether ln can handle directories properly])
++AC_MSG_CHECKING([whether ln -s can handle directories properly])
+ [mkdir testdir 2>/dev/null
+ case $srcdir in
+ [\\/$]* | ?:[\\/]* ) reldir=$srcdir/include/grub/util ;;
+     *) reldir=../$srcdir/include/grub/util ;;
+ esac
+-if ln -s $reldir testdir/util 2>/dev/null ; then]
++if ln -s $reldir testdir/util 2>/dev/null && rm -f testdir/util 2>/dev/null ; then]
+   AC_MSG_RESULT([yes])
+   [link_dir=yes
+ else
+-- 
+1.9.3
+
diff --git a/SOURCES/0032-Don-t-draw-a-border-around-the-menu.patch b/SOURCES/0032-Don-t-draw-a-border-around-the-menu.patch
deleted file mode 100644
index 2f6c8f7..0000000
--- a/SOURCES/0032-Don-t-draw-a-border-around-the-menu.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 3209ab4020a0c660bb5df1d8ad5ccd530e465839 Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Wed, 15 May 2013 16:47:33 -0400
-Subject: [PATCH 32/34] Don't draw a border around the menu
-
-It looks cleaner without it.
----
- grub-core/normal/menu_text.c | 43 -------------------------------------------
- 1 file changed, 43 deletions(-)
-
-diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
-index 6202c2a..beddd7f 100644
---- a/grub-core/normal/menu_text.c
-+++ b/grub-core/normal/menu_text.c
-@@ -108,47 +108,6 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right,
-   grub_print_message_indented_real (msg, margin_left, margin_right, term, 0);
- }
- 
--static void
--draw_border (struct grub_term_output *term, const struct grub_term_screen_geometry *geo)
--{
--  int i;
--
--  grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
--
--  grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1,
--	geo->first_entry_y - 1 });
--  grub_putcode (GRUB_UNICODE_CORNER_UL, term);
--  for (i = 0; i < geo->entry_width + 1; i++)
--    grub_putcode (GRUB_UNICODE_HLINE, term);
--  grub_putcode (GRUB_UNICODE_CORNER_UR, term);
--
--  for (i = 0; i < geo->num_entries; i++)
--    {
--      grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1,
--	    geo->first_entry_y + i });
--      grub_putcode (GRUB_UNICODE_VLINE, term);
--      grub_term_gotoxy (term,
--			(struct grub_term_coordinate) { geo->first_entry_x + geo->entry_width + 1,
--			    geo->first_entry_y + i });
--      grub_putcode (GRUB_UNICODE_VLINE, term);
--    }
--
--  grub_term_gotoxy (term,
--		    (struct grub_term_coordinate) { geo->first_entry_x - 1,
--			geo->first_entry_y - 1 + geo->num_entries + 1 });
--  grub_putcode (GRUB_UNICODE_CORNER_LL, term);
--  for (i = 0; i < geo->entry_width + 1; i++)
--    grub_putcode (GRUB_UNICODE_HLINE, term);
--  grub_putcode (GRUB_UNICODE_CORNER_LR, term);
--
--  grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
--
--  grub_term_gotoxy (term,
--		    (struct grub_term_coordinate) { geo->first_entry_x - 1,
--			(geo->first_entry_y - 1 + geo->num_entries
--			 + GRUB_TERM_MARGIN + 1) });
--}
--
- static int
- print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
- {
-@@ -403,8 +362,6 @@ grub_menu_init_page (int nested, int edit,
- 
-   grub_term_normal_color = grub_color_menu_normal;
-   grub_term_highlight_color = grub_color_menu_highlight;
--  if (geo->border)
--    draw_border (term, geo);
-   grub_term_normal_color = old_color_normal;
-   grub_term_highlight_color = old_color_highlight;
-   geo->timeout_y = geo->first_entry_y + geo->num_entries
--- 
-1.8.4.2
-
diff --git a/SOURCES/0032-grub-core-normal-main.c-read_config_file-Buffer-conf.patch b/SOURCES/0032-grub-core-normal-main.c-read_config_file-Buffer-conf.patch
new file mode 100644
index 0000000..a11f833
--- /dev/null
+++ b/SOURCES/0032-grub-core-normal-main.c-read_config_file-Buffer-conf.patch
@@ -0,0 +1,68 @@
+From 221f6e1ac22f66881276d4cb012d588ecfb17e47 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sat, 18 Jan 2014 19:54:09 +0100
+Subject: [PATCH 032/143] 	* grub-core/normal/main.c (read_config_file):
+ Buffer config file. 	Reduces boot time.
+
+---
+ ChangeLog               |  5 +++++
+ grub-core/normal/main.c | 14 +++++++++++---
+ 2 files changed, 16 insertions(+), 3 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index c3bfa9f..c84f7e7 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/normal/main.c (read_config_file): Buffer config file.
++	Reduces boot time.
++
+ 2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* acinclude.m4 (grub_CHECK_LINK_DIR): Check that we can also remove
+diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
+index c36663f..3a926fc 100644
+--- a/grub-core/normal/main.c
++++ b/grub-core/normal/main.c
+@@ -32,6 +32,7 @@
+ #include <grub/i18n.h>
+ #include <grub/charset.h>
+ #include <grub/script_sh.h>
++#include <grub/bufio.h>
+ 
+ GRUB_MOD_LICENSE ("GPLv3+");
+ 
+@@ -104,7 +105,7 @@ read_config_file_getline (char **line, int cont __attribute__ ((unused)),
+ static grub_menu_t
+ read_config_file (const char *config)
+ {
+-  grub_file_t file;
++  grub_file_t rawfile, file;
+   char *old_file = 0, *old_dir = 0;
+   char *config_dir, *ptr = 0;
+   const char *ctmp;
+@@ -122,10 +123,17 @@ read_config_file (const char *config)
+     }
+ 
+   /* Try to open the config file.  */
+-  file = grub_file_open (config);
+-  if (! file)
++  rawfile = grub_file_open (config);
++  if (! rawfile)
+     return 0;
+ 
++  file = grub_bufio_open (rawfile, 0);
++  if (! file)
++    {
++      grub_file_close (file);
++      return 0;
++    }
++
+   ctmp = grub_env_get ("config_file");
+   if (ctmp)
+     old_file = grub_strdup (ctmp);
+-- 
+1.9.3
+
diff --git a/SOURCES/0033-Use-the-standard-margin-for-the-timeout-string.patch b/SOURCES/0033-Use-the-standard-margin-for-the-timeout-string.patch
deleted file mode 100644
index 35a6284..0000000
--- a/SOURCES/0033-Use-the-standard-margin-for-the-timeout-string.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 3a1a0619d212adbaa19fc714997b006ede827d51 Mon Sep 17 00:00:00 2001
-From: William Jon McCann <william.jon.mccann@gmail.com>
-Date: Fri, 7 Jun 2013 10:52:32 -0400
-Subject: [PATCH 33/34] Use the standard margin for the timeout string
-
-So that it aligns with the other messages
----
- grub-core/normal/menu_text.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
-index beddd7f..33b208b 100644
---- a/grub-core/normal/menu_text.c
-+++ b/grub-core/normal/menu_text.c
-@@ -369,7 +369,7 @@ grub_menu_init_page (int nested, int edit,
-   if (bottom_message)
-     {
-       grub_term_gotoxy (term,
--			(struct grub_term_coordinate) { GRUB_TERM_MARGIN,
-+			(struct grub_term_coordinate) { STANDARD_MARGIN,
- 			    geo->timeout_y });
- 
-       print_message (nested, edit, term, 0);
-@@ -404,14 +404,14 @@ menu_text_print_timeout (int timeout, void *dataptr)
-   if (data->timeout_msg == TIMEOUT_UNKNOWN)
-     {
-       data->timeout_msg = grub_print_message_indented_real (msg_translated,
--							    3, 1, data->term, 1)
-+							    STANDARD_MARGIN, 1, data->term, 1)
- 	<= data->geo.timeout_lines ? TIMEOUT_NORMAL : TIMEOUT_TERSE;
-       if (data->timeout_msg == TIMEOUT_TERSE)
- 	{
- 	  grub_free (msg_translated);
- 	  msg_translated = grub_xasprintf (_("%ds"), timeout);
- 	  if (grub_term_width (data->term) < 10)
--	    data->timeout_msg = TIMEOUT_TERSE_NO_MARGIN;
-+	    data->timeout_msg = STANDARD_MARGIN;
- 	}
-     }
- 
--- 
-1.8.4.2
-
diff --git a/SOURCES/0033-util-grub-install.c-Fix-a-typo.patch b/SOURCES/0033-util-grub-install.c-Fix-a-typo.patch
new file mode 100644
index 0000000..7e69b96
--- /dev/null
+++ b/SOURCES/0033-util-grub-install.c-Fix-a-typo.patch
@@ -0,0 +1,40 @@
+From d353b169aa6b2a9cd03d0c2987da7da059aa6f99 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sat, 18 Jan 2014 20:02:51 +0100
+Subject: [PATCH 033/143] 	* util/grub-install.c: Fix a typo.
+
+---
+ ChangeLog           | 4 ++++
+ util/grub-install.c | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index c84f7e7..9360345 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,9 @@
+ 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* util/grub-install.c: Fix a typo.
++
++2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/normal/main.c (read_config_file): Buffer config file.
+ 	Reduces boot time.
+ 
+diff --git a/util/grub-install.c b/util/grub-install.c
+index 4608b80..5903f34 100644
+--- a/util/grub-install.c
++++ b/util/grub-install.c
+@@ -1259,7 +1259,7 @@ main (int argc, char *argv[])
+ 
+   if (!config.is_cryptodisk_enabled && have_cryptodisk)
+     grub_util_error (_("attempt to install to encrypted disk without cryptodisk enabled. "
+-		       "Set `%s' in file `%s'."), "GRUB_ENABLE_CRYPTODISK=1",
++		       "Set `%s' in file `%s'."), "GRUB_ENABLE_CRYPTODISK=y",
+ 		     grub_util_get_config_filename ());
+ 
+   if (disk_module && grub_strcmp (disk_module, "ata") == 0)
+-- 
+1.9.3
+
diff --git a/SOURCES/0034-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch b/SOURCES/0034-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch
deleted file mode 100644
index 0fdd51c..0000000
--- a/SOURCES/0034-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From a4fea77b144995d5ae533c8d3b0efdb959dc63cb Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Fri, 10 Jan 2014 09:36:24 -0500
-Subject: [PATCH 34/34] Fix grub_script_execute_sourcecode() usage on ppc.
-
-593e430c made it not take the extra argc/argv that this code still
-passes it.
-
-Signed-off-by: Peter Jones <pjones@redhat.com>
----
- grub-core/normal/main.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
-index 6c24a07..6eae828 100644
---- a/grub-core/normal/main.c
-+++ b/grub-core/normal/main.c
-@@ -281,7 +281,7 @@ grub_normal_execute (const char *config, int nested, int batch)
-       if (! grub_ieee1275_cas_reboot (script))
-         {
-           char *dummy[1] = { NULL };
--          if (! grub_script_execute_sourcecode (script, 0, dummy))
-+          if (! grub_script_execute_sourcecode (script))
-             boot = 1;
-         }
-       grub_free (script);
--- 
-1.8.4.2
-
diff --git a/SOURCES/0034-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch b/SOURCES/0034-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch
new file mode 100644
index 0000000..4a33b6c
--- /dev/null
+++ b/SOURCES/0034-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch
@@ -0,0 +1,91 @@
+From 85cc4b1abfed85fd8504da4acc391d5936de2812 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sat, 18 Jan 2014 23:15:40 +0400
+Subject: [PATCH 034/143] use MODULE_FILES for genemuinit* instead of MOD_FILES
+
+MinGW native nm does not support ELF binaries.
+---
+ ChangeLog                     | 8 ++++++++
+ grub-core/Makefile.am         | 8 ++++----
+ grub-core/genemuinit.sh       | 4 ++--
+ grub-core/genemuinitheader.sh | 4 ++--
+ 4 files changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 9360345..4688ff4 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,11 @@
++2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* grub-core/Makefile.am: Build grub_emu_init.[ch] from MODULE_FILES
++	instead of MOD_FILES.
++	* grub-core/genemuinit.sh: Simplify stripping of suffix so it works
++	both with and without .exe.
++	* grub-core/genemuinitheader.sh: Same.
++
+ 2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* util/grub-install.c: Fix a typo.
+diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
+index 826b3dd..5c087c8 100644
+--- a/grub-core/Makefile.am
++++ b/grub-core/Makefile.am
+@@ -294,12 +294,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
+ kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
+ grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
+ 
+-grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
+-	rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
++grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
++	rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
+ CLEANFILES += grub_emu_init.h
+ 
+-grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
+-	rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
++grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MODULE_FILES)
++	rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
+ CLEANFILES += grub_emu_init.c
+ endif
+ 
+diff --git a/grub-core/genemuinit.sh b/grub-core/genemuinit.sh
+index 45c15ec..8c6bb1c 100644
+--- a/grub-core/genemuinit.sh
++++ b/grub-core/genemuinit.sh
+@@ -47,7 +47,7 @@ EOF
+ read mods
+ for line in $mods; do
+   if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
+-      echo "grub_${line}_init ();" | sed 's,\.mod,,g;'
++      echo "grub_${line%%.*}_init ();"
+   fi
+ done
+ 
+@@ -63,7 +63,7 @@ EOF
+ 
+ for line in $mods; do
+   if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
+-      echo "grub_${line}_fini ();" | sed 's,\.mod,,g;'
++      echo "grub_${line%%.*}_fini ();"
+   fi
+ done
+ 
+diff --git a/grub-core/genemuinitheader.sh b/grub-core/genemuinitheader.sh
+index 6b83f59..a99a15d 100644
+--- a/grub-core/genemuinitheader.sh
++++ b/grub-core/genemuinitheader.sh
+@@ -44,9 +44,9 @@ EOF
+ read mods
+ for line in $mods; do
+   if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
+-      echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;'
++      echo "void grub_${line%%.*}_init (void);"
+   fi
+   if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
+-      echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;'
++      echo "void grub_${line%%.*}_fini (void);"
+   fi
+ done
+-- 
+1.9.3
+
diff --git a/SOURCES/0035-Ignore-EPERM-when-modifying-kern.geom.debugflags.patch b/SOURCES/0035-Ignore-EPERM-when-modifying-kern.geom.debugflags.patch
new file mode 100644
index 0000000..4bb4ccd
--- /dev/null
+++ b/SOURCES/0035-Ignore-EPERM-when-modifying-kern.geom.debugflags.patch
@@ -0,0 +1,58 @@
+From 97fca4331e317b0491912c3cf3d02a9fac96c419 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Fri, 17 Jan 2014 02:28:46 +0000
+Subject: [PATCH 035/143] Ignore EPERM when modifying kern.geom.debugflags
+
+Many tests fail when run as a non-root user on FreeBSD.  The failures
+all amount to an inability to open files using grub_util_fd_open,
+because we cannot set the kern.geom.debugflags sysctl.  This sysctl is
+indeed important to allow us to do such things as installing GRUB to the
+MBR, but if we need to do that and can't then we will get an error
+later.  Enforcing it here is unnecessary and prevents otherwise
+perfectly reasonable operations.
+---
+ ChangeLog                          |  7 +++++++
+ grub-core/osdep/freebsd/hostdisk.c | 12 ++++++++++--
+ 2 files changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 4688ff4..10abfe2 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,10 @@
++2014-01-19  Colin Watson  <cjwatson@ubuntu.com>
++
++	* grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Ignore
++	EPERM when modifying kern.geom.debugflags.  It is only a problem for
++	such things as installing GRUB to the MBR, in which case there'll be
++	an error later anyway, not for opening files during tests.
++
+ 2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* grub-core/Makefile.am: Build grub_emu_init.[ch] from MODULE_FILES
+diff --git a/grub-core/osdep/freebsd/hostdisk.c b/grub-core/osdep/freebsd/hostdisk.c
+index eb202dc..6145d07 100644
+--- a/grub-core/osdep/freebsd/hostdisk.c
++++ b/grub-core/osdep/freebsd/hostdisk.c
+@@ -102,8 +102,16 @@ grub_util_fd_open (const char *os_dev, int flags)
+   if (! (sysctl_oldflags & 0x10)
+       && sysctlbyname ("kern.geom.debugflags", NULL , 0, &sysctl_flags, sysctl_size))
+     {
+-      grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl kern.geom.debugflags");
+-      return GRUB_UTIL_FD_INVALID;
++      if (errno == EPERM)
++	/* Running as an unprivileged user; don't worry about restoring
++	   flags, although if we try to write to anything interesting such
++	   as the MBR then we may fail later.  */
++	sysctl_oldflags = 0x10;
++      else
++	{
++	  grub_error (GRUB_ERR_BAD_DEVICE, "cannot set flags of sysctl kern.geom.debugflags");
++	  return GRUB_UTIL_FD_INVALID;
++	}
+     }
+ 
+   ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
+-- 
+1.9.3
+
diff --git a/SOURCES/0036-change-stop-condition-to-avoid-infinite-loops.patch b/SOURCES/0036-change-stop-condition-to-avoid-infinite-loops.patch
new file mode 100644
index 0000000..a065485
--- /dev/null
+++ b/SOURCES/0036-change-stop-condition-to-avoid-infinite-loops.patch
@@ -0,0 +1,52 @@
+From 547d1e84df5d57c7600ead4556d43d5dbbe33c4b Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Tue, 21 Jan 2014 10:49:39 -0200
+Subject: [PATCH 036/143] change stop condition to avoid infinite loops
+
+In net/net.c there is a while (1) that only exits if there is a stop
+condition and more then 10 packages or if there is no package received.
+
+If GRUB is idle and enter in this loop, the only condition to leave is
+if it doesn't have incoming packages. In a network with heavy traffic
+this never happens.
+---
+ ChangeLog           | 12 ++++++++++++
+ grub-core/net/net.c |  2 +-
+ 2 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 10abfe2..f69d8c7 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,15 @@
++2014-01-21  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
++
++	* grub-core/net/net.c (receive_packets): Change stop condition to avoid
++	infinite loops.
++
++	In net/net.c there is a while (1) that only exits if there is a stop
++	condition and more then 10 packages or if there is no package received.
++
++	If GRUB is idle and enter in this loop, the only condition to leave is
++	if it doesn't have incoming packages. In a network with heavy traffic
++	this never happens.
++
+ 2014-01-19  Colin Watson  <cjwatson@ubuntu.com>
+ 
+ 	* grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Ignore
+diff --git a/grub-core/net/net.c b/grub-core/net/net.c
+index 0e57e93..56355f3 100644
+--- a/grub-core/net/net.c
++++ b/grub-core/net/net.c
+@@ -1453,7 +1453,7 @@ receive_packets (struct grub_net_card *card, int *stop_condition)
+ 	}
+       card->opened = 1;
+     }
+-  while (1)
++  while (received < 100)
+     {
+       /* Maybe should be better have a fixed number of packets for each card
+ 	 and just mark them as used and not used.  */ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0037-increase-network-try-interval-gradually.patch b/SOURCES/0037-increase-network-try-interval-gradually.patch
new file mode 100644
index 0000000..d85b797
--- /dev/null
+++ b/SOURCES/0037-increase-network-try-interval-gradually.patch
@@ -0,0 +1,111 @@
+From d3652ff33623d842fc4422ffd98e4303795e9519 Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Tue, 21 Jan 2014 11:03:51 -0200
+Subject: [PATCH 037/143] increase network try interval gradually
+
+* grub-core/net/arp.c (grub_net_arp_send_request): Increase network try
+interval gradually.
+* grub-core/net/icmp6.c (grub_net_icmp6_send_request): Likewise.
+* grub-core/net/net.c (grub_net_fs_read_real): Likewise.
+* grub-core/net/tftp.c (tftp_open): Likewise.
+* include/grub/net.h (GRUB_NET_INTERVAL_ADDITION): New define.
+---
+ ChangeLog             | 9 +++++++++
+ grub-core/net/arp.c   | 3 ++-
+ grub-core/net/icmp6.c | 3 ++-
+ grub-core/net/net.c   | 5 +++--
+ grub-core/net/tftp.c  | 3 ++-
+ include/grub/net.h    | 1 +
+ 6 files changed, 19 insertions(+), 5 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index f69d8c7..f5618a6 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,14 @@
+ 2014-01-21  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
+ 
++	* grub-core/net/arp.c (grub_net_arp_send_request): Increase network try
++	interval gradually.
++	* grub-core/net/icmp6.c (grub_net_icmp6_send_request): Likewise.
++	* grub-core/net/net.c (grub_net_fs_read_real): Likewise.
++	* grub-core/net/tftp.c (tftp_open): Likewise.
++	* include/grub/net.h (GRUB_NET_INTERVAL_ADDITION): New define.
++
++2014-01-21  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
++
+ 	* grub-core/net/net.c (receive_packets): Change stop condition to avoid
+ 	infinite loops.
+ 
+diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
+index e92c7e7..d62d0cc 100644
+--- a/grub-core/net/arp.c
++++ b/grub-core/net/arp.c
+@@ -110,7 +110,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
+ 	return GRUB_ERR_NONE;
+       pending_req = proto_addr->ipv4;
+       have_pending = 0;
+-      grub_net_poll_cards (GRUB_NET_INTERVAL, &have_pending);
++      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
++                           &have_pending);
+       if (grub_net_link_layer_resolve_check (inf, proto_addr))
+ 	return GRUB_ERR_NONE;
+       nb.data = nbd;
+diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c
+index 2741e6f..bbc9020 100644
+--- a/grub-core/net/icmp6.c
++++ b/grub-core/net/icmp6.c
+@@ -518,7 +518,8 @@ grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf,
+     {
+       if (grub_net_link_layer_resolve_check (inf, proto_addr))
+ 	break;
+-      grub_net_poll_cards (GRUB_NET_INTERVAL, 0);
++      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
++                           0);
+       if (grub_net_link_layer_resolve_check (inf, proto_addr))
+ 	break;
+       nb->data = nbd;
+diff --git a/grub-core/net/net.c b/grub-core/net/net.c
+index 56355f3..1521d8d 100644
+--- a/grub-core/net/net.c
++++ b/grub-core/net/net.c
+@@ -1558,8 +1558,9 @@ grub_net_fs_read_real (grub_file_t file, char *buf, grub_size_t len)
+       if (!net->eof)
+ 	{
+ 	  try++;
+-	  grub_net_poll_cards (GRUB_NET_INTERVAL, &net->stall);
+-	}
++	  grub_net_poll_cards (GRUB_NET_INTERVAL +
++                               (try * GRUB_NET_INTERVAL_ADDITION), &net->stall);
++        }
+       else
+ 	return total;
+     }
+diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
+index 9c489f1..5173614 100644
+--- a/grub-core/net/tftp.c
++++ b/grub-core/net/tftp.c
+@@ -398,7 +398,8 @@ tftp_open (struct grub_file *file, const char *filename)
+ 	  destroy_pq (data);
+ 	  return err;
+ 	}
+-      grub_net_poll_cards (GRUB_NET_INTERVAL, &data->have_oack);
++      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
++                           &data->have_oack);
+       if (data->have_oack)
+ 	break;
+     }
+diff --git a/include/grub/net.h b/include/grub/net.h
+index de6259e..0e0a605 100644
+--- a/include/grub/net.h
++++ b/include/grub/net.h
+@@ -532,5 +532,6 @@ extern char *grub_net_default_server;
+ 
+ #define GRUB_NET_TRIES 40
+ #define GRUB_NET_INTERVAL 400
++#define GRUB_NET_INTERVAL_ADDITION 20
+ 
+ #endif /* ! GRUB_NET_HEADER */
+-- 
+1.9.3
+
diff --git a/SOURCES/0038-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch b/SOURCES/0038-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch
new file mode 100644
index 0000000..8599034
--- /dev/null
+++ b/SOURCES/0038-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch
@@ -0,0 +1,39 @@
+From 90d83cda679fef485f7bb1a318bd682c4eb86cb4 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Tue, 21 Jan 2014 19:29:33 +0400
+Subject: [PATCH 038/143] look for DejaVu also in /usr/share/fonts/truetype
+
+It is installed in this path on openSUSE.
+---
+ ChangeLog    | 4 ++++
+ configure.ac | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index f5618a6..9f5d81d 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-21  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* configure.ac: Look for DejaVuSans also in /usr/share/fonts/truetype.
++
+ 2014-01-21  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
+ 
+ 	* grub-core/net/arp.c (grub_net_arp_send_request): Increase network try
+diff --git a/configure.ac b/configure.ac
+index cf3de3b..120263e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1389,7 +1389,7 @@ fi
+ 
+ if test x"$starfield_excuse" = x; then
+    for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
+-     for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
++     for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do
+         if test -f "$dir/DejaVuSans.$ext"; then
+           DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
+           break 2
+-- 
+1.9.3
+
diff --git a/SOURCES/0039-Show-detected-path-to-DejaVuSans-in-configure-summar.patch b/SOURCES/0039-Show-detected-path-to-DejaVuSans-in-configure-summar.patch
new file mode 100644
index 0000000..7abb266
--- /dev/null
+++ b/SOURCES/0039-Show-detected-path-to-DejaVuSans-in-configure-summar.patch
@@ -0,0 +1,37 @@
+From 3e02e2fbd2089645ac2c482dad59318394b62252 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Tue, 21 Jan 2014 19:41:11 +0400
+Subject: [PATCH 039/143] Show detected path to DejaVuSans in configure summary
+
+---
+ ChangeLog    | 1 +
+ configure.ac | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index 9f5d81d..3ba57ae 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,6 +1,7 @@
+ 2014-01-21  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* configure.ac: Look for DejaVuSans also in /usr/share/fonts/truetype.
++	Show detected font path in summary.
+ 
+ 2014-01-21  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
+ 
+diff --git a/configure.ac b/configure.ac
+index 120263e..8888c2f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1816,6 +1816,7 @@ echo grub-mount: No "($grub_mount_excuse)"
+ fi
+ if [ x"$starfield_excuse" = x ]; then
+ echo starfield theme: Yes
++echo With DejaVuSans font from $DJVU_FONT_SOURCE
+ else
+ echo starfield theme: No "($starfield_excuse)"
+ fi
+-- 
+1.9.3
+
diff --git a/SOURCES/0040-add-GRUB_WINDOWS_EXTRA_DIST-to-allow-shipping-runtim.patch b/SOURCES/0040-add-GRUB_WINDOWS_EXTRA_DIST-to-allow-shipping-runtim.patch
new file mode 100644
index 0000000..573b3b2
--- /dev/null
+++ b/SOURCES/0040-add-GRUB_WINDOWS_EXTRA_DIST-to-allow-shipping-runtim.patch
@@ -0,0 +1,62 @@
+From 6e9483ee94033f4bb7b9a17bd032c4af4479abc0 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Tue, 21 Jan 2014 20:54:09 +0400
+Subject: [PATCH 040/143] add GRUB_WINDOWS_EXTRA_DIST to allow shipping runtime
+ files
+
+Not all toolkits provide static libraries. This patch enables creation of self
+contained distribution that does not require pre-existing runtime libraries.
+Intended usage is
+
+export GRUB_WINDOWS_EXTRA_DIST="/path/to/liblzma.dll /path/to/libintl.dll"
+make
+make windowszip
+
+As those libraries and locations are dependent on toolchain in use, trying
+to autodetect them is likely impossible. So just provide a simple way to
+package everything in one step.
+
+Also remove $(windowsdir) after ZIP was created same as other "make dist"
+targets.
+---
+ ChangeLog   | 5 +++++
+ Makefile.am | 4 ++++
+ 2 files changed, 9 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index 3ba57ae..1ede370 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-01-21  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
++	* Makefile.am: Allow adding extra files to generated Windows ZIP
++	archive by setting GRUB_WINDOWS_EXTRA_DIST.
++
++2014-01-21  Andrey Borzenkov <arvidjaar@gmail.com>
++
+ 	* configure.ac: Look for DejaVuSans also in /usr/share/fonts/truetype.
+ 	Show detected font path in summary.
+ 
+diff --git a/Makefile.am b/Makefile.am
+index 97c062d..f02ae0a 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -420,10 +420,14 @@ windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
+ 	for x in $(starfield_DATA); do \
+ 		cp -fp $$x $(windowsdir)/themes/starfield/$$(basename $$x); \
+ 	done
++	for x in $(GRUB_WINDOWS_EXTRA_DIST); do \
++		cp -fp $$x $(windowsdir); \
++	done
+ 
+ windowszip=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows.zip
+ windowszip: windowsdir
+ 	test -f $(windowszip) && rm $(windowszip) || true
+ 	zip -r $(windowszip) $(windowsdir)
++	rm -rf $(windowsdir)
+ 
+ EXTRA_DIST += linguas.sh
+-- 
+1.9.3
+
diff --git a/SOURCES/0041-util-grub-install.c-write_to_disk-Add-an-info-messag.patch b/SOURCES/0041-util-grub-install.c-write_to_disk-Add-an-info-messag.patch
new file mode 100644
index 0000000..e89d938
--- /dev/null
+++ b/SOURCES/0041-util-grub-install.c-write_to_disk-Add-an-info-messag.patch
@@ -0,0 +1,38 @@
+From 100e7015f7dcf2cee0c4ddbbd7498a67bac695d0 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Thu, 23 Jan 2014 12:05:36 +0000
+Subject: [PATCH 041/143] * util/grub-install.c (write_to_disk): Add an info
+ message.
+
+---
+ ChangeLog           | 4 ++++
+ util/grub-install.c | 1 +
+ 2 files changed, 5 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index 1ede370..eee8e78 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-23  Colin Watson  <cjwatson@ubuntu.com>
++
++	* util/grub-install.c (write_to_disk): Add an info message.
++
+ 2014-01-21  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* Makefile.am: Allow adding extra files to generated Windows ZIP
+diff --git a/util/grub-install.c b/util/grub-install.c
+index 5903f34..787dc90 100644
+--- a/util/grub-install.c
++++ b/util/grub-install.c
+@@ -675,6 +675,7 @@ write_to_disk (grub_device_t dev, const char *fn)
+ 
+   core_img = grub_util_read_image (fn);    
+ 
++  grub_util_info ("writing `%s' to `%s'", fn, dev->disk->name);
+   err = grub_disk_write (dev->disk, 0, 0,
+ 			 core_size, core_img);
+   free (core_img);
+-- 
+1.9.3
+
diff --git a/SOURCES/0042-util-grub-install.c-List-available-targets.patch b/SOURCES/0042-util-grub-install.c-List-available-targets.patch
new file mode 100644
index 0000000..c12e35d
--- /dev/null
+++ b/SOURCES/0042-util-grub-install.c-List-available-targets.patch
@@ -0,0 +1,109 @@
+From d25ddbcafa537525f606938df0e500c50a5e93e1 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 24 Jan 2014 18:09:25 +0100
+Subject: [PATCH 042/143] 	* util/grub-install.c: List available targets.
+
+---
+ ChangeLog                   |  4 ++++
+ include/grub/util/install.h |  2 ++
+ util/grub-install-common.c  | 30 ++++++++++++++++++++++++++++++
+ util/grub-install.c         | 10 ++++++++--
+ 4 files changed, 44 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index eee8e78..20e8baa 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-24  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* util/grub-install.c: List available targets.
++
+ 2014-01-23  Colin Watson  <cjwatson@ubuntu.com>
+ 
+ 	* util/grub-install.c (write_to_disk): Add an info message.
+diff --git a/include/grub/util/install.h b/include/grub/util/install.h
+index bc987aa..aedcd29 100644
+--- a/include/grub/util/install.h
++++ b/include/grub/util/install.h
+@@ -138,6 +138,8 @@ grub_install_get_platform_cpu (enum grub_install_plat platid);
+ const char *
+ grub_install_get_platform_platform (enum grub_install_plat platid);
+ 
++char *
++grub_install_get_platforms_string (void);
+ 
+ typedef enum {
+   GRUB_COMPRESSION_AUTO,
+diff --git a/util/grub-install-common.c b/util/grub-install-common.c
+index 6ea0a8e..c8bedcb 100644
+--- a/util/grub-install-common.c
++++ b/util/grub-install-common.c
+@@ -668,6 +668,36 @@ static struct
+   }; 
+ 
+ char *
++grub_install_get_platforms_string (void)
++{
++  char **arr = xmalloc (sizeof (char *) * ARRAY_SIZE (platforms));
++  int platform_strins_len = 0;
++  char *platforms_string;
++  char *ptr;
++  unsigned i;
++  for (i = 0; i < ARRAY_SIZE (platforms); i++)
++    {
++      arr[i] = xasprintf ("%s-%s", platforms[i].cpu,
++			  platforms[i].platform);
++      platform_strins_len += strlen (arr[i]) + 2;
++    }
++  ptr = platforms_string = xmalloc (platform_strins_len);
++  qsort (arr, ARRAY_SIZE (platforms), sizeof (char *), grub_qsort_strcmp);
++  for (i = 0; i < ARRAY_SIZE (platforms); i++)
++    {
++      strcpy (ptr, arr[i]);
++      ptr += strlen (arr[i]);
++      *ptr++ = ',';
++      *ptr++ = ' ';
++      free (arr[i]);
++    }
++  ptr[-2] = 0;
++  free (arr);
++ 
++  return platforms_string;
++}
++
++char *
+ grub_install_get_platform_name (enum grub_install_plat platid)
+ {
+   return xasprintf ("%s-%s", platforms[platid].cpu,
+diff --git a/util/grub-install.c b/util/grub-install.c
+index 787dc90..2e6226a 100644
+--- a/util/grub-install.c
++++ b/util/grub-install.c
+@@ -256,7 +256,7 @@ static struct argp_option options[] = {
+    OPTION_HIDDEN, 0, 2},
+   {"target", OPTION_TARGET, N_("TARGET"),
+    /* TRANSLATORS: "TARGET" as in "target platform".  */
+-   0, N_("install GRUB for TARGET platform [default=%s]"), 2},
++   0, N_("install GRUB for TARGET platform [default=%s]; available targets: %s"), 2},
+   {"grub-setup", OPTION_SETUP, "FILE", OPTION_HIDDEN, 0, 2},
+   {"grub-mkrelpath", OPTION_MKRELPATH, "FILE", OPTION_HIDDEN, 0, 2},
+   {"grub-mkdevicemap", OPTION_MKDEVICEMAP, "FILE", OPTION_HIDDEN, 0, 2},
+@@ -340,7 +340,13 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
+     case OPTION_BOOT_DIRECTORY:
+       return xasprintf (text, GRUB_DIR_NAME, GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME);
+     case OPTION_TARGET:
+-      return xasprintf (text, get_default_platform ());
++      {
++	char *plats = grub_install_get_platforms_string ();
++	char *ret;
++	ret = xasprintf (text, get_default_platform (), plats);
++	free (plats);
++	return ret;
++      }
+     case ARGP_KEY_HELP_POST_DOC:
+       return xasprintf (text, program_name, GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME);
+     default:
+-- 
+1.9.3
+
diff --git a/SOURCES/0043-Fix-several-translatable-strings.patch b/SOURCES/0043-Fix-several-translatable-strings.patch
new file mode 100644
index 0000000..3c25967
--- /dev/null
+++ b/SOURCES/0043-Fix-several-translatable-strings.patch
@@ -0,0 +1,78 @@
+From 2cd73ec6b2efeaff2bdcd40cce0cd3145d9e07d0 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 24 Jan 2014 18:20:27 +0100
+Subject: [PATCH 043/143] 	Fix several translatable strings.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+	Suggested by: D. Prévot.
+---
+ ChangeLog                        | 6 ++++++
+ grub-core/commands/syslinuxcfg.c | 2 +-
+ grub-core/loader/arm64/linux.c   | 2 +-
+ util/grub-syslinux2cfg.c         | 4 ++--
+ 4 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 20e8baa..e149d8e 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,11 @@
+ 2014-01-24  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	Fix several translatable strings.
++
++	Suggested by: D. Prévot.
++
++2014-01-24  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* util/grub-install.c: List available targets.
+ 
+ 2014-01-23  Colin Watson  <cjwatson@ubuntu.com>
+diff --git a/grub-core/commands/syslinuxcfg.c b/grub-core/commands/syslinuxcfg.c
+index a4bfc40..00ae113 100644
+--- a/grub-core/commands/syslinuxcfg.c
++++ b/grub-core/commands/syslinuxcfg.c
+@@ -50,7 +50,7 @@ static const struct grub_arg_option options[] =
+      N_("root directory of the syslinux disk [default=/]."),
+      N_("DIR"), ARG_TYPE_STRING},
+     {"cwd",  'c', 0,
+-     N_("current directory of the syslinux [default is parent directory of input file]."),
++     N_("current directory of syslinux [default is parent directory of input file]."),
+      N_("DIR"), ARG_TYPE_STRING},
+     {"isolinux",     'i',  0, N_("assume input is an isolinux configuration file."), 0, 0},
+     {"pxelinux",     'p',  0, N_("assume input is a pxelinux configuration file."), 0, 0},
+diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
+index 75ad871..65129c2 100644
+--- a/grub-core/loader/arm64/linux.c
++++ b/grub-core/loader/arm64/linux.c
+@@ -120,7 +120,7 @@ check_kernel (struct grub_arm64_linux_kernel_header *lh)
+ 
+   if ((lh->code0 & 0xffff) != GRUB_EFI_PE_MAGIC)
+     return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+-		       N_("plain Image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
++		       N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
+ 
+   grub_dprintf ("linux", "UEFI stub kernel:\n");
+   grub_dprintf ("linux", "text_offset = 0x%012llx\n",
+diff --git a/util/grub-syslinux2cfg.c b/util/grub-syslinux2cfg.c
+index 5e944c2..f4fda6d 100644
+--- a/util/grub-syslinux2cfg.c
++++ b/util/grub-syslinux2cfg.c
+@@ -66,10 +66,10 @@ static struct argp_option options[] = {
+    N_("root directory of the syslinux disk [default=/]."), 0},
+   {"target-cwd",  'T', N_("DIR"), 0,
+    N_(
+-      "current directory of the syslinux as it will be seen on runtime  [default is parent directory of input file]."
++      "current directory of syslinux as it will be seen on runtime  [default is parent directory of input file]."
+ ), 0},
+   {"cwd",  'c', N_("DIR"), 0,
+-   N_("current directory of the syslinux [default is parent directory of input file]."), 0},
++   N_("current directory of syslinux [default is parent directory of input file]."), 0},
+ 
+   {"output",  'o', N_("FILE"), 0, N_("write output to FILE [default=stdout]."), 0},
+   {"isolinux",     'i', 0,      0, N_("assume input is an isolinux configuration file."), 0},
+-- 
+1.9.3
+
diff --git a/SOURCES/0044-do-not-set-default-prefix-in-grub-mkimage.patch b/SOURCES/0044-do-not-set-default-prefix-in-grub-mkimage.patch
new file mode 100644
index 0000000..2caa0c9
--- /dev/null
+++ b/SOURCES/0044-do-not-set-default-prefix-in-grub-mkimage.patch
@@ -0,0 +1,75 @@
+From 2b2a550c14e70d17af4140e64d08022ed170f0c8 Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sat, 25 Jan 2014 19:54:51 +0400
+Subject: [PATCH 044/143] do not set default prefix in grub-mkimage
+
+Default prefix is likely wrong on Unix and completely wrong on Windows.
+Let caller set it explicitly to avoid any ambiguity.
+---
+ ChangeLog           |  4 ++++
+ util/grub-mkimage.c | 16 +++++++++++-----
+ 2 files changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index e149d8e..b405b7e 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-25  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* util/grub-mkimage.c: Make prefix argument mandatory.
++
+ 2014-01-24  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	Fix several translatable strings.
+diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
+index a2bd4c1..1e0bcf1 100644
+--- a/util/grub-mkimage.c
++++ b/util/grub-mkimage.c
+@@ -64,7 +64,7 @@ static struct argp_option options[] = {
+   {"directory",  'd', N_("DIR"), 0,
+    /* TRANSLATORS: platform here isn't identifier. It can be translated.  */
+    N_("use images and modules under DIR [default=%s/<platform>]"), 0},
+-  {"prefix",  'p', N_("DIR"), 0, N_("set prefix directory [default=%s]"), 0},
++  {"prefix",  'p', N_("DIR"), 0, N_("set prefix directory"), 0},
+   {"memdisk",  'm', N_("FILE"), 0,
+    /* TRANSLATORS: "memdisk" here isn't an identifier, it can be translated.
+     "embed" is a verb (command description).  "*/
+@@ -93,8 +93,6 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
+     {
+     case 'd':
+       return xasprintf (text, grub_util_get_pkglibdir ());
+-    case 'p':
+-      return xasprintf (text, DEFAULT_DIRECTORY);
+     case 'O':
+       {
+ 	char *formats = grub_install_get_image_targets_string (), *ret;
+@@ -268,6 +266,15 @@ main (int argc, char *argv[])
+       exit(1);
+     }
+ 
++  if (!arguments.prefix)
++    {
++      char *program = xstrdup(program_name);
++      printf ("%s\n", _("Prefix not specified (use the -p option)."));
++      argp_help (&argp, stderr, ARGP_HELP_STD_USAGE, program);
++      free (program);
++      exit(1);
++    }
++
+   if (arguments.output)
+     {
+       fp = grub_util_fopen (arguments.output, "wb");
+@@ -287,8 +294,7 @@ main (int argc, char *argv[])
+       strcpy (ptr, dn);
+     }
+ 
+-  grub_install_generate_image (arguments.dir,
+-			       arguments.prefix ? : DEFAULT_DIRECTORY, fp,
++  grub_install_generate_image (arguments.dir, arguments.prefix, fp,
+ 			       arguments.output, arguments.modules,
+ 			       arguments.memdisk, arguments.pubkeys,
+ 			       arguments.npubkeys, arguments.config,
+-- 
+1.9.3
+
diff --git a/SOURCES/0045-fix-Mingw-W64-32-cross-compile-failure-due-to-printf.patch b/SOURCES/0045-fix-Mingw-W64-32-cross-compile-failure-due-to-printf.patch
new file mode 100644
index 0000000..daf6702
--- /dev/null
+++ b/SOURCES/0045-fix-Mingw-W64-32-cross-compile-failure-due-to-printf.patch
@@ -0,0 +1,108 @@
+From 90efd351fa4f81df97473e1bb8c8234a801f8ebe Mon Sep 17 00:00:00 2001
+From: Andrey Borzenkov <arvidjaar@gmail.com>
+Date: Sat, 25 Jan 2014 21:49:41 +0400
+Subject: [PATCH 045/143] fix Mingw W64-32 cross compile failure due to printf
+ redefinition in libintl.h
+
+In file included from util/misc.c:36:0:
+./include/grub/emu/misc.h:56:1: error: 'libintl_printf' is an unrecognized format function type [-Werror=format=]
+ char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) WARN_UNUSED_RESULT;
+ ^
+./include/grub/emu/misc.h:58:1: error: 'libintl_printf' is an unrecognized format function type [-Werror=format=]
+
+The reason is libintl.h which redefines printf as libintl_printf. The problem
+is not present in native MinGW build which avoids redefinition.  Use
+(format (__printf__) instead which is valid replacement in GCC.
+
+v2: add grub-core/lib/libgcrypt/src/g10lib.h
+v3: modify g10lib.h during import
+---
+ ChangeLog               | 9 +++++++++
+ include/grub/crypto.h   | 2 +-
+ include/grub/emu/misc.h | 8 ++++----
+ include/grub/err.h      | 2 +-
+ util/import_gcry.py     | 6 ++++++
+ 5 files changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index b405b7e..c93f11f 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,12 @@
++
++2014-01-25  Andrey Borzenkov <arvidjaar@gmail.com>
++
++	* include/grub/crypto.h: Replace __attribute__ ((format (printf)) with
++	__attribute__ ((format (__printf__)) to fix compilation under MinGW-w64.
++	* include/grub/emu/misc.h: ... and here.
++	* include/grub/err.h: ... and here.
++	* util/import_gcry.py: ... and here (in files g10lib.h).
++
+ 2014-01-25  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+ 	* util/grub-mkimage.c: Make prefix argument mandatory.
+diff --git a/include/grub/crypto.h b/include/grub/crypto.h
+index ec1b980..a24e89d 100644
+--- a/include/grub/crypto.h
++++ b/include/grub/crypto.h
+@@ -408,7 +408,7 @@ void _gcry_assert_failed (const char *expr, const char *file, int line,
+                           const char *func) __attribute__ ((noreturn));
+ 
+ void _gcry_burn_stack (int bytes);
+-void _gcry_log_error( const char *fmt, ... )  __attribute__ ((format (printf, 1, 2)));
++void _gcry_log_error( const char *fmt, ... )  __attribute__ ((format (__printf__, 1, 2)));
+ 
+ 
+ #ifdef GRUB_UTIL
+diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
+index dde48c1..a588ba2 100644
+--- a/include/grub/emu/misc.h
++++ b/include/grub/emu/misc.h
+@@ -53,11 +53,11 @@ grub_util_device_is_mapped (const char *dev);
+ void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT;
+ void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT;
+ char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT;
+-char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) WARN_UNUSED_RESULT;
++char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))) WARN_UNUSED_RESULT;
+ 
+-void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
+-void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
+-void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2), noreturn));
++void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2)));
++void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2)));
++void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2), noreturn));
+ 
+ grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void);
+ 
+diff --git a/include/grub/err.h b/include/grub/err.h
+index 9896fcc..1590c68 100644
+--- a/include/grub/err.h
++++ b/include/grub/err.h
+@@ -91,6 +91,6 @@ int EXPORT_FUNC(grub_error_pop) (void);
+ void EXPORT_FUNC(grub_print_error) (void);
+ extern int EXPORT_VAR(grub_err_printed_errors);
+ int grub_err_printf (const char *fmt, ...)
+-     __attribute__ ((format (printf, 1, 2)));
++     __attribute__ ((format (__printf__, 1, 2)));
+ 
+ #endif /* ! GRUB_ERR_HEADER */
+diff --git a/util/import_gcry.py b/util/import_gcry.py
+index 63ebb90..2b3322d 100644
+--- a/util/import_gcry.py
++++ b/util/import_gcry.py
+@@ -534,6 +534,12 @@ for src in sorted (os.listdir (os.path.join (indir, "src"))):
+         fw.close ()
+         continue
+ 
++    if src == "g10lib.h":
++        fw.write (f.read ().replace ("(printf,f,a)", "(__printf__,f,a)"))
++        f.close ()
++        fw.close ()
++        continue
++
+     fw.write (f.read ())
+     f.close ()
+     fw.close ()
+-- 
+1.9.3
+
diff --git a/SOURCES/0046-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch b/SOURCES/0046-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch
new file mode 100644
index 0000000..2d0824d
--- /dev/null
+++ b/SOURCES/0046-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch
@@ -0,0 +1,60 @@
+From c18e39b667adb11624f3f4162c1342b76712d655 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sun, 26 Jan 2014 02:36:05 +0100
+Subject: [PATCH 046/143] 	* grub-core/term/serial.c
+ (grub_serial_register): Fix invalid free. 	Ensure that pointers are
+ inited to NULL and that pointers are not 	accessed after free.
+
+---
+ ChangeLog               | 5 +++++
+ grub-core/term/serial.c | 8 ++++----
+ 2 files changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index c93f11f..67b4d5c 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-01-26  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/term/serial.c (grub_serial_register): Fix invalid free.
++	Ensure that pointers are inited to NULL and that pointers are not
++	accessed after free.
+ 
+ 2014-01-25  Andrey Borzenkov <arvidjaar@gmail.com>
+ 
+diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c
+index b581a76..c9b5574 100644
+--- a/grub-core/term/serial.c
++++ b/grub-core/term/serial.c
+@@ -338,23 +338,23 @@ grub_serial_register (struct grub_serial_port *port)
+       grub_free (indata);
+       return grub_errno;
+     }
+-  
+-  out = grub_malloc (sizeof (*out));
++
++  out = grub_zalloc (sizeof (*out));
+   if (!out)
+     {
+-      grub_free (in);
+       grub_free (indata);
+       grub_free ((char *) in->name);
++      grub_free (in);
+       return grub_errno;
+     }
+ 
+   outdata = grub_malloc (sizeof (*outdata));
+   if (!outdata)
+     {
+-      grub_free (in);
+       grub_free (indata);
+       grub_free ((char *) in->name);
+       grub_free (out);
++      grub_free (in);
+       return grub_errno;
+     }
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0047-grub-install-support-for-partitioned-partx-loop-devi.patch b/SOURCES/0047-grub-install-support-for-partitioned-partx-loop-devi.patch
new file mode 100644
index 0000000..5a4df90
--- /dev/null
+++ b/SOURCES/0047-grub-install-support-for-partitioned-partx-loop-devi.patch
@@ -0,0 +1,55 @@
+From c889057e089d69bd187c8ba134c9669247744628 Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Sun, 26 Jan 2014 02:56:04 +0100
+Subject: [PATCH 047/143] 	grub-install: support for partitioned partx
+ loop devices.
+
+	* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect
+	/dev/loopX as being the parent of /dev/loopXpY.
+---
+ ChangeLog                       |  7 +++++++
+ grub-core/osdep/linux/getroot.c | 13 +++++++++++++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index 67b4d5c..bbec1e7 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,10 @@
++2014-01-26  Mike Gilbert <floppym@gentoo.org>
++
++	grub-install: support for partitioned partx loop devices.
++
++	* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect
++	/dev/loopX as being the parent of /dev/loopXpY.
++
+ 2014-01-26  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/term/serial.c (grub_serial_register): Fix invalid free.
+diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
+index 772de0a..19581d3 100644
+--- a/grub-core/osdep/linux/getroot.c
++++ b/grub-core/osdep/linux/getroot.c
+@@ -883,6 +883,19 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st,
+ 	  *pp = '\0';
+ 	  return path;
+ 	}
++
++      /* If this is a loop device */
++      if ((strncmp ("loop", p, 4) == 0) && p[4] >= '0' && p[4] <= '9')
++	{
++	  char *pp = p + 4;
++	  while (*pp >= '0' && *pp <= '9')
++	    pp++;
++	  if (*pp == 'p')
++	    *is_part = 1;
++	  /* /dev/loop[0-9]+p[0-9]* */
++	  *pp = '\0';
++	  return path;
++	}
+     }
+ 
+   return path;
+-- 
+1.9.3
+
diff --git a/SOURCES/0048-grub-core-term-at_keyboard.c-Tolerate-missing-keyboa.patch b/SOURCES/0048-grub-core-term-at_keyboard.c-Tolerate-missing-keyboa.patch
new file mode 100644
index 0000000..2e2fe1a
--- /dev/null
+++ b/SOURCES/0048-grub-core-term-at_keyboard.c-Tolerate-missing-keyboa.patch
@@ -0,0 +1,40 @@
+From 379cbd6233fe227544ff3073b60b295fe841b654 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sun, 26 Jan 2014 03:31:10 +0100
+Subject: [PATCH 048/143] 	* grub-core/term/at_keyboard.c: Tolerate
+ missing keyboard.
+
+---
+ ChangeLog                    | 4 ++++
+ grub-core/term/at_keyboard.c | 3 +++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index bbec1e7..d37d4a6 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-26  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/term/at_keyboard.c: Tolerate missing keyboard.
++
+ 2014-01-26  Mike Gilbert <floppym@gentoo.org>
+ 
+ 	grub-install: support for partitioned partx loop devices.
+diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c
+index f5071ce..b4257e8 100644
+--- a/grub-core/term/at_keyboard.c
++++ b/grub-core/term/at_keyboard.c
+@@ -396,6 +396,9 @@ fetch_key (int *is_break)
+   if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS)))
+     return -1;
+   at_key = grub_inb (KEYBOARD_REG_DATA);
++  /* May happen if no keyboard is connected. Just ignore this.  */
++  if (at_key == 0xff)
++    return -1;
+   if (at_key == 0xe0)
+     {
+       e0_received = 1;
+-- 
+1.9.3
+
diff --git a/SOURCES/0049-.gitignore-add-missing-files-and-.exe-variants.patch b/SOURCES/0049-.gitignore-add-missing-files-and-.exe-variants.patch
new file mode 100644
index 0000000..71bc474
--- /dev/null
+++ b/SOURCES/0049-.gitignore-add-missing-files-and-.exe-variants.patch
@@ -0,0 +1,73 @@
+From 58ca3abc65a64d950d6da8b473e91f16d410f1ac Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Wed, 29 Jan 2014 13:26:00 -0200
+Subject: [PATCH 049/143] .gitignore: add missing files and .exe variants.
+
+---
+ .gitignore | 7 +++++++
+ ChangeLog  | 6 +++++-
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/.gitignore b/.gitignore
+index 2b0156a..18ab8e8 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -58,6 +58,8 @@ grub-emu.exe
+ grub-emu-lite.exe
+ grub_emu_init.c
+ grub_emu_init.h
++/grub-file
++/grub-file.exe
+ grub-fstest
+ grub-fstest.exe
+ grub_fstest_init.c
+@@ -66,6 +68,8 @@ grub_func_test
+ grub-install
+ grub-install.exe
+ grub-kbdcomp
++/grub-macbless
++/grub-macbless.exe
+ grub-macho2img
+ /grub-menulst2cfg
+ /grub-menulst2cfg.exe
+@@ -120,6 +124,8 @@ grub-shell
+ grub-shell-tester
+ grub-sparc64-setup
+ grub-sparc64-setup.exe
++/grub-syslinux2cfg
++/grub-syslinux2cfg.exe
+ gzcompress_test
+ hddboot_test
+ help_test
+@@ -194,6 +200,7 @@ grub-core/modinfo.sh
+ grub-core/*.module
+ grub-core/*.module.exe
+ grub-core/*.pp
++grub-core/kernel.img.bin
+ util/bash-completion.d/grub
+ grub-core/gnulib/alloca.h
+ grub-core/gnulib/arg-nonnull.h
+diff --git a/ChangeLog b/ChangeLog
+index d37d4a6..a49f5f1 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-01-29  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
++
++	* .gitignore: add missing files and .exe variants.
++
+ 2014-01-26  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/term/at_keyboard.c: Tolerate missing keyboard.
+@@ -1113,7 +1117,7 @@
+ 
+ 2013-12-14  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+-	* .gitignore: Add .exe variants. Add missing files. Remove few outdated
++	* .gitignore: add .exe variants. add missing files. remove few outdated
+ 	entries.
+ 
+ 2013-12-14  Vladimir Serbinenko  <phcoder@gmail.com>
+-- 
+1.9.3
+
diff --git a/SOURCES/0050-util-grub-mkfont.c-Downgrade-warnings-about-unhandle.patch b/SOURCES/0050-util-grub-mkfont.c-Downgrade-warnings-about-unhandle.patch
new file mode 100644
index 0000000..d67ef51
--- /dev/null
+++ b/SOURCES/0050-util-grub-mkfont.c-Downgrade-warnings-about-unhandle.patch
@@ -0,0 +1,77 @@
+From f21c40f33c95d908cee32a5063f285d22574a507 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Wed, 29 Jan 2014 23:41:48 +0100
+Subject: [PATCH 050/143] 	* util/grub-mkfont.c: Downgrade warnings about
+ unhandled features 	to debug.
+
+---
+ ChangeLog          |  9 +++++++++
+ util/grub-mkfont.c | 14 ++++++++------
+ 2 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index a49f5f1..9837c7f 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,12 @@
++2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* util/grub-mkfont.c: Downgrade warnings about unhandled features
++	to debug.
++
++2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/term/at_keyboard.c: Tolerate missing keyboard.
++
+ 2014-01-29  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
+ 
+ 	* .gitignore: add missing files and .exe variants.
+diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c
+index 3cb02ad..3de07ee 100644
+--- a/util/grub-mkfont.c
++++ b/util/grub-mkfont.c
+@@ -516,8 +516,8 @@ process_cursive (struct gsub_feature *feature,
+ 	}		      
+       if (grub_be_to_cpu16 (lookup->flag) & ~GSUB_RTL_CHAR)
+ 	{
+-	  printf (_("Unsupported substitution flag: 0x%x\n"),
+-		  grub_be_to_cpu16 (lookup->flag));
++	  grub_util_info ("unsupported substitution flag: 0x%x",
++			  grub_be_to_cpu16 (lookup->flag));
+ 	}
+       switch (feattag)
+ 	{
+@@ -577,7 +577,8 @@ process_cursive (struct gsub_feature *feature,
+ 	       There are 2 coverage specifications: list and range.
+ 	       This warning is thrown when another coverage specification
+ 	       is detected.  */
+-	    printf (_("Unsupported coverage specification: %d\n"), covertype);
++	    fprintf (stderr,
++		     _("Unsupported coverage specification: %d\n"), covertype);
+ 	}
+     }
+ }
+@@ -616,7 +617,8 @@ add_font (struct grub_font_info *font_info, FT_Face face, int nocut)
+ 	  grub_uint32_t feattag
+ 	    = grub_be_to_cpu32 (features->features[i].feature_tag);
+ 	  if (feature->params)
+-	    printf (_("WARNING: unsupported font feature parameters: %x\n"),
++	    fprintf (stderr,
++		     _("WARNING: unsupported font feature parameters: %x\n"),
+ 		    grub_be_to_cpu16 (feature->params));
+ 	  switch (feattag)
+ 	    {
+@@ -647,8 +649,8 @@ add_font (struct grub_font_info *font_info, FT_Face face, int nocut)
+ 		  if (!grub_isgraph (str[j]))
+ 		    str[j] = '?';
+ 		/* TRANSLATORS: It's gsub feature, not gsub font.  */
+-		printf (_("Unknown gsub font feature 0x%x (%s)\n"),
+-			feattag, str);
++		grub_util_info ("Unknown gsub font feature 0x%x (%s)",
++				feattag, str);
+ 	      }
+ 	    }
+ 	}
+-- 
+1.9.3
+
diff --git a/SOURCES/0051-grub-core-disk-ahci.c-Do-not-enable-I-O-decoding-and.patch b/SOURCES/0051-grub-core-disk-ahci.c-Do-not-enable-I-O-decoding-and.patch
new file mode 100644
index 0000000..ca6c86d
--- /dev/null
+++ b/SOURCES/0051-grub-core-disk-ahci.c-Do-not-enable-I-O-decoding-and.patch
@@ -0,0 +1,57 @@
+From 5795341bb64a4e101d7c067d688b19a41dd50662 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Wed, 29 Jan 2014 23:43:25 +0100
+Subject: [PATCH 051/143] 	* grub-core/disk/ahci.c: Do not enable I/O
+ decoding and keep 	enabling busmaster for the end.
+
+---
+ ChangeLog             |  5 +++++
+ grub-core/disk/ahci.c | 10 ++++++----
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 9837c7f..51eba95 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* grub-core/disk/ahci.c: Do not enable I/O decoding and keep
++	enabling busmaster for the end.
++
++2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* util/grub-mkfont.c: Downgrade warnings about unhandled features
+ 	to debug.
+ 
+diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c
+index 0b13fb8..18c1327 100644
+--- a/grub-core/disk/ahci.c
++++ b/grub-core/disk/ahci.c
+@@ -194,10 +194,8 @@ grub_ahci_pciinit (grub_pci_device_t dev,
+     return 0;
+ 
+   addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
+-  grub_pci_write_word (addr, grub_pci_read_word (addr) | 
+-		    GRUB_PCI_COMMAND_IO_ENABLED
+-		    | GRUB_PCI_COMMAND_MEM_ENABLED
+-		    | GRUB_PCI_COMMAND_BUS_MASTER);
++  grub_pci_write_word (addr, grub_pci_read_word (addr)
++		    | GRUB_PCI_COMMAND_MEM_ENABLED);
+ 
+   hba = grub_pci_device_map_range (dev, bar & GRUB_PCI_ADDR_MEM_MASK,
+ 				   sizeof (hba));
+@@ -621,6 +619,10 @@ grub_ahci_pciinit (grub_pci_device_t dev,
+     if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].sig >> 16) == 0xeb14)
+       adevs[i]->atapi = 1;
+ 
++  addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
++  grub_pci_write_word (addr, grub_pci_read_word (addr)
++		    | GRUB_PCI_COMMAND_BUS_MASTER);
++
+   for (i = 0; i < nports; i++)
+     if (adevs[i])
+       {
+-- 
+1.9.3
+
diff --git a/SOURCES/0052-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch b/SOURCES/0052-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch
new file mode 100644
index 0000000..8236481
--- /dev/null
+++ b/SOURCES/0052-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch
@@ -0,0 +1,55 @@
+From 50cb0018044359180aa57e6aa7ec944def83bbcc Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Wed, 29 Jan 2014 23:45:18 +0100
+Subject: [PATCH 052/143] 	* grub-core/disk/ahci.c: Allocate and clean
+ space for all possible 32 	slots to avoid pointing to uninited area.
+
+---
+ ChangeLog             | 5 +++++
+ grub-core/disk/ahci.c | 8 +++++++-
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 51eba95..9bb1817 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* grub-core/disk/ahci.c: Allocate and clean space for all possible 32
++	slots to avoid pointing to uninited area.
++
++2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/disk/ahci.c: Do not enable I/O decoding and keep
+ 	enabling busmaster for the end.
+ 
+diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c
+index 18c1327..d63fd09 100644
+--- a/grub-core/disk/ahci.c
++++ b/grub-core/disk/ahci.c
+@@ -358,7 +358,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
+ 	grub_dprintf ("ahci", "err: %x\n",
+ 		      adevs[i]->hba->ports[adevs[i]->port].sata_error);
+ 
+-	adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head));
++	adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head) * 32);
+ 	if (!adevs[i]->command_list_chunk)
+ 	  {
+ 	    adevs[i] = 0;
+@@ -376,6 +376,12 @@ grub_ahci_pciinit (grub_pci_device_t dev,
+ 
+ 	adevs[i]->command_list = grub_dma_get_virt (adevs[i]->command_list_chunk);
+ 	adevs[i]->command_table = grub_dma_get_virt (adevs[i]->command_table_chunk);
++
++	grub_memset ((void *) adevs[i]->command_list, 0,
++		     sizeof (struct grub_ahci_cmd_table));
++	grub_memset ((void *) adevs[i]->command_table, 0,
++		     sizeof (struct grub_ahci_cmd_head) * 32);
++
+ 	adevs[i]->command_list->command_table_base
+ 	  = grub_dma_get_phys (adevs[i]->command_table_chunk);
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0053-grub-core-disk-ahci.c-Add-safety-cleanups.patch b/SOURCES/0053-grub-core-disk-ahci.c-Add-safety-cleanups.patch
new file mode 100644
index 0000000..1c26b0b
--- /dev/null
+++ b/SOURCES/0053-grub-core-disk-ahci.c-Add-safety-cleanups.patch
@@ -0,0 +1,62 @@
+From 3f00de9c207fb4b3f9e45fd775650404ce087aac Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Wed, 29 Jan 2014 23:46:17 +0100
+Subject: [PATCH 053/143] 	* grub-core/disk/ahci.c: Add safety cleanups.
+
+---
+ ChangeLog             |  4 ++++
+ grub-core/disk/ahci.c | 10 ++++++++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index 9bb1817..15300b0 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,9 @@
+ 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* grub-core/disk/ahci.c: Add safety cleanups.
++
++2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/disk/ahci.c: Allocate and clean space for all possible 32
+ 	slots to avoid pointing to uninited area.
+ 
+diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c
+index d63fd09..643e691 100644
+--- a/grub-core/disk/ahci.c
++++ b/grub-core/disk/ahci.c
+@@ -454,6 +454,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
+ 	adevs[i]->hba->ports[adevs[i]->port].fis_base = grub_dma_get_phys (adevs[i]->rfis);
+ 	adevs[i]->hba->ports[adevs[i]->port].command_list_base
+ 	  = grub_dma_get_phys (adevs[i]->command_list_chunk);
++	adevs[i]->hba->ports[adevs[i]->port].command_issue = 0;
+ 	adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_FRE;
+       }
+ 
+@@ -600,6 +601,9 @@ grub_ahci_pciinit (grub_pci_device_t dev,
+ 	failed_adevs[i] = adevs[i];
+ 	adevs[i] = 0;
+       }
++
++  grub_dprintf ("ahci", "cleaning up failed devs\n");
++
+   for (i = 0; i < nports; i++)
+     if (failed_adevs[i] && (fr_running & (1 << i)))
+       failed_adevs[i]->hba->ports[failed_adevs[i]->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE;
+@@ -855,6 +859,12 @@ grub_ahci_reset_port (struct grub_ahci_device *dev, int force)
+     {
+       struct grub_disk_ata_pass_through_parms parms2;
+       dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST;
++      dev->hba->ports[dev->port].command_issue = 0;
++      dev->command_list[0].config = 0;
++      dev->command_table[0].prdt[0].unused = 0;
++      dev->command_table[0].prdt[0].size = 0;
++      dev->command_table[0].prdt[0].data_base = 0;
++
+       endtime = grub_get_time_ms () + 1000;
+       while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR))
+ 	if (grub_get_time_ms () > endtime)
+-- 
+1.9.3
+
diff --git a/SOURCES/0054-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch b/SOURCES/0054-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch
new file mode 100644
index 0000000..1dbe706
--- /dev/null
+++ b/SOURCES/0054-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch
@@ -0,0 +1,54 @@
+From 5e8c619b17cdf70b30d37412738b149d80874c28 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Wed, 29 Jan 2014 23:49:51 +0100
+Subject: [PATCH 054/143] 	* grub-core/disk/ahci.c: Properly handle
+ transactions with no 	transferred data.
+
+---
+ ChangeLog             | 5 +++++
+ grub-core/disk/ahci.c | 7 +++++--
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 15300b0..bc1ab23 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* grub-core/disk/ahci.c: Properly handle transactions with no
++	transferred data.
++
++2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/disk/ahci.c: Add safety cleanups.
+ 
+ 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
+diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c
+index 643e691..fdd40c6 100644
+--- a/grub-core/disk/ahci.c
++++ b/grub-core/disk/ahci.c
+@@ -932,7 +932,10 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
+   if (parms->size > GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH)
+     return grub_error (GRUB_ERR_BUG, "too big data buffer");
+ 
+-  bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
++  if (parms->size)
++    bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
++  else
++    bufc = grub_memalign_dma32 (1024, 512);
+ 
+   grub_dprintf ("ahci", "AHCI tfd = %x, CL=%p\n",
+ 		dev->hba->ports[dev->port].task_file_data,
+@@ -942,7 +945,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
+     = (5 << GRUB_AHCI_CONFIG_CFIS_LENGTH_SHIFT)
+     //    | GRUB_AHCI_CONFIG_CLEAR_R_OK
+     | (0 << GRUB_AHCI_CONFIG_PMP_SHIFT)
+-    | (1 << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
++    | ((parms->size ? 1 : 0) << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
+     | (parms->cmdsize ? GRUB_AHCI_CONFIG_ATAPI : 0)
+     | (parms->write ? GRUB_AHCI_CONFIG_WRITE : GRUB_AHCI_CONFIG_READ)
+     | (parms->taskfile.cmd == 8 ? (1 << 8) : 0);
+-- 
+1.9.3
+
diff --git a/SOURCES/0055-grub-core-disk-ahci.c-Increase-timeout.-Some-SSDs-ta.patch b/SOURCES/0055-grub-core-disk-ahci.c-Increase-timeout.-Some-SSDs-ta.patch
new file mode 100644
index 0000000..0e135a8
--- /dev/null
+++ b/SOURCES/0055-grub-core-disk-ahci.c-Increase-timeout.-Some-SSDs-ta.patch
@@ -0,0 +1,42 @@
+From 45dd39fb467d061a550113fd5e5431209f0db73c Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Wed, 29 Jan 2014 23:50:49 +0100
+Subject: [PATCH 055/143] 	* grub-core/disk/ahci.c: Increase timeout.
+ Some SSDs take up to 	7 seconds to recover if last poweroff was bad.
+
+---
+ ChangeLog             | 5 +++++
+ grub-core/disk/ahci.c | 2 +-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index bc1ab23..1a822f3 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* grub-core/disk/ahci.c: Increase timeout. Some SSDs take up to
++	7 seconds to recover if last poweroff was bad.
++
++2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/disk/ahci.c: Properly handle transactions with no
+ 	transferred data.
+ 
+diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c
+index fdd40c6..5e4a639 100644
+--- a/grub-core/disk/ahci.c
++++ b/grub-core/disk/ahci.c
+@@ -1022,7 +1022,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
+   grub_dprintf ("ahci", "AHCI tfd = %x\n",
+ 		dev->hba->ports[dev->port].task_file_data);
+ 
+-  endtime = grub_get_time_ms () + (spinup ? 10000 : 5000);
++  endtime = grub_get_time_ms () + (spinup ? 20000 : 20000);
+   while ((dev->hba->ports[dev->port].command_issue & 1))
+     if (grub_get_time_ms () > endtime)
+       {
+-- 
+1.9.3
+
diff --git a/SOURCES/0056-util-grub-mkfont.c-Build-fix-for-argp.h-with-older-g.patch b/SOURCES/0056-util-grub-mkfont.c-Build-fix-for-argp.h-with-older-g.patch
new file mode 100644
index 0000000..b2dbf4f
--- /dev/null
+++ b/SOURCES/0056-util-grub-mkfont.c-Build-fix-for-argp.h-with-older-g.patch
@@ -0,0 +1,42 @@
+From 767cf43a2e5c738df50155cc8729ad0f57d6ab47 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Mon, 3 Feb 2014 14:34:27 +0100
+Subject: [PATCH 056/143] 	* util/grub-mkfont.c: Build fix for argp.h
+ with older gcc.
+
+---
+ ChangeLog          | 4 ++++
+ util/grub-mkfont.c | 4 ++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index 1a822f3..f2bba84 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-02-03  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* util/grub-mkfont.c: Build fix for argp.h with older gcc.
++
+ 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/disk/ahci.c: Increase timeout. Some SSDs take up to
+diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c
+index 3de07ee..e6485b4 100644
+--- a/util/grub-mkfont.c
++++ b/util/grub-mkfont.c
+@@ -33,7 +33,11 @@
+ 
+ #ifndef GRUB_BUILD
+ #define _GNU_SOURCE	1
++#pragma GCC diagnostic ignored "-Wmissing-prototypes"
++#pragma GCC diagnostic ignored "-Wmissing-declarations"
+ #include <argp.h>
++#pragma GCC diagnostic error "-Wmissing-prototypes"
++#pragma GCC diagnostic error "-Wmissing-declarations"
+ #endif
+ #include <assert.h>
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0057-util-grub-mkrescue.c-Build-fix-for-argp.h-with-older.patch b/SOURCES/0057-util-grub-mkrescue.c-Build-fix-for-argp.h-with-older.patch
new file mode 100644
index 0000000..20ed6af
--- /dev/null
+++ b/SOURCES/0057-util-grub-mkrescue.c-Build-fix-for-argp.h-with-older.patch
@@ -0,0 +1,44 @@
+From 3365d3eb4062cee9581f3560ec3e93f8c8ababb2 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Mon, 3 Feb 2014 14:35:51 +0100
+Subject: [PATCH 057/143] 	* util/grub-mkrescue.c: Build fix for argp.h
+ with older gcc.
+
+---
+ ChangeLog            | 4 ++++
+ util/grub-mkrescue.c | 4 ++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index f2bba84..f4a4721 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,9 @@
+ 2014-02-03  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* util/grub-mkrescue.c: Build fix for argp.h with older gcc.
++
++2014-02-03  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* util/grub-mkfont.c: Build fix for argp.h with older gcc.
+ 
+ 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
+diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c
+index 34e0b7a..e719839 100644
+--- a/util/grub-mkrescue.c
++++ b/util/grub-mkrescue.c
+@@ -25,7 +25,11 @@
+ #include <grub/emu/exec.h>
+ #include <grub/emu/config.h>
+ #include <grub/emu/hostdisk.h>
++#pragma GCC diagnostic ignored "-Wmissing-prototypes"
++#pragma GCC diagnostic ignored "-Wmissing-declarations"
+ #include <argp.h>
++#pragma GCC diagnostic error "-Wmissing-prototypes"
++#pragma GCC diagnostic error "-Wmissing-declarations"
+ 
+ #include <sys/types.h>
+ #include <sys/wait.h>
+-- 
+1.9.3
+
diff --git a/SOURCES/0058-add-grub_env_set_net_property-function.patch b/SOURCES/0058-add-grub_env_set_net_property-function.patch
new file mode 100644
index 0000000..18e1201
--- /dev/null
+++ b/SOURCES/0058-add-grub_env_set_net_property-function.patch
@@ -0,0 +1,199 @@
+From 533058df7c164a4d3498dfaa626923904597f162 Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Tue, 4 Feb 2014 18:41:38 -0200
+Subject: [PATCH 058/143] add grub_env_set_net_property function
+
+* grub-core/net/bootp.c: Remove set_env_limn_ro.
+* grub-core/net/net.c: Add grub_env_set_net_property.
+* include/grub/net.h: Likewise.
+---
+ ChangeLog             |  8 +++++++
+ grub-core/net/bootp.c | 63 +++++++++++++--------------------------------------
+ grub-core/net/net.c   | 38 +++++++++++++++++++++++++++++++
+ include/grub/net.h    |  4 ++++
+ 4 files changed, 66 insertions(+), 47 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index f4a4721..63f5aa3 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,11 @@
++2014-02-04  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
++
++	Add grub_env_set_net_property function.
++
++	* grub-core/net/bootp.c: Remove set_env_limn_ro.
++	* grub-core/net/net.c: Add grub_env_set_net_property.
++	* include/grub/net.h: Likewise.
++
+ 2014-02-03  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* util/grub-mkrescue.c: Build fix for argp.h with older gcc.
+diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
+index c14e9de..6310ed4 100644
+--- a/grub-core/net/bootp.c
++++ b/grub-core/net/bootp.c
+@@ -25,41 +25,6 @@
+ #include <grub/net/udp.h>
+ #include <grub/datetime.h>
+ 
+-static char *
+-grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)),
+-			 const char *val __attribute__ ((unused)))
+-{
+-  return NULL;
+-}
+-
+-static void
+-set_env_limn_ro (const char *intername, const char *suffix,
+-		 const char *value, grub_size_t len)
+-{
+-  char *varname, *varvalue;
+-  char *ptr;
+-  varname = grub_xasprintf ("net_%s_%s", intername, suffix);
+-  if (!varname)
+-    return;
+-  for (ptr = varname; *ptr; ptr++)
+-    if (*ptr == ':')
+-      *ptr = '_';
+-  varvalue = grub_malloc (len + 1);
+-  if (!varvalue)
+-    {
+-      grub_free (varname);
+-      return;
+-    }
+-
+-  grub_memcpy (varvalue, value, len);
+-  varvalue[len] = 0;
+-  grub_env_set (varname, varvalue);
+-  grub_register_variable_hook (varname, 0, grub_env_write_readonly);
+-  grub_env_export (varname);
+-  grub_free (varname);
+-  grub_free (varvalue);
+-}
+-
+ static void
+ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
+ {
+@@ -136,20 +101,24 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
+ 	  }
+ 	  continue;
+ 	case GRUB_NET_BOOTP_HOSTNAME:
+-	  set_env_limn_ro (name, "hostname", (const char *) ptr, taglength);
+-	  break;
++          grub_env_set_net_property (name, "hostname", (const char *) ptr,
++                                     taglength);
++          break;
+ 
+ 	case GRUB_NET_BOOTP_DOMAIN:
+-	  set_env_limn_ro (name, "domain", (const char *) ptr, taglength);
+-	  break;
++          grub_env_set_net_property (name, "domain", (const char *) ptr,
++                                     taglength);
++          break;
+ 
+ 	case GRUB_NET_BOOTP_ROOT_PATH:
+-	  set_env_limn_ro (name, "rootpath", (const char *) ptr, taglength);
+-	  break;
++          grub_env_set_net_property (name, "rootpath", (const char *) ptr,
++                                     taglength);
++          break;
+ 
+ 	case GRUB_NET_BOOTP_EXTENSIONS_PATH:
+-	  set_env_limn_ro (name, "extensionspath", (const char *) ptr, taglength);
+-	  break;
++          grub_env_set_net_property (name, "extensionspath", (const char *) ptr,
++                                     taglength);
++          break;
+ 
+ 	  /* If you need any other options please contact GRUB
+ 	     development team.  */
+@@ -211,8 +180,8 @@ grub_net_configure_by_dhcp_ack (const char *name,
+     }
+ 
+   if (size > OFFSET_OF (boot_file, bp))
+-    set_env_limn_ro (name, "boot_file", (char *) bp->boot_file,
+-		     sizeof (bp->boot_file));
++    grub_env_set_net_property (name, "boot_file", bp->boot_file,
++                               sizeof (bp->boot_file));
+   if (is_def)
+     grub_net_default_server = 0;
+   if (is_def && !grub_net_default_server && bp->server_ip)
+@@ -243,8 +212,8 @@ grub_net_configure_by_dhcp_ack (const char *name,
+   if (size > OFFSET_OF (server_name, bp)
+       && bp->server_name[0])
+     {
+-      set_env_limn_ro (name, "dhcp_server_name", (char *) bp->server_name,
+-		       sizeof (bp->server_name));
++      grub_env_set_net_property (name, "dhcp_server_name", bp->server_name,
++                                 sizeof (bp->server_name));
+       if (is_def && !grub_net_default_server)
+ 	{
+ 	  grub_net_default_server = grub_strdup (bp->server_name);
+diff --git a/grub-core/net/net.c b/grub-core/net/net.c
+index 1521d8d..f2e723b 100644
+--- a/grub-core/net/net.c
++++ b/grub-core/net/net.c
+@@ -1480,6 +1480,44 @@ receive_packets (struct grub_net_card *card, int *stop_condition)
+   grub_print_error ();
+ }
+ 
++static char *
++grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)),
++			 const char *val __attribute__ ((unused)))
++{
++  return NULL;
++}
++
++grub_err_t
++grub_env_set_net_property (const char *intername, const char *suffix,
++                           const char *value, grub_size_t len)
++{
++  char *varname, *varvalue;
++  char *ptr;
++
++  varname = grub_xasprintf ("net_%s_%s", intername, suffix);
++  if (!varname)
++    return grub_errno;
++  for (ptr = varname; *ptr; ptr++)
++    if (*ptr == ':')
++      *ptr = '_';
++  varvalue = grub_malloc (len + 1);
++  if (!varvalue)
++    {
++      grub_free (varname);
++      return grub_errno;
++    }
++
++  grub_memcpy (varvalue, value, len);
++  varvalue[len] = 0;
++  grub_err_t ret = grub_env_set (varname, varvalue);
++  grub_register_variable_hook (varname, 0, grub_env_write_readonly);
++  grub_env_export (varname);
++  grub_free (varname);
++  grub_free (varvalue);
++
++  return ret;
++}
++
+ void
+ grub_net_poll_cards (unsigned time, int *stop_condition)
+ {
+diff --git a/include/grub/net.h b/include/grub/net.h
+index 0e0a605..538baa3 100644
+--- a/include/grub/net.h
++++ b/include/grub/net.h
+@@ -480,6 +480,10 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target,
+ void
+ grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str);
+ 
++grub_err_t
++grub_env_set_net_property (const char *intername, const char *suffix,
++                           const char *value, grub_size_t len);
++
+ void
+ grub_net_poll_cards (unsigned time, int *stop_condition);
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0059-add-bootpath-parser-for-open-firmware.patch b/SOURCES/0059-add-bootpath-parser-for-open-firmware.patch
new file mode 100644
index 0000000..b2bd212
--- /dev/null
+++ b/SOURCES/0059-add-bootpath-parser-for-open-firmware.patch
@@ -0,0 +1,211 @@
+From 1a768cc5a65094e19c216caf92dd190317df25fc Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Tue, 4 Feb 2014 19:00:55 -0200
+Subject: [PATCH 059/143] add bootpath parser for open firmware
+
+It enables net boot even when there is no bootp/dhcp server.
+
+* grub-core/net/drivers/ieee1275/ofnet.c: Add grub_ieee1275_parse_bootpath and
+call it at grub_ieee1275_net_config_real.
+* grub-core/kern/ieee1275/init.c: Add bootpath to grub_ieee1275_net_config.
+* include/grub/ieee1275/ieee1275.h: Likewise.
+---
+ ChangeLog                              |  13 ++++
+ grub-core/kern/ieee1275/init.c         |   7 +--
+ grub-core/net/drivers/ieee1275/ofnet.c | 107 ++++++++++++++++++++++++++++++++-
+ include/grub/ieee1275/ieee1275.h       |   5 +-
+ 4 files changed, 125 insertions(+), 7 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 63f5aa3..5237631 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,18 @@
+ 2014-02-04  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
+ 
++	Add bootpath parser for open firmware.
++
++	It enables net boot even when there is no bootp/dhcp server.
++
++	* grub-core/net/drivers/ieee1275/ofnet.c: Add grub_ieee1275_parse_bootpath
++	and call it at grub_ieee1275_net_config_real.
++	* grub-core/kern/ieee1275/init.c: Add bootpath to
++	grub_ieee1275_net_config.
++	* include/grub/ieee1275/ieee1275.h: Likewise.
++
++
++2014-02-04  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
++
+ 	Add grub_env_set_net_property function.
+ 
+ 	* grub-core/net/bootp.c: Remove set_env_limn_ro.
+diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
+index 89b2822..d5bd74d 100644
+--- a/grub-core/kern/ieee1275/init.c
++++ b/grub-core/kern/ieee1275/init.c
+@@ -80,9 +80,8 @@ grub_translate_ieee1275_path (char *filepath)
+     }
+ }
+ 
+-void (*grub_ieee1275_net_config) (const char *dev,
+-				  char **device,
+-				  char **path);
++void (*grub_ieee1275_net_config) (const char *dev, char **device, char **path,
++                                  char *bootpath);
+ void
+ grub_machine_get_bootlocation (char **device, char **path)
+ {
+@@ -126,7 +125,7 @@ grub_machine_get_bootlocation (char **device, char **path)
+       *ptr = 0;
+ 
+       if (grub_ieee1275_net_config)
+-	grub_ieee1275_net_config (canon, device, path);
++	grub_ieee1275_net_config (canon, device, path, bootpath);
+       grub_free (dev);
+       grub_free (canon);
+     }
+diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
+index 4483c91..eea8e71 100644
+--- a/grub-core/net/drivers/ieee1275/ofnet.c
++++ b/grub-core/net/drivers/ieee1275/ofnet.c
+@@ -127,8 +127,111 @@ bootp_response_properties[] =
+     { .name = "bootpreply-packet", .offset = 0x2a},
+   };
+ 
++enum
++{
++  BOOTARGS_SERVER_ADDR,
++  BOOTARGS_FILENAME,
++  BOOTARGS_CLIENT_ADDR,
++  BOOTARGS_GATEWAY_ADDR,
++  BOOTARGS_BOOTP_RETRIES,
++  BOOTARGS_TFTP_RETRIES,
++  BOOTARGS_SUBNET_MASK,
++  BOOTARGS_BLOCKSIZE
++};
++
++static int
++grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
++                              char **device, struct grub_net_card **card)
++{
++  char *args;
++  char *comma_char = 0;
++  char *equal_char = 0;
++  grub_size_t field_counter = 0;
++
++  grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask;
++  grub_net_link_level_address_t hw_addr;
++  grub_net_interface_flags_t flags = 0;
++  struct grub_net_network_level_interface *inter;
++
++  hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
++
++  args = bootpath + grub_strlen (devpath) + 1;
++  do
++    {
++      comma_char = grub_strchr (args, ',');
++      if (comma_char != 0)
++        *comma_char = 0;
++
++      /* Check if it's an option (like speed=auto) and not a default parameter */
++      equal_char = grub_strchr (args, '=');
++      if (equal_char != 0)
++        {
++          *equal_char = 0;
++          grub_env_set_net_property ((*card)->name, args, equal_char + 1,
++                                     grub_strlen(equal_char + 1));
++          *equal_char = '=';
++        }
++      else
++        {
++          switch (field_counter++)
++            {
++            case BOOTARGS_SERVER_ADDR:
++              *device = grub_xasprintf ("tftp,%s", args);
++              if (!*device)
++                return grub_errno;
++              break;
++
++            case BOOTARGS_CLIENT_ADDR:
++              grub_net_resolve_address (args, &client_addr);
++              break;
++
++            case BOOTARGS_GATEWAY_ADDR:
++              grub_net_resolve_address (args, &gateway_addr);
++              break;
++
++            case BOOTARGS_SUBNET_MASK:
++              grub_net_resolve_address (args, &subnet_mask);
++              break;
++            }
++        }
++      args = comma_char + 1;
++      if (comma_char != 0)
++        *comma_char = ',';
++    } while (comma_char != 0);
++
++  if ((client_addr.ipv4 != 0) && (subnet_mask.ipv4 != 0))
++    {
++      grub_ieee1275_phandle_t devhandle;
++      grub_ieee1275_finddevice (devpath, &devhandle);
++      grub_ieee1275_get_property (devhandle, "mac-address",
++                                  hw_addr.mac, sizeof(hw_addr.mac), 0);
++      inter = grub_net_add_addr ((*card)->name, *card, &client_addr, &hw_addr,
++                                 flags);
++      grub_net_add_ipv4_local (inter,
++                          __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)));
++    }
++
++  if (gateway_addr.ipv4 != 0)
++    {
++      grub_net_network_level_netaddress_t target;
++      char *rname;
++
++      target.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
++      target.ipv4.base = 0;
++      target.ipv4.masksize = 0;
++      rname = grub_xasprintf ("%s:default", ((*card)->name));
++      if (rname)
++        grub_net_add_route_gw (rname, target, gateway_addr);
++      else
++        return grub_errno;
++    }
++
++  return 0;
++}
++
+ static void
+-grub_ieee1275_net_config_real (const char *devpath, char **device, char **path)
++grub_ieee1275_net_config_real (const char *devpath, char **device, char **path,
++                               char *bootpath)
+ {
+   struct grub_net_card *card;
+ 
+@@ -158,6 +261,8 @@ grub_ieee1275_net_config_real (const char *devpath, char **device, char **path)
+       }
+     grub_free (canon);
+ 
++    grub_ieee1275_parse_bootpath (devpath, bootpath, device, &card);
++
+     for (i = 0; i < ARRAY_SIZE (bootp_response_properties); i++)
+       if (grub_ieee1275_get_property_length (grub_ieee1275_chosen,
+ 					     bootp_response_properties[i].name,
+diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
+index dc54bea..8e42513 100644
+--- a/include/grub/ieee1275/ieee1275.h
++++ b/include/grub/ieee1275/ieee1275.h
+@@ -70,8 +70,9 @@ struct grub_ieee1275_devalias
+ };
+ 
+ extern void (*EXPORT_VAR(grub_ieee1275_net_config)) (const char *dev,
+-						     char **device,
+-						     char **path);
++                                                     char **device,
++                                                     char **path,
++                                                     char *bootargs);
+ 
+ /* Maps a device alias to a pathname.  */
+ extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen);
+-- 
+1.9.3
+
diff --git a/SOURCES/0060-grub-core-disk-ahci.c-Ignore-NPORTS-field-and-rely-o.patch b/SOURCES/0060-grub-core-disk-ahci.c-Ignore-NPORTS-field-and-rely-o.patch
new file mode 100644
index 0000000..52d68c3
--- /dev/null
+++ b/SOURCES/0060-grub-core-disk-ahci.c-Ignore-NPORTS-field-and-rely-o.patch
@@ -0,0 +1,40 @@
+From 7f4e3839c9b872f0981e1ecdecfa2bd91065f99c Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Thu, 20 Feb 2014 10:11:43 +0100
+Subject: [PATCH 060/143] 	* grub-core/disk/ahci.c: Ignore NPORTS field
+ and rely on PI 	exclusively.
+
+---
+ ChangeLog             | 5 +++++
+ grub-core/disk/ahci.c | 2 +-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 5237631..be41aa5 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-02-20  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/disk/ahci.c: Ignore NPORTS field and rely on PI
++	exclusively.
++
+ 2014-02-04  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
+ 
+ 	Add bootpath parser for open firmware.
+diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c
+index 5e4a639..89365cd 100644
+--- a/grub-core/disk/ahci.c
++++ b/grub-core/disk/ahci.c
+@@ -322,7 +322,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
+ 
+   grub_dprintf ("ahci", "GLC:%x\n", hba->global_control);
+ 
+-  nports = (hba->cap & GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1;
++  nports = (GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1;
+ 
+   grub_dprintf ("ahci", "%d AHCI ports, PI = 0x%x\n", nports,
+ 		hba->ports_implemented);
+-- 
+1.9.3
+
diff --git a/SOURCES/0061-grub-core-kern-i386-coreboot-mmap.c-Filter-out-0xa00.patch b/SOURCES/0061-grub-core-kern-i386-coreboot-mmap.c-Filter-out-0xa00.patch
new file mode 100644
index 0000000..11deb12
--- /dev/null
+++ b/SOURCES/0061-grub-core-kern-i386-coreboot-mmap.c-Filter-out-0xa00.patch
@@ -0,0 +1,82 @@
+From c65d7e05498edecd560753768114b574f7c3543d Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 28 Feb 2014 09:47:57 +0100
+Subject: [PATCH 061/143] 	* grub-core/kern/i386/coreboot/mmap.c: Filter
+ out 0xa0000-0x100000 	region.
+
+---
+ ChangeLog                           |  5 +++++
+ grub-core/kern/i386/coreboot/mmap.c | 38 +++++++++++++++++++++++++++++++------
+ 2 files changed, 37 insertions(+), 6 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index be41aa5..4f6f6d6 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/kern/i386/coreboot/mmap.c: Filter out 0xa0000-0x100000
++	region.
++
+ 2014-02-20  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/disk/ahci.c: Ignore NPORTS field and rely on PI
+diff --git a/grub-core/kern/i386/coreboot/mmap.c b/grub-core/kern/i386/coreboot/mmap.c
+index 1197975..4d29f6b 100644
+--- a/grub-core/kern/i386/coreboot/mmap.c
++++ b/grub-core/kern/i386/coreboot/mmap.c
+@@ -44,18 +44,44 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data)
+   mem_region =
+     (mem_region_t) ((long) table_item +
+ 			       sizeof (struct grub_linuxbios_table_item));
+-  while ((long) mem_region < (long) table_item + (long) table_item->size)
++  for (; (long) mem_region < (long) table_item + (long) table_item->size;
++       mem_region++)
+     {
+-      if (ctx->hook (mem_region->addr, mem_region->size,
++      grub_uint64_t start = mem_region->addr;
++      grub_uint64_t end = mem_region->addr + mem_region->size;
++      /* Mark region 0xa0000 - 0x100000 as reserved.  */
++      if (start < 0x100000 && end >= 0xa0000
++	  && mem_region->type == GRUB_MACHINE_MEMORY_AVAILABLE)
++	{
++	  if (start < 0xa0000
++	      && ctx->hook (start, 0xa0000 - start,
++			    /* Multiboot mmaps match with the coreboot mmap
++			       definition.  Therefore, we can just pass type
++			       through.  */
++			    mem_region->type,
++			    ctx->hook_data))
++	    return 1;
++	  if (start < 0xa0000)
++	    start = 0xa0000;
++	  if (start >= end)
++	    continue;
++
++	  if (ctx->hook (start, (end > 0x100000 ? 0x100000 : end) - start,
++			 GRUB_MEMORY_RESERVED,
++			 ctx->hook_data))
++	    return 1;
++	  start = 0x100000;
++
++	  if (end <= start)
++	    continue;
++	}
++      if (ctx->hook (start, end - start,
+ 		     /* Multiboot mmaps match with the coreboot mmap
+ 		        definition.  Therefore, we can just pass type
+ 		        through.  */
+-		     (((mem_region->type <= GRUB_MACHINE_MEMORY_BADRAM) && (mem_region->type >= GRUB_MACHINE_MEMORY_AVAILABLE))
+-		      || mem_region->type == GRUB_MEMORY_COREBOOT_TABLES) ? mem_region->type : GRUB_MEMORY_RESERVED,
++		     mem_region->type,
+ 		     ctx->hook_data))
+ 	return 1;
+-
+-      mem_region++;
+     }
+ 
+   return 0;
+-- 
+1.9.3
+
diff --git a/SOURCES/0062-grub-core-loader-i386-multiboot_mbi.c-grub_multiboot.patch b/SOURCES/0062-grub-core-loader-i386-multiboot_mbi.c-grub_multiboot.patch
new file mode 100644
index 0000000..b98968e
--- /dev/null
+++ b/SOURCES/0062-grub-core-loader-i386-multiboot_mbi.c-grub_multiboot.patch
@@ -0,0 +1,42 @@
+From 4530afc725782bbb92d4681fc338acebc4604b45 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 28 Feb 2014 09:48:57 +0100
+Subject: [PATCH 062/143] 	* grub-core/loader/i386/multiboot_mbi.c
+ (grub_multiboot_make_mbi): Limit 	location to 640K.
+
+---
+ ChangeLog                             | 5 +++++
+ grub-core/loader/i386/multiboot_mbi.c | 2 +-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 4f6f6d6..bbaed26 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_make_mbi): Limit
++	location to 640K.
++
++2014-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/kern/i386/coreboot/mmap.c: Filter out 0xa0000-0x100000
+ 	region.
+ 
+diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c
+index 7431aa4..f10c087 100644
+--- a/grub-core/loader/i386/multiboot_mbi.c
++++ b/grub-core/loader/i386/multiboot_mbi.c
+@@ -446,7 +446,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
+   bufsize = grub_multiboot_get_mbi_size ();
+ 
+   err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch,
+-					  0x10000, 0x100000 - bufsize,
++					  0x10000, 0xa0000 - bufsize,
+ 					  bufsize, 4,
+ 					  GRUB_RELOCATOR_PREFERENCE_NONE, 0);
+   if (err)
+-- 
+1.9.3
+
diff --git a/SOURCES/0063-grub-core-mmap-i386-uppermem.c-lower_hook-COREBOOT-I.patch b/SOURCES/0063-grub-core-mmap-i386-uppermem.c-lower_hook-COREBOOT-I.patch
new file mode 100644
index 0000000..a2820a8
--- /dev/null
+++ b/SOURCES/0063-grub-core-mmap-i386-uppermem.c-lower_hook-COREBOOT-I.patch
@@ -0,0 +1,47 @@
+From e85cc7078e669509d3a22c4e76f94cdd53335fff Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 28 Feb 2014 09:50:47 +0100
+Subject: [PATCH 063/143] 	* grub-core/mmap/i386/uppermem.c (lower_hook)
+ [COREBOOT]: Ignore low 	tables for low memory calculations.
+
+---
+ ChangeLog                      | 5 +++++
+ grub-core/mmap/i386/uppermem.c | 6 +++++-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index bbaed26..6ed6cf4 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* grub-core/mmap/i386/uppermem.c (lower_hook) [COREBOOT]: Ignore low
++	tables for low memory calculations.
++
++2014-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_make_mbi): Limit
+ 	location to 640K.
+ 
+diff --git a/grub-core/mmap/i386/uppermem.c b/grub-core/mmap/i386/uppermem.c
+index bd8b429..a6be989 100644
+--- a/grub-core/mmap/i386/uppermem.c
++++ b/grub-core/mmap/i386/uppermem.c
+@@ -31,8 +31,12 @@ lower_hook (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type,
+ 
+   if (type != GRUB_MEMORY_AVAILABLE)
+     return 0;
++#ifdef GRUB_MACHINE_COREBOOT
++  if (addr <= 0x1000)
++#else
+   if (addr == 0)
+-    *lower = size;
++#endif
++    *lower = size + addr;
+   return 0;
+ }
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0064-grub-core-kern-i386-pc-mmap.c-Fallback-to-EISA-memor.patch b/SOURCES/0064-grub-core-kern-i386-pc-mmap.c-Fallback-to-EISA-memor.patch
new file mode 100644
index 0000000..4c0dac1
--- /dev/null
+++ b/SOURCES/0064-grub-core-kern-i386-pc-mmap.c-Fallback-to-EISA-memor.patch
@@ -0,0 +1,88 @@
+From 37e3b5e42930e8cd4e801e4203dc2fde335b4b10 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 28 Feb 2014 10:07:11 +0100
+Subject: [PATCH 064/143] 	* grub-core/kern/i386/pc/mmap.c: Fallback to
+ EISA memory map 	if E820 failed to return any regions.
+
+---
+ ChangeLog                     |  5 +++++
+ grub-core/kern/i386/pc/mmap.c | 40 +++++++++++++++++++++-------------------
+ 2 files changed, 26 insertions(+), 19 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 6ed6cf4..97cf57e 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* grub-core/kern/i386/pc/mmap.c: Fallback to EISA memory map
++	if E820 failed to return any regions.
++
++2014-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/mmap/i386/uppermem.c (lower_hook) [COREBOOT]: Ignore low
+ 	tables for low memory calculations.
+ 
+diff --git a/grub-core/kern/i386/pc/mmap.c b/grub-core/kern/i386/pc/mmap.c
+index 8009e83..f1375f3 100644
+--- a/grub-core/kern/i386/pc/mmap.c
++++ b/grub-core/kern/i386/pc/mmap.c
+@@ -141,33 +141,35 @@ grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
+ grub_err_t
+ grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
+ {
+-  grub_uint32_t cont;
++  grub_uint32_t cont = 0;
+   struct grub_machine_mmap_entry *entry
+     = (struct grub_machine_mmap_entry *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
++  int e820_works = 0;
+ 
+-  grub_memset (entry, 0, sizeof (entry));
++  while (1)
++    {
++      grub_memset (entry, 0, sizeof (entry));
+ 
+-  /* Check if grub_get_mmap_entry works.  */
+-  cont = grub_get_mmap_entry (entry, 0);
++      cont = grub_get_mmap_entry (entry, cont);
+ 
+-  if (entry->size)
+-    do
+-      {
+-	if (hook (entry->addr, entry->len,
+-		  /* GRUB mmaps have been defined to match with the E820 definition.
+-		     Therefore, we can just pass type through.  */
+-		  entry->type, hook_data))
+-	  break;
++      if (!entry->size)
++	break;
+ 
+-	if (! cont)
+-	  break;
++      if (entry->len)
++	e820_works = 1;
++      if (entry->len
++	  && hook (entry->addr, entry->len,
++		   /* GRUB mmaps have been defined to match with
++		      the E820 definition.
++		      Therefore, we can just pass type through.  */
++		   entry->type, hook_data))
++	break;
+ 
+-	grub_memset (entry, 0, sizeof (entry));
++      if (! cont)
++	break;
++    }
+ 
+-	cont = grub_get_mmap_entry (entry, cont);
+-      }
+-    while (entry->size);
+-  else
++  if (!e820_works)
+     {
+       grub_uint32_t eisa_mmap = grub_get_eisa_mmap ();
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0065-include-grub-i386-openbsd_bootarg.h-Add-addr-and-fre.patch b/SOURCES/0065-include-grub-i386-openbsd_bootarg.h-Add-addr-and-fre.patch
new file mode 100644
index 0000000..ba1192e
--- /dev/null
+++ b/SOURCES/0065-include-grub-i386-openbsd_bootarg.h-Add-addr-and-fre.patch
@@ -0,0 +1,70 @@
+From 1cdf2c717c0f4a2efac0e5dc8b5c564f930c537a Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 28 Feb 2014 10:50:05 +0100
+Subject: [PATCH 065/143] 	* include/grub/i386/openbsd_bootarg.h: Add
+ addr and frequency fields. 	* grub-core/loader/i386/bsd.c
+ (grub_cmd_openbsd): Fill addr field.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+	Suggested by: Markus Müller.
+---
+ ChangeLog                           | 7 +++++++
+ grub-core/loader/i386/bsd.c         | 2 ++
+ include/grub/i386/openbsd_bootarg.h | 2 ++
+ 3 files changed, 11 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index 97cf57e..f571f66 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,12 @@
+ 2014-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* include/grub/i386/openbsd_bootarg.h: Add addr and frequency fields.
++	* grub-core/loader/i386/bsd.c (grub_cmd_openbsd): Fill addr field.
++
++	Suggested by: Markus Müller.
++
++2014-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/kern/i386/pc/mmap.c: Fallback to EISA memory map
+ 	if E820 failed to return any regions.
+ 
+diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
+index ea0edfa..19985f0 100644
+--- a/grub-core/loader/i386/bsd.c
++++ b/grub-core/loader/i386/bsd.c
+@@ -1646,6 +1646,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
+ 
+       serial.device = (GRUB_OPENBSD_COM_MAJOR << 8) | port;
+       serial.speed = speed;
++      serial.addr = grub_ns8250_hw_get_port (port);
+ 	  
+       grub_bsd_add_meta (OPENBSD_BOOTARG_CONSOLE, &serial, sizeof (serial));
+       bootflags |= OPENBSD_RB_SERCONS;
+@@ -1656,6 +1657,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
+ 
+       grub_memset (&serial, 0, sizeof (serial));
+       serial.device = (GRUB_OPENBSD_VGA_MAJOR << 8);
++      serial.addr = 0xffffffff;
+       grub_bsd_add_meta (OPENBSD_BOOTARG_CONSOLE, &serial, sizeof (serial));
+       bootflags &= ~OPENBSD_RB_SERCONS;
+     }
+diff --git a/include/grub/i386/openbsd_bootarg.h b/include/grub/i386/openbsd_bootarg.h
+index 01ca486..9ebe6b4 100644
+--- a/include/grub/i386/openbsd_bootarg.h
++++ b/include/grub/i386/openbsd_bootarg.h
+@@ -75,6 +75,8 @@ struct grub_openbsd_bootarg_console
+ {
+   grub_uint32_t device;
+   grub_uint32_t speed;
++  grub_uint32_t addr;
++  grub_uint32_t frequency;
+ };
+ 
+ struct grub_openbsd_bootarg_pcibios
+-- 
+1.9.3
+
diff --git a/SOURCES/0066-ieee1275-check-for-IBM-pseries-emulated-machine.patch b/SOURCES/0066-ieee1275-check-for-IBM-pseries-emulated-machine.patch
new file mode 100644
index 0000000..4dc5ad3
--- /dev/null
+++ b/SOURCES/0066-ieee1275-check-for-IBM-pseries-emulated-machine.patch
@@ -0,0 +1,33 @@
+From 2a20b05871d51635060ab58c1b63ac2ee9f8a359 Mon Sep 17 00:00:00 2001
+From: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
+Date: Thu, 20 Mar 2014 16:57:12 +0530
+Subject: [PATCH 066/143] ieee1275: check for IBM pseries emulated machine
+
+is_qemu is not being set lead to disabling of feature like
+GRUB_IEEE1275_FLAG_HAS_CURSORONOFF. This resulted in cursor not being
+displayed during the grub-menu edit.
+
+Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
+---
+ grub-core/kern/ieee1275/cmain.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c
+index d92ae14..3e12e6b 100644
+--- a/grub-core/kern/ieee1275/cmain.c
++++ b/grub-core/kern/ieee1275/cmain.c
+@@ -84,8 +84,10 @@ grub_ieee1275_find_options (void)
+ 
+   rc = grub_ieee1275_get_property (root, "model",
+ 				   tmp,	sizeof (tmp), 0);
+-  if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC"))
++  if (rc >= 0 && (!grub_strcmp (tmp, "Emulated PC")
++		  || !grub_strcmp (tmp, "IBM pSeries (emulated by qemu)"))) {
+     is_qemu = 1;
++  }
+ 
+   if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0)
+     grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS);
+-- 
+1.9.3
+
diff --git a/SOURCES/0067-grub-core-loader-arm64-linux.c-Remove-redundant-0x.patch b/SOURCES/0067-grub-core-loader-arm64-linux.c-Remove-redundant-0x.patch
new file mode 100644
index 0000000..65614f5
--- /dev/null
+++ b/SOURCES/0067-grub-core-loader-arm64-linux.c-Remove-redundant-0x.patch
@@ -0,0 +1,39 @@
+From 530b22a1c04a08fbdb4dcbc3d34bc610af17cc68 Mon Sep 17 00:00:00 2001
+From: Fu Wei <fu.wei@linaro.org>
+Date: Wed, 26 Mar 2014 08:13:07 +0100
+Subject: [PATCH 067/143] 	* grub-core/loader/arm64/linux.c: Remove
+ redundant "0x".
+
+---
+ ChangeLog                      | 4 ++++
+ grub-core/loader/arm64/linux.c | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index f571f66..091535b 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-03-26  Fu Wei <fu.wei@linaro.org>
++
++	* grub-core/loader/arm64/linux.c: Remove redundant "0x".
++
+ 2014-02-28  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* include/grub/i386/openbsd_bootarg.h: Add addr and frequency fields.
+diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
+index 65129c2..f1d10a1 100644
+--- a/grub-core/loader/arm64/linux.c
++++ b/grub-core/loader/arm64/linux.c
+@@ -68,7 +68,7 @@ get_firmware_fdt (void)
+     if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
+       {
+ 	firmware_fdt = tables[i].vendor_table;
+-	grub_dprintf ("linux", "found registered FDT @ 0x%p\n", firmware_fdt);
++	grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt);
+ 	break;
+       }
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0068-grub-core-lib-relocator.c-Fix-the-case-when-end-of-l.patch b/SOURCES/0068-grub-core-lib-relocator.c-Fix-the-case-when-end-of-l.patch
new file mode 100644
index 0000000..d5cb1d1
--- /dev/null
+++ b/SOURCES/0068-grub-core-lib-relocator.c-Fix-the-case-when-end-of-l.patch
@@ -0,0 +1,39 @@
+From 5d1749ea5730be5c9c32228461b784317a500f4b Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Wed, 26 Mar 2014 08:48:30 +0100
+Subject: [PATCH 068/143] 	* grub-core/lib/relocator.c: Fix the case when
+ end of leftover is used.
+
+---
+ ChangeLog                 | 4 ++++
+ grub-core/lib/relocator.c | 2 ++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index 091535b..9404eda 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-03-26  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/lib/relocator.c: Fix the case when end of leftover is used.
++
+ 2014-03-26  Fu Wei <fu.wei@linaro.org>
+ 
+ 	* grub-core/loader/arm64/linux.c: Remove redundant "0x".
+diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c
+index 9f9770b..cb11ea5 100644
+--- a/grub-core/lib/relocator.c
++++ b/grub-core/lib/relocator.c
+@@ -865,6 +865,8 @@ malloc_in_range (struct grub_relocator *rel,
+ 			% GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT;
+ 		      struct grub_relocator_fw_leftover *lo
+ 			= events[last_lo].leftover;
++		      if (offend == 0 && alloc_end != alloc_start)
++			offend = GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT;
+ 		      lo->freebytes[offstart / 8]
+ 			&= ((1 << (8 - (start % 8))) - 1);
+ 		      grub_memset (lo->freebytes + (offstart + 7) / 8, 0,
+-- 
+1.9.3
+
diff --git a/SOURCES/0069-Fix-grub-probe-0-option.patch b/SOURCES/0069-Fix-grub-probe-0-option.patch
new file mode 100644
index 0000000..d85fa3a
--- /dev/null
+++ b/SOURCES/0069-Fix-grub-probe-0-option.patch
@@ -0,0 +1,55 @@
+From fdf24f98bc9e4632bfe7f280872cbbf40942ae7b Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Mon, 31 Mar 2014 13:51:17 +0100
+Subject: [PATCH 069/143] Fix grub-probe -0 option
+
+* util/grub-probe,c (options): Make -0 work again (broken by
+conversion to argp).
+(main): Simplify logic.
+---
+ ChangeLog         | 6 ++++++
+ util/grub-probe.c | 7 ++-----
+ 2 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 9404eda..efbed8c 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,9 @@
++2014-03-31  Colin Watson  <cjwatson@ubuntu.com>
++
++	* util/grub-probe,c (options): Make -0 work again (broken by
++	conversion to argp).
++	(main): Simplify logic.
++
+ 2014-03-26  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/lib/relocator.c: Fix the case when end of leftover is used.
+diff --git a/util/grub-probe.c b/util/grub-probe.c
+index 1f3b59f..80509be 100644
+--- a/util/grub-probe.c
++++ b/util/grub-probe.c
+@@ -711,6 +711,7 @@ static struct argp_option options[] = {
+    N_("use FILE as the device map [default=%s]"), 0},
+   {"target",  't', N_("TARGET"), 0, 0, 0},
+   {"verbose",     'v', 0,      0, N_("print verbose messages."), 0},
++  {0, '0', 0, 0, N_("separate items in output using ASCII NUL characters"), 0},
+   { 0, 0, 0, 0, 0, 0 }
+ };
+ 
+@@ -884,11 +885,7 @@ main (int argc, char *argv[])
+   else
+     probe (arguments.devices[0], NULL, delim);
+ 
+-  if (!arguments.zero_delim && (print == PRINT_BIOS_HINT
+-				|| print == PRINT_IEEE1275_HINT
+-				|| print == PRINT_BAREMETAL_HINT
+-				|| print == PRINT_EFI_HINT
+-				|| print == PRINT_ARC_HINT))
++  if (delim == ' ')
+     putchar ('\n');
+ 
+   /* Free resources.  */
+-- 
+1.9.3
+
diff --git a/SOURCES/0070-Fix-partmap-cryptodisk-and-abstraction-handling-in-g.patch b/SOURCES/0070-Fix-partmap-cryptodisk-and-abstraction-handling-in-g.patch
new file mode 100644
index 0000000..64e8ab2
--- /dev/null
+++ b/SOURCES/0070-Fix-partmap-cryptodisk-and-abstraction-handling-in-g.patch
@@ -0,0 +1,366 @@
+From 0a65563c2b355c0eb7412b46f015556691f1b5d1 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Mon, 31 Mar 2014 14:48:33 +0100
+Subject: [PATCH 070/143] Fix partmap, cryptodisk, and abstraction handling in
+ grub-mkconfig.
+
+Commit 588744d0dc655177d5883bdcb8f72ff5160109ed caused grub-mkconfig
+no longer to be forgiving of trailing spaces on grub-probe output
+lines, which among other things means that util/grub.d/10_linux.in
+no longer detects LVM.  To fix this, make grub-probe's output
+delimiting more consistent.  As a bonus, this improves the coverage
+of the -0 option.
+
+Fixes Debian bug #735935.
+
+* grub-core/disk/cryptodisk.c
+(grub_util_cryptodisk_get_abstraction): Add a user-data argument.
+* grub-core/disk/diskfilter.c (grub_diskfilter_get_partmap):
+Likewise.
+* include/grub/cryptodisk.h (grub_util_cryptodisk_get_abstraction):
+Update prototype.
+* include/grub/diskfilter.h (grub_diskfilter_get_partmap): Likewise.
+* util/grub-install.c (push_partmap_module, push_cryptodisk_module,
+probe_mods): Adjust for extra user-data arguments.
+* util/grub-probe.c (do_print, probe_partmap, probe_cryptodisk_uuid,
+probe_abstraction): Use configured delimiter.  Update callers.
+---
+ ChangeLog                   | 25 ++++++++++++++++++++++++
+ grub-core/disk/cryptodisk.c | 19 ++++++++++---------
+ grub-core/disk/diskfilter.c |  5 +++--
+ include/grub/cryptodisk.h   |  3 ++-
+ include/grub/diskfilter.h   |  3 ++-
+ util/grub-install.c         | 14 ++++++++++----
+ util/grub-probe.c           | 46 ++++++++++++++++++++++-----------------------
+ 7 files changed, 74 insertions(+), 41 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index efbed8c..1cb3b68 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,30 @@
+ 2014-03-31  Colin Watson  <cjwatson@ubuntu.com>
+ 
++	Fix partmap, cryptodisk, and abstraction handling in grub-mkconfig.
++
++	Commit 588744d0dc655177d5883bdcb8f72ff5160109ed caused grub-mkconfig
++	no longer to be forgiving of trailing spaces on grub-probe output
++	lines, which among other things means that util/grub.d/10_linux.in
++	no longer detects LVM.  To fix this, make grub-probe's output
++	delimiting more consistent.  As a bonus, this improves the coverage
++	of the -0 option.
++
++	Fixes Debian bug #735935.
++
++	* grub-core/disk/cryptodisk.c
++	(grub_util_cryptodisk_get_abstraction): Add a user-data argument.
++	* grub-core/disk/diskfilter.c (grub_diskfilter_get_partmap):
++	Likewise.
++	* include/grub/cryptodisk.h (grub_util_cryptodisk_get_abstraction):
++	Update prototype.
++	* include/grub/diskfilter.h (grub_diskfilter_get_partmap): Likewise.
++	* util/grub-install.c (push_partmap_module, push_cryptodisk_module,
++	probe_mods): Adjust for extra user-data arguments.
++	* util/grub-probe.c (do_print, probe_partmap, probe_cryptodisk_uuid,
++	probe_abstraction): Use configured delimiter.  Update callers.
++
++2014-03-31  Colin Watson  <cjwatson@ubuntu.com>
++
+ 	* util/grub-probe,c (options): Make -0 work again (broken by
+ 	conversion to argp).
+ 	(main): Simplify logic.
+diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
+index 75c6e1f..f0e3a90 100644
+--- a/grub-core/disk/cryptodisk.c
++++ b/grub-core/disk/cryptodisk.c
+@@ -762,25 +762,26 @@ grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name,
+ 
+ void
+ grub_util_cryptodisk_get_abstraction (grub_disk_t disk,
+-				      void (*cb) (const char *val))
++				      void (*cb) (const char *val, void *data),
++				      void *data)
+ {
+   grub_cryptodisk_t dev = (grub_cryptodisk_t) disk->data;
+ 
+-  cb ("cryptodisk");
+-  cb (dev->modname);
++  cb ("cryptodisk", data);
++  cb (dev->modname, data);
+ 
+   if (dev->cipher)
+-    cb (dev->cipher->cipher->modname);
++    cb (dev->cipher->cipher->modname, data);
+   if (dev->secondary_cipher)
+-    cb (dev->secondary_cipher->cipher->modname);
++    cb (dev->secondary_cipher->cipher->modname, data);
+   if (dev->essiv_cipher)
+-    cb (dev->essiv_cipher->cipher->modname);
++    cb (dev->essiv_cipher->cipher->modname, data);
+   if (dev->hash)
+-    cb (dev->hash->modname);
++    cb (dev->hash->modname, data);
+   if (dev->essiv_hash)
+-    cb (dev->essiv_hash->modname);
++    cb (dev->essiv_hash->modname, data);
+   if (dev->iv_hash)
+-    cb (dev->iv_hash->modname);
++    cb (dev->iv_hash->modname, data);
+ }
+ 
+ const char *
+diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
+index 28b70c6..e8a3bcb 100644
+--- a/grub-core/disk/diskfilter.c
++++ b/grub-core/disk/diskfilter.c
+@@ -354,7 +354,8 @@ grub_diskfilter_memberlist (grub_disk_t disk)
+ 
+ void
+ grub_diskfilter_get_partmap (grub_disk_t disk,
+-			     void (*cb) (const char *pm))
++			     void (*cb) (const char *pm, void *data),
++			     void *data)
+ {
+   struct grub_diskfilter_lv *lv = disk->data;
+   struct grub_diskfilter_pv *pv;
+@@ -376,7 +377,7 @@ grub_diskfilter_get_partmap (grub_disk_t disk,
+ 	    continue;
+ 	  }
+ 	for (s = 0; pv->partmaps[s]; s++)
+-	  cb (pv->partmaps[s]);
++	  cb (pv->partmaps[s], data);
+       }
+ }
+ 
+diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h
+index 66f3e1e..f2ad2a7 100644
+--- a/include/grub/cryptodisk.h
++++ b/include/grub/cryptodisk.h
+@@ -145,7 +145,8 @@ grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name,
+ 			      grub_disk_t source, const char *cheat);
+ void
+ grub_util_cryptodisk_get_abstraction (grub_disk_t disk,
+-				      void (*cb) (const char *val));
++				      void (*cb) (const char *val, void *data),
++				      void *data);
+ 
+ char *
+ grub_util_get_geli_uuid (const char *dev);
+diff --git a/include/grub/diskfilter.h b/include/grub/diskfilter.h
+index 042fe04..1aedcd3 100644
+--- a/include/grub/diskfilter.h
++++ b/include/grub/diskfilter.h
+@@ -202,7 +202,8 @@ grub_diskfilter_get_pv_from_disk (grub_disk_t disk,
+ 				  struct grub_diskfilter_vg **vg);
+ void
+ grub_diskfilter_get_partmap (grub_disk_t disk,
+-			     void (*cb) (const char *val));
++			     void (*cb) (const char *val, void *data),
++			     void *data);
+ #endif
+ 
+ #endif /* ! GRUB_RAID_H */
+diff --git a/util/grub-install.c b/util/grub-install.c
+index 2e6226a..e9c6a46 100644
+--- a/util/grub-install.c
++++ b/util/grub-install.c
+@@ -387,7 +387,7 @@ probe_raid_level (grub_disk_t disk)
+ }
+ 
+ static void
+-push_partmap_module (const char *map)
++push_partmap_module (const char *map, void *data __attribute__ ((unused)))
+ {
+   char buf[50];
+ 
+@@ -402,6 +402,12 @@ push_partmap_module (const char *map)
+ }
+ 
+ static void
++push_cryptodisk_module (const char *mod, void *data __attribute__ ((unused)))
++{
++  grub_install_push_module (mod);
++}
++
++static void
+ probe_mods (grub_disk_t disk)
+ {
+   grub_partition_t part;
+@@ -412,11 +418,11 @@ probe_mods (grub_disk_t disk)
+     grub_util_info ("no partition map found for %s", disk->name);
+ 
+   for (part = disk->partition; part; part = part->parent)
+-    push_partmap_module (part->partmap->name);
++    push_partmap_module (part->partmap->name, NULL);
+ 
+   if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID)
+     {
+-      grub_diskfilter_get_partmap (disk, push_partmap_module);
++      grub_diskfilter_get_partmap (disk, push_partmap_module, NULL);
+       have_abstractions = 1;
+     }
+ 
+@@ -432,7 +438,7 @@ probe_mods (grub_disk_t disk)
+   if (disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID)
+     {
+       grub_util_cryptodisk_get_abstraction (disk,
+-					    grub_install_push_module);
++					    push_cryptodisk_module, NULL);
+       have_abstractions = 1;
+       have_cryptodisk = 1;
+     }
+diff --git a/util/grub-probe.c b/util/grub-probe.c
+index 80509be..ecb7b6b 100644
+--- a/util/grub-probe.c
++++ b/util/grub-probe.c
+@@ -130,13 +130,14 @@ get_targets_string (void)
+ }
+ 
+ static void
+-do_print (const char *x)
++do_print (const char *x, void *data)
+ {
+-  grub_printf ("%s ", x);
++  char delim = *(const char *) data;
++  grub_printf ("%s%c", x, delim);
+ }
+ 
+ static void
+-probe_partmap (grub_disk_t disk)
++probe_partmap (grub_disk_t disk, char delim)
+ {
+   grub_partition_t part;
+   grub_disk_memberlist_t list = NULL, tmp;
+@@ -147,10 +148,10 @@ probe_partmap (grub_disk_t disk)
+     }
+ 
+   for (part = disk->partition; part; part = part->parent)
+-    printf ("%s ", part->partmap->name);
++    printf ("%s%c", part->partmap->name, delim);
+ 
+   if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID)
+-    grub_diskfilter_get_partmap (disk, do_print);
++    grub_diskfilter_get_partmap (disk, do_print, &delim);
+ 
+   /* In case of LVM/RAID, check the member devices as well.  */
+   if (disk->dev->memberlist)
+@@ -159,7 +160,7 @@ probe_partmap (grub_disk_t disk)
+     }
+   while (list)
+     {
+-      probe_partmap (list->disk);
++      probe_partmap (list->disk, delim);
+       tmp = list->next;
+       free (list);
+       list = tmp;
+@@ -167,7 +168,7 @@ probe_partmap (grub_disk_t disk)
+ }
+ 
+ static void
+-probe_cryptodisk_uuid (grub_disk_t disk)
++probe_cryptodisk_uuid (grub_disk_t disk, char delim)
+ {
+   grub_disk_memberlist_t list = NULL, tmp;
+ 
+@@ -178,7 +179,7 @@ probe_cryptodisk_uuid (grub_disk_t disk)
+     }
+   while (list)
+     {
+-      probe_cryptodisk_uuid (list->disk);
++      probe_cryptodisk_uuid (list->disk, delim);
+       tmp = list->next;
+       free (list);
+       list = tmp;
+@@ -186,7 +187,7 @@ probe_cryptodisk_uuid (grub_disk_t disk)
+   if (disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID)
+     {
+       const char *uu = grub_util_cryptodisk_get_uuid (disk);
+-      grub_printf ("%s ", uu);
++      grub_printf ("%s%c", uu, delim);
+     }
+ }
+ 
+@@ -210,7 +211,7 @@ probe_raid_level (grub_disk_t disk)
+ }
+ 
+ static void
+-probe_abstraction (grub_disk_t disk)
++probe_abstraction (grub_disk_t disk, char delim)
+ {
+   grub_disk_memberlist_t list = NULL, tmp;
+   int raid_level;
+@@ -219,7 +220,7 @@ probe_abstraction (grub_disk_t disk)
+     list = disk->dev->memberlist (disk);
+   while (list)
+     {
+-      probe_abstraction (list->disk);
++      probe_abstraction (list->disk, delim);
+ 
+       tmp = list->next;
+       free (list);
+@@ -229,26 +230,26 @@ probe_abstraction (grub_disk_t disk)
+   if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID
+       && (grub_memcmp (disk->name, "lvm/", sizeof ("lvm/") - 1) == 0 ||
+ 	  grub_memcmp (disk->name, "lvmid/", sizeof ("lvmid/") - 1) == 0))
+-    printf ("lvm ");
++    printf ("lvm%c", delim);
+ 
+   if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID
+       && grub_memcmp (disk->name, "ldm/", sizeof ("ldm/") - 1) == 0)
+-    printf ("ldm ");
++    printf ("ldm%c", delim);
+ 
+   if (disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID)
+-    grub_util_cryptodisk_get_abstraction (disk, do_print);
++    grub_util_cryptodisk_get_abstraction (disk, do_print, &delim);
+ 
+   raid_level = probe_raid_level (disk);
+   if (raid_level >= 0)
+     {
+-      printf ("diskfilter ");
++      printf ("diskfilter%c", delim);
+       if (disk->dev->raidname)
+-	printf ("%s ", disk->dev->raidname (disk));
++	printf ("%s%c", disk->dev->raidname (disk), delim);
+     }
+   if (raid_level == 5)
+-    printf ("raid5rec ");
++    printf ("raid5rec%c", delim);
+   if (raid_level == 6)
+-    printf ("raid6rec ");
++    printf ("raid6rec%c", delim);
+ }
+ 
+ static void
+@@ -630,16 +631,14 @@ probe (const char *path, char **device_names, char delim)
+ 
+       if (print == PRINT_ABSTRACTION)
+ 	{
+-	  probe_abstraction (dev->disk);
+-	  putchar (delim);
++	  probe_abstraction (dev->disk, delim);
+ 	  grub_device_close (dev);
+ 	  continue;
+ 	}
+ 
+       if (print == PRINT_CRYPTODISK_UUID)
+ 	{
+-	  probe_cryptodisk_uuid (dev->disk);
+-	  putchar (delim);
++	  probe_cryptodisk_uuid (dev->disk, delim);
+ 	  grub_device_close (dev);
+ 	  continue;
+ 	}
+@@ -647,8 +646,7 @@ probe (const char *path, char **device_names, char delim)
+       if (print == PRINT_PARTMAP)
+ 	{
+ 	  /* Check if dev->disk itself is contained in a partmap.  */
+-	  probe_partmap (dev->disk);
+-	  putchar (delim);
++	  probe_partmap (dev->disk, delim);
+ 	  grub_device_close (dev);
+ 	  continue;
+ 	}
+-- 
+1.9.3
+
diff --git a/SOURCES/0071-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch b/SOURCES/0071-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch
new file mode 100644
index 0000000..7cd3384
--- /dev/null
+++ b/SOURCES/0071-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch
@@ -0,0 +1,44 @@
+From bd2125649cbeae60a5caff05d5a39c88a4e6eff6 Mon Sep 17 00:00:00 2001
+From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
+Date: Mon, 31 Mar 2014 15:32:30 +0100
+Subject: [PATCH 071/143] btrfs: fix get_root key comparison failures due to
+ endianness
+
+* grub-core/fs/btrfs.c (get_root): Convert
+GRUB_BTRFS_ROOT_VOL_OBJECTID to little-endian.
+---
+ ChangeLog            | 7 +++++++
+ grub-core/fs/btrfs.c | 2 +-
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 1cb3b68..accffad 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,10 @@
++2014-03-31  Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
++
++	btrfs: fix get_root key comparison failures due to endianness
++
++	* grub-core/fs/btrfs.c (get_root): Convert
++	GRUB_BTRFS_ROOT_VOL_OBJECTID to little-endian.
++
+ 2014-03-31  Colin Watson  <cjwatson@ubuntu.com>
+ 
+ 	Fix partmap, cryptodisk, and abstraction handling in grub-mkconfig.
+diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
+index 89666b6..f7b6c15 100644
+--- a/grub-core/fs/btrfs.c
++++ b/grub-core/fs/btrfs.c
+@@ -1201,7 +1201,7 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
+   struct grub_btrfs_key key_out, key_in;
+   struct grub_btrfs_root_item ri;
+ 
+-  key_in.object_id = GRUB_BTRFS_ROOT_VOL_OBJECTID;
++  key_in.object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_ROOT_VOL_OBJECTID);
+   key_in.offset = 0;
+   key_in.type = GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM;
+   err = lower_bound (data, &key_in, &key_out,
+-- 
+1.9.3
+
diff --git a/SOURCES/0072-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch b/SOURCES/0072-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch
new file mode 100644
index 0000000..e8af09a
--- /dev/null
+++ b/SOURCES/0072-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch
@@ -0,0 +1,55 @@
+From c3d9e64a61d17e57ef941a6a46e5a148c51c8519 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Thu, 3 Apr 2014 21:31:12 +0200
+Subject: [PATCH 072/143] * grub-core/osdep/linux/getroot.c
+ (grub_util_part_to_disk): Support NVMe device names.
+
+---
+ ChangeLog                       |  5 +++++
+ grub-core/osdep/linux/getroot.c | 17 +++++++++++++++++
+ 2 files changed, 22 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index accffad..4a48409 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-04-03  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe
++	device names.
++
+ 2014-03-31  Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
+ 
+ 	btrfs: fix get_root key comparison failures due to endianness
+diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
+index 19581d3..7007193 100644
+--- a/grub-core/osdep/linux/getroot.c
++++ b/grub-core/osdep/linux/getroot.c
+@@ -896,6 +896,23 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st,
+ 	  *pp = '\0';
+ 	  return path;
+ 	}
++
++      /* If this is a NVMe device */
++      if ((strncmp ("nvme", p, 4) == 0) && p[4] >= '0' && p[4] <= '9')
++	{
++	  char *pp = p + 4;
++	  while (*pp >= '0' && *pp <= '9')
++	    pp++;
++	  if (*pp == 'n')
++	    pp++;
++	  while (*pp >= '0' && *pp <= '9')
++	    pp++;
++	  if (*pp == 'p')
++	    *is_part = 1;
++	  /* /dev/nvme[0-9]+n[0-9]+p[0-9]* */
++	  *pp = '\0';
++	  return path;
++	}
+     }
+ 
+   return path;
+-- 
+1.9.3
+
diff --git a/SOURCES/0073-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch b/SOURCES/0073-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch
new file mode 100644
index 0000000..8846511
--- /dev/null
+++ b/SOURCES/0073-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch
@@ -0,0 +1,102 @@
+From cb2cfc87fad111a539e9645f6a96d0a89a28c8ab Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 4 Apr 2014 07:58:42 +0200
+Subject: [PATCH 073/143] Replace few instances of memcmp/memcpy in the code
+ that should be grub_memcmp/grub_memcpy.
+
+---
+ ChangeLog                      | 5 +++++
+ grub-core/commands/acpihalt.c  | 4 ++--
+ grub-core/commands/legacycfg.c | 4 ++--
+ grub-core/lib/relocator.c      | 2 +-
+ grub-core/loader/i386/bsd.c    | 4 ++--
+ 5 files changed, 12 insertions(+), 7 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 4a48409..f18cdba 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	Replace few instances of memcmp/memcpy in the code that should be
++	grub_memcmp/grub_memcpy.
++
+ 2014-04-03  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe
+diff --git a/grub-core/commands/acpihalt.c b/grub-core/commands/acpihalt.c
+index 09421a6..83bdfe1 100644
+--- a/grub-core/commands/acpihalt.c
++++ b/grub-core/commands/acpihalt.c
+@@ -214,8 +214,8 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
+ 	  }
+ 	case GRUB_ACPI_OPCODE_NAME:
+ 	  ptr++;
+-	  if ((!scope || memcmp (scope, "\\", scope_len) == 0) &&
+-	      (memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0))
++	  if ((!scope || grub_memcmp (scope, "\\", scope_len) == 0) &&
++	      (grub_memcmp (ptr, "_S5_", 4) == 0 || grub_memcmp (ptr, "\\_S5_", 4) == 0))
+ 	    {
+ 	      int ll;
+ 	      grub_uint8_t *ptr2 = ptr;
+diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c
+index e42a9d8..2c09fb7 100644
+--- a/grub-core/commands/legacycfg.c
++++ b/grub-core/commands/legacycfg.c
+@@ -580,7 +580,7 @@ check_password_md5_real (const char *entered,
+   GRUB_MD_MD5->write (ctx, entered, enteredlen);
+   digest = GRUB_MD_MD5->read (ctx);
+   GRUB_MD_MD5->final (ctx);
+-  memcpy (alt_result, digest, MD5_HASHLEN);
++  grub_memcpy (alt_result, digest, MD5_HASHLEN);
+   
+   GRUB_MD_MD5->init (ctx);
+   GRUB_MD_MD5->write (ctx, entered, enteredlen);
+@@ -596,7 +596,7 @@ check_password_md5_real (const char *entered,
+ 
+   for (i = 0; i < 1000; i++)
+     {
+-      memcpy (alt_result, digest, 16);
++      grub_memcpy (alt_result, digest, 16);
+ 
+       GRUB_MD_MD5->init (ctx);
+       if ((i & 1) != 0)
+diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c
+index cb11ea5..f759c7f 100644
+--- a/grub-core/lib/relocator.c
++++ b/grub-core/lib/relocator.c
+@@ -652,7 +652,7 @@ malloc_in_range (struct grub_relocator *rel,
+     for (i = 0; i < (BITS_IN_BYTE * sizeof (grub_addr_t) / DIGITSORT_BITS);
+ 	 i++)
+       {
+-	memset (counter, 0, (1 + (1 << DIGITSORT_BITS)) * sizeof (counter[0]));
++	grub_memset (counter, 0, (1 + (1 << DIGITSORT_BITS)) * sizeof (counter[0]));
+ 	for (j = 0; j < N; j++)
+ 	  counter[((events[j].pos >> (DIGITSORT_BITS * i)) 
+ 		   & DIGITSORT_MASK) + 1]++;
+diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
+index 19985f0..41ef910 100644
+--- a/grub-core/loader/i386/bsd.c
++++ b/grub-core/loader/i386/bsd.c
+@@ -1082,7 +1082,7 @@ grub_netbsd_add_boot_disk_and_wedge (void)
+ 
+     grub_crypto_hash (GRUB_MD_MD5, hash,
+ 		      buf.raw, GRUB_DISK_SECTOR_SIZE);
+-    memcpy (biw.matchhash, hash, 16);
++    grub_memcpy (biw.matchhash, hash, 16);
+ 
+     grub_bsd_add_meta (NETBSD_BTINFO_BOOTWEDGE, &biw, sizeof (biw));
+   }
+@@ -1100,7 +1100,7 @@ grub_netbsd_add_boot_disk_and_wedge (void)
+ 	bid.labelsector = partmapsector;
+ 	bid.label.type = buf.label.type;
+ 	bid.label.checksum = buf.label.checksum;
+-	memcpy (bid.label.packname, buf.label.packname, 16);
++	grub_memcpy (bid.label.packname, buf.label.packname, 16);
+       }
+     else
+       {
+-- 
+1.9.3
+
diff --git a/SOURCES/0074-include-grub-libgcc.h-Remove-ctzsi2-and-ctzdi2.-They.patch b/SOURCES/0074-include-grub-libgcc.h-Remove-ctzsi2-and-ctzdi2.-They.patch
new file mode 100644
index 0000000..564f09e
--- /dev/null
+++ b/SOURCES/0074-include-grub-libgcc.h-Remove-ctzsi2-and-ctzdi2.-They.patch
@@ -0,0 +1,47 @@
+From 91152c6e2944e9ad3583482140f8991b972fec08 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 4 Apr 2014 08:02:38 +0200
+Subject: [PATCH 074/143] * include/grub/libgcc.h: Remove ctzsi2 and ctzdi2.
+ They're no longer pulled from libgcc.
+
+---
+ ChangeLog             | 5 +++++
+ include/grub/libgcc.h | 7 -------
+ 2 files changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index f18cdba..90e41bd 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* include/grub/libgcc.h: Remove ctzsi2 and ctzdi2. They're no longer
++	pulled from libgcc.
++
++2014-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	Replace few instances of memcmp/memcpy in the code that should be
+ 	grub_memcmp/grub_memcpy.
+ 
+diff --git a/include/grub/libgcc.h b/include/grub/libgcc.h
+index fdc6611..97233d7 100644
+--- a/include/grub/libgcc.h
++++ b/include/grub/libgcc.h
+@@ -42,13 +42,6 @@ void EXPORT_FUNC (__bswapsi2) (void);
+ # ifdef HAVE___BSWAPDI2
+ void EXPORT_FUNC (__bswapdi2) (void);
+ # endif
+-# ifdef HAVE___CTZDI2
+-void EXPORT_FUNC (__ctzdi2) (void);
+-# endif
+-# ifdef HAVE___CTZSI2
+-void EXPORT_FUNC (__ctzsi2) (void);
+-# endif
+-#endif
+ 
+ #ifdef HAVE__RESTGPR_14_X
+ void EXPORT_FUNC (_restgpr_14_x) (void);
+-- 
+1.9.3
+
diff --git a/SOURCES/0075-Add-missing-endif.patch b/SOURCES/0075-Add-missing-endif.patch
new file mode 100644
index 0000000..df7aa60
--- /dev/null
+++ b/SOURCES/0075-Add-missing-endif.patch
@@ -0,0 +1,24 @@
+From fb1b02802aa368f43c8d0a871e017c14cb39b180 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Fri, 4 Apr 2014 08:11:15 +0200
+Subject: [PATCH 075/143] Add missing #endif
+
+---
+ include/grub/libgcc.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/grub/libgcc.h b/include/grub/libgcc.h
+index 97233d7..8e93b67 100644
+--- a/include/grub/libgcc.h
++++ b/include/grub/libgcc.h
+@@ -42,6 +42,7 @@ void EXPORT_FUNC (__bswapsi2) (void);
+ # ifdef HAVE___BSWAPDI2
+ void EXPORT_FUNC (__bswapdi2) (void);
+ # endif
++#endif
+ 
+ #ifdef HAVE__RESTGPR_14_X
+ void EXPORT_FUNC (_restgpr_14_x) (void);
+-- 
+1.9.3
+
diff --git a/SOURCES/0076-grub-core-lib-syslinux_parse.c-Fix-timeout-quoting.patch b/SOURCES/0076-grub-core-lib-syslinux_parse.c-Fix-timeout-quoting.patch
new file mode 100644
index 0000000..c1037c8
--- /dev/null
+++ b/SOURCES/0076-grub-core-lib-syslinux_parse.c-Fix-timeout-quoting.patch
@@ -0,0 +1,39 @@
+From fb62186fefaca6b302eb61081bb6281042ff7283 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sun, 6 Apr 2014 00:44:44 +0200
+Subject: [PATCH 076/143] 	* grub-core/lib/syslinux_parse.c: Fix timeout
+ quoting.
+
+---
+ ChangeLog                      | 4 ++++
+ grub-core/lib/syslinux_parse.c | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 90e41bd..50d9291 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-04-06  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/lib/syslinux_parse.c: Fix timeout quoting.
++
+ 2014-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* include/grub/libgcc.h: Remove ctzsi2 and ctzdi2. They're no longer
+diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c
+index 21fa175..6bc504b 100644
+--- a/grub-core/lib/syslinux_parse.c
++++ b/grub-core/lib/syslinux_parse.c
+@@ -1432,7 +1432,7 @@ config_file (struct output_buffer *outbuf,
+       for (curentry = menu.entries; curentry->next; curentry = curentry->next);
+       lentry = curentry;
+ 
+-      print_string ("set timeout='");
++      print_string ("set timeout=");
+       err = print_num (outbuf, (menu.timeout + 9) / 10);
+       if (err)
+ 	return err;
+-- 
+1.9.3
+
diff --git a/SOURCES/0077-Improve-LVM-logical_volumes-string-matching.patch b/SOURCES/0077-Improve-LVM-logical_volumes-string-matching.patch
new file mode 100644
index 0000000..3b774c9
--- /dev/null
+++ b/SOURCES/0077-Improve-LVM-logical_volumes-string-matching.patch
@@ -0,0 +1,45 @@
+From d576e05a7bfe25413f70b54f671f305397bacf5e Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Thu, 10 Apr 2014 14:42:41 +0100
+Subject: [PATCH 077/143] Improve LVM "logical_volumes" string matching
+
+* grub-core/disk/lvm.c (grub_lvm_detect): Search for
+"logical_volumes" block a little more accurately.
+---
+ ChangeLog            | 5 +++++
+ grub-core/disk/lvm.c | 4 ++--
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 50d9291..7f0c57d 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-04-10  Colin Watson  <cjwatson@ubuntu.com>
++
++	* grub-core/disk/lvm.c (grub_lvm_detect): Search for
++	"logical_volumes" block a little more accurately.
++
+ 2014-04-06  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/lib/syslinux_parse.c: Fix timeout quoting.
+diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c
+index 483c17e..862a966 100644
+--- a/grub-core/disk/lvm.c
++++ b/grub-core/disk/lvm.c
+@@ -333,10 +333,10 @@ grub_lvm_detect (grub_disk_t disk,
+ 	    }
+ 	}
+ 
+-      p = grub_strstr (p, "logical_volumes");
++      p = grub_strstr (p, "logical_volumes {");
+       if (p)
+ 	{
+-	  p += sizeof ("logical_volumes = ") - 1;
++	  p += sizeof ("logical_volumes {") - 1;
+ 
+ 	  /* And add all the lvs to the volume group. */
+ 	  while (1)
+-- 
+1.9.3
+
diff --git a/SOURCES/0078-Tolerate-devices-with-no-filesystem-UUID-returned-by.patch b/SOURCES/0078-Tolerate-devices-with-no-filesystem-UUID-returned-by.patch
new file mode 100644
index 0000000..f512a75
--- /dev/null
+++ b/SOURCES/0078-Tolerate-devices-with-no-filesystem-UUID-returned-by.patch
@@ -0,0 +1,83 @@
+From 0942ce33c5b88d85a6b81f4b3dd75c32fdf21978 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Thu, 10 Apr 2014 16:54:33 +0100
+Subject: [PATCH 078/143] Tolerate devices with no filesystem UUID returned by
+ os-prober
+
+* util/grub.d/30_os-prober.in: Tolerate devices with no filesystem
+UUID.  Other parts of grub-mkconfig tolerate these, they were
+previously allowed here up to commit
+55e706c918922def17f5012c23cfe88c4c645208, and they can arise in
+practice when the system has active LVM snapshots.
+Fixes Ubuntu bug #1287436.
+---
+ ChangeLog                   |  9 +++++++++
+ util/grub.d/30_os-prober.in | 23 +++++++++++++----------
+ 2 files changed, 22 insertions(+), 10 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 7f0c57d..3556468 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,14 @@
+ 2014-04-10  Colin Watson  <cjwatson@ubuntu.com>
+ 
++	* util/grub.d/30_os-prober.in: Tolerate devices with no filesystem
++	UUID.  Other parts of grub-mkconfig tolerate these, they were
++	previously allowed here up to commit
++	55e706c918922def17f5012c23cfe88c4c645208, and they can arise in
++	practice when the system has active LVM snapshots.
++	Fixes Ubuntu bug #1287436.
++
++2014-04-10  Colin Watson  <cjwatson@ubuntu.com>
++
+ 	* grub-core/disk/lvm.c (grub_lvm_detect): Search for
+ 	"logical_volumes" block a little more accurately.
+ 
+diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
+index 7cf8487..6f38c82 100644
+--- a/util/grub.d/30_os-prober.in
++++ b/util/grub.d/30_os-prober.in
+@@ -112,16 +112,17 @@ for OS in ${OSPROBED} ; do
+   LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
+   LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
+   BOOT="`echo ${OS} | cut -d ':' -f 4`"
+-  UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"
+-  EXPUUID="$UUID"
++  if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then
++    EXPUUID="$UUID"
+ 
+-  if [ x"${DEVICE#*@}" != x ] ; then
++    if [ x"${DEVICE#*@}" != x ] ; then
+       EXPUUID="${EXPUUID}@${DEVICE#*@}"
+-  fi
++    fi
+ 
+-  if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
+-    echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
+-    continue
++    if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
++      echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
++      continue
++    fi
+   fi
+ 
+   BTRFS="`echo ${OS} | cut -d ':' -f 5`"
+@@ -277,9 +278,11 @@ EOF
+       echo "$title_correction_code"
+     ;;
+     macosx)
+-      OSXUUID="${UUID}"
+-      osx_entry xnu_kernel 32
+-      osx_entry xnu_kernel64 64
++      if [ "${UUID}" ]; then
++	OSXUUID="${UUID}"
++	osx_entry xnu_kernel 32
++	osx_entry xnu_kernel64 64
++      fi
+     ;;
+     hurd)
+       onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
+-- 
+1.9.3
+
diff --git a/SOURCES/0079-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch b/SOURCES/0079-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch
new file mode 100644
index 0000000..0efba39
--- /dev/null
+++ b/SOURCES/0079-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch
@@ -0,0 +1,49 @@
+From 42c1756fd0ff7d94dcc8e9be2e429a2a976f6d41 Mon Sep 17 00:00:00 2001
+From: Piotr Krysiuk <piotras@gmail.com>
+Date: Sun, 20 Apr 2014 15:58:45 +0200
+Subject: [PATCH 079/143] Allow loading old kernels by placing GDT in
+ conventional memory.
+
+---
+ ChangeLog                      |  5 +++++
+ grub-core/lib/i386/relocator.c | 11 +++++++----
+ 2 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 3556468..73a8928 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-04-20  Piotr Krysiuk  <piotras@gmail.com>
++
++	* grub-core/lib/i386/relocator.c: Allow loading old kernels by placing
++	GDT in conventional memory.
++
+ 2014-04-10  Colin Watson  <cjwatson@ubuntu.com>
+ 
+ 	* util/grub.d/30_os-prober.in: Tolerate devices with no filesystem
+diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c
+index d2a1b27..ffaf25f 100644
+--- a/grub-core/lib/i386/relocator.c
++++ b/grub-core/lib/i386/relocator.c
+@@ -81,10 +81,13 @@ grub_relocator32_boot (struct grub_relocator *rel,
+   void *relst;
+   grub_relocator_chunk_t ch;
+ 
+-  err = grub_relocator_alloc_chunk_align (rel, &ch, 0,
+-					  (0xffffffff - RELOCATOR_SIZEOF (32))
+-					  + 1, RELOCATOR_SIZEOF (32), 16,
+-					  GRUB_RELOCATOR_PREFERENCE_NONE,
++  /* Specific memory range due to Global Descriptor Table for use by payload
++     that we will store in returned chunk.  The address range and preference
++     are based on "THE LINUX/x86 BOOT PROTOCOL" specification.  */
++  err = grub_relocator_alloc_chunk_align (rel, &ch, 0x1000,
++					  0x9a000 - RELOCATOR_SIZEOF (32),
++					  RELOCATOR_SIZEOF (32), 16,
++					  GRUB_RELOCATOR_PREFERENCE_LOW,
+ 					  avoid_efi_bootservices);
+   if (err)
+     return err;
+-- 
+1.9.3
+
diff --git a/SOURCES/0080-grub-core-kern-misc.c-__bzero-Don-t-compile-in-GRUB_.patch b/SOURCES/0080-grub-core-kern-misc.c-__bzero-Don-t-compile-in-GRUB_.patch
new file mode 100644
index 0000000..aaa2228
--- /dev/null
+++ b/SOURCES/0080-grub-core-kern-misc.c-__bzero-Don-t-compile-in-GRUB_.patch
@@ -0,0 +1,43 @@
+From ec4609b70a7deebf6381297aae95dd4bf05bd008 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sun, 20 Apr 2014 16:12:41 +0200
+Subject: [PATCH 080/143] 	* grub-core/kern/misc.c (__bzero): Don't
+ compile in GRUB_UTIL.
+
+	Reported by: Yves Blusseau <blusseau@zetam.org>.
+---
+ ChangeLog             | 6 ++++++
+ grub-core/kern/misc.c | 3 +++
+ 2 files changed, 9 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index 73a8928..3b61c0a 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,9 @@
++2014-04-20  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/kern/misc.c (__bzero): Don't compile in GRUB_UTIL.
++
++	Reported by: Yves Blusseau <blusseau@zetam.org>.
++
+ 2014-04-20  Piotr Krysiuk  <piotras@gmail.com>
+ 
+ 	* grub-core/lib/i386/relocator.c: Allow loading old kernels by placing
+diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
+index 54db2e1..c5c815d 100644
+--- a/grub-core/kern/misc.c
++++ b/grub-core/kern/misc.c
+@@ -542,6 +542,9 @@ memset (void *s, int c, grub_size_t n)
+   return grub_memset (s, c, n);
+ }
+ 
++#endif
++
++#if !defined(GRUB_UTIL) && defined(__APPLE__)
+ void GRUB_BUILTIN_ATTR
+ __bzero (void *s, grub_size_t n)
+ {
+-- 
+1.9.3
+
diff --git a/SOURCES/0081-grub-core-commands-verify.c-grub_pubkey_open-Fix-mem.patch b/SOURCES/0081-grub-core-commands-verify.c-grub_pubkey_open-Fix-mem.patch
new file mode 100644
index 0000000..67e8193
--- /dev/null
+++ b/SOURCES/0081-grub-core-commands-verify.c-grub_pubkey_open-Fix-mem.patch
@@ -0,0 +1,40 @@
+From 4a307e8fe1298f88641a40c8a8008363aa4b9c17 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Mon, 12 May 2014 10:01:48 +0200
+Subject: [PATCH 081/143] 	* grub-core/commands/verify.c
+ (grub_pubkey_open): Fix memdisk 	check.
+
+---
+ ChangeLog                   | 5 +++++
+ grub-core/commands/verify.c | 2 +-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 3b61c0a..d0896d8 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-06-21  Vladimir Serbinenko  <phcoder@gmail.com>
++
++	* grub-core/commands/verify.c (grub_pubkey_open): Fix memdisk
++	check.
++
+ 2014-04-20  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/kern/misc.c (__bzero): Don't compile in GRUB_UTIL.
+diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c
+index a9dfd88..6349ccf 100644
+--- a/grub-core/commands/verify.c
++++ b/grub-core/commands/verify.c
+@@ -835,7 +835,7 @@ grub_pubkey_open (grub_file_t io, const char *filename)
+ 
+   if (!sec)
+     return io;
+-  if (io->device->disk && io->device->disk->id == GRUB_DISK_DEVICE_MEMDISK_ID)
++  if (io->device->disk && io->device->disk->dev->id == GRUB_DISK_DEVICE_MEMDISK_ID)
+     return io;
+   fsuf = grub_malloc (grub_strlen (filename) + sizeof (".sig"));
+   if (!fsuf)
+-- 
+1.9.3
+
diff --git a/SOURCES/0082-grub-core-commands-verify.c-grub_pubkey_open-Trust-p.patch b/SOURCES/0082-grub-core-commands-verify.c-grub_pubkey_open-Trust-p.patch
new file mode 100644
index 0000000..5ad0e40
--- /dev/null
+++ b/SOURCES/0082-grub-core-commands-verify.c-grub_pubkey_open-Trust-p.patch
@@ -0,0 +1,43 @@
+From 61fdf8bebdeaed4b601f0eca847282780380191f Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Thu, 15 May 2014 14:36:48 +0200
+Subject: [PATCH 082/143] 	* grub-core/commands/verify.c
+ (grub_pubkey_open): Trust procfs.
+
+---
+ ChangeLog                   | 4 ++++
+ grub-core/commands/verify.c | 4 +++-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index d0896d8..2a94ad9 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,9 @@
+ 2014-06-21  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
++	* grub-core/commands/verify.c (grub_pubkey_open): Trust procfs.
++
++2014-06-21  Vladimir Serbinenko  <phcoder@gmail.com>
++
+ 	* grub-core/commands/verify.c (grub_pubkey_open): Fix memdisk
+ 	check.
+ 
+diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c
+index 6349ccf..525bdd1 100644
+--- a/grub-core/commands/verify.c
++++ b/grub-core/commands/verify.c
+@@ -835,7 +835,9 @@ grub_pubkey_open (grub_file_t io, const char *filename)
+ 
+   if (!sec)
+     return io;
+-  if (io->device->disk && io->device->disk->dev->id == GRUB_DISK_DEVICE_MEMDISK_ID)
++  if (io->device->disk && 
++      (io->device->disk->dev->id == GRUB_DISK_DEVICE_MEMDISK_ID
++       || io->device->disk->dev->id == GRUB_DISK_DEVICE_PROCFS_ID))
+     return io;
+   fsuf = grub_malloc (grub_strlen (filename) + sizeof (".sig"));
+   if (!fsuf)
+-- 
+1.9.3
+
diff --git a/SOURCES/0083-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch b/SOURCES/0083-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch
new file mode 100644
index 0000000..0189af4
--- /dev/null
+++ b/SOURCES/0083-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch
@@ -0,0 +1,73 @@
+From 473348e663de53939fc077a1e1ef262405712dd8 Mon Sep 17 00:00:00 2001
+From: Trevor Woerner <trevor.woerner@linaro.org>
+Date: Sat, 21 Jun 2014 20:26:47 +0200
+Subject: [PATCH 083/143] 	* util/grub-gen-asciih.c (add_glyph): Fix
+ uninitialised variable.
+
+---
+ ChangeLog              |  4 ++++
+ util/grub-gen-asciih.c | 15 +++++++++------
+ 2 files changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 2a94ad9..b552113 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-06-21  Trevor Woerner <trevor.woerner@linaro.org>
++
++	* util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable.
++
+ 2014-06-21  Vladimir Serbinenko  <phcoder@gmail.com>
+ 
+ 	* grub-core/commands/verify.c (grub_pubkey_open): Trust procfs.
+diff --git a/util/grub-gen-asciih.c b/util/grub-gen-asciih.c
+index e01447a..e35dcb7 100644
+--- a/util/grub-gen-asciih.c
++++ b/util/grub-gen-asciih.c
+@@ -81,14 +81,14 @@ add_glyph (FT_UInt glyph_idx, FT_Face face,
+   err = FT_Load_Glyph (face, glyph_idx, flag);
+   if (err)
+     {
+-      printf ("Freetype Error %d loading glyph 0x%x for U+0x%x",
++      fprintf (stderr, "Freetype Error %d loading glyph 0x%x for U+0x%x",
+ 	      err, glyph_idx, char_code);
+ 
+       if (err > 0 && err < (signed) ARRAY_SIZE (ft_errmsgs))
+-	printf (": %s\n", ft_errmsgs[err]);
++	fprintf (stderr, ": %s\n", ft_errmsgs[err]);
+       else
+-	printf ("\n");
+-      return;
++	fprintf (stderr, "\n");
++      exit (1);
+     }
+ 
+   glyph = face->glyph;
+@@ -128,7 +128,6 @@ add_glyph (FT_UInt glyph_idx, FT_Face face,
+ static void
+ write_font_ascii_bitmap (FILE *file, FT_Face face)
+ {
+-  struct grub_glyph_info glyph;
+   int char_code;
+ 
+   fprintf (file, "/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\n");
+@@ -138,10 +137,14 @@ write_font_ascii_bitmap (FILE *file, FT_Face face)
+   for (char_code = 0; char_code <= 0x7f; char_code++)
+     {
+       FT_UInt glyph_idx;
+-      
++      struct grub_glyph_info glyph;
++
+       glyph_idx = FT_Get_Char_Index (face, char_code);
+       if (!glyph_idx)
+ 	return;
++
++      memset (&glyph, 0, sizeof(glyph));
++
+       add_glyph (glyph_idx, face, char_code, &glyph);
+ 
+       if (glyph.width == 8 && glyph.height == 16
+-- 
+1.9.3
+
diff --git a/SOURCES/0084-grub-core-commands-efi-lsefisystab.c-grub_cmd_lsefis.patch b/SOURCES/0084-grub-core-commands-efi-lsefisystab.c-grub_cmd_lsefis.patch
new file mode 100644
index 0000000..5dc0249
--- /dev/null
+++ b/SOURCES/0084-grub-core-commands-efi-lsefisystab.c-grub_cmd_lsefis.patch
@@ -0,0 +1,39 @@
+From 9de53cc99ce4c8e404e645443d07324bd9cfc157 Mon Sep 17 00:00:00 2001
+From: Stephane Rochoy <sheda>
+Date: Sun, 22 Jun 2014 01:34:57 +0200
+Subject: [PATCH 084/143] 	* grub-core/commands/efi/lsefisystab.c
+ (grub_cmd_lsefisystab): Show 	EFI system table physical address.
+
+---
+ ChangeLog                            | 5 +++++
+ grub-core/commands/efi/lsefisystab.c | 1 +
+ 2 files changed, 6 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index b552113..abf8f4b 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2014-06-21  Stephane Rochoy <sheda>
++
++	* grub-core/commands/efi/lsefisystab.c (grub_cmd_lsefisystab): Show
++	EFI system table physical address.
++
+ 2014-06-21  Trevor Woerner <trevor.woerner@linaro.org>
+ 
+ 	* util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable.
+diff --git a/grub-core/commands/efi/lsefisystab.c b/grub-core/commands/efi/lsefisystab.c
+index eda8c5f..8717db9 100644
+--- a/grub-core/commands/efi/lsefisystab.c
++++ b/grub-core/commands/efi/lsefisystab.c
+@@ -52,6 +52,7 @@ grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)),
+   grub_efi_configuration_table_t *t;
+   unsigned int i;
+ 
++  grub_printf ("Address: %p\n", st);
+   grub_printf ("Signature: %016" PRIxGRUB_UINT64_T " revision: %08x\n",
+ 	       st->hdr.signature, st->hdr.revision);
+   {
+-- 
+1.9.3
+
diff --git a/SOURCES/0085-grub-core-loader-i386-bsd.c-grub_netbsd_boot-Pass-po.patch b/SOURCES/0085-grub-core-loader-i386-bsd.c-grub_netbsd_boot-Pass-po.patch
new file mode 100644
index 0000000..5b06a4e
--- /dev/null
+++ b/SOURCES/0085-grub-core-loader-i386-bsd.c-grub_netbsd_boot-Pass-po.patch
@@ -0,0 +1,72 @@
+From 3be166827cecb977ad47ac4d3d89ec92688307a4 Mon Sep 17 00:00:00 2001
+From: Stephane Rochoy <sheda>
+Date: Sun, 22 Jun 2014 01:35:52 +0200
+Subject: [PATCH 085/143] 	* grub-core/loader/i386/bsd.c
+ (grub_netbsd_boot): Pass pointer to 	EFI system table.
+
+---
+ ChangeLog                           | 5 +++++
+ grub-core/loader/i386/bsd.c         | 8 ++++++++
+ include/grub/i386/netbsd_bootinfo.h | 7 +++++++
+ 3 files changed, 20 insertions(+)
+
+diff --git a/ChangeLog b/ChangeLog
+index abf8f4b..0cdd095 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,10 @@
+ 2014-06-21  Stephane Rochoy <sheda>
+ 
++	* grub-core/loader/i386/bsd.c (grub_netbsd_boot): Pass pointer to
++	EFI system table.
++
++2014-06-21  Stephane Rochoy <sheda>
++
+ 	* grub-core/commands/efi/lsefisystab.c (grub_cmd_lsefisystab): Show
+ 	EFI system table physical address.
+ 
+diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
+index 41ef910..8f691e0 100644
+--- a/grub-core/loader/i386/bsd.c
++++ b/grub-core/loader/i386/bsd.c
+@@ -1145,6 +1145,14 @@ grub_netbsd_boot (void)
+   if (err)
+     return err;
+ 
++#ifdef GRUB_MACHINE_EFI
++  err = grub_bsd_add_meta (NETBSD_BTINFO_EFI,
++			   &grub_efi_system_table,
++			   sizeof (grub_efi_system_table));
++  if (err)
++    return err;
++#endif
++
+   {
+     struct bsd_tag *tag;
+     tag_buf_len = 0;
+diff --git a/include/grub/i386/netbsd_bootinfo.h b/include/grub/i386/netbsd_bootinfo.h
+index e48c19b..9b4f460 100644
+--- a/include/grub/i386/netbsd_bootinfo.h
++++ b/include/grub/i386/netbsd_bootinfo.h
+@@ -58,6 +58,8 @@
+ #define NETBSD_BTINFO_BOOTWEDGE		10
+ #define NETBSD_BTINFO_MODULES		11
+ #define NETBSD_BTINFO_FRAMEBUF		12
++#define NETBSD_BTINFO_USERCONFCOMMANDS  13
++#define NETBSD_BTINFO_EFI	        14
+ 
+ struct grub_netbsd_bootinfo
+ {
+@@ -146,4 +148,9 @@ struct grub_netbsd_btinfo_framebuf
+ 
+ #define GRUB_NETBSD_MAX_ROOTDEVICE_LEN 16
+ 
++struct grub_netbsd_btinfo_efi
++{
++  void *pa_systbl;  /* Physical address of the EFI System Table */
++};
++
+ #endif
+-- 
+1.9.3
+
diff --git a/SOURCES/0086-util-grub-install.c-Fix-handling-of-disk-module.patch b/SOURCES/0086-util-grub-install.c-Fix-handling-of-disk-module.patch
new file mode 100644
index 0000000..26c86f6
--- /dev/null
+++ b/SOURCES/0086-util-grub-install.c-Fix-handling-of-disk-module.patch
@@ -0,0 +1,47 @@
+From d45ed8a6bf7c0c0abacb268da1f6d569743f16a0 Mon Sep 17 00:00:00 2001
+From: Glenn Washburn <development@efficientek.com>
+Date: Sun, 22 Jun 2014 01:45:11 +0200
+Subject: [PATCH 086/143] 	* util/grub-install.c: Fix handling of
+ --disk-module.
+
+---
+ ChangeLog           | 4 ++++
+ util/grub-install.c | 3 +--
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 0cdd095..4ce6643 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-06-21  Glenn Washburn <development@efficientek.com>
++
++	* util/grub-install.c: Fix handling of --disk-module.
++
+ 2014-06-21  Stephane Rochoy <sheda>
+ 
+ 	* grub-core/loader/i386/bsd.c (grub_netbsd_boot): Pass pointer to
+diff --git a/util/grub-install.c b/util/grub-install.c
+index e9c6a46..7d61c32 100644
+--- a/util/grub-install.c
++++ b/util/grub-install.c
+@@ -94,7 +94,6 @@ enum
+     OPTION_RECHECK, 
+     OPTION_FORCE,
+     OPTION_FORCE_FILE_ID,
+-    OPTION_MODULE, 
+     OPTION_NO_NVRAM, 
+     OPTION_REMOVABLE, 
+     OPTION_BOOTLOADER_ID, 
+@@ -273,7 +272,7 @@ static struct argp_option options[] = {
+    N_("install even if problems are detected"), 2},
+   {"force-file-id", OPTION_FORCE_FILE_ID, 0, 0,
+    N_("use identifier file even if UUID is available"), 2},
+-  {"disk-module", OPTION_MODULE, N_("MODULE"), 0,
++  {"disk-module", OPTION_DISK_MODULE, N_("MODULE"), 0,
+    N_("disk module to use (biosdisk or native). "
+       "This option is only available on BIOS target."), 2},
+   {"no-nvram", OPTION_NO_NVRAM, 0, 0,
+-- 
+1.9.3
+
diff --git a/SOURCES/0087-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch b/SOURCES/0087-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch
new file mode 100644
index 0000000..57e46ef
--- /dev/null
+++ b/SOURCES/0087-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch
@@ -0,0 +1,58 @@
+From a9c472a7eeec6816868dbccce6decaef3b3c62bb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=9F=D0=B5=D1=85=D0=BE?=
+ =?UTF-8?q?=D0=B2?= <roman_pekhov>
+Date: Sun, 22 Jun 2014 03:51:50 +0400
+Subject: [PATCH 087/143] 	* grub-core/commands/loadenv.c
+ (check_blocklists): Fix overlap check.
+
+---
+ ChangeLog                    |  4 ++++
+ grub-core/commands/loadenv.c | 13 ++-----------
+ 2 files changed, 6 insertions(+), 11 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 4ce6643..a2da974 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2014-06-21  Роман Пехов <roman_pekhov>
++
++	* grub-core/commands/loadenv.c (check_blocklists): Fix overlap check.
++
+ 2014-06-21  Glenn Washburn <development@efficientek.com>
+ 
+ 	* util/grub-install.c: Fix handling of --disk-module.
+diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
+index 6af8112..acd93d1 100644
+--- a/grub-core/commands/loadenv.c
++++ b/grub-core/commands/loadenv.c
+@@ -263,7 +263,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
+       for (q = p->next; q; q = q->next)
+         {
+ 	  grub_disk_addr_t s1, s2;
+-	  grub_disk_addr_t e1, e2, t;
++	  grub_disk_addr_t e1, e2;
+ 
+ 	  s1 = p->sector;
+ 	  e1 = s1 + ((p->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
+@@ -271,16 +271,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
+ 	  s2 = q->sector;
+ 	  e2 = s2 + ((q->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
+ 
+-	  if (s2 > s1)
+-	    {
+-	      t = s2;
+-	      s2 = s1;
+-	      s1 = t;
+-	      t = e2;
+-	      e2 = e1;
+-	      e1 = t;
+-	    }
+-          if (e1 > s2)
++	  if (s1 < e2 && s2 < e1)
+             {
+               /* This might be actually valid, but it is unbelievable that
+                  any filesystem makes such a silly allocation.  */
+-- 
+1.9.3
+
diff --git a/SOURCES/0088-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch b/SOURCES/0088-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch
new file mode 100644
index 0000000..4df5517
--- /dev/null
+++ b/SOURCES/0088-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch
@@ -0,0 +1,26 @@
+From e4ecf3a1f8eef683feae27ed84c85eb8aeb79e11 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Sat, 28 Dec 2013 02:20:27 +0000
+Subject: [PATCH 088/143] * NEWS: The cmosclean command in fact dates back to
+ 1.99.  Remove mention of it from 2.02.
+
+---
+ NEWS | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/NEWS b/NEWS
+index a61df94..f621c65 100644
+--- a/NEWS
++++ b/NEWS
+@@ -63,6 +63,8 @@ New in 2.02:
+   * New `efifwsetup' and `lsefi' commands on EFI platforms.
+   * New `cmosdump' and `cmosset' commands on platforms with CMOS support.
+   * New command `pcidump' for PCI platforms.
++  * New `cbmemc', `coreboot_boottime', and `lscoreboot' commands on
++    coreboot.
+   * Improve opcode parsing in ACPI halt implementation.
+   * Use the TSC as a possible time source on i386-ieee1275.
+   * Merge PowerPC grub-mkrescue implementation with the common one.
+-- 
+1.9.3
+
diff --git a/SOURCES/0089-Migrate-PPC-from-Yaboot-to-Grub2.patch b/SOURCES/0089-Migrate-PPC-from-Yaboot-to-Grub2.patch
new file mode 100644
index 0000000..0065544
--- /dev/null
+++ b/SOURCES/0089-Migrate-PPC-from-Yaboot-to-Grub2.patch
@@ -0,0 +1,154 @@
+From f01392a68f7f20bcc064a7d28e10805509701c4d Mon Sep 17 00:00:00 2001
+From: Mark Hamzy <hamzy@us.ibm.com>
+Date: Wed, 28 Mar 2012 14:46:41 -0500
+Subject: [PATCH 089/143] Migrate PPC from Yaboot to Grub2
+
+Add configuration support for serial terminal consoles.  This will set the
+maximum screen size so that text is not overwritten.
+---
+ Makefile.util.def              |   7 +++
+ util/grub.d/20_ppc_terminfo.in | 114 +++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 121 insertions(+)
+ create mode 100644 util/grub.d/20_ppc_terminfo.in
+
+diff --git a/Makefile.util.def b/Makefile.util.def
+index a286a89..8f40e78 100644
+--- a/Makefile.util.def
++++ b/Makefile.util.def
+@@ -485,6 +485,13 @@ script = {
+ };
+ 
+ script = {
++  name = '20_ppc_terminfo';
++  common = util/grub.d/20_ppc_terminfo.in;
++  installdir = grubconf;
++  condition = COND_HOST_LINUX;
++};
++
++script = {
+   name = '30_os-prober';
+   common = util/grub.d/30_os-prober.in;
+   installdir = grubconf;
+diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in
+new file mode 100644
+index 0000000..10d6658
+--- /dev/null
++++ b/util/grub.d/20_ppc_terminfo.in
+@@ -0,0 +1,114 @@
++#! /bin/sh
++set -e
++
++# grub-mkconfig helper script.
++# Copyright (C) 2006,2007,2008,2009,2010  Free Software Foundation, Inc.
++#
++# GRUB is free software: you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation, either version 3 of the License, or
++# (at your option) any later version.
++#
++# GRUB is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
++
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++bindir=@bindir@
++libdir=@libdir@
++. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
++
++export TEXTDOMAIN=@PACKAGE@
++export TEXTDOMAINDIR=@localedir@
++
++X=80
++Y=24
++TERMINAL=ofconsole
++
++argument () {
++  opt=$1
++  shift
++
++  if test $# -eq 0; then
++      echo "$0: option requires an argument -- '$opt'" 1>&2
++      exit 1
++  fi
++  echo $1
++}
++
++check_terminfo () {
++
++  while test $# -gt 0
++  do
++    option=$1
++    shift
++
++    case "$option" in
++    terminfo | TERMINFO)
++        ;;
++
++    -g)
++        NEWXY=`argument $option "$@"`
++        NEWX=`echo $NEWXY | cut -d x -f 1`
++        NEWY=`echo $NEWXY | cut -d x -f 2`
++
++        if [ ${NEWX} -ge 80 ] ; then
++          X=${NEWX}
++        else
++          echo "Warning: ${NEWX} is less than the minimum size of 80"
++        fi
++
++        if [ ${NEWY} -ge 24 ] ; then
++          Y=${NEWY}
++        else
++          echo "Warning: ${NEWY} is less than the minimum size of 24"
++        fi
++
++        shift
++        ;;
++
++    *)
++#       # accept console or ofconsole
++#       if [ "$option" != "console" -a "$option" != "ofconsole" ] ; then
++#         echo "Error: GRUB_TERMINFO unknown console: $option"
++#         exit 1
++#       fi
++#       # perfer console
++#       TERMINAL=console
++        # accept ofconsole
++        if [ "$option" != "ofconsole" ] ; then
++          echo "Error: GRUB_TERMINFO unknown console: $option"
++          exit 1
++        fi
++        # perfer console
++        TERMINAL=ofconsole
++        ;;
++    esac
++
++  done
++
++}
++
++if ! uname -m | grep -q ppc ; then
++  exit 0
++fi
++
++if [ "x${GRUB_TERMINFO}" != "x" ] ; then
++  F1=`echo ${GRUB_TERMINFO} | cut -d " " -f 1`
++
++  if [ "${F1}" != "terminfo" ] ; then
++    echo "Error: GRUB_TERMINFO is set to \"${GRUB_TERMINFO}\" The first word should be terminfo."
++    exit 1
++  fi
++
++  check_terminfo ${GRUB_TERMINFO}
++fi
++
++cat << EOF
++  terminfo -g ${X}x${Y} ${TERMINAL}
++EOF
+-- 
+1.9.3
+
diff --git a/SOURCES/0090-Add-fw_path-variable-revised.patch b/SOURCES/0090-Add-fw_path-variable-revised.patch
new file mode 100644
index 0000000..5caff3f
--- /dev/null
+++ b/SOURCES/0090-Add-fw_path-variable-revised.patch
@@ -0,0 +1,81 @@
+From 5bd3e1f888eeddc2575608516220ffa7b8270c7a Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Wed, 19 Sep 2012 21:22:55 -0300
+Subject: [PATCH 090/143] Add fw_path variable (revised)
+
+This patch makes grub look for its config file on efi where the app was
+found. It was originally written by Matthew Garrett, and adapted to fix the
+"No modules are loaded on grub2 network boot" issue:
+
+https://bugzilla.redhat.com/show_bug.cgi?id=857936
+---
+ grub-core/kern/main.c   | 13 ++++++-------
+ grub-core/normal/main.c | 25 ++++++++++++++++++++++++-
+ 2 files changed, 30 insertions(+), 8 deletions(-)
+
+diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
+index 9cad0c4..8ab7794 100644
+--- a/grub-core/kern/main.c
++++ b/grub-core/kern/main.c
+@@ -127,16 +127,15 @@ grub_set_prefix_and_root (void)
+ 
+   grub_machine_get_bootlocation (&fwdevice, &fwpath);
+ 
+-  if (fwdevice)
++  if (fwdevice && fwpath)
+     {
+-      char *cmdpath;
++      char *fw_path;
+ 
+-      cmdpath = grub_xasprintf ("(%s)%s", fwdevice, fwpath ? : "");
+-      if (cmdpath)
++      fw_path = grub_xasprintf ("(%s)/%s", fwdevice, fwpath);
++      if (fw_path)
+ 	{
+-	  grub_env_set ("cmdpath", cmdpath);
+-	  grub_env_export ("cmdpath");
+-	  grub_free (cmdpath);
++	  grub_env_set ("fw_path", fw_path);
++	  grub_free (fw_path);
+ 	}
+     }
+ 
+diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
+index 3a926fc..6f4970f 100644
+--- a/grub-core/normal/main.c
++++ b/grub-core/normal/main.c
+@@ -319,7 +319,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
+       /* Guess the config filename. It is necessary to make CONFIG static,
+ 	 so that it won't get broken by longjmp.  */
+       char *config;
+-      const char *prefix;
++      const char *prefix, *fw_path;
++
++      fw_path = grub_env_get ("fw_path");
++      if (fw_path)
++	{
++	  config = grub_xasprintf ("%s/grub.cfg", fw_path);
++	  if (config)
++	    {
++	      grub_file_t file;
++
++	      file = grub_file_open (config);
++	      if (file)
++		{
++		  grub_file_close (file);
++		  grub_enter_normal_mode (config);
++		}
++              else
++                {
++                  /*  Ignore all errors.  */
++                  grub_errno = 0;
++                }
++	      grub_free (config);
++	    }
++	}
+ 
+       prefix = grub_env_get ("prefix");
+       if (prefix)
+-- 
+1.9.3
+
diff --git a/SOURCES/0091-Add-support-for-linuxefi.patch b/SOURCES/0091-Add-support-for-linuxefi.patch
new file mode 100644
index 0000000..d3f4172
--- /dev/null
+++ b/SOURCES/0091-Add-support-for-linuxefi.patch
@@ -0,0 +1,482 @@
+From 70e7bfb2caa9d0f52187b4f6e84762c6459c5903 Mon Sep 17 00:00:00 2001
+From: Matthew Garrett <mjg@redhat.com>
+Date: Tue, 10 Jul 2012 11:58:52 -0400
+Subject: [PATCH 091/143] Add support for linuxefi
+
+---
+ grub-core/Makefile.core.def       |   8 +
+ grub-core/kern/efi/mm.c           |  32 ++++
+ grub-core/loader/i386/efi/linux.c | 371 ++++++++++++++++++++++++++++++++++++++
+ include/grub/efi/efi.h            |   3 +
+ include/grub/i386/linux.h         |   1 +
+ 5 files changed, 415 insertions(+)
+ create mode 100644 grub-core/loader/i386/efi/linux.c
+
+diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
+index 42443bc..ec46506 100644
+--- a/grub-core/Makefile.core.def
++++ b/grub-core/Makefile.core.def
+@@ -1706,6 +1706,14 @@ module = {
+ };
+ 
+ module = {
++  name = linuxefi;
++  efi = loader/i386/efi/linux.c;
++  efi = lib/cmdline.c;
++  enable = i386_efi;
++  enable = x86_64_efi;
++};
++
++module = {
+   name = chain;
+   efi = loader/efi/chainloader.c;
+   i386_pc = loader/i386/pc/chainloader.c;
+diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
+index be37afd..ddeca60 100644
+--- a/grub-core/kern/efi/mm.c
++++ b/grub-core/kern/efi/mm.c
+@@ -49,6 +49,38 @@ static grub_efi_uintn_t finish_desc_size;
+ static grub_efi_uint32_t finish_desc_version;
+ int grub_efi_is_finished = 0;
+ 
++/* Allocate pages below a specified address */
++void *
++grub_efi_allocate_pages_max (grub_efi_physical_address_t max,
++			     grub_efi_uintn_t pages)
++{
++  grub_efi_status_t status;
++  grub_efi_boot_services_t *b;
++  grub_efi_physical_address_t address = max;
++
++  if (max > 0xffffffff)
++    return 0;
++
++  b = grub_efi_system_table->boot_services;
++  status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
++
++  if (status != GRUB_EFI_SUCCESS)
++    return 0;
++
++  if (address == 0)
++    {
++      /* Uggh, the address 0 was allocated... This is too annoying,
++	 so reallocate another one.  */
++      address = max;
++      status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
++      grub_efi_free_pages (0, pages);
++      if (status != GRUB_EFI_SUCCESS)
++	return 0;
++    }
++
++  return (void *) ((grub_addr_t) address);
++}
++
+ /* Allocate pages. Return the pointer to the first of allocated pages.  */
+ void *
+ grub_efi_allocate_pages (grub_efi_physical_address_t address,
+diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
+new file mode 100644
+index 0000000..b79e632
+--- /dev/null
++++ b/grub-core/loader/i386/efi/linux.c
+@@ -0,0 +1,371 @@
++/*
++ *  GRUB  --  GRand Unified Bootloader
++ *  Copyright (C) 2012  Free Software Foundation, Inc.
++ *
++ *  GRUB is free software: you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation, either version 3 of the License, or
++ *  (at your option) any later version.
++ *
++ *  GRUB is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include <grub/loader.h>
++#include <grub/file.h>
++#include <grub/err.h>
++#include <grub/types.h>
++#include <grub/mm.h>
++#include <grub/cpu/linux.h>
++#include <grub/command.h>
++#include <grub/i18n.h>
++#include <grub/lib/cmdline.h>
++#include <grub/efi/efi.h>
++
++GRUB_MOD_LICENSE ("GPLv3+");
++
++static grub_dl_t my_mod;
++static int loaded;
++static void *kernel_mem;
++static grub_uint64_t kernel_size;
++static grub_uint8_t *initrd_mem;
++static grub_uint32_t handover_offset;
++struct linux_kernel_params *params;
++static char *linux_cmdline;
++
++#define BYTES_TO_PAGES(bytes)   (((bytes) + 0xfff) >> 12)
++
++#define SHIM_LOCK_GUID \
++  { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
++
++struct grub_efi_shim_lock
++{
++  grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size);
++};
++typedef struct grub_efi_shim_lock grub_efi_shim_lock_t;
++
++static grub_efi_boolean_t
++grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
++{
++  grub_efi_guid_t guid = SHIM_LOCK_GUID;
++  grub_efi_shim_lock_t *shim_lock;
++
++  shim_lock = grub_efi_locate_protocol(&guid, NULL);
++
++  if (!shim_lock)
++    return 1;
++
++  if (shim_lock->verify(data, size) == GRUB_EFI_SUCCESS)
++    return 1;
++
++  return 0;
++}
++
++typedef void(*handover_func)(void *, grub_efi_system_table_t *, struct linux_kernel_params *);
++
++static grub_err_t
++grub_linuxefi_boot (void)
++{
++  handover_func hf;
++  int offset = 0;
++
++#ifdef __x86_64__
++  offset = 512;
++#endif
++
++  hf = (handover_func)((char *)kernel_mem + handover_offset + offset);
++
++  asm volatile ("cli");
++
++  hf (grub_efi_image_handle, grub_efi_system_table, params);
++
++  /* Not reached */
++  return GRUB_ERR_NONE;
++}
++
++static grub_err_t
++grub_linuxefi_unload (void)
++{
++  grub_dl_unref (my_mod);
++  loaded = 0;
++  if (initrd_mem)
++    grub_efi_free_pages((grub_efi_physical_address_t)initrd_mem, BYTES_TO_PAGES(params->ramdisk_size));
++  if (linux_cmdline)
++    grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(params->cmdline_size + 1));
++  if (kernel_mem)
++    grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size));
++  if (params)
++    grub_efi_free_pages((grub_efi_physical_address_t)params, BYTES_TO_PAGES(16384));
++  return GRUB_ERR_NONE;
++}
++
++static grub_err_t
++grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
++                 int argc, char *argv[])
++{
++  grub_file_t *files = 0;
++  int i, nfiles = 0;
++  grub_size_t size = 0;
++  grub_uint8_t *ptr;
++
++  if (argc == 0)
++    {
++      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
++      goto fail;
++    }
++
++  if (!loaded)
++    {
++      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
++      goto fail;
++    }
++
++  files = grub_zalloc (argc * sizeof (files[0]));
++  if (!files)
++    goto fail;
++
++  for (i = 0; i < argc; i++)
++    {
++      grub_file_filter_disable_compression ();
++      files[i] = grub_file_open (argv[i]);
++      if (! files[i])
++        goto fail;
++      nfiles++;
++      size += ALIGN_UP (grub_file_size (files[i]), 4);
++    }
++
++  initrd_mem = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(size));
++
++  if (!initrd_mem)
++    {
++      grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate initrd"));
++      goto fail;
++    }
++
++  params->ramdisk_size = size;
++  params->ramdisk_image = (grub_uint32_t)(grub_uint64_t) initrd_mem;
++
++  ptr = initrd_mem;
++
++  for (i = 0; i < nfiles; i++)
++    {
++      grub_ssize_t cursize = grub_file_size (files[i]);
++      if (grub_file_read (files[i], ptr, cursize) != cursize)
++        {
++          if (!grub_errno)
++            grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
++                        argv[i]);
++          goto fail;
++        }
++      ptr += cursize;
++      grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
++      ptr += ALIGN_UP_OVERHEAD (cursize, 4);
++    }
++
++  params->ramdisk_size = size;
++
++ fail:
++  for (i = 0; i < nfiles; i++)
++    grub_file_close (files[i]);
++  grub_free (files);
++
++  if (initrd_mem && grub_errno)
++    grub_efi_free_pages((grub_efi_physical_address_t)initrd_mem, BYTES_TO_PAGES(size));
++
++  return grub_errno;
++}
++
++static grub_err_t
++grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
++		int argc, char *argv[])
++{
++  grub_file_t file = 0;
++  struct linux_kernel_header lh;
++  grub_ssize_t len, start, filelen;
++  void *kernel;
++
++  grub_dl_ref (my_mod);
++
++  if (argc == 0)
++    {
++      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
++      goto fail;
++    }
++
++  file = grub_file_open (argv[0]);
++  if (! file)
++    goto fail;
++
++  filelen = grub_file_size (file);
++
++  kernel = grub_malloc(filelen);
++
++  if (!kernel)
++    {
++      grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel buffer"));
++      goto fail;
++    }
++
++  if (grub_file_read (file, kernel, filelen) != filelen)
++    {
++      grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), argv[0]);
++      goto fail;
++    }
++
++  if (! grub_linuxefi_secure_validate (kernel, filelen))
++    {
++      grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]);
++      grub_free (kernel);
++      goto fail;
++    }
++
++  grub_file_seek (file, 0);
++
++  grub_free(kernel);
++
++  params = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(16384));
++
++  if (! params)
++    {
++      grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate kernel parameters");
++      goto fail;
++    }
++
++  memset (params, 0, 16384);
++
++  if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
++    {
++      if (!grub_errno)
++	grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
++		    argv[0]);
++      goto fail;
++    }
++
++  if (lh.boot_flag != grub_cpu_to_le16 (0xaa55))
++    {
++      grub_error (GRUB_ERR_BAD_OS, N_("invalid magic number"));
++      goto fail;
++    }
++
++  if (lh.setup_sects > GRUB_LINUX_MAX_SETUP_SECTS)
++    {
++      grub_error (GRUB_ERR_BAD_OS, N_("too many setup sectors"));
++      goto fail;
++    }
++
++  if (lh.version < grub_cpu_to_le16 (0x020b))
++    {
++      grub_error (GRUB_ERR_BAD_OS, N_("kernel too old"));
++      goto fail;
++    }
++
++  if (!lh.handover_offset)
++    {
++      grub_error (GRUB_ERR_BAD_OS, N_("kernel doesn't support EFI handover"));
++      goto fail;
++    }
++
++  linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff,
++					 BYTES_TO_PAGES(lh.cmdline_size + 1));
++
++  if (!linux_cmdline)
++    {
++      grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate cmdline"));
++      goto fail;
++    }
++
++  grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
++  grub_create_loader_cmdline (argc, argv,
++                              linux_cmdline + sizeof (LINUX_IMAGE) - 1,
++			      lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1));
++
++  lh.cmd_line_ptr = (grub_uint32_t)(grub_uint64_t)linux_cmdline;
++
++  handover_offset = lh.handover_offset;
++
++  start = (lh.setup_sects + 1) * 512;
++  len = grub_file_size(file) - start;
++
++  kernel_mem = grub_efi_allocate_pages(lh.pref_address,
++				       BYTES_TO_PAGES(lh.init_size));
++
++  if (!kernel_mem)
++    kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
++					     BYTES_TO_PAGES(lh.init_size));
++
++  if (!kernel_mem)
++    {
++      grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel"));
++      goto fail;
++    }
++
++  if (grub_file_seek (file, start) == (grub_off_t) -1)
++    {
++      grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
++		  argv[0]);
++      goto fail;
++    }
++
++  if (grub_file_read (file, kernel_mem, len) != len && !grub_errno)
++    {
++      grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
++		  argv[0]);
++    }
++
++  if (grub_errno == GRUB_ERR_NONE)
++    {
++      grub_loader_set (grub_linuxefi_boot, grub_linuxefi_unload, 0);
++      loaded = 1;
++      lh.code32_start = (grub_uint32_t)(grub_uint64_t) kernel_mem;
++    }
++
++  memcpy(params, &lh, 2 * 512);
++
++  params->type_of_loader = 0x21;
++
++ fail:
++
++  if (file)
++    grub_file_close (file);
++
++  if (grub_errno != GRUB_ERR_NONE)
++    {
++      grub_dl_unref (my_mod);
++      loaded = 0;
++    }
++
++  if (linux_cmdline && !loaded)
++    grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(lh.cmdline_size + 1));
++
++  if (kernel_mem && !loaded)
++    grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size));
++
++  if (params && !loaded)
++    grub_efi_free_pages((grub_efi_physical_address_t)params, BYTES_TO_PAGES(16384));
++
++  return grub_errno;
++}
++
++static grub_command_t cmd_linux, cmd_initrd;
++
++GRUB_MOD_INIT(linuxefi)
++{
++  cmd_linux =
++    grub_register_command ("linuxefi", grub_cmd_linux,
++                           0, N_("Load Linux."));
++  cmd_initrd =
++    grub_register_command ("initrdefi", grub_cmd_initrd,
++                           0, N_("Load initrd."));
++  my_mod = mod;
++}
++
++GRUB_MOD_FINI(linuxefi)
++{
++  grub_unregister_command (cmd_linux);
++  grub_unregister_command (cmd_initrd);
++}
+diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
+index 489cf9e..9370fd5 100644
+--- a/include/grub/efi/efi.h
++++ b/include/grub/efi/efi.h
+@@ -40,6 +40,9 @@ void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
+ void *
+ EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address,
+ 				      grub_efi_uintn_t pages);
++void *
++EXPORT_FUNC(grub_efi_allocate_pages_max) (grub_efi_physical_address_t max,
++					  grub_efi_uintn_t pages);
+ void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
+ 				       grub_efi_uintn_t pages);
+ int
+diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h
+index da0ca3b..fc36bda 100644
+--- a/include/grub/i386/linux.h
++++ b/include/grub/i386/linux.h
+@@ -139,6 +139,7 @@ struct linux_kernel_header
+   grub_uint64_t setup_data;
+   grub_uint64_t pref_address;
+   grub_uint32_t init_size;
++  grub_uint32_t handover_offset;
+ } GRUB_PACKED;
+ 
+ /* Boot parameters for Linux based on 2.6.12. This is used by the setup
+-- 
+1.9.3
+
diff --git a/SOURCES/0092-Use-linuxefi-and-initrdefi-where-appropriate.patch b/SOURCES/0092-Use-linuxefi-and-initrdefi-where-appropriate.patch
new file mode 100644
index 0000000..e0e1cf2
--- /dev/null
+++ b/SOURCES/0092-Use-linuxefi-and-initrdefi-where-appropriate.patch
@@ -0,0 +1,50 @@
+From acc83cfa76a6457be73b1e748a80deb3967e2364 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Mon, 16 Jul 2012 18:57:11 -0400
+Subject: [PATCH 092/143] Use "linuxefi" and "initrdefi" where appropriate.
+
+---
+ util/grub.d/10_linux.in | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 00d1931..ad34cc0 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -127,17 +127,31 @@ linux_entry ()
+     printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
+   fi
+   message="$(gettext_printf "Loading Linux %s ..." ${version})"
+-  sed "s/^/$submenu_indentation/" << EOF
++  if [ -d /sys/firmware/efi ]; then
++    sed "s/^/$submenu_indentation/" << EOF
++	echo	'$(echo "$message" | grub_quote)'
++	linuxefi ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
++EOF
++  else
++    sed "s/^/$submenu_indentation/" << EOF
+ 	echo	'$(echo "$message" | grub_quote)'
+ 	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
+ EOF
++  fi
+   if test -n "${initrd}" ; then
+     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
+     message="$(gettext_printf "Loading initial ramdisk ...")"
+-    sed "s/^/$submenu_indentation/" << EOF
++    if [ -d /sys/firmware/efi ]; then
++      sed "s/^/$submenu_indentation/" << EOF
+ 	echo	'$(echo "$message" | grub_quote)'
++	initrdefi ${rel_dirname}/${initrd}
++EOF
++    else
++      sed "s/^/$submenu_indentation/" << EOF
++	echo	'$message'
+ 	initrd	${rel_dirname}/${initrd}
+ EOF
++    fi
+   fi
+   sed "s/^/$submenu_indentation/" << EOF
+ }
+-- 
+1.9.3
+
diff --git a/SOURCES/0093-Don-t-allow-insmod-when-secure-boot-is-enabled.patch b/SOURCES/0093-Don-t-allow-insmod-when-secure-boot-is-enabled.patch
new file mode 100644
index 0000000..79eea04
--- /dev/null
+++ b/SOURCES/0093-Don-t-allow-insmod-when-secure-boot-is-enabled.patch
@@ -0,0 +1,117 @@
+From fe7b32ab9e58470fdf930d8efc7c9ebcd69e6ef3 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Tue, 23 Oct 2012 10:40:49 -0400
+Subject: [PATCH 093/143] Don't allow insmod when secure boot is enabled.
+
+Hi,
+
+Fedora's patch to forbid insmod in UEFI Secure Boot environments is fine
+as far as it goes.  However, the insmod command is not the only way that
+modules can be loaded.  In particular, the 'normal' command, which
+implements the usual GRUB menu and the fully-featured command prompt,
+will implicitly load commands not currently loaded into memory.  This
+permits trivial Secure Boot violations by writing commands implementing
+whatever you want to do and pointing $prefix at the malicious code.
+
+I'm currently test-building this patch (replacing your current
+grub-2.00-no-insmod-on-sb.patch), but this should be more correct.  It
+moves the check into grub_dl_load_file.
+---
+ grub-core/kern/dl.c      | 21 +++++++++++++++++++++
+ grub-core/kern/efi/efi.c | 28 ++++++++++++++++++++++++++++
+ include/grub/efi/efi.h   |  1 +
+ 3 files changed, 50 insertions(+)
+
+diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
+index 6850e04..b0b0405 100644
+--- a/grub-core/kern/dl.c
++++ b/grub-core/kern/dl.c
+@@ -38,6 +38,14 @@
+ #define GRUB_MODULES_MACHINE_READONLY
+ #endif
+ 
++#ifdef GRUB_MACHINE_EMU
++#include <sys/mman.h>
++#endif
++
++#ifdef GRUB_MACHINE_EFI
++#include <grub/efi/efi.h>
++#endif
++
+ 
+ 
+ #pragma GCC diagnostic ignored "-Wcast-align"
+@@ -680,6 +688,19 @@ grub_dl_load_file (const char *filename)
+   void *core = 0;
+   grub_dl_t mod = 0;
+ 
++#ifdef GRUB_MACHINE_EFI
++  if (grub_efi_secure_boot ())
++    {
++#if 0
++      /* This is an error, but grub2-mkconfig still generates a pile of
++       * insmod commands, so emitting it would be mostly just obnoxious. */
++      grub_error (GRUB_ERR_ACCESS_DENIED,
++		  "Secure Boot forbids loading module from %s", filename);
++#endif
++      return 0;
++    }
++#endif
++
+   grub_boot_time ("Loading module %s", filename);
+ 
+   file = grub_file_open (filename);
+diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
+index b9eb1ab..cd839cc 100644
+--- a/grub-core/kern/efi/efi.c
++++ b/grub-core/kern/efi/efi.c
+@@ -259,6 +259,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
+   return NULL;
+ }
+ 
++grub_efi_boolean_t
++grub_efi_secure_boot (void)
++{
++  grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
++  grub_size_t datasize;
++  char *secure_boot = NULL;
++  char *setup_mode = NULL;
++  grub_efi_boolean_t ret = 0;
++
++  secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize);
++
++  if (datasize != 1 || !secure_boot)
++    goto out;
++
++  setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize);
++
++  if (datasize != 1 || !setup_mode)
++    goto out;
++
++  if (*secure_boot && !*setup_mode)
++    ret = 1;
++
++ out:
++  grub_free (secure_boot);
++  grub_free (setup_mode);
++  return ret;
++}
++
+ #pragma GCC diagnostic ignored "-Wcast-align"
+ 
+ /* Search the mods section from the PE32/PE32+ image. This code uses
+diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
+index 9370fd5..a000c38 100644
+--- a/include/grub/efi/efi.h
++++ b/include/grub/efi/efi.h
+@@ -72,6 +72,7 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var,
+ 				     const grub_efi_guid_t *guid,
+ 				     void *data,
+ 				     grub_size_t datasize);
++grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void);
+ int
+ EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
+ 					     const grub_efi_device_path_t *dp2);
+-- 
+1.9.3
+
diff --git a/SOURCES/0094-Pass-x-hex-hex-straight-through-unmolested.patch b/SOURCES/0094-Pass-x-hex-hex-straight-through-unmolested.patch
new file mode 100644
index 0000000..83cf483
--- /dev/null
+++ b/SOURCES/0094-Pass-x-hex-hex-straight-through-unmolested.patch
@@ -0,0 +1,183 @@
+From a4f335a93d417c7f51f715d55ae59621fc9772ad Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Mon, 1 Oct 2012 13:24:37 -0400
+Subject: [PATCH 094/143] Pass "\x[[:hex:]][[:hex:]]" straight through
+ unmolested.
+
+---
+ grub-core/commands/wildcard.c | 16 +++++++++++++++-
+ grub-core/lib/cmdline.c       | 34 ++++++++++++++++++++++++++++++++--
+ grub-core/script/execute.c    | 43 +++++++++++++++++++++++++++++++++++++------
+ 3 files changed, 84 insertions(+), 9 deletions(-)
+
+diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c
+index 2807f80..0f40e04 100644
+--- a/grub-core/commands/wildcard.c
++++ b/grub-core/commands/wildcard.c
+@@ -458,6 +458,12 @@ check_file (const char *dir, const char *basename)
+   return ctx.found;
+ }
+ 
++static int
++is_hex(char c)
++{
++  return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
++}
++
+ static void
+ unescape (char *out, const char *in, const char *end)
+ {
+@@ -466,7 +472,15 @@ unescape (char *out, const char *in, const char *end)
+ 
+   for (optr = out, iptr = in; iptr < end;)
+     {
+-      if (*iptr == '\\' && iptr + 1 < end)
++      if (*iptr == '\\' && iptr + 3 < end && iptr[1] == 'x' && is_hex(iptr[2]) && is_hex(iptr[3]))
++	{
++	  *optr++ = *iptr++;
++	  *optr++ = *iptr++;
++	  *optr++ = *iptr++;
++	  *optr++ = *iptr++;
++	  continue;
++	}
++      else if (*iptr == '\\' && iptr + 1 < end)
+ 	{
+ 	  *optr++ = iptr[1];
+ 	  iptr += 2;
+diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
+index d5e10ee..0a5b2af 100644
+--- a/grub-core/lib/cmdline.c
++++ b/grub-core/lib/cmdline.c
+@@ -20,6 +20,12 @@
+ #include <grub/lib/cmdline.h>
+ #include <grub/misc.h>
+ 
++static int
++is_hex(char c)
++{
++  return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
++}
++
+ static unsigned int check_arg (char *c, int *has_space)
+ {
+   int space = 0;
+@@ -27,7 +33,13 @@ static unsigned int check_arg (char *c, int *has_space)
+ 
+   while (*c)
+     {
+-      if (*c == '\\' || *c == '\'' || *c == '"')
++      if (*c == '\\' && *(c+1) == 'x' && is_hex(*(c+2)) && is_hex(*(c+3)))
++	{
++	  size += 4;
++	  c += 4;
++	  continue;
++	}
++      else if (*c == '\\' || *c == '\'' || *c == '"')
+ 	size++;
+       else if (*c == ' ')
+ 	space = 1;
+@@ -85,7 +97,25 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
+ 
+       while (*c)
+ 	{
+-	  if (*c == '\\' || *c == '\'' || *c == '"')
++	  if (*c == ' ')
++	    {
++	      *buf++ = '\\';
++	      *buf++ = 'x';
++	      *buf++ = '2';
++	      *buf++ = '0';
++	      c++;
++	      continue;
++	    }
++	  else if (*c == '\\' && *(c+1) == 'x' &&
++		   is_hex(*(c+2)) && is_hex(*(c+3)))
++	    {
++	      *buf++ = *c++;
++	      *buf++ = *c++;
++	      *buf++ = *c++;
++	      *buf++ = *c++;
++	      continue;
++	    }
++	  else if (*c == '\\' || *c == '\'' || *c == '"')
+ 	    *buf++ = '\\';
+ 
+ 	  *buf++ = *c;
+diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
+index afd5513..8f01c1b 100644
+--- a/grub-core/script/execute.c
++++ b/grub-core/script/execute.c
+@@ -52,6 +52,12 @@ static struct grub_script_scope *scope = 0;
+ /* Wildcard translator for GRUB script.  */
+ struct grub_script_wildcard_translator *grub_wildcard_translator;
+ 
++static int
++is_hex(char c)
++{
++  return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
++}
++
+ static char*
+ wildcard_escape (const char *s)
+ {
+@@ -68,7 +74,15 @@ wildcard_escape (const char *s)
+   i = 0;
+   while ((ch = *s++))
+     {
+-      if (ch == '*' || ch == '\\' || ch == '?')
++      if (ch == '\\' && s[0] == 'x' && is_hex(s[1]) && is_hex(s[2]))
++	{
++	  p[i++] = ch;
++	  p[i++] = *s++;
++	  p[i++] = *s++;
++	  p[i++] = *s++;
++	  continue;
++	}
++      else if (ch == '*' || ch == '\\' || ch == '?')
+ 	p[i++] = '\\';
+       p[i++] = ch;
+     }
+@@ -92,7 +106,14 @@ wildcard_unescape (const char *s)
+   i = 0;
+   while ((ch = *s++))
+     {
+-      if (ch == '\\')
++      if (ch == '\\' && s[0] == 'x' && is_hex(s[1]) && is_hex(s[2]))
++	{
++	  p[i++] = '\\';
++	  p[i++] = *s++;
++	  p[i++] = *s++;
++	  p[i++] = *s++;
++	}
++      else if (ch == '\\')
+ 	p[i++] = *s++;
+       else
+ 	p[i++] = ch;
+@@ -394,10 +415,20 @@ parse_string (const char *str,
+     switch (*ptr)
+       {
+       case '\\':
+-	escaped = !escaped;
+-	if (!escaped && put)
+-	  *(put++) = '\\';
+-	ptr++;
++	if (!escaped && put && *(ptr+1) == 'x' && is_hex(*(ptr+2)) && is_hex(*(ptr+3)))
++	  {
++	    *(put++) = *ptr++;
++	    *(put++) = *ptr++;
++	    *(put++) = *ptr++;
++	    *(put++) = *ptr++;
++	  }
++	else
++	  {
++	    escaped = !escaped;
++	    if (!escaped && put)
++	      *(put++) = '\\';
++	    ptr++;
++	  }
+ 	break;
+       case '$':
+ 	if (escaped)
+-- 
+1.9.3
+
diff --git a/SOURCES/0095-Fix-crash-on-http.patch b/SOURCES/0095-Fix-crash-on-http.patch
new file mode 100644
index 0000000..cf87c9e
--- /dev/null
+++ b/SOURCES/0095-Fix-crash-on-http.patch
@@ -0,0 +1,28 @@
+From e5a51c7c96d347cd6cbb7a2aa11f5dd7358c802a Mon Sep 17 00:00:00 2001
+From: Gustavo Luiz Duarte <gustavold@linux.vnet.ibm.com>
+Date: Tue, 25 Sep 2012 18:40:55 -0400
+Subject: [PATCH 095/143] Fix crash on http
+
+Don't free file->data on receiving FIN flag since it is used all over without
+checking. http_close() will be called later to free that memory.
+https://bugzilla.redhat.com/show_bug.cgi?id=860834
+---
+ grub-core/net/http.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/net/http.c b/grub-core/net/http.c
+index 4684f8b..ef9538c 100644
+--- a/grub-core/net/http.c
++++ b/grub-core/net/http.c
+@@ -393,7 +393,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
+ 
+   data->sock = grub_net_tcp_open (file->device->net->server,
+ 				  HTTP_PORT, http_receive,
+-				  http_err, http_err,
++				  http_err, NULL,
+ 				  file);
+   if (!data->sock)
+     {
+-- 
+1.9.3
+
diff --git a/SOURCES/0096-IBM-client-architecture-CAS-reboot-support.patch b/SOURCES/0096-IBM-client-architecture-CAS-reboot-support.patch
new file mode 100644
index 0000000..93bb525
--- /dev/null
+++ b/SOURCES/0096-IBM-client-architecture-CAS-reboot-support.patch
@@ -0,0 +1,174 @@
+From 9d1411ffa7290c1cbdc9ee95bb5fcc5506e63e0f Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Thu, 20 Sep 2012 18:07:39 -0300
+Subject: [PATCH 096/143] IBM client architecture (CAS) reboot support
+
+This is an implementation of IBM client architecture (CAS) reboot for GRUB.
+
+There are cases where the POWER firmware must reboot in order to support
+specific features requested by a kernel. The kernel calls
+ibm,client-architecture-support and it may either return or reboot with the new
+feature set. eg:
+
+Calling ibm,client-architecture-support.../
+Elapsed time since release of system processors: 70959 mins 50 secs
+Welcome to GRUB!
+
+Instead of return to the GRUB menu, it will check if the flag for CAS reboot is
+set. If so, grub will automatically boot the last booted kernel using the same
+parameters
+---
+ grub-core/kern/ieee1275/openfw.c | 62 ++++++++++++++++++++++++++++++++++++++++
+ grub-core/normal/main.c          | 19 ++++++++++++
+ grub-core/script/execute.c       |  7 +++++
+ include/grub/ieee1275/ieee1275.h |  2 ++
+ 4 files changed, 90 insertions(+)
+
+diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
+index ddb7783..6db8b98 100644
+--- a/grub-core/kern/ieee1275/openfw.c
++++ b/grub-core/kern/ieee1275/openfw.c
+@@ -561,3 +561,65 @@ grub_ieee1275_canonicalise_devname (const char *path)
+   return NULL;
+ }
+ 
++/* Check if it's a CAS reboot. If so, set the script to be executed.  */
++int
++grub_ieee1275_cas_reboot (char *script)
++{
++  grub_uint32_t ibm_ca_support_reboot;
++  grub_uint32_t ibm_fw_nbr_reboots;
++  char property_value[10];
++  grub_ssize_t actual;
++  grub_ieee1275_ihandle_t options;
++
++  if (grub_ieee1275_finddevice ("/options", &options) < 0)
++    return -1;
++
++  /* Check two properties, one is enough to get cas reboot value */
++  ibm_ca_support_reboot = 0;
++  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen,
++                                          "ibm,client-architecture-support-reboot",
++                                          &ibm_ca_support_reboot,
++                                          sizeof (ibm_ca_support_reboot),
++                                          &actual) >= 0)
++    grub_dprintf("ieee1275", "ibm,client-architecture-support-reboot: %u\n",
++                 ibm_ca_support_reboot);
++
++  ibm_fw_nbr_reboots = 0;
++  if (grub_ieee1275_get_property (options, "ibm,fw-nbr-reboots",
++                                  property_value, sizeof (property_value),
++                                  &actual) >= 0)
++    {
++      property_value[sizeof (property_value) - 1] = 0;
++      ibm_fw_nbr_reboots = (grub_uint8_t) grub_strtoul (property_value, 0, 10);
++      grub_dprintf("ieee1275", "ibm,fw-nbr-reboots: %u\n", ibm_fw_nbr_reboots);
++    }
++
++  if (ibm_ca_support_reboot || ibm_fw_nbr_reboots)
++    {
++      if (! grub_ieee1275_get_property_length (options, "boot-last-label", &actual))
++        {
++          if (actual > 1024)
++            script = grub_realloc (script, actual + 1);
++          grub_ieee1275_get_property (options, "boot-last-label", script, actual,
++                                      &actual);
++          return 0;
++        }
++    }
++
++  grub_ieee1275_set_boot_last_label ("");
++
++  return -1;
++}
++
++int grub_ieee1275_set_boot_last_label (const char *text)
++{
++  grub_ieee1275_ihandle_t options;
++  grub_ssize_t actual;
++
++  grub_dprintf("ieee1275", "set boot_last_label (size: %u)\n", grub_strlen(text));
++  if (! grub_ieee1275_finddevice ("/options", &options) &&
++      options != (grub_ieee1275_ihandle_t) -1)
++    grub_ieee1275_set_property (options, "boot-last-label", text,
++                                grub_strlen (text), &actual);
++  return 0;
++}
+diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
+index 6f4970f..f72844c 100644
+--- a/grub-core/normal/main.c
++++ b/grub-core/normal/main.c
+@@ -33,6 +33,9 @@
+ #include <grub/charset.h>
+ #include <grub/script_sh.h>
+ #include <grub/bufio.h>
++#ifdef GRUB_MACHINE_IEEE1275
++#include <grub/ieee1275/ieee1275.h>
++#endif
+ 
+ GRUB_MOD_LICENSE ("GPLv3+");
+ 
+@@ -275,6 +278,22 @@ grub_normal_execute (const char *config, int nested, int batch)
+     {
+       menu = read_config_file (config);
+ 
++#ifdef GRUB_MACHINE_IEEE1275
++      int boot;
++      boot = 0;
++      char *script;
++      script = grub_malloc (1024);
++      if (! grub_ieee1275_cas_reboot (script))
++        {
++          char *dummy[1] = { NULL };
++          if (! grub_script_execute_sourcecode (script, 0, dummy))
++            boot = 1;
++        }
++      grub_free (script);
++      if (boot)
++        grub_command_execute ("boot", 0, 0);
++#endif
++
+       /* Ignore any error.  */
+       grub_errno = GRUB_ERR_NONE;
+     }
+diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
+index 8f01c1b..cec9539 100644
+--- a/grub-core/script/execute.c
++++ b/grub-core/script/execute.c
+@@ -27,6 +27,9 @@
+ #include <grub/normal.h>
+ #include <grub/extcmd.h>
+ #include <grub/i18n.h>
++#ifdef GRUB_MACHINE_IEEE1275
++#include <grub/ieee1275/ieee1275.h>
++#endif
+ 
+ /* Max digits for a char is 3 (0xFF is 255), similarly for an int it
+    is sizeof (int) * 3, and one extra for a possible -ve sign.  */
+@@ -892,6 +895,10 @@ grub_script_execute_sourcecode (const char *source)
+   grub_err_t ret = 0;
+   struct grub_script *parsed_script;
+ 
++#ifdef GRUB_MACHINE_IEEE1275
++  grub_ieee1275_set_boot_last_label (source);
++#endif
++
+   while (source)
+     {
+       char *line;
+diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
+index 8e42513..9f26c69 100644
+--- a/include/grub/ieee1275/ieee1275.h
++++ b/include/grub/ieee1275/ieee1275.h
+@@ -234,6 +234,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali
+ void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias);
+ void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
+ 						struct grub_ieee1275_devalias *alias);
++int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char *script);
++int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text);
+ 
+ #define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));)
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0097-Add-vlan-tag-support.patch b/SOURCES/0097-Add-vlan-tag-support.patch
new file mode 100644
index 0000000..dad2d5d
--- /dev/null
+++ b/SOURCES/0097-Add-vlan-tag-support.patch
@@ -0,0 +1,186 @@
+From c987623113e2d03e80f0ba1e108bf0a800628f85 Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Tue, 30 Oct 2012 15:19:39 -0200
+Subject: [PATCH 097/143] Add vlan-tag support
+
+This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows
+multiple VLANs in a bridged network to share the same physical network link but
+maintain isolation:
+
+http://en.wikipedia.org/wiki/IEEE_802.1Q
+
+This patch should fix this bugzilla:
+https://bugzilla.redhat.com/show_bug.cgi?id=871563
+---
+ grub-core/kern/ieee1275/init.c   |  1 +
+ grub-core/kern/ieee1275/openfw.c | 30 ++++++++++++++++++++++++++++
+ grub-core/net/ethernet.c         | 42 +++++++++++++++++++++++++++++++++++++---
+ include/grub/ieee1275/ieee1275.h |  1 +
+ include/grub/net.h               |  2 ++
+ 5 files changed, 73 insertions(+), 3 deletions(-)
+
+diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
+index d5bd74d..8191f8c 100644
+--- a/grub-core/kern/ieee1275/init.c
++++ b/grub-core/kern/ieee1275/init.c
+@@ -117,6 +117,7 @@ grub_machine_get_bootlocation (char **device, char **path)
+       char *dev, *canon;
+       char *ptr;
+       dev = grub_ieee1275_get_aliasdevname (bootpath);
++      grub_ieee1275_parse_net_options (bootpath);
+       canon = grub_ieee1275_canonicalise_devname (dev);
+       ptr = canon + grub_strlen (canon) - 1;
+       while (ptr > canon && (*ptr == ',' || *ptr == ':'))
+diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
+index 6db8b98..81276fa 100644
+--- a/grub-core/kern/ieee1275/openfw.c
++++ b/grub-core/kern/ieee1275/openfw.c
+@@ -23,6 +23,7 @@
+ #include <grub/mm.h>
+ #include <grub/ieee1275/ieee1275.h>
+ #include <grub/net.h>
++#include <grub/env.h>
+ 
+ enum grub_ieee1275_parse_type
+ {
+@@ -451,6 +452,35 @@ fail:
+   return ret;
+ }
+ 
++int
++grub_ieee1275_parse_net_options (const char *path)
++{
++  char *comma;
++  char *args;
++  char *option = 0;
++
++  args = grub_ieee1275_get_devargs (path);
++  if (!args)
++    /* There is no option.  */
++    return -1;
++
++  do
++    {
++      comma = grub_strchr (args, ',');
++      if (! comma)
++        option = grub_strdup (args);
++      else
++        option = grub_strndup (args, (grub_size_t)(comma - args));
++      args = comma + 1;
++
++      if (! grub_strncmp(option, "vtag", 4))
++          grub_env_set ("vlan-tag", option + grub_strlen("vtag="));
++
++    } while (comma);
++
++  return 0;
++}
++
+ char *
+ grub_ieee1275_get_device_type (const char *path)
+ {
+diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c
+index c397b1b..faaca67 100644
+--- a/grub-core/net/ethernet.c
++++ b/grub-core/net/ethernet.c
+@@ -23,6 +23,7 @@
+ #include <grub/net/arp.h>
+ #include <grub/net/netbuff.h>
+ #include <grub/net.h>
++#include <grub/env.h>
+ #include <grub/time.h>
+ #include <grub/net/arp.h>
+ 
+@@ -56,10 +57,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
+ {
+   struct etherhdr *eth;
+   grub_err_t err;
++  grub_uint32_t vlantag = 0;
++  grub_uint8_t etherhdr_size;
+ 
+-  COMPILE_TIME_ASSERT (sizeof (*eth) < GRUB_NET_MAX_LINK_HEADER_SIZE);
++  etherhdr_size = sizeof (*eth);
++  COMPILE_TIME_ASSERT (sizeof (*eth) + 4 < GRUB_NET_MAX_LINK_HEADER_SIZE);
+ 
+-  err = grub_netbuff_push (nb, sizeof (*eth));
++  const char *vlantag_text = grub_env_get ("vlan-tag");
++  if (vlantag_text != 0) {
++      etherhdr_size += 4;
++      vlantag = grub_strtoul (vlantag_text, 0, 16);
++  }
++
++  err = grub_netbuff_push (nb, etherhdr_size);
+   if (err)
+     return err;
+   eth = (struct etherhdr *) nb->data;
+@@ -76,6 +86,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
+ 	return err;
+       inf->card->opened = 1;
+     }
++
++  /* Check if a vlan-tag is needed. */
++  if (vlantag != 0)
++    {
++      /* Move eth type to the right */
++      grub_memcpy((char *) nb->data + etherhdr_size - 2,
++                  (char *) nb->data + etherhdr_size - 6, 2);
++
++      /* Add the tag in the middle */
++      grub_memcpy((char *) nb->data + etherhdr_size - 6,
++                  &vlantag, 4);
++    }
++
+   return inf->card->driver->send (inf->card, nb);
+ }
+ 
+@@ -90,10 +113,23 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
+   grub_net_link_level_address_t hwaddress;
+   grub_net_link_level_address_t src_hwaddress;
+   grub_err_t err;
++  grub_uint8_t etherhdr_size = sizeof (*eth);
++
++  grub_uint16_t vlantag_identifier = 0;
++  grub_memcpy (&vlantag_identifier, nb->data + etherhdr_size - 2, 2);
++
++  /* Check if a vlan-tag is present. */
++  if (vlantag_identifier == VLANTAG_IDENTIFIER)
++    {
++      etherhdr_size += 4;
++      /* Move eth type to the original position */
++      grub_memcpy((char *) nb->data + etherhdr_size - 6,
++                  (char *) nb->data + etherhdr_size - 2, 2);
++    }
+ 
+   eth = (struct etherhdr *) nb->data;
+   type = grub_be_to_cpu16 (eth->type);
+-  err = grub_netbuff_pull (nb, sizeof (*eth));
++  err = grub_netbuff_pull (nb, etherhdr_size);
+   if (err)
+     return err;
+ 
+diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
+index 9f26c69..6a21f5d 100644
+--- a/include/grub/ieee1275/ieee1275.h
++++ b/include/grub/ieee1275/ieee1275.h
+@@ -236,6 +236,7 @@ void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
+ 						struct grub_ieee1275_devalias *alias);
+ int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char *script);
+ int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text);
++int EXPORT_FUNC(grub_ieee1275_parse_net_options) (const char *path);
+ 
+ #define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));)
+ 
+diff --git a/include/grub/net.h b/include/grub/net.h
+index 538baa3..a799e6b 100644
+--- a/include/grub/net.h
++++ b/include/grub/net.h
+@@ -538,4 +538,6 @@ extern char *grub_net_default_server;
+ #define GRUB_NET_INTERVAL 400
+ #define GRUB_NET_INTERVAL_ADDITION 20
+ 
++#define VLANTAG_IDENTIFIER 0x8100
++
+ #endif /* ! GRUB_NET_HEADER */
+-- 
+1.9.3
+
diff --git a/SOURCES/0098-Add-X-option-to-printf-functions.patch b/SOURCES/0098-Add-X-option-to-printf-functions.patch
new file mode 100644
index 0000000..8865950
--- /dev/null
+++ b/SOURCES/0098-Add-X-option-to-printf-functions.patch
@@ -0,0 +1,58 @@
+From d7aaf1651f4b36721f73331753d017d33d7879b4 Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Tue, 27 Nov 2012 16:58:39 -0200
+Subject: [PATCH 098/143] Add %X option to printf functions.
+
+---
+ grub-core/kern/misc.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
+index c5c815d..a56cfe7 100644
+--- a/grub-core/kern/misc.c
++++ b/grub-core/kern/misc.c
+@@ -762,7 +762,7 @@ __umoddi3 (grub_uint64_t a, grub_uint64_t b)
+ static inline char *
+ grub_lltoa (char *str, int c, unsigned long long n)
+ {
+-  unsigned base = (c == 'x') ? 16 : 10;
++  unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
+   char *p;
+ 
+   if ((long long) n < 0 && c == 'd')
+@@ -777,7 +777,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
+     do
+       {
+ 	unsigned d = (unsigned) (n & 0xf);
+-	*p++ = (d > 9) ? d + 'a' - 10 : d + '0';
++	*p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
+       }
+     while (n >>= 4);
+   else
+@@ -850,6 +850,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
+ 	{
+ 	case 'p':
+ 	case 'x':
++	case 'X':
+ 	case 'u':
+ 	case 'd':
+ 	case 'c':
+@@ -930,6 +931,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
+       switch (c)
+ 	{
+ 	case 'x':
++	case 'X':
+ 	case 'u':
+ 	  args->ptr[curn].type = UNSIGNED_INT + longfmt;
+ 	  break;
+@@ -1067,6 +1069,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
+ 	  c = 'x';
+ 	  /* Fall through. */
+ 	case 'x':
++	case 'X':
+ 	case 'u':
+ 	case 'd':
+ 	  {
+-- 
+1.9.3
+
diff --git a/SOURCES/0099-DHCP-client-ID-and-UUID-options-added.patch b/SOURCES/0099-DHCP-client-ID-and-UUID-options-added.patch
new file mode 100644
index 0000000..1699024
--- /dev/null
+++ b/SOURCES/0099-DHCP-client-ID-and-UUID-options-added.patch
@@ -0,0 +1,145 @@
+From 2f3846a557e4ddf83f44e166d959ee460bedf8e1 Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Tue, 27 Nov 2012 17:18:53 -0200
+Subject: [PATCH 099/143] DHCP client ID and UUID options added.
+
+---
+ grub-core/net/bootp.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++-----
+ include/grub/net.h    |  2 ++
+ 2 files changed, 81 insertions(+), 8 deletions(-)
+
+diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
+index 6310ed4..88f2056 100644
+--- a/grub-core/net/bootp.c
++++ b/grub-core/net/bootp.c
+@@ -25,6 +25,49 @@
+ #include <grub/net/udp.h>
+ #include <grub/datetime.h>
+ 
++static char *
++grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)),
++			 const char *val __attribute__ ((unused)))
++{
++  return NULL;
++}
++
++static void
++set_env_limn_ro (const char *intername, const char *suffix,
++		 const char *value, grub_size_t len)
++{
++  char *varname, *varvalue;
++  char *ptr;
++  varname = grub_xasprintf ("net_%s_%s", intername, suffix);
++  if (!varname)
++    return;
++  for (ptr = varname; *ptr; ptr++)
++    if (*ptr == ':')
++      *ptr = '_';
++  varvalue = grub_malloc (len + 1);
++  if (!varvalue)
++    {
++      grub_free (varname);
++      return;
++    }
++
++  grub_memcpy (varvalue, value, len);
++  varvalue[len] = 0;
++  grub_env_set (varname, varvalue);
++  grub_register_variable_hook (varname, 0, grub_env_write_readonly);
++  grub_env_export (varname);
++  grub_free (varname);
++  grub_free (varvalue);
++}
++
++static char
++hexdigit (grub_uint8_t val)
++{
++  if (val < 10)
++    return val + '0';
++  return val + 'a' - 10;
++}
++
+ static void
+ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
+ {
+@@ -55,6 +98,9 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
+ 
+       taglength = *ptr++;
+ 
++      grub_dprintf("net", "DHCP option %u (0x%02x) found with length %u.\n",
++                   tagtype, tagtype, taglength);
++
+       switch (tagtype)
+ 	{
+ 	case GRUB_NET_BOOTP_NETMASK:
+@@ -120,6 +166,39 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
+                                      taglength);
+           break;
+ 
++        case GRUB_NET_BOOTP_CLIENT_ID:
++	  set_env_limn_ro (name, "clientid", (char *) ptr, taglength);
++          break;
++
++        case GRUB_NET_BOOTP_CLIENT_UUID:
++            {
++              if (taglength != 17)
++                break;
++
++              /* The format is 9cfe245e-d0c8-bd45-a79f-54ea5fbd3d97 */
++
++              ptr += 1;
++              taglength -= 1;
++
++              char *val = grub_malloc (2 * taglength + 4 + 1);
++              int i = 0;
++              int j = 0;
++              for (i = 0; i < taglength; i++)
++                {
++                  val[2 * i + j] = hexdigit (ptr[i] >> 4);
++                  val[2 * i + 1 + j] = hexdigit (ptr[i] & 0xf);
++
++                  if ((i == 3) || (i == 5) || (i == 7) || (i == 9))
++                    {
++                      j++;
++                      val[2 * i + 1+ j] = '-';
++                    }
++                }
++
++              set_env_limn_ro (name, "clientuuid", (char *) val, 2 * taglength + 4);
++            }
++          break;
++
+ 	  /* If you need any other options please contact GRUB
+ 	     development team.  */
+ 	}
+@@ -288,14 +367,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
+     }
+ }
+ 
+-static char
+-hexdigit (grub_uint8_t val)
+-{
+-  if (val < 10)
+-    return val + '0';
+-  return val + 'a' - 10;
+-}
+-
+ static grub_err_t
+ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
+ 		  int argc, char **args)
+diff --git a/include/grub/net.h b/include/grub/net.h
+index a799e6b..59e5975 100644
+--- a/include/grub/net.h
++++ b/include/grub/net.h
+@@ -433,6 +433,8 @@ enum
+     GRUB_NET_BOOTP_DOMAIN = 0x0f,
+     GRUB_NET_BOOTP_ROOT_PATH = 0x11,
+     GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12,
++    GRUB_NET_BOOTP_CLIENT_ID = 0x3d,
++    GRUB_NET_BOOTP_CLIENT_UUID = 0x61,
+     GRUB_NET_BOOTP_END = 0xff
+   };
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0100-Search-for-specific-config-file-for-netboot.patch b/SOURCES/0100-Search-for-specific-config-file-for-netboot.patch
new file mode 100644
index 0000000..2616383
--- /dev/null
+++ b/SOURCES/0100-Search-for-specific-config-file-for-netboot.patch
@@ -0,0 +1,203 @@
+From bf19a1e123fd09552165bd0d2b19ccf438c0a46c Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Tue, 27 Nov 2012 17:22:07 -0200
+Subject: [PATCH 100/143] Search for specific config file for netboot
+
+This patch implements a search for a specific configuration when the config
+file is on a remoteserver. It uses the following order:
+   1) DHCP client UUID option.
+   2) MAC address (in lower case hexadecimal with dash separators);
+   3) IP (in upper case hexadecimal) or IPv6;
+   4) The original grub.cfg file.
+
+This procedure is similar to what is used by pxelinux and yaboot:
+http://www.syslinux.org/wiki/index.php/PXELINUX#config
+
+This should close the bugzilla:
+https://bugzilla.redhat.com/show_bug.cgi?id=873406
+---
+ grub-core/net/net.c     | 118 ++++++++++++++++++++++++++++++++++++++++++++++++
+ grub-core/normal/main.c |  18 ++++++--
+ include/grub/net.h      |   3 ++
+ 3 files changed, 135 insertions(+), 4 deletions(-)
+
+diff --git a/grub-core/net/net.c b/grub-core/net/net.c
+index f2e723b..578e057 100644
+--- a/grub-core/net/net.c
++++ b/grub-core/net/net.c
+@@ -1702,6 +1702,124 @@ grub_net_restore_hw (void)
+   return GRUB_ERR_NONE;
+ }
+ 
++grub_err_t
++grub_net_search_configfile (char *config)
++{
++  grub_size_t config_len;
++  char *suffix;
++
++  auto int search_through (grub_size_t num_tries, grub_size_t slice_size);
++  int search_through (grub_size_t num_tries, grub_size_t slice_size)
++    {
++      while (num_tries-- > 0)
++        {
++	  grub_dprintf ("net", "probe %s\n", config);
++
++          grub_file_t file;
++          file = grub_file_open (config);
++
++          if (file)
++            {
++              grub_file_close (file);
++              grub_dprintf ("net", "found!\n");
++              return 0;
++            }
++          else
++            {
++              if (grub_errno == GRUB_ERR_IO)
++                grub_errno = GRUB_ERR_NONE;
++            }
++
++          if (grub_strlen (suffix) < slice_size)
++            break;
++
++          config[grub_strlen (config) - slice_size] = '\0';
++        }
++
++      return 1;
++    }
++
++  config_len = grub_strlen (config);
++  config[config_len] = '-';
++  suffix = config + config_len + 1;
++
++  struct grub_net_network_level_interface *inf;
++  FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
++    {
++      /* By the Client UUID. */
++
++      char client_uuid_var[sizeof ("net_") + grub_strlen (inf->name) +
++                           sizeof ("_clientuuid") + 1];
++      grub_snprintf (client_uuid_var, sizeof (client_uuid_var),
++                     "net_%s_clientuuid", inf->name);
++
++      const char *client_uuid;
++      client_uuid = grub_env_get (client_uuid_var);
++
++      if (client_uuid)
++        {
++          grub_strcpy (suffix, client_uuid);
++          if (search_through (1, 0) == 0) return GRUB_ERR_NONE;
++        }
++
++      /* By the MAC address. */
++
++      /* Add ethernet type */
++      grub_strcpy (suffix, "01-");
++
++      grub_net_hwaddr_to_str (&inf->hwaddress, suffix + 3);
++
++      char *ptr;
++      for (ptr = suffix; *ptr; ptr++)
++        if (*ptr == ':')
++          *ptr = '-';
++
++      if (search_through (1, 0) == 0) return GRUB_ERR_NONE;
++
++      /* By IP address */
++
++      switch ((&inf->address)->type)
++        {
++        case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4:
++            {
++              grub_uint32_t n = grub_be_to_cpu32 ((&inf->address)->ipv4);
++              grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%02X%02X%02X%02X", \
++                             ((n >> 24) & 0xff), ((n >> 16) & 0xff), \
++                             ((n >> 8) & 0xff), ((n >> 0) & 0xff));
++
++              if (search_through (8, 1) == 0) return GRUB_ERR_NONE;
++              break;
++            }
++        case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6:
++            {
++              char buf[GRUB_NET_MAX_STR_ADDR_LEN];
++              struct grub_net_network_level_address base;
++              base.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
++              grub_memcpy (&base.ipv6, ((&inf->address)->ipv6), 16);
++              grub_net_addr_to_str (&base, buf);
++
++              for (ptr = buf; *ptr; ptr++)
++                if (*ptr == ':')
++                  *ptr = '-';
++
++              grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%s", buf);
++              if (search_through (1, 0) == 0) return GRUB_ERR_NONE;
++              break;
++            }
++        case GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV:
++          return grub_error (GRUB_ERR_BUG, "shouldn't reach here");
++        default:
++          return grub_error (GRUB_ERR_BUG,
++                             "unsupported address type %d", (&inf->address)->type);
++        }
++    }
++
++  /* Remove the remaining minus sign at the end. */
++  config[config_len] = '\0';
++
++  return GRUB_ERR_NONE;
++}
++
+ static struct grub_preboot *fini_hnd;
+ 
+ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
+diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
+index f72844c..85d2a28 100644
+--- a/grub-core/normal/main.c
++++ b/grub-core/normal/main.c
+@@ -33,6 +33,7 @@
+ #include <grub/charset.h>
+ #include <grub/script_sh.h>
+ #include <grub/bufio.h>
++#include <grub/net.h>
+ #ifdef GRUB_MACHINE_IEEE1275
+ #include <grub/ieee1275/ieee1275.h>
+ #endif
+@@ -365,10 +366,19 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
+ 
+       prefix = grub_env_get ("prefix");
+       if (prefix)
+-	{
+-	  config = grub_xasprintf ("%s/grub.cfg", prefix);
+-	  if (! config)
+-	    goto quit;
++        {
++          grub_size_t config_len;
++          config_len = grub_strlen (prefix) +
++                      sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
++          config = grub_malloc (config_len);
++
++          if (! config)
++            goto quit;
++
++          grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
++
++          if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
++            grub_net_search_configfile (config);
+ 
+ 	  grub_enter_normal_mode (config);
+ 	  grub_free (config);
+diff --git a/include/grub/net.h b/include/grub/net.h
+index 59e5975..88fc71c 100644
+--- a/include/grub/net.h
++++ b/include/grub/net.h
+@@ -542,4 +542,7 @@ extern char *grub_net_default_server;
+ 
+ #define VLANTAG_IDENTIFIER 0x8100
+ 
++grub_err_t
++grub_net_search_configfile (char *config);
++
+ #endif /* ! GRUB_NET_HEADER */
+-- 
+1.9.3
+
diff --git a/SOURCES/0101-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/SOURCES/0101-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch
new file mode 100644
index 0000000..b7dc5dc
--- /dev/null
+++ b/SOURCES/0101-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch
@@ -0,0 +1,251 @@
+From ddfb160353df14e9f88affe7498512a553146872 Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <grub2-owner@fedoraproject.org>
+Date: Tue, 22 Jan 2013 06:31:38 +0100
+Subject: [PATCH 101/143] blscfg: add blscfg module to parse Boot Loader
+ Specification snippets
+
+http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
+
+Works like this:
+
+ insmod blscfg
+ bls_import
+
+Done! You should now have menu items for your snippets in place.
+
+Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
+---
+ grub-core/Makefile.core.def |   8 ++
+ grub-core/commands/blscfg.c | 201 ++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 209 insertions(+)
+ create mode 100644 grub-core/commands/blscfg.c
+
+diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
+index ec46506..7bf1c8a 100644
+--- a/grub-core/Makefile.core.def
++++ b/grub-core/Makefile.core.def
+@@ -747,6 +747,14 @@ module = {
+ };
+ 
+ module = {
++  name = blscfg;
++  common = commands/blscfg.c;
++  enable = i386_efi;
++  enable = x86_64_efi;
++  enable = i386_pc;
++};
++
++module = {
+   name = boot;
+   common = commands/boot.c;
+   i386_pc = lib/i386/pc/biosnum.c;
+diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
+new file mode 100644
+index 0000000..4274aca
+--- /dev/null
++++ b/grub-core/commands/blscfg.c
+@@ -0,0 +1,201 @@
++/*-*- Mode: C; c-basic-offset: 2; indent-tabs-mode: t -*-*/
++
++/* bls.c - implementation of the boot loader spec */
++
++/*
++ *  GRUB  --  GRand Unified Bootloader
++ *
++ *  GRUB is free software: you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation, either version 3 of the License, or
++ *  (at your option) any later version.
++ *
++ *  GRUB is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include <grub/types.h>
++#include <grub/misc.h>
++#include <grub/mm.h>
++#include <grub/err.h>
++#include <grub/dl.h>
++#include <grub/extcmd.h>
++#include <grub/i18n.h>
++#include <grub/fs.h>
++#include <grub/env.h>
++#include <grub/file.h>
++#include <grub/normal.h>
++
++GRUB_MOD_LICENSE ("GPLv3+");
++
++#ifdef GRUB_MACHINE_EFI
++#define GRUB_LINUX_CMD "linuxefi"
++#define GRUB_INITRD_CMD "initrdefi"
++#define GRUB_BLS_CONFIG_PATH "/EFI/fedora/loader/entries/"
++#define GRUB_BOOT_DEVICE "($boot)"
++#else
++#define GRUB_LINUX_CMD "linux"
++#define GRUB_INITRD_CMD "initrd"
++#define GRUB_BLS_CONFIG_PATH "/loader/entries/"
++#define GRUB_BOOT_DEVICE "($root)"
++#endif
++
++static int parse_entry (
++    const char *filename,
++    const struct grub_dirhook_info *info __attribute__ ((unused)),
++    void *data __attribute__ ((unused)))
++{
++  grub_size_t n;
++  char *p;
++  grub_file_t f = NULL;
++  grub_off_t sz;
++  char *title = NULL, *options = NULL, *clinux = NULL, *initrd = NULL, *src = NULL;
++  const char *args[2] = { NULL, NULL };
++
++  if (filename[0] == '.')
++    return 0;
++
++  n = grub_strlen (filename);
++  if (n <= 5)
++    return 0;
++
++  if (grub_strcmp (filename + n - 5, ".conf") != 0)
++    return 0;
++
++  p = grub_xasprintf (GRUB_BLS_CONFIG_PATH "%s", filename);
++
++  f = grub_file_open (p);
++  if (!f)
++    goto finish;
++
++  sz = grub_file_size (f);
++  if (sz == GRUB_FILE_SIZE_UNKNOWN || sz > 1024*1024)
++    goto finish;
++
++  for (;;)
++    {
++      char *buf;
++
++      buf = grub_file_getline (f);
++      if (!buf)
++	break;
++
++      if (grub_strncmp (buf, "title ", 6) == 0)
++	{
++	  grub_free (title);
++	  title = grub_strdup (buf + 6);
++	  if (!title)
++	    goto finish;
++	}
++      else if (grub_strncmp (buf, "options ", 8) == 0)
++	{
++	  grub_free (options);
++	  options = grub_strdup (buf + 8);
++	  if (!options)
++	    goto finish;
++	}
++      else if (grub_strncmp (buf, "linux ", 6) == 0)
++	{
++	  grub_free (clinux);
++	  clinux = grub_strdup (buf + 6);
++	  if (!clinux)
++	    goto finish;
++	}
++      else if (grub_strncmp (buf, "initrd ", 7) == 0)
++	{
++	  grub_free (initrd);
++	  initrd = grub_strdup (buf + 7);
++	  if (!initrd)
++	    goto finish;
++	}
++
++      grub_free(buf);
++    }
++
++  if (!linux)
++    {
++      grub_printf ("Skipping file %s with no 'linux' key.", p);
++      goto finish;
++    }
++
++  args[0] = title ? title : filename;
++
++  src = grub_xasprintf ("load_video\n"
++			"set gfx_payload=keep\n"
++			"insmod gzio\n"
++			GRUB_LINUX_CMD " %s%s%s%s\n"
++			"%s%s%s%s",
++			GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "",
++			initrd ? GRUB_INITRD_CMD " " : "", initrd ? GRUB_BOOT_DEVICE : "", initrd ? initrd : "", initrd ? "\n" : "");
++
++  grub_normal_add_menu_entry (1, args, NULL, NULL, "bls", NULL, NULL, src, 0);
++
++finish:
++  grub_free (p);
++  grub_free (title);
++  grub_free (options);
++  grub_free (clinux);
++  grub_free (initrd);
++  grub_free (src);
++
++  if (f)
++    grub_file_close (f);
++
++  return 0;
++}
++
++static grub_err_t
++grub_cmd_bls_import (grub_extcmd_context_t ctxt __attribute__ ((unused)),
++		     int argc __attribute__ ((unused)),
++		     char **args __attribute__ ((unused)))
++{
++  grub_fs_t fs;
++  grub_device_t dev;
++  static grub_err_t r;
++  const char *devid;
++
++  devid = grub_env_get ("root");
++  if (!devid)
++    return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "root");
++
++  dev = grub_device_open (devid);
++  if (!dev)
++    return grub_errno;
++
++  fs = grub_fs_probe (dev);
++  if (!fs)
++    {
++      r = grub_errno;
++      goto finish;
++    }
++
++  r = fs->dir (dev, GRUB_BLS_CONFIG_PATH, parse_entry, NULL);
++
++finish:
++  if (dev)
++    grub_device_close (dev);
++
++  return r;
++}
++
++static grub_extcmd_t cmd;
++
++GRUB_MOD_INIT(bls)
++{
++  cmd = grub_register_extcmd ("bls_import",
++			      grub_cmd_bls_import,
++			      0,
++			      NULL,
++			      N_("Import Boot Loader Specification snippets."),
++			      NULL);
++}
++
++GRUB_MOD_FINI(bls)
++{
++  grub_unregister_extcmd (cmd);
++}
+-- 
+1.9.3
+
diff --git a/SOURCES/0102-Move-bash-completion-script-922997.patch b/SOURCES/0102-Move-bash-completion-script-922997.patch
new file mode 100644
index 0000000..97d882b
--- /dev/null
+++ b/SOURCES/0102-Move-bash-completion-script-922997.patch
@@ -0,0 +1,26 @@
+From f60046d87e55646d36c21520c5f6391c184ec8ad Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Wed, 3 Apr 2013 14:35:34 -0400
+Subject: [PATCH 102/143] Move bash completion script (#922997)
+
+Apparently these go in a new place now.
+---
+ util/bash-completion.d/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/util/bash-completion.d/Makefile.am b/util/bash-completion.d/Makefile.am
+index 136287c..0bcdb06 100644
+--- a/util/bash-completion.d/Makefile.am
++++ b/util/bash-completion.d/Makefile.am
+@@ -6,7 +6,7 @@ EXTRA_DIST = $(bash_completion_source)
+ 
+ CLEANFILES = $(bash_completion_script) config.log
+ 
+-bashcompletiondir = $(sysconfdir)/bash_completion.d
++bashcompletiondir = $(datarootdir)/bash-completion/completions
+ bashcompletion_DATA = $(bash_completion_script)
+ 
+ $(bash_completion_script): $(bash_completion_source) $(top_builddir)/config.status
+-- 
+1.9.3
+
diff --git a/SOURCES/0103-for-ppc-reset-console-display-attr-when-clear-screen.patch b/SOURCES/0103-for-ppc-reset-console-display-attr-when-clear-screen.patch
new file mode 100644
index 0000000..0bbfabc
--- /dev/null
+++ b/SOURCES/0103-for-ppc-reset-console-display-attr-when-clear-screen.patch
@@ -0,0 +1,27 @@
+From e52a5b66e765740deea4dbd201ab802c408184b9 Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Wed, 24 Apr 2013 10:51:48 -0300
+Subject: [PATCH 103/143] for ppc, reset console display attr when clear screen
+
+This should fix this bugzilla:
+https://bugzilla.redhat.com/show_bug.cgi?id=908519
+---
+ grub-core/term/terminfo.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
+index f0d3e3d..7cb7909 100644
+--- a/grub-core/term/terminfo.c
++++ b/grub-core/term/terminfo.c
+@@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term,
+       /* Clear the screen.  Using serial console, screen(1) only recognizes the
+        * ANSI escape sequence.  Using video console, Apple Open Firmware
+        * (version 3.1.1) only recognizes the literal ^L.  So use both.  */
+-      data->cls               = grub_strdup ("\e[2J");
++      data->cls               = grub_strdup ("\e[2J\e[m");
+       data->reverse_video_on  = grub_strdup ("\e[7m");
+       data->reverse_video_off = grub_strdup ("\e[m");
+       if (grub_strcmp ("ieee1275", str) == 0)
+-- 
+1.9.3
+
diff --git a/SOURCES/0104-Don-t-write-messages-to-the-screen.patch b/SOURCES/0104-Don-t-write-messages-to-the-screen.patch
new file mode 100644
index 0000000..c3bb21c
--- /dev/null
+++ b/SOURCES/0104-Don-t-write-messages-to-the-screen.patch
@@ -0,0 +1,158 @@
+From 0ee337319fc8c21da04bca1cabb51b3445dba3fd Mon Sep 17 00:00:00 2001
+From: William Jon McCann <william.jon.mccann@gmail.com>
+Date: Wed, 15 May 2013 13:30:20 -0400
+Subject: [PATCH 104/143] Don't write messages to the screen
+
+Writing messages to the screen before the menus or boot splash
+happens so quickly it looks like something is wrong and isn't
+very appealing.
+---
+ grub-core/boot/i386/pc/boot.S     |  3 ---
+ grub-core/boot/i386/pc/diskboot.S |  5 -----
+ grub-core/gettext/gettext.c       | 15 ---------------
+ grub-core/kern/main.c             |  5 -----
+ util/grub.d/10_linux.in           |  7 -------
+ 5 files changed, 35 deletions(-)
+
+diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S
+index b4975e2..432a472 100644
+--- a/grub-core/boot/i386/pc/boot.S
++++ b/grub-core/boot/i386/pc/boot.S
+@@ -249,9 +249,6 @@ real_start:
+ 	/* save drive reference first thing! */
+ 	pushw	%dx
+ 
+-	/* print a notification message on the screen */
+-	MSG(notification_string)
+-
+ 	/* set %si to the disk address packet */
+ 	movw	$disk_address_packet, %si
+ 
+diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S
+index d030a14..a494d02 100644
+--- a/grub-core/boot/i386/pc/diskboot.S
++++ b/grub-core/boot/i386/pc/diskboot.S
+@@ -50,11 +50,6 @@ _start:
+ 	/* save drive reference first thing! */
+ 	pushw	%dx
+ 
+-	/* print a notification message on the screen */
+-	pushw	%si
+-	MSG(notification_string)
+-	popw	%si
+-
+ 	/* this sets up for the first run through "bootloop" */
+ 	movw	$LOCAL(firstlist), %di
+ 
+diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c
+index 4880cef..1e5c21d 100644
+--- a/grub-core/gettext/gettext.c
++++ b/grub-core/gettext/gettext.c
+@@ -437,13 +437,9 @@ grub_gettext_env_write_lang (struct grub_env_var *var
+   grub_err_t err;
+   err = grub_gettext_init_ext (&main_context, val, grub_env_get ("locale_dir"),
+ 			       grub_env_get ("prefix"));
+-  if (err)
+-    grub_print_error ();
+ 
+   err = grub_gettext_init_ext (&secondary_context, val,
+ 			       grub_env_get ("secondary_locale_dir"), 0);
+-  if (err)
+-    grub_print_error ();
+ 
+   return grub_strdup (val);
+ }
+@@ -455,8 +451,6 @@ grub_gettext_reread_prefix (const char *val)
+   err = grub_gettext_init_ext (&main_context, grub_env_get ("lang"), 
+ 			       grub_env_get ("locale_dir"),
+ 			       val);
+-  if (err)
+-    grub_print_error ();
+ }
+ 
+ static char *
+@@ -466,8 +460,6 @@ read_main (struct grub_env_var *var
+   grub_err_t err;
+   err = grub_gettext_init_ext (&main_context, grub_env_get ("lang"), val,
+ 			       grub_env_get ("prefix"));
+-  if (err)
+-    grub_print_error ();
+   return grub_strdup (val);
+ }
+ 
+@@ -478,9 +470,6 @@ read_secondary (struct grub_env_var *var
+   grub_err_t err;
+   err = grub_gettext_init_ext (&secondary_context, grub_env_get ("lang"), val,
+ 			       0);
+-  if (err)
+-    grub_print_error ();
+-
+   return grub_strdup (val);
+ }
+ 
+@@ -506,12 +495,8 @@ GRUB_MOD_INIT (gettext)
+ 
+   err = grub_gettext_init_ext (&main_context, lang, grub_env_get ("locale_dir"),
+ 			       grub_env_get ("prefix"));
+-  if (err)
+-    grub_print_error ();
+   err = grub_gettext_init_ext (&secondary_context, lang,
+ 			       grub_env_get ("secondary_locale_dir"), 0);
+-  if (err)
+-    grub_print_error ();
+ 
+   grub_register_variable_hook ("locale_dir", NULL, read_main);
+   grub_register_variable_hook ("secondary_locale_dir", NULL, read_secondary);
+diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
+index 8ab7794..da47b18 100644
+--- a/grub-core/kern/main.c
++++ b/grub-core/kern/main.c
+@@ -268,11 +268,6 @@ grub_main (void)
+ 
+   grub_boot_time ("After machine init.");
+ 
+-  /* Hello.  */
+-  grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
+-  grub_printf ("Welcome to GRUB!\n\n");
+-  grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
+-
+   grub_load_config ();
+ 
+   grub_boot_time ("Before loading embedded modules.");
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index ad34cc0..e762e1f 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -126,29 +126,22 @@ linux_entry ()
+     fi
+     printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
+   fi
+-  message="$(gettext_printf "Loading Linux %s ..." ${version})"
+   if [ -d /sys/firmware/efi ]; then
+     sed "s/^/$submenu_indentation/" << EOF
+-	echo	'$(echo "$message" | grub_quote)'
+ 	linuxefi ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
+ EOF
+   else
+     sed "s/^/$submenu_indentation/" << EOF
+-	echo	'$(echo "$message" | grub_quote)'
+ 	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
+ EOF
+   fi
+   if test -n "${initrd}" ; then
+-    # TRANSLATORS: ramdisk isn't identifier. Should be translated.
+-    message="$(gettext_printf "Loading initial ramdisk ...")"
+     if [ -d /sys/firmware/efi ]; then
+       sed "s/^/$submenu_indentation/" << EOF
+-	echo	'$(echo "$message" | grub_quote)'
+ 	initrdefi ${rel_dirname}/${initrd}
+ EOF
+     else
+       sed "s/^/$submenu_indentation/" << EOF
+-	echo	'$message'
+ 	initrd	${rel_dirname}/${initrd}
+ EOF
+     fi
+-- 
+1.9.3
+
diff --git a/SOURCES/0105-Don-t-print-GNU-GRUB-header.patch b/SOURCES/0105-Don-t-print-GNU-GRUB-header.patch
new file mode 100644
index 0000000..5ae2b7e
--- /dev/null
+++ b/SOURCES/0105-Don-t-print-GNU-GRUB-header.patch
@@ -0,0 +1,33 @@
+From e3cabcd95237fadbad8e6a0e36222d97d16b5365 Mon Sep 17 00:00:00 2001
+From: William Jon McCann <william.jon.mccann@gmail.com>
+Date: Wed, 15 May 2013 13:53:48 -0400
+Subject: [PATCH 105/143] Don't print GNU GRUB header
+
+No one cares.
+---
+ grub-core/normal/main.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
+index 85d2a28..3777cd2 100644
+--- a/grub-core/normal/main.c
++++ b/grub-core/normal/main.c
+@@ -212,6 +212,7 @@ grub_normal_init_page (struct grub_term_output *term,
+  
+   grub_term_cls (term);
+ 
++#if 0
+   msg_formatted = grub_xasprintf (_("GNU GRUB  version %s"), PACKAGE_VERSION);
+   if (!msg_formatted)
+     return;
+@@ -235,6 +236,7 @@ grub_normal_init_page (struct grub_term_output *term,
+   grub_putcode ('\n', term);
+   grub_putcode ('\n', term);
+   grub_free (unicode_msg);
++#endif
+ }
+ 
+ static void
+-- 
+1.9.3
+
diff --git a/SOURCES/0106-Don-t-add-to-highlighted-row.patch b/SOURCES/0106-Don-t-add-to-highlighted-row.patch
new file mode 100644
index 0000000..e1bcb39
--- /dev/null
+++ b/SOURCES/0106-Don-t-add-to-highlighted-row.patch
@@ -0,0 +1,26 @@
+From c89f05d148a1a1416513d22f62d23504b35dd230 Mon Sep 17 00:00:00 2001
+From: William Jon McCann <william.jon.mccann@gmail.com>
+Date: Wed, 15 May 2013 17:49:45 -0400
+Subject: [PATCH 106/143] Don't add '*' to highlighted row
+
+It is already highlighted.
+---
+ grub-core/normal/menu_text.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
+index 2ff2941..2f84fcc 100644
+--- a/grub-core/normal/menu_text.c
++++ b/grub-core/normal/menu_text.c
+@@ -242,7 +242,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
+       unicode_title[i] = ' ';
+ 
+   if (data->geo.num_entries > 1)
+-    grub_putcode (highlight ? '*' : ' ', data->term);
++    grub_putcode (' ', data->term);
+ 
+   grub_print_ucs4_menu (unicode_title,
+ 			unicode_title + len,
+-- 
+1.9.3
+
diff --git a/SOURCES/0107-Message-string-cleanups.patch b/SOURCES/0107-Message-string-cleanups.patch
new file mode 100644
index 0000000..2c71592
--- /dev/null
+++ b/SOURCES/0107-Message-string-cleanups.patch
@@ -0,0 +1,71 @@
+From 6c33a9b3a96a5e8c782a8eef97f5d95a3a542921 Mon Sep 17 00:00:00 2001
+From: William Jon McCann <william.jon.mccann@gmail.com>
+Date: Fri, 7 Jun 2013 11:09:04 -0400
+Subject: [PATCH 107/143] Message string cleanups
+
+Make use of terminology consistent. Remove jargon.
+---
+ grub-core/normal/menu_text.c | 21 +++++++++------------
+ 1 file changed, 9 insertions(+), 12 deletions(-)
+
+diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
+index 2f84fcc..9d20c6b 100644
+--- a/grub-core/normal/menu_text.c
++++ b/grub-core/normal/menu_text.c
+@@ -157,9 +157,8 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
+ 
+   if (edit)
+     {
+-      ret += grub_print_message_indented_real (_("Minimum Emacs-like screen editing is \
+-supported. TAB lists completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a \
+-command-line or ESC to discard edits and return to the GRUB menu."),
++      ret += grub_print_message_indented_real (_("Press Ctrl-x or F10 to start, Ctrl-c or F2 for a \
++command prompt or Escape to discard edits and return to the menu. Pressing Tab lists possible completions."),
+ 					       STANDARD_MARGIN, STANDARD_MARGIN,
+ 					       term, dry_run);
+     }
+@@ -167,8 +166,8 @@ command-line or ESC to discard edits and return to the GRUB menu."),
+     {
+       char *msg_translated;
+ 
+-      msg_translated = grub_xasprintf (_("Use the %C and %C keys to select which "
+-					 "entry is highlighted."),
++      msg_translated = grub_xasprintf (_("Use the %C and %C keys to change the "
++					 "selection."),
+ 				       GRUB_UNICODE_UPARROW,
+ 				       GRUB_UNICODE_DOWNARROW);
+       if (!msg_translated)
+@@ -181,17 +180,15 @@ command-line or ESC to discard edits and return to the GRUB menu."),
+       if (nested)
+ 	{
+ 	  ret += grub_print_message_indented_real
+-	    (_("Press enter to boot the selected OS, "
+-	       "`e' to edit the commands before booting "
+-	       "or `c' for a command-line. ESC to return previous menu."),
++	    (_("Press 'e' to edit the selected item, "
++	       "or 'c' for a command prompt. Press Escape to return to the previous menu."),
+ 	     STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
+ 	}
+       else
+ 	{
+ 	  ret += grub_print_message_indented_real
+-	    (_("Press enter to boot the selected OS, "
+-	       "`e' to edit the commands before booting "
+-	       "or `c' for a command-line."),
++	    (_("Press 'e' to edit the selected item, "
++	       "or 'c' for a command prompt."),
+ 	     STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
+ 	}	
+     }
+@@ -440,7 +437,7 @@ menu_text_print_timeout (int timeout, void *dataptr)
+       || data->timeout_msg == TIMEOUT_TERSE_NO_MARGIN)
+     msg_translated = grub_xasprintf (_("%ds"), timeout);
+   else
+-    msg_translated = grub_xasprintf (_("The highlighted entry will be executed automatically in %ds."), timeout);
++    msg_translated = grub_xasprintf (_("The selected entry will be started automatically in %ds."), timeout);
+   if (!msg_translated)
+     {
+       grub_print_error ();
+-- 
+1.9.3
+
diff --git a/SOURCES/0108-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch b/SOURCES/0108-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch
new file mode 100644
index 0000000..7d1da28
--- /dev/null
+++ b/SOURCES/0108-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch
@@ -0,0 +1,32 @@
+From 6227514ebbfcf1744060eb4bf1b39b669221809d Mon Sep 17 00:00:00 2001
+From: William Jon McCann <william.jon.mccann@gmail.com>
+Date: Fri, 7 Jun 2013 14:08:23 -0400
+Subject: [PATCH 108/143] Fix border spacing now that we aren't displaying it
+
+---
+ grub-core/normal/menu_text.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
+index 9d20c6b..aa3454f 100644
+--- a/grub-core/normal/menu_text.c
++++ b/grub-core/normal/menu_text.c
+@@ -331,12 +331,12 @@ grub_menu_init_page (int nested, int edit,
+   int empty_lines = 1;
+   int version_msg = 1;
+ 
+-  geo->border = 1;
+-  geo->first_entry_x = 1 /* margin */ + 1 /* border */;
++  geo->border = 0;
++  geo->first_entry_x = 0 /* margin */ + 0 /* border */;
+   geo->entry_width = grub_term_width (term) - 5;
+ 
+   geo->first_entry_y = 2 /* two empty lines*/
+-    + 1 /* GNU GRUB version text  */ + 1 /* top border */;
++    + 0 /* GNU GRUB version text  */ + 1 /* top border */;
+ 
+   geo->timeout_lines = 2;
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0109-Use-the-correct-indentation-for-the-term-help-text.patch b/SOURCES/0109-Use-the-correct-indentation-for-the-term-help-text.patch
new file mode 100644
index 0000000..6911db2
--- /dev/null
+++ b/SOURCES/0109-Use-the-correct-indentation-for-the-term-help-text.patch
@@ -0,0 +1,28 @@
+From 9cc9edb600ad1acc1598910ed95a8482ff3de6e2 Mon Sep 17 00:00:00 2001
+From: William Jon McCann <william.jon.mccann@gmail.com>
+Date: Fri, 7 Jun 2013 14:08:49 -0400
+Subject: [PATCH 109/143] Use the correct indentation for the term help text
+
+That is consistent with the menu help text
+---
+ grub-core/normal/main.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
+index 3777cd2..0da2a52 100644
+--- a/grub-core/normal/main.c
++++ b/grub-core/normal/main.c
+@@ -426,8 +426,8 @@ grub_normal_reader_init (int nested)
+     grub_normal_init_page (term, 1);
+     grub_term_setcursor (term, 1);
+ 
+-    if (grub_term_width (term) > 3 + STANDARD_MARGIN + 20)
+-      grub_print_message_indented (msg_formatted, 3, STANDARD_MARGIN, term);
++    if (grub_term_width (term) > 2 * STANDARD_MARGIN + 20)
++      grub_print_message_indented (msg_formatted, STANDARD_MARGIN, STANDARD_MARGIN, term);
+     else
+       grub_print_message_indented (msg_formatted, 0, 0, term);
+     grub_putcode ('\n', term);
+-- 
+1.9.3
+
diff --git a/SOURCES/0110-Indent-menu-entries.patch b/SOURCES/0110-Indent-menu-entries.patch
new file mode 100644
index 0000000..7930d76
--- /dev/null
+++ b/SOURCES/0110-Indent-menu-entries.patch
@@ -0,0 +1,26 @@
+From e52c695e09447f6fbc51c23f1745d50c6db5c7b8 Mon Sep 17 00:00:00 2001
+From: William Jon McCann <william.jon.mccann@gmail.com>
+Date: Fri, 7 Jun 2013 14:30:55 -0400
+Subject: [PATCH 110/143] Indent menu entries
+
+---
+ grub-core/normal/menu_text.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
+index aa3454f..01b6f1c 100644
+--- a/grub-core/normal/menu_text.c
++++ b/grub-core/normal/menu_text.c
+@@ -239,7 +239,8 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
+       unicode_title[i] = ' ';
+ 
+   if (data->geo.num_entries > 1)
+-    grub_putcode (' ', data->term);
++    for (i = 0; i < STANDARD_MARGIN; i++)
++      grub_putcode (' ', data->term);
+ 
+   grub_print_ucs4_menu (unicode_title,
+ 			unicode_title + len,
+-- 
+1.9.3
+
diff --git a/SOURCES/0111-Fix-margins.patch b/SOURCES/0111-Fix-margins.patch
new file mode 100644
index 0000000..3c7c493
--- /dev/null
+++ b/SOURCES/0111-Fix-margins.patch
@@ -0,0 +1,37 @@
+From a623d490ea6a94cc7db68400d3fea5b0c25ccb9c Mon Sep 17 00:00:00 2001
+From: William Jon McCann <william.jon.mccann@gmail.com>
+Date: Fri, 7 Jun 2013 14:59:36 -0400
+Subject: [PATCH 111/143] Fix margins
+
+---
+ grub-core/normal/menu_text.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
+index 01b6f1c..ead3391 100644
+--- a/grub-core/normal/menu_text.c
++++ b/grub-core/normal/menu_text.c
+@@ -333,17 +333,15 @@ grub_menu_init_page (int nested, int edit,
+   int version_msg = 1;
+ 
+   geo->border = 0;
+-  geo->first_entry_x = 0 /* margin */ + 0 /* border */;
+-  geo->entry_width = grub_term_width (term) - 5;
++  geo->first_entry_x = 0; /* no margin */
++  geo->entry_width = grub_term_width (term) - 1;
+ 
+-  geo->first_entry_y = 2 /* two empty lines*/
+-    + 0 /* GNU GRUB version text  */ + 1 /* top border */;
++  geo->first_entry_y = 3; /* three empty lines*/
+ 
+   geo->timeout_lines = 2;
+ 
+   /* 3 lines for timeout message and bottom margin.  2 lines for the border.  */
+   geo->num_entries = grub_term_height (term) - geo->first_entry_y
+-    - 1 /* bottom border */
+     - 1 /* empty line before info message*/
+     - geo->timeout_lines /* timeout */
+     - 1 /* empty final line  */;
+-- 
+1.9.3
+
diff --git a/SOURCES/0112-Add-support-for-UEFI-operating-systems-returned-by-o.patch b/SOURCES/0112-Add-support-for-UEFI-operating-systems-returned-by-o.patch
new file mode 100644
index 0000000..c8dd53a
--- /dev/null
+++ b/SOURCES/0112-Add-support-for-UEFI-operating-systems-returned-by-o.patch
@@ -0,0 +1,51 @@
+From 5980cac9e0320a3eb65e7fb73487a565d21361da Mon Sep 17 00:00:00 2001
+From: Matthew Garrett <matthew.garrett@nebula.com>
+Date: Wed, 12 Jun 2013 11:51:49 -0400
+Subject: [PATCH 112/143] Add support for UEFI operating systems returned by
+ os-prober
+
+os-prober returns UEFI operating systems in the form:
+
+path:long-name:name
+
+where path is the path under the EFI directory on the ESP. This is in
+contrast to legacy OSes, where path is the device string. Handle this case.
+---
+ util/grub.d/30_os-prober.in | 22 ++++++++++++++++++----
+ 1 file changed, 18 insertions(+), 4 deletions(-)
+
+diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
+index 6f38c82..9f955ab 100644
+--- a/util/grub.d/30_os-prober.in
++++ b/util/grub.d/30_os-prober.in
+@@ -322,9 +322,23 @@ EOF
+ EOF
+     ;;
+     *)
+-      echo -n "  "
+-      # TRANSLATORS: %s is replaced by OS name.
+-      gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2
+-    ;;
++      case ${DEVICE} in
++	*.efi)
++	  cat << EOF
++menuentry '$(echo "${LONGNAME}" | grub_quote)' {
++EOF
++	  save_default_entry | grub_add_tab
++	  cat << EOF
++	  chainloader /EFI/${DEVICE}
++	  boot
++}
++EOF
++	  ;;
++	*)
++          echo -n "  "
++          # TRANSLATORS: %s is replaced by OS name.
++          gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2
++        ;;
++      esac
+   esac
+ done
+-- 
+1.9.3
+
diff --git a/SOURCES/0113-Disable-GRUB-video-support-for-IBM-power-machines.patch b/SOURCES/0113-Disable-GRUB-video-support-for-IBM-power-machines.patch
new file mode 100644
index 0000000..664682f
--- /dev/null
+++ b/SOURCES/0113-Disable-GRUB-video-support-for-IBM-power-machines.patch
@@ -0,0 +1,65 @@
+From 3fd909cbba26f1f76a64aa095937b00cd1785570 Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Tue, 11 Jun 2013 15:14:05 -0300
+Subject: [PATCH 113/143] Disable GRUB video support for IBM power machines
+
+Should fix the problem in bugzilla:
+https://bugzilla.redhat.com/show_bug.cgi?id=973205
+---
+ grub-core/kern/ieee1275/cmain.c  | 5 ++++-
+ grub-core/video/ieee1275.c       | 9 ++++++---
+ include/grub/ieee1275/ieee1275.h | 2 ++
+ 3 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c
+index 3e12e6b..3e14f53 100644
+--- a/grub-core/kern/ieee1275/cmain.c
++++ b/grub-core/kern/ieee1275/cmain.c
+@@ -90,7 +90,10 @@ grub_ieee1275_find_options (void)
+   }
+ 
+   if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0)
+-    grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS);
++    {
++      grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS);
++      grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT);
++    }
+ 
+   /* Old Macs have no key repeat, newer ones have fully working one.
+      The ones inbetween when repeated key generates an escaoe sequence
+diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c
+index 0b150ec..813ab38 100644
+--- a/grub-core/video/ieee1275.c
++++ b/grub-core/video/ieee1275.c
+@@ -351,9 +351,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter =
+ 
+ GRUB_MOD_INIT(ieee1275_fb)
+ {
+-  find_display ();
+-  if (display)
+-    grub_video_register (&grub_video_ieee1275_adapter);
++  if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT))
++    {
++      find_display ();
++      if (display)
++        grub_video_register (&grub_video_ieee1275_adapter);
++    }
+ }
+ 
+ GRUB_MOD_FINI(ieee1275_fb)
+diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
+index 6a21f5d..663935d 100644
+--- a/include/grub/ieee1275/ieee1275.h
++++ b/include/grub/ieee1275/ieee1275.h
+@@ -146,6 +146,8 @@ enum grub_ieee1275_flag
+   GRUB_IEEE1275_FLAG_BROKEN_REPEAT,
+ 
+   GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN,
++
++  GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT
+ };
+ 
+ extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
+-- 
+1.9.3
+
diff --git a/SOURCES/0114-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch b/SOURCES/0114-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch
new file mode 100644
index 0000000..c734740
--- /dev/null
+++ b/SOURCES/0114-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch
@@ -0,0 +1,27 @@
+From 6550cd89b1dee8c9ad866cbf10bf72dc2ff8a8bc Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Fri, 21 Jun 2013 14:44:08 -0400
+Subject: [PATCH 114/143] Use -2 instead of -1 for our right-hand margin, so
+ linewrapping works (#976643).
+
+Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
+---
+ grub-core/normal/menu_text.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
+index ead3391..bc1fc71 100644
+--- a/grub-core/normal/menu_text.c
++++ b/grub-core/normal/menu_text.c
+@@ -334,7 +334,7 @@ grub_menu_init_page (int nested, int edit,
+ 
+   geo->border = 0;
+   geo->first_entry_x = 0; /* no margin */
+-  geo->entry_width = grub_term_width (term) - 1;
++  geo->entry_width = grub_term_width (term) - 2;
+ 
+   geo->first_entry_y = 3; /* three empty lines*/
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0115-Use-linux16-when-appropriate-880840.patch b/SOURCES/0115-Use-linux16-when-appropriate-880840.patch
new file mode 100644
index 0000000..6cef47e
--- /dev/null
+++ b/SOURCES/0115-Use-linux16-when-appropriate-880840.patch
@@ -0,0 +1,52 @@
+From ba749818b7a53df63d887cb17497f82c78ca934c Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Mon, 28 Oct 2013 10:05:07 -0400
+Subject: [PATCH 115/143] Use linux16 when appropriate (#880840)
+
+The kernel group really would prefer that we use the 16 bit entry point
+on x86 bios machines.
+
+Resolves: rhbz#880840
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ util/grub.d/10_linux.in | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index e762e1f..600bfd2 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -74,6 +74,11 @@ linux_entry ()
+   type="$3"
+   args="$4"
+ 
++  sixteenbit=""
++  case "$machine" in
++    i?86|x86_64) sixteenbit="16" ;;
++  esac
++
+   if [ -z "$boot_device_id" ]; then
+       boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+   fi
+@@ -132,7 +137,7 @@ linux_entry ()
+ EOF
+   else
+     sed "s/^/$submenu_indentation/" << EOF
+-	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
++	linux${sixteenbit} ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
+ EOF
+   fi
+   if test -n "${initrd}" ; then
+@@ -142,7 +147,7 @@ EOF
+ EOF
+     else
+       sed "s/^/$submenu_indentation/" << EOF
+-	initrd	${rel_dirname}/${initrd}
++	initrd${sixteenbit} ${rel_dirname}/${initrd}
+ EOF
+     fi
+   fi
+-- 
+1.9.3
+
diff --git a/SOURCES/0116-Enable-pager-by-default.-985860.patch b/SOURCES/0116-Enable-pager-by-default.-985860.patch
new file mode 100644
index 0000000..f300fb8
--- /dev/null
+++ b/SOURCES/0116-Enable-pager-by-default.-985860.patch
@@ -0,0 +1,26 @@
+From 26f2fbd4fb424ad097ea99578864ae526b79f732 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Mon, 28 Oct 2013 10:09:27 -0400
+Subject: [PATCH 116/143] Enable pager by default. (#985860)
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ util/grub.d/00_header.in | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
+index ce2ec81..fefa7dd 100644
+--- a/util/grub.d/00_header.in
++++ b/util/grub.d/00_header.in
+@@ -43,6 +43,8 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_
+ if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi
+ 
+ cat << EOF
++set pager=1
++
+ if [ -s \$prefix/grubenv ]; then
+   load_env
+ fi
+-- 
+1.9.3
+
diff --git a/SOURCES/0117-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch b/SOURCES/0117-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch
new file mode 100644
index 0000000..0baa67a
--- /dev/null
+++ b/SOURCES/0117-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch
@@ -0,0 +1,27 @@
+From 3e8fad7dba63db810a9626d472de5270b2d1bb75 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Mon, 28 Oct 2013 10:13:27 -0400
+Subject: [PATCH 117/143] F10 doesn't work on serial, so don't tell the user to
+ hit it (#987443)
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ grub-core/normal/menu_text.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
+index bc1fc71..6202c2a 100644
+--- a/grub-core/normal/menu_text.c
++++ b/grub-core/normal/menu_text.c
+@@ -157,7 +157,7 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
+ 
+   if (edit)
+     {
+-      ret += grub_print_message_indented_real (_("Press Ctrl-x or F10 to start, Ctrl-c or F2 for a \
++      ret += grub_print_message_indented_real (_("Press Ctrl-x to start, Ctrl-c for a \
+ command prompt or Escape to discard edits and return to the menu. Pressing Tab lists possible completions."),
+ 					       STANDARD_MARGIN, STANDARD_MARGIN,
+ 					       term, dry_run);
+-- 
+1.9.3
+
diff --git a/SOURCES/0118-Don-t-say-GNU-Linux-in-generated-menus.patch b/SOURCES/0118-Don-t-say-GNU-Linux-in-generated-menus.patch
new file mode 100644
index 0000000..ba22a7f
--- /dev/null
+++ b/SOURCES/0118-Don-t-say-GNU-Linux-in-generated-menus.patch
@@ -0,0 +1,45 @@
+From 03d405d9b503c435f3a975c5789a0bda9650a753 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Mon, 14 Mar 2011 14:27:42 -0400
+Subject: [PATCH 118/143] Don't say "GNU/Linux" in generated menus.
+
+---
+ util/grub.d/10_linux.in     | 4 ++--
+ util/grub.d/20_linux_xen.in | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 600bfd2..c943a1e 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
+ CLASS="--class gnu-linux --class gnu --class os"
+ 
+ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
+-  OS=GNU/Linux
++  OS="$(sed 's, release .*$,,g' /etc/system-release)"
+ else
+-  OS="${GRUB_DISTRIBUTOR} GNU/Linux"
++  OS="${GRUB_DISTRIBUTOR}"
+   CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
+ fi
+ 
+diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
+index a608435..79d4e38 100644
+--- a/util/grub.d/20_linux_xen.in
++++ b/util/grub.d/20_linux_xen.in
+@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
+ CLASS="--class gnu-linux --class gnu --class os --class xen"
+ 
+ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
+-  OS=GNU/Linux
++  OS="$(sed 's, release .*$,,g' /etc/system-release)"
+ else
+-  OS="${GRUB_DISTRIBUTOR} GNU/Linux"
++  OS="${GRUB_DISTRIBUTOR}"
+   CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
+ fi
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0119-Don-t-draw-a-border-around-the-menu.patch b/SOURCES/0119-Don-t-draw-a-border-around-the-menu.patch
new file mode 100644
index 0000000..34e0d66
--- /dev/null
+++ b/SOURCES/0119-Don-t-draw-a-border-around-the-menu.patch
@@ -0,0 +1,74 @@
+From 6bf4deb61df3ecb1e2d108195efa5ac980baa961 Mon Sep 17 00:00:00 2001
+From: William Jon McCann <william.jon.mccann@gmail.com>
+Date: Wed, 15 May 2013 16:47:33 -0400
+Subject: [PATCH 119/143] Don't draw a border around the menu
+
+It looks cleaner without it.
+---
+ grub-core/normal/menu_text.c | 43 -------------------------------------------
+ 1 file changed, 43 deletions(-)
+
+diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
+index 6202c2a..beddd7f 100644
+--- a/grub-core/normal/menu_text.c
++++ b/grub-core/normal/menu_text.c
+@@ -108,47 +108,6 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right,
+   grub_print_message_indented_real (msg, margin_left, margin_right, term, 0);
+ }
+ 
+-static void
+-draw_border (struct grub_term_output *term, const struct grub_term_screen_geometry *geo)
+-{
+-  int i;
+-
+-  grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
+-
+-  grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1,
+-	geo->first_entry_y - 1 });
+-  grub_putcode (GRUB_UNICODE_CORNER_UL, term);
+-  for (i = 0; i < geo->entry_width + 1; i++)
+-    grub_putcode (GRUB_UNICODE_HLINE, term);
+-  grub_putcode (GRUB_UNICODE_CORNER_UR, term);
+-
+-  for (i = 0; i < geo->num_entries; i++)
+-    {
+-      grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1,
+-	    geo->first_entry_y + i });
+-      grub_putcode (GRUB_UNICODE_VLINE, term);
+-      grub_term_gotoxy (term,
+-			(struct grub_term_coordinate) { geo->first_entry_x + geo->entry_width + 1,
+-			    geo->first_entry_y + i });
+-      grub_putcode (GRUB_UNICODE_VLINE, term);
+-    }
+-
+-  grub_term_gotoxy (term,
+-		    (struct grub_term_coordinate) { geo->first_entry_x - 1,
+-			geo->first_entry_y - 1 + geo->num_entries + 1 });
+-  grub_putcode (GRUB_UNICODE_CORNER_LL, term);
+-  for (i = 0; i < geo->entry_width + 1; i++)
+-    grub_putcode (GRUB_UNICODE_HLINE, term);
+-  grub_putcode (GRUB_UNICODE_CORNER_LR, term);
+-
+-  grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
+-
+-  grub_term_gotoxy (term,
+-		    (struct grub_term_coordinate) { geo->first_entry_x - 1,
+-			(geo->first_entry_y - 1 + geo->num_entries
+-			 + GRUB_TERM_MARGIN + 1) });
+-}
+-
+ static int
+ print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
+ {
+@@ -403,8 +362,6 @@ grub_menu_init_page (int nested, int edit,
+ 
+   grub_term_normal_color = grub_color_menu_normal;
+   grub_term_highlight_color = grub_color_menu_highlight;
+-  if (geo->border)
+-    draw_border (term, geo);
+   grub_term_normal_color = old_color_normal;
+   grub_term_highlight_color = old_color_highlight;
+   geo->timeout_y = geo->first_entry_y + geo->num_entries
+-- 
+1.9.3
+
diff --git a/SOURCES/0120-Use-the-standard-margin-for-the-timeout-string.patch b/SOURCES/0120-Use-the-standard-margin-for-the-timeout-string.patch
new file mode 100644
index 0000000..4d3af1e
--- /dev/null
+++ b/SOURCES/0120-Use-the-standard-margin-for-the-timeout-string.patch
@@ -0,0 +1,43 @@
+From a3e6964bd3242bd042489bb510e63fc0224fede4 Mon Sep 17 00:00:00 2001
+From: William Jon McCann <william.jon.mccann@gmail.com>
+Date: Fri, 7 Jun 2013 10:52:32 -0400
+Subject: [PATCH 120/143] Use the standard margin for the timeout string
+
+So that it aligns with the other messages
+---
+ grub-core/normal/menu_text.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
+index beddd7f..33b208b 100644
+--- a/grub-core/normal/menu_text.c
++++ b/grub-core/normal/menu_text.c
+@@ -369,7 +369,7 @@ grub_menu_init_page (int nested, int edit,
+   if (bottom_message)
+     {
+       grub_term_gotoxy (term,
+-			(struct grub_term_coordinate) { GRUB_TERM_MARGIN,
++			(struct grub_term_coordinate) { STANDARD_MARGIN,
+ 			    geo->timeout_y });
+ 
+       print_message (nested, edit, term, 0);
+@@ -404,14 +404,14 @@ menu_text_print_timeout (int timeout, void *dataptr)
+   if (data->timeout_msg == TIMEOUT_UNKNOWN)
+     {
+       data->timeout_msg = grub_print_message_indented_real (msg_translated,
+-							    3, 1, data->term, 1)
++							    STANDARD_MARGIN, 1, data->term, 1)
+ 	<= data->geo.timeout_lines ? TIMEOUT_NORMAL : TIMEOUT_TERSE;
+       if (data->timeout_msg == TIMEOUT_TERSE)
+ 	{
+ 	  grub_free (msg_translated);
+ 	  msg_translated = grub_xasprintf (_("%ds"), timeout);
+ 	  if (grub_term_width (data->term) < 10)
+-	    data->timeout_msg = TIMEOUT_TERSE_NO_MARGIN;
++	    data->timeout_msg = STANDARD_MARGIN;
+ 	}
+     }
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0121-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch b/SOURCES/0121-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch
new file mode 100644
index 0000000..37e91be
--- /dev/null
+++ b/SOURCES/0121-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch
@@ -0,0 +1,29 @@
+From a7a033ed92a55dd44314ed20f720a3d32fa9c684 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Fri, 10 Jan 2014 09:36:24 -0500
+Subject: [PATCH 121/143] Fix grub_script_execute_sourcecode() usage on ppc.
+
+593e430c made it not take the extra argc/argv that this code still
+passes it.
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ grub-core/normal/main.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
+index 0da2a52..f66c03c 100644
+--- a/grub-core/normal/main.c
++++ b/grub-core/normal/main.c
+@@ -289,7 +289,7 @@ grub_normal_execute (const char *config, int nested, int batch)
+       if (! grub_ieee1275_cas_reboot (script))
+         {
+           char *dummy[1] = { NULL };
+-          if (! grub_script_execute_sourcecode (script, 0, dummy))
++          if (! grub_script_execute_sourcecode (script))
+             boot = 1;
+         }
+       grub_free (script);
+-- 
+1.9.3
+
diff --git a/SOURCES/0122-Add-.eh_frame-to-list-of-relocations-stripped.patch b/SOURCES/0122-Add-.eh_frame-to-list-of-relocations-stripped.patch
new file mode 100644
index 0000000..cfc5ec3
--- /dev/null
+++ b/SOURCES/0122-Add-.eh_frame-to-list-of-relocations-stripped.patch
@@ -0,0 +1,25 @@
+From 9120cc5592d26a945ead586b71820fb9708f5062 Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <grub2-owner@fedoraproject.org>
+Date: Mon, 13 Jan 2014 21:50:59 -0500
+Subject: [PATCH 122/143] Add .eh_frame to list of relocations stripped
+
+---
+ conf/Makefile.common | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/conf/Makefile.common b/conf/Makefile.common
+index e4c301f..6f836d8 100644
+--- a/conf/Makefile.common
++++ b/conf/Makefile.common
+@@ -45,7 +45,7 @@ CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
+ LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_LDFLAGS_STATIC_LIBGCC)
+ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
+ CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
+-STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version
++STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version
+ 
+ CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
+ LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
+-- 
+1.9.3
+
diff --git a/SOURCES/0123-Make-10_linux-work-with-our-changes-for-linux16-and-.patch b/SOURCES/0123-Make-10_linux-work-with-our-changes-for-linux16-and-.patch
new file mode 100644
index 0000000..0d77e70
--- /dev/null
+++ b/SOURCES/0123-Make-10_linux-work-with-our-changes-for-linux16-and-.patch
@@ -0,0 +1,85 @@
+From 1c9518bb506f8f4fa6b388571c76797705e7b566 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Tue, 14 Jan 2014 13:12:23 -0500
+Subject: [PATCH 123/143] Make 10_linux work with our changes for linux16 and
+ linuxefi on aarch64
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ util/grub.d/10_linux.in | 31 ++++++++++++++++++++++++++++---
+ 1 file changed, 28 insertions(+), 3 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index c943a1e..2b8c561 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -75,8 +75,18 @@ linux_entry ()
+   args="$4"
+ 
+   sixteenbit=""
++  linuxefi="linux"
++  initrdefi="initrd"
+   case "$machine" in
+-    i?86|x86_64) sixteenbit="16" ;;
++    i?86|x86_64)
++	sixteenbit="16"
++	linuxefi="linuxefi"
++	initrdefi="initrdefi"
++	;;
++    aarch64)
++	linuxefi="linux"
++	initrdefi="initrd"
++	;;
+   esac
+ 
+   if [ -z "$boot_device_id" ]; then
+@@ -133,7 +143,7 @@ linux_entry ()
+   fi
+   if [ -d /sys/firmware/efi ]; then
+     sed "s/^/$submenu_indentation/" << EOF
+-	linuxefi ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
++	${linuxefi} ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
+ EOF
+   else
+     sed "s/^/$submenu_indentation/" << EOF
+@@ -143,7 +153,7 @@ EOF
+   if test -n "${initrd}" ; then
+     if [ -d /sys/firmware/efi ]; then
+       sed "s/^/$submenu_indentation/" << EOF
+-	initrdefi ${rel_dirname}/${initrd}
++	${initrdefi} ${rel_dirname}/${initrd}
+ EOF
+     else
+       sed "s/^/$submenu_indentation/" << EOF
+@@ -151,6 +161,13 @@ EOF
+ EOF
+     fi
+   fi
++  if test -n "${fdt}" ; then
++    message="$(gettext_printf "Loading fdt ...")"
++    sed "s/^/$submenu_indentation/" << EOF
++	echo	'$(echo "$message" | grub_quote)'
++	devicetree	${rel_dirname}/${fdt}
++EOF
++  fi
+   sed "s/^/$submenu_indentation/" << EOF
+ }
+ EOF
+@@ -211,6 +228,14 @@ while [ "x$list" != "x" ] ; do
+     fi
+   done
+ 
++  fdt=
++  for i in "dtb-${version}" "dtb-${alt_version}"; do
++    if test -e "${dirname}/${i}/foundation-v8.dtb" ; then
++      fdt="${i}/foundation-v8.dtb"
++      break
++    fi
++  done
++
+   config=
+   for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
+     if test -e "${i}" ; then
+-- 
+1.9.3
+
diff --git a/SOURCES/0124-Don-t-print-during-fdt-loading-method.patch b/SOURCES/0124-Don-t-print-during-fdt-loading-method.patch
new file mode 100644
index 0000000..8bf4191
--- /dev/null
+++ b/SOURCES/0124-Don-t-print-during-fdt-loading-method.patch
@@ -0,0 +1,27 @@
+From aa8c71086da3a28382b8bd958bac1c5d3b2b2be3 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Tue, 14 Jan 2014 16:15:46 -0500
+Subject: [PATCH 124/143] Don't print during fdt loading method.
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ util/grub.d/10_linux.in | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 2b8c561..acf2e0e 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -162,9 +162,7 @@ EOF
+     fi
+   fi
+   if test -n "${fdt}" ; then
+-    message="$(gettext_printf "Loading fdt ...")"
+     sed "s/^/$submenu_indentation/" << EOF
+-	echo	'$(echo "$message" | grub_quote)'
+ 	devicetree	${rel_dirname}/${fdt}
+ EOF
+   fi
+-- 
+1.9.3
+
diff --git a/SOURCES/0125-Honor-a-symlink-when-generating-configuration-by-gru.patch b/SOURCES/0125-Honor-a-symlink-when-generating-configuration-by-gru.patch
new file mode 100644
index 0000000..1958333
--- /dev/null
+++ b/SOURCES/0125-Honor-a-symlink-when-generating-configuration-by-gru.patch
@@ -0,0 +1,29 @@
+From 37ad82c4f11e293e30eea26302624691e80f19b8 Mon Sep 17 00:00:00 2001
+From: Marcel Kolaja <mkolaja@redhat.com>
+Date: Tue, 21 Jan 2014 10:57:08 -0500
+Subject: [PATCH 125/143] Honor a symlink when generating configuration by
+ grub2-mkconfig
+
+Honor a symlink when generating configuration by grub2-mkconfig, so that
+the -o option follows it rather than overwriting it with a regular file.
+---
+ util/grub-mkconfig.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
+index ca040dd..b00f9e6 100644
+--- a/util/grub-mkconfig.in
++++ b/util/grub-mkconfig.in
+@@ -272,7 +272,8 @@ and /etc/grub.d/* files or please file a bug report with
+     echo >&2
+   else
+     # none of the children aborted with error, install the new grub.cfg
+-    mv -f ${grub_cfg}.new ${grub_cfg}
++    cat ${grub_cfg}.new > ${grub_cfg}
++    rm -f ${grub_cfg}.new
+   fi
+ fi
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0126-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch b/SOURCES/0126-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch
new file mode 100644
index 0000000..ea0ac8e
--- /dev/null
+++ b/SOURCES/0126-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch
@@ -0,0 +1,36 @@
+From ee6df3680adbe2bb8165c98ed0e39f6258cd873e Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Mon, 30 Jun 2014 14:16:46 -0400
+Subject: [PATCH 126/143] Don't munge raw spaces when we're doing our cmdline
+ escaping (#923374)
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ grub-core/lib/cmdline.c | 11 +----------
+ 1 file changed, 1 insertion(+), 10 deletions(-)
+
+diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
+index 0a5b2af..970ea86 100644
+--- a/grub-core/lib/cmdline.c
++++ b/grub-core/lib/cmdline.c
+@@ -97,16 +97,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
+ 
+       while (*c)
+ 	{
+-	  if (*c == ' ')
+-	    {
+-	      *buf++ = '\\';
+-	      *buf++ = 'x';
+-	      *buf++ = '2';
+-	      *buf++ = '0';
+-	      c++;
+-	      continue;
+-	    }
+-	  else if (*c == '\\' && *(c+1) == 'x' &&
++	  if (*c == '\\' && *(c+1) == 'x' &&
+ 		   is_hex(*(c+2)) && is_hex(*(c+3)))
+ 	    {
+ 	      *buf++ = *c++;
+-- 
+1.9.3
+
diff --git a/SOURCES/0127-Don-t-require-a-password-to-boot-entries-generated-b.patch b/SOURCES/0127-Don-t-require-a-password-to-boot-entries-generated-b.patch
new file mode 100644
index 0000000..94ed88d
--- /dev/null
+++ b/SOURCES/0127-Don-t-require-a-password-to-boot-entries-generated-b.patch
@@ -0,0 +1,31 @@
+From 0ce7596ab544955073318a4ed650d7d0615b933e Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Tue, 11 Feb 2014 11:14:50 -0500
+Subject: [PATCH 127/143] Don't require a password to boot entries generated by
+ grub-mkconfig.
+
+When we set a password, we just want that to mean you can't /edit/ an entry.
+
+Resolves: rhbz#1030176
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ util/grub.d/10_linux.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index acf2e0e..136abd7 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -26,7 +26,7 @@ datarootdir="@datarootdir@"
+ export TEXTDOMAIN=@PACKAGE@
+ export TEXTDOMAINDIR="@localedir@"
+ 
+-CLASS="--class gnu-linux --class gnu --class os"
++CLASS="--class gnu-linux --class gnu --class os --unrestricted"
+ 
+ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
+   OS="$(sed 's, release .*$,,g' /etc/system-release)"
+-- 
+1.9.3
+
diff --git a/SOURCES/0128-Don-t-emit-Booting-.-message.patch b/SOURCES/0128-Don-t-emit-Booting-.-message.patch
new file mode 100644
index 0000000..c7b26c6
--- /dev/null
+++ b/SOURCES/0128-Don-t-emit-Booting-.-message.patch
@@ -0,0 +1,48 @@
+From 34f60bd4d04b142667c5fc0a4287b118834e71bb Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Tue, 18 Feb 2014 09:37:49 -0500
+Subject: [PATCH 128/143] Don't emit "Booting ..." message.
+
+UI team still hates this stuff, so we're disabling it for RHEL 7.
+
+Resolves: rhbz#1023142
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ grub-core/normal/menu.c       | 2 ++
+ grub-core/normal/menu_entry.c | 3 ---
+ 2 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
+index b47991a..cc27c37 100644
+--- a/grub-core/normal/menu.c
++++ b/grub-core/normal/menu.c
+@@ -810,9 +810,11 @@ static void
+ notify_booting (grub_menu_entry_t entry,
+ 		void *userdata __attribute__((unused)))
+ {
++#if 0
+   grub_printf ("  ");
+   grub_printf_ (N_("Booting `%s'"), entry->title);
+   grub_printf ("\n\n");
++#endif
+ }
+ 
+ /* Callback invoked when a default menu entry executed because of a timeout
+diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c
+index b485df8..62e5db1 100644
+--- a/grub-core/normal/menu_entry.c
++++ b/grub-core/normal/menu_entry.c
+@@ -1156,9 +1156,6 @@ run (struct screen *screen)
+   char *dummy[1] = { NULL };
+ 
+   grub_cls ();
+-  grub_printf ("  ");
+-  grub_printf_ (N_("Booting a command list"));
+-  grub_printf ("\n\n");
+ 
+   errs_before = grub_err_printed_errors;
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0129-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch b/SOURCES/0129-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch
new file mode 100644
index 0000000..cb00dcc
--- /dev/null
+++ b/SOURCES/0129-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch
@@ -0,0 +1,304 @@
+From fe42ce5fc9eec355027a533861dfe7f2eeefc63c Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Mon, 3 Feb 2014 15:21:46 -0500
+Subject: [PATCH 129/143] Make CTRL and ALT keys work as expected on EFI
+ systems (version 5).
+
+This is version 4.
+
+Changes from version 1:
+- handles SHIFT as a modifier
+- handles F11 and F12 keys
+- uses the handle provided by the system table to find our _EX protocol.
+
+Changes from version 2:
+- eliminate duplicate keycode translation.
+
+Changes from version 3:
+- Do not add the shift modifier for any ascii character between space
+  (0x20) and DEL (0x7f); the combination of the modifier and many of the
+  keys causes it not to be recognized at all.  Specifically, if we
+  include the modifier on any querty punctuation character, i.e.
+  anything the string "~!@#$%^&*()_+{}|:\"<>?" represents in C, it stops
+  being recognized whatsoever.
+
+Changes from version 4:
+- Always initialize term->data from locate protocol (i.e. make it
+  unconditional.)
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ grub-core/term/efi/console.c | 118 +++++++++++++++++++++++++++++++++++--------
+ include/grub/efi/api.h       |  65 +++++++++++++++++++++++-
+ 2 files changed, 161 insertions(+), 22 deletions(-)
+
+diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c
+index a37eb84..677eab5 100644
+--- a/grub-core/term/efi/console.c
++++ b/grub-core/term/efi/console.c
+@@ -104,26 +104,12 @@ const unsigned efi_codes[] =
+     GRUB_TERM_KEY_DC, GRUB_TERM_KEY_PPAGE, GRUB_TERM_KEY_NPAGE, GRUB_TERM_KEY_F1,
+     GRUB_TERM_KEY_F2, GRUB_TERM_KEY_F3, GRUB_TERM_KEY_F4, GRUB_TERM_KEY_F5,
+     GRUB_TERM_KEY_F6, GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, GRUB_TERM_KEY_F9,
+-    GRUB_TERM_KEY_F10, 0, 0, '\e'
++    GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, '\e'
+   };
+ 
+-
+ static int
+-grub_console_getkey (struct grub_term_input *term __attribute__ ((unused)))
++grub_efi_translate_key (grub_efi_input_key_t key)
+ {
+-  grub_efi_simple_input_interface_t *i;
+-  grub_efi_input_key_t key;
+-  grub_efi_status_t status;
+-
+-  if (grub_efi_is_finished)
+-    return 0;
+-
+-  i = grub_efi_system_table->con_in;
+-  status = efi_call_2 (i->read_key_stroke, i, &key);
+-
+-  if (status != GRUB_EFI_SUCCESS)
+-    return GRUB_TERM_NO_KEY;
+-
+   if (key.scan_code == 0)
+     {
+       /* Some firmware implementations use VT100-style codes against the spec.
+@@ -139,9 +125,98 @@ grub_console_getkey (struct grub_term_input *term __attribute__ ((unused)))
+   else if (key.scan_code < ARRAY_SIZE (efi_codes))
+     return efi_codes[key.scan_code];
+ 
++  if (key.unicode_char >= 0x20 && key.unicode_char <= 0x7f)
++    return key.unicode_char;
++
+   return GRUB_TERM_NO_KEY;
+ }
+ 
++static int
++grub_console_getkey_con (struct grub_term_input *term __attribute__ ((unused)))
++{
++  grub_efi_simple_input_interface_t *i;
++  grub_efi_input_key_t key;
++  grub_efi_status_t status;
++
++  i = grub_efi_system_table->con_in;
++  status = efi_call_2 (i->read_key_stroke, i, &key);
++
++  if (status != GRUB_EFI_SUCCESS)
++    return GRUB_TERM_NO_KEY;
++
++  return grub_efi_translate_key(key);
++}
++
++static int
++grub_console_getkey_ex(struct grub_term_input *term)
++{
++  grub_efi_key_data_t key_data;
++  grub_efi_status_t status;
++  grub_efi_uint32_t kss;
++  int key = -1;
++
++  grub_efi_simple_text_input_ex_interface_t *text_input = term->data;
++
++  status = efi_call_2 (text_input->read_key_stroke, text_input, &key_data);
++
++  if (status != GRUB_EFI_SUCCESS)
++    return GRUB_TERM_NO_KEY;
++
++  kss = key_data.key_state.key_shift_state;
++  key = grub_efi_translate_key(key_data.key);
++
++  if (key == GRUB_TERM_NO_KEY)
++    return GRUB_TERM_NO_KEY;
++
++  if (kss & GRUB_EFI_SHIFT_STATE_VALID)
++    {
++      if ((kss & GRUB_EFI_LEFT_SHIFT_PRESSED
++	   || kss & GRUB_EFI_RIGHT_SHIFT_PRESSED)
++	  && !(key >= 0x20 && key <= 0x7f))
++	key |= GRUB_TERM_SHIFT;
++      if (kss & GRUB_EFI_LEFT_ALT_PRESSED || kss & GRUB_EFI_RIGHT_ALT_PRESSED)
++	key |= GRUB_TERM_ALT;
++      if (kss & GRUB_EFI_LEFT_CONTROL_PRESSED
++	  || kss & GRUB_EFI_RIGHT_CONTROL_PRESSED)
++	key |= GRUB_TERM_CTRL;
++    }
++
++  return key;
++}
++
++static grub_err_t
++grub_efi_console_input_init (struct grub_term_input *term)
++{
++  grub_efi_guid_t text_input_ex_guid =
++    GRUB_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
++
++  if (grub_efi_is_finished)
++    return 0;
++
++  grub_efi_simple_text_input_ex_interface_t *text_input = term->data;
++  if (text_input)
++    return 0;
++
++  text_input = grub_efi_open_protocol(grub_efi_system_table->console_in_handler,
++				      &text_input_ex_guid,
++				      GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
++  term->data = (void *)text_input;
++
++  return 0;
++}
++
++static int
++grub_console_getkey (struct grub_term_input *term)
++{
++  if (grub_efi_is_finished)
++    return 0;
++
++  if (term->data)
++    return grub_console_getkey_ex(term);
++  else
++    return grub_console_getkey_con(term);
++}
++
+ static struct grub_term_coordinate
+ grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
+ {
+@@ -243,7 +318,7 @@ grub_console_setcursor (struct grub_term_output *term __attribute__ ((unused)),
+ }
+ 
+ static grub_err_t
+-grub_efi_console_init (struct grub_term_output *term)
++grub_efi_console_output_init (struct grub_term_output *term)
+ {
+   grub_efi_set_text_mode (1);
+   grub_console_setcursor (term, 1);
+@@ -251,7 +326,7 @@ grub_efi_console_init (struct grub_term_output *term)
+ }
+ 
+ static grub_err_t
+-grub_efi_console_fini (struct grub_term_output *term)
++grub_efi_console_output_fini (struct grub_term_output *term)
+ {
+   grub_console_setcursor (term, 0);
+   grub_efi_set_text_mode (0);
+@@ -262,13 +337,14 @@ static struct grub_term_input grub_console_term_input =
+   {
+     .name = "console",
+     .getkey = grub_console_getkey,
++    .init = grub_efi_console_input_init,
+   };
+ 
+ static struct grub_term_output grub_console_term_output =
+   {
+     .name = "console",
+-    .init = grub_efi_console_init,
+-    .fini = grub_efi_console_fini,
++    .init = grub_efi_console_output_init,
++    .fini = grub_efi_console_output_fini,
+     .putchar = grub_console_putchar,
+     .getwh = grub_console_getwh,
+     .getxy = grub_console_getxy,
+@@ -291,8 +367,8 @@ grub_console_init (void)
+       return;
+     }
+ 
+-  grub_term_register_input ("console", &grub_console_term_input);
+   grub_term_register_output ("console", &grub_console_term_output);
++  grub_term_register_input ("console", &grub_console_term_input);
+ }
+ 
+ void
+diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
+index e5dd543..1423403 100644
+--- a/include/grub/efi/api.h
++++ b/include/grub/efi/api.h
+@@ -111,7 +111,7 @@
+     { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
+   }
+ 
+-#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
++#define GRUB_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
+   { 0xdd9e7534, 0x7762, 0x4698, \
+     { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } \
+   }
+@@ -952,6 +952,32 @@ struct grub_efi_input_key
+ };
+ typedef struct grub_efi_input_key grub_efi_input_key_t;
+ 
++typedef grub_efi_uint8_t grub_efi_key_toggle_state_t;
++struct grub_efi_key_state
++{
++	grub_efi_uint32_t key_shift_state;
++	grub_efi_key_toggle_state_t key_toggle_state;
++};
++typedef struct grub_efi_key_state grub_efi_key_state_t;
++
++#define GRUB_EFI_SHIFT_STATE_VALID     0x80000000
++#define GRUB_EFI_RIGHT_SHIFT_PRESSED   0x00000001
++#define GRUB_EFI_LEFT_SHIFT_PRESSED    0x00000002
++#define GRUB_EFI_RIGHT_CONTROL_PRESSED 0x00000004
++#define GRUB_EFI_LEFT_CONTROL_PRESSED  0x00000008
++#define GRUB_EFI_RIGHT_ALT_PRESSED     0x00000010
++#define GRUB_EFI_LEFT_ALT_PRESSED      0x00000020
++#define GRUB_EFI_RIGHT_LOGO_PRESSED    0x00000040
++#define GRUB_EFI_LEFT_LOGO_PRESSED     0x00000080
++#define GRUB_EFI_MENU_KEY_PRESSED      0x00000100
++#define GRUB_EFI_SYS_REQ_PRESSED       0x00000200
++
++#define GRUB_EFI_TOGGLE_STATE_VALID 0x80
++#define GRUB_EFI_KEY_STATE_EXPOSED  0x40
++#define GRUB_EFI_SCROLL_LOCK_ACTIVE 0x01
++#define GRUB_EFI_NUM_LOCK_ACTIVE    0x02
++#define GRUB_EFI_CAPS_LOCK_ACTIVE   0x04
++
+ struct grub_efi_simple_text_output_mode
+ {
+   grub_efi_int32_t max_mode;
+@@ -1294,6 +1320,43 @@ struct grub_efi_simple_input_interface
+ };
+ typedef struct grub_efi_simple_input_interface grub_efi_simple_input_interface_t;
+ 
++struct grub_efi_key_data {
++	grub_efi_input_key_t key;
++	grub_efi_key_state_t key_state;
++};
++typedef struct grub_efi_key_data grub_efi_key_data_t;
++
++typedef grub_efi_status_t (*grub_efi_key_notify_function_t) (
++	grub_efi_key_data_t *key_data
++	);
++
++struct grub_efi_simple_text_input_ex_interface
++{
++	grub_efi_status_t
++	(*reset) (struct grub_efi_simple_text_input_ex_interface *this,
++		  grub_efi_boolean_t extended_verification);
++
++	grub_efi_status_t
++	(*read_key_stroke) (struct grub_efi_simple_text_input_ex_interface *this,
++			    grub_efi_key_data_t *key_data);
++
++	grub_efi_event_t wait_for_key;
++
++	grub_efi_status_t
++	(*set_state) (struct grub_efi_simple_text_input_ex_interface *this,
++		      grub_efi_key_toggle_state_t *key_toggle_state);
++
++	grub_efi_status_t
++	(*register_key_notify) (struct grub_efi_simple_text_input_ex_interface *this,
++				grub_efi_key_data_t *key_data,
++				grub_efi_key_notify_function_t key_notification_function);
++
++	grub_efi_status_t
++	(*unregister_key_notify) (struct grub_efi_simple_text_input_ex_interface *this,
++				  void *notification_handle);
++};
++typedef struct grub_efi_simple_text_input_ex_interface grub_efi_simple_text_input_ex_interface_t;
++
+ struct grub_efi_simple_text_output_interface
+ {
+   grub_efi_status_t
+-- 
+1.9.3
+
diff --git a/SOURCES/0130-May-as-well-try-it.patch b/SOURCES/0130-May-as-well-try-it.patch
new file mode 100644
index 0000000..f8b611d
--- /dev/null
+++ b/SOURCES/0130-May-as-well-try-it.patch
@@ -0,0 +1,1962 @@
+From bd4b1ae40c743174fc0236851855dfaf6094f875 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Tue, 4 Mar 2014 11:00:23 -0500
+Subject: [PATCH 130/143] May as well try it.
+
+---
+ conf/Makefile.extra-dist          |   1 -
+ configure.ac                      |  23 ++++++
+ docs/Makefile.am                  |   2 -
+ docs/man/grub-bios-setup.h2m      |   6 --
+ docs/man/grub-editenv.h2m         |   5 --
+ docs/man/grub-emu.h2m             |   6 --
+ docs/man/grub-file.h2m            |   2 -
+ docs/man/grub-fstest.h2m          |   4 -
+ docs/man/grub-glue-efi.h2m        |   4 -
+ docs/man/grub-install.h2m         |   6 --
+ docs/man/grub-kbdcomp.h2m         |  10 ---
+ docs/man/grub-macbless.h2m        |   4 -
+ docs/man/grub-macho2img.h2m       |   4 -
+ docs/man/grub-menulst2cfg.h2m     |   4 -
+ docs/man/grub-mkconfig.h2m        |   4 -
+ docs/man/grub-mkfont.h2m          |   4 -
+ docs/man/grub-mkimage.h2m         |   6 --
+ docs/man/grub-mklayout.h2m        |  10 ---
+ docs/man/grub-mknetdir.h2m        |   4 -
+ docs/man/grub-mkpasswd-pbkdf2.h2m |   4 -
+ docs/man/grub-mkrelpath.h2m       |   4 -
+ docs/man/grub-mkrescue.h2m        |   4 -
+ docs/man/grub-mkstandalone.h2m    |   4 -
+ docs/man/grub-mount.h2m           |   2 -
+ docs/man/grub-ofpathname.h2m      |   4 -
+ docs/man/grub-pe2elf.h2m          |   4 -
+ docs/man/grub-probe.h2m           |   4 -
+ docs/man/grub-reboot.h2m          |   5 --
+ docs/man/grub-render-label.h2m    |   3 -
+ docs/man/grub-script-check.h2m    |   4 -
+ docs/man/grub-set-default.h2m     |   5 --
+ docs/man/grub-sparc64-setup.h2m   |   6 --
+ docs/man/grub-syslinux2cfg.h2m    |   4 -
+ gentpl.py                         |   5 +-
+ util/grub-bios-setup.8            |  54 +++++++++++++
+ util/grub-editenv.1               |  46 +++++++++++
+ util/grub-file.1                  | 165 ++++++++++++++++++++++++++++++++++++++
+ util/grub-fstest.1                |  99 +++++++++++++++++++++++
+ util/grub-glue-efi.1              |  31 +++++++
+ util/grub-install.8               | 129 +++++++++++++++++++++++++++++
+ util/grub-kbdcomp.1               |  19 +++++
+ util/grub-macbless.1              |  22 +++++
+ util/grub-menulst2cfg.1           |  12 +++
+ util/grub-mkconfig.8              |  17 ++++
+ util/grub-mkfont.1                |  87 ++++++++++++++++++++
+ util/grub-mkimage.1               |  95 ++++++++++++++++++++++
+ util/grub-mklayout.1              |  27 +++++++
+ util/grub-mknetdir.1              |  12 +++
+ util/grub-mkpasswd-pbkdf2.1       |  27 +++++++
+ util/grub-mkrelpath.1             |  12 +++
+ util/grub-mkrescue.1              | 123 ++++++++++++++++++++++++++++
+ util/grub-mkstandalone.1          | 100 +++++++++++++++++++++++
+ util/grub-ofpathname.8            |  12 +++
+ util/grub-probe.8                 |  80 ++++++++++++++++++
+ util/grub-reboot.8                |  21 +++++
+ util/grub-render-label.1          |  51 ++++++++++++
+ util/grub-script-check.1          |  21 +++++
+ util/grub-set-default.8           |  21 +++++
+ util/grub-sparc64-setup.8         |  12 +++
+ 59 files changed, 1319 insertions(+), 147 deletions(-)
+ delete mode 100644 docs/man/grub-bios-setup.h2m
+ delete mode 100644 docs/man/grub-editenv.h2m
+ delete mode 100644 docs/man/grub-emu.h2m
+ delete mode 100644 docs/man/grub-file.h2m
+ delete mode 100644 docs/man/grub-fstest.h2m
+ delete mode 100644 docs/man/grub-glue-efi.h2m
+ delete mode 100644 docs/man/grub-install.h2m
+ delete mode 100644 docs/man/grub-kbdcomp.h2m
+ delete mode 100644 docs/man/grub-macbless.h2m
+ delete mode 100644 docs/man/grub-macho2img.h2m
+ delete mode 100644 docs/man/grub-menulst2cfg.h2m
+ delete mode 100644 docs/man/grub-mkconfig.h2m
+ delete mode 100644 docs/man/grub-mkfont.h2m
+ delete mode 100644 docs/man/grub-mkimage.h2m
+ delete mode 100644 docs/man/grub-mklayout.h2m
+ delete mode 100644 docs/man/grub-mknetdir.h2m
+ delete mode 100644 docs/man/grub-mkpasswd-pbkdf2.h2m
+ delete mode 100644 docs/man/grub-mkrelpath.h2m
+ delete mode 100644 docs/man/grub-mkrescue.h2m
+ delete mode 100644 docs/man/grub-mkstandalone.h2m
+ delete mode 100644 docs/man/grub-mount.h2m
+ delete mode 100644 docs/man/grub-ofpathname.h2m
+ delete mode 100644 docs/man/grub-pe2elf.h2m
+ delete mode 100644 docs/man/grub-probe.h2m
+ delete mode 100644 docs/man/grub-reboot.h2m
+ delete mode 100644 docs/man/grub-render-label.h2m
+ delete mode 100644 docs/man/grub-script-check.h2m
+ delete mode 100644 docs/man/grub-set-default.h2m
+ delete mode 100644 docs/man/grub-sparc64-setup.h2m
+ delete mode 100644 docs/man/grub-syslinux2cfg.h2m
+ create mode 100644 util/grub-bios-setup.8
+ create mode 100644 util/grub-editenv.1
+ create mode 100644 util/grub-file.1
+ create mode 100644 util/grub-fstest.1
+ create mode 100644 util/grub-glue-efi.1
+ create mode 100644 util/grub-install.8
+ create mode 100644 util/grub-kbdcomp.1
+ create mode 100644 util/grub-macbless.1
+ create mode 100644 util/grub-menulst2cfg.1
+ create mode 100644 util/grub-mkconfig.8
+ create mode 100644 util/grub-mkfont.1
+ create mode 100644 util/grub-mkimage.1
+ create mode 100644 util/grub-mklayout.1
+ create mode 100644 util/grub-mknetdir.1
+ create mode 100644 util/grub-mkpasswd-pbkdf2.1
+ create mode 100644 util/grub-mkrelpath.1
+ create mode 100644 util/grub-mkrescue.1
+ create mode 100644 util/grub-mkstandalone.1
+ create mode 100644 util/grub-ofpathname.8
+ create mode 100644 util/grub-probe.8
+ create mode 100644 util/grub-reboot.8
+ create mode 100644 util/grub-render-label.1
+ create mode 100644 util/grub-script-check.1
+ create mode 100644 util/grub-set-default.8
+ create mode 100644 util/grub-sparc64-setup.8
+
+diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
+index 51f08c1..e914dfd 100644
+--- a/conf/Makefile.extra-dist
++++ b/conf/Makefile.extra-dist
+@@ -10,7 +10,6 @@ EXTRA_DIST += unicode
+ EXTRA_DIST += util/import_gcry.py
+ EXTRA_DIST += util/import_unicode.py
+ 
+-EXTRA_DIST += docs/man
+ EXTRA_DIST += docs/autoiso.cfg
+ EXTRA_DIST += docs/grub.cfg
+ EXTRA_DIST += docs/osdetect.cfg
+diff --git a/configure.ac b/configure.ac
+index 8888c2f..2632e2d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -70,6 +70,29 @@ grub_TRANSFORM([grub-set-default])
+ grub_TRANSFORM([grub-sparc64-setup])
+ grub_TRANSFORM([grub-render-label])
+ grub_TRANSFORM([grub-file])
++grub_TRANSFORM([grub-bios-setup.3])
++grub_TRANSFORM([grub-editenv.1])
++grub_TRANSFORM([grub-fstest.3])
++grub_TRANSFORM([grub-glue-efi.3])
++grub_TRANSFORM([grub-install.1])
++grub_TRANSFORM([grub-kbdcomp.3])
++grub_TRANSFORM([grub-menulst2cfg.1])
++grub_TRANSFORM([grub-mkconfig.1])
++grub_TRANSFORM([grub-mkfont.3])
++grub_TRANSFORM([grub-mkimage.1])
++grub_TRANSFORM([grub-mklayout.3])
++grub_TRANSFORM([grub-mknetdir.3])
++grub_TRANSFORM([grub-mkpasswd-pbkdf2.3])
++grub_TRANSFORM([grub-mkrelpath.3])
++grub_TRANSFORM([grub-mkrescue.1])
++grub_TRANSFORM([grub-mkstandalone.3])
++grub_TRANSFORM([grub-ofpathname.3])
++grub_TRANSFORM([grub-probe.3])
++grub_TRANSFORM([grub-reboot.3])
++grub_TRANSFORM([grub-render-label.3])
++grub_TRANSFORM([grub-script-check.3])
++grub_TRANSFORM([grub-set-default.1])
++grub_TRANSFORM([grub-sparc64-setup.3])
+ 
+ # Optimization flag.  Allow user to override.
+ if test "x$TARGET_CFLAGS" = x; then
+diff --git a/docs/Makefile.am b/docs/Makefile.am
+index 93eb396..ab28f19 100644
+--- a/docs/Makefile.am
++++ b/docs/Makefile.am
+@@ -5,5 +5,3 @@ info_TEXINFOS = grub.texi grub-dev.texi
+ grub_TEXINFOS = fdl.texi
+ 
+ EXTRA_DIST = font_char_metrics.png font_char_metrics.txt
+-
+-
+diff --git a/docs/man/grub-bios-setup.h2m b/docs/man/grub-bios-setup.h2m
+deleted file mode 100644
+index ac6ede3..0000000
+--- a/docs/man/grub-bios-setup.h2m
++++ /dev/null
+@@ -1,6 +0,0 @@
+-[NAME]
+-grub-bios-setup \- set up a device to boot using GRUB
+-[SEE ALSO]
+-.BR grub-install (8),
+-.BR grub-mkimage (1),
+-.BR grub-mkrescue (1)
+diff --git a/docs/man/grub-editenv.h2m b/docs/man/grub-editenv.h2m
+deleted file mode 100644
+index 3859d3d..0000000
+--- a/docs/man/grub-editenv.h2m
++++ /dev/null
+@@ -1,5 +0,0 @@
+-[NAME]
+-grub-editenv \- edit GRUB environment block
+-[SEE ALSO]
+-.BR grub-reboot (8),
+-.BR grub-set-default (8)
+diff --git a/docs/man/grub-emu.h2m b/docs/man/grub-emu.h2m
+deleted file mode 100644
+index ef1c000..0000000
+--- a/docs/man/grub-emu.h2m
++++ /dev/null
+@@ -1,6 +0,0 @@
+-[NAME]
+-grub-emu \- GRUB emulator
+-[SEE ALSO]
+-If you are trying to install GRUB, then you should use
+-.BR grub-install (8)
+-rather than this program.
+diff --git a/docs/man/grub-file.h2m b/docs/man/grub-file.h2m
+deleted file mode 100644
+index e09bb4d..0000000
+--- a/docs/man/grub-file.h2m
++++ /dev/null
+@@ -1,2 +0,0 @@
+-[NAME]
+-grub-file \- check file type
+diff --git a/docs/man/grub-fstest.h2m b/docs/man/grub-fstest.h2m
+deleted file mode 100644
+index 9676b15..0000000
+--- a/docs/man/grub-fstest.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-fstest \- debug tool for GRUB filesystem drivers
+-[SEE ALSO]
+-.BR grub-probe (8)
+diff --git a/docs/man/grub-glue-efi.h2m b/docs/man/grub-glue-efi.h2m
+deleted file mode 100644
+index c1c6ded..0000000
+--- a/docs/man/grub-glue-efi.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-glue-efi \- generate a fat binary for EFI
+-[DESCRIPTION]
+-grub-glue-efi processes ia32 and amd64 EFI images and glues them according to Apple format.
+diff --git a/docs/man/grub-install.h2m b/docs/man/grub-install.h2m
+deleted file mode 100644
+index 8cbbc87..0000000
+--- a/docs/man/grub-install.h2m
++++ /dev/null
+@@ -1,6 +0,0 @@
+-[NAME]
+-grub-install \- install GRUB to a device
+-[SEE ALSO]
+-.BR grub-mkconfig (8),
+-.BR grub-mkimage (1),
+-.BR grub-mkrescue (1)
+diff --git a/docs/man/grub-kbdcomp.h2m b/docs/man/grub-kbdcomp.h2m
+deleted file mode 100644
+index d81f915..0000000
+--- a/docs/man/grub-kbdcomp.h2m
++++ /dev/null
+@@ -1,10 +0,0 @@
+-[NAME]
+-grub-kbdcomp \- generate a GRUB keyboard layout file
+-[DESCRIPTION]
+-grub-kbdcomp processes a X keyboard layout description in
+-.BR keymaps (5)
+-format into a format that can be used by GRUB's
+-.B keymap
+-command.
+-[SEE ALSO]
+-.BR grub-mklayout (8)
+diff --git a/docs/man/grub-macbless.h2m b/docs/man/grub-macbless.h2m
+deleted file mode 100644
+index 0197c00..0000000
+--- a/docs/man/grub-macbless.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-macbless \- bless a mac file/directory
+-[SEE ALSO]
+-.BR grub-install (1)
+diff --git a/docs/man/grub-macho2img.h2m b/docs/man/grub-macho2img.h2m
+deleted file mode 100644
+index d79aaee..0000000
+--- a/docs/man/grub-macho2img.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-macho2img \- convert Mach-O to raw image
+-[SEE ALSO]
+-.BR grub-mkimage (1)
+diff --git a/docs/man/grub-menulst2cfg.h2m b/docs/man/grub-menulst2cfg.h2m
+deleted file mode 100644
+index c2e0055..0000000
+--- a/docs/man/grub-menulst2cfg.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-menulst2cfg \- transform legacy menu.lst into grub.cfg
+-[SEE ALSO]
+-.BR grub-mkconfig (8)
+diff --git a/docs/man/grub-mkconfig.h2m b/docs/man/grub-mkconfig.h2m
+deleted file mode 100644
+index 9b42f81..0000000
+--- a/docs/man/grub-mkconfig.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-mkconfig \- generate a GRUB configuration file
+-[SEE ALSO]
+-.BR grub-install (8)
+diff --git a/docs/man/grub-mkfont.h2m b/docs/man/grub-mkfont.h2m
+deleted file mode 100644
+index d46fe60..0000000
+--- a/docs/man/grub-mkfont.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-mkfont \- make GRUB font files
+-[SEE ALSO]
+-.BR grub-mkconfig (8)
+diff --git a/docs/man/grub-mkimage.h2m b/docs/man/grub-mkimage.h2m
+deleted file mode 100644
+index f0fbc2b..0000000
+--- a/docs/man/grub-mkimage.h2m
++++ /dev/null
+@@ -1,6 +0,0 @@
+-[NAME]
+-grub-mkimage \- make a bootable image of GRUB
+-[SEE ALSO]
+-.BR grub-install (8),
+-.BR grub-mkrescue (1),
+-.BR grub-mknetdir (8)
+diff --git a/docs/man/grub-mklayout.h2m b/docs/man/grub-mklayout.h2m
+deleted file mode 100644
+index 1e43409..0000000
+--- a/docs/man/grub-mklayout.h2m
++++ /dev/null
+@@ -1,10 +0,0 @@
+-[NAME]
+-grub-mklayout \- generate a GRUB keyboard layout file
+-[DESCRIPTION]
+-grub-mklayout processes a keyboard layout description in
+-.BR keymaps (5)
+-format into a format that can be used by GRUB's
+-.B keymap
+-command.
+-[SEE ALSO]
+-.BR grub-mkconfig (8)
+diff --git a/docs/man/grub-mknetdir.h2m b/docs/man/grub-mknetdir.h2m
+deleted file mode 100644
+index a2ef13e..0000000
+--- a/docs/man/grub-mknetdir.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-mknetdir \- prepare a GRUB netboot directory.
+-[SEE ALSO]
+-.BR grub-mkimage (1)
+diff --git a/docs/man/grub-mkpasswd-pbkdf2.h2m b/docs/man/grub-mkpasswd-pbkdf2.h2m
+deleted file mode 100644
+index 4d202f3..0000000
+--- a/docs/man/grub-mkpasswd-pbkdf2.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-mkpasswd-pbkdf2 \- generate hashed password for GRUB
+-[SEE ALSO]
+-.BR grub-mkconfig (8)
+diff --git a/docs/man/grub-mkrelpath.h2m b/docs/man/grub-mkrelpath.h2m
+deleted file mode 100644
+index d01f396..0000000
+--- a/docs/man/grub-mkrelpath.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-mkrelpath \- make a system path relative to its root
+-[SEE ALSO]
+-.BR grub-probe (8)
+diff --git a/docs/man/grub-mkrescue.h2m b/docs/man/grub-mkrescue.h2m
+deleted file mode 100644
+index a427f02..0000000
+--- a/docs/man/grub-mkrescue.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-mkrescue \- make a GRUB rescue image
+-[SEE ALSO]
+-.BR grub-mkimage (1)
+diff --git a/docs/man/grub-mkstandalone.h2m b/docs/man/grub-mkstandalone.h2m
+deleted file mode 100644
+index c773139..0000000
+--- a/docs/man/grub-mkstandalone.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-mkstandalone \- make a memdisk-based GRUB image
+-[SEE ALSO]
+-.BR grub-mkimage (1)
+diff --git a/docs/man/grub-mount.h2m b/docs/man/grub-mount.h2m
+deleted file mode 100644
+index 8d16898..0000000
+--- a/docs/man/grub-mount.h2m
++++ /dev/null
+@@ -1,2 +0,0 @@
+-[NAME]
+-grub-mount \- export GRUB filesystem with FUSE
+diff --git a/docs/man/grub-ofpathname.h2m b/docs/man/grub-ofpathname.h2m
+deleted file mode 100644
+index 74b43ee..0000000
+--- a/docs/man/grub-ofpathname.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-ofpathname \- find OpenBOOT path for a device
+-[SEE ALSO]
+-.BR grub-probe (8)
+diff --git a/docs/man/grub-pe2elf.h2m b/docs/man/grub-pe2elf.h2m
+deleted file mode 100644
+index 7ca29bd..0000000
+--- a/docs/man/grub-pe2elf.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-pe2elf \- convert PE image to ELF
+-[SEE ALSO]
+-.BR grub-mkimage (1)
+diff --git a/docs/man/grub-probe.h2m b/docs/man/grub-probe.h2m
+deleted file mode 100644
+index 6e1ffdc..0000000
+--- a/docs/man/grub-probe.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-probe \- probe device information for GRUB
+-[SEE ALSO]
+-.BR grub-fstest (1)
+diff --git a/docs/man/grub-reboot.h2m b/docs/man/grub-reboot.h2m
+deleted file mode 100644
+index e4acace..0000000
+--- a/docs/man/grub-reboot.h2m
++++ /dev/null
+@@ -1,5 +0,0 @@
+-[NAME]
+-grub-reboot \- set the default boot entry for GRUB, for the next boot only
+-[SEE ALSO]
+-.BR grub-set-default (8),
+-.BR grub-editenv (1)
+diff --git a/docs/man/grub-render-label.h2m b/docs/man/grub-render-label.h2m
+deleted file mode 100644
+index 50ae524..0000000
+--- a/docs/man/grub-render-label.h2m
++++ /dev/null
+@@ -1,3 +0,0 @@
+-[NAME]
+-grub-render-label \- generate a .disk_label for Apple Macs.
+-
+diff --git a/docs/man/grub-script-check.h2m b/docs/man/grub-script-check.h2m
+deleted file mode 100644
+index 3653682..0000000
+--- a/docs/man/grub-script-check.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-script-check \- check grub.cfg for syntax errors
+-[SEE ALSO]
+-.BR grub-mkconfig (8)
+diff --git a/docs/man/grub-set-default.h2m b/docs/man/grub-set-default.h2m
+deleted file mode 100644
+index 7945001..0000000
+--- a/docs/man/grub-set-default.h2m
++++ /dev/null
+@@ -1,5 +0,0 @@
+-[NAME]
+-grub-set-default \- set the saved default boot entry for GRUB
+-[SEE ALSO]
+-.BR grub-reboot (8),
+-.BR grub-editenv (1)
+diff --git a/docs/man/grub-sparc64-setup.h2m b/docs/man/grub-sparc64-setup.h2m
+deleted file mode 100644
+index 18f803a..0000000
+--- a/docs/man/grub-sparc64-setup.h2m
++++ /dev/null
+@@ -1,6 +0,0 @@
+-[NAME]
+-grub-sparc64-setup \- set up a device to boot using GRUB
+-[SEE ALSO]
+-.BR grub-install (8),
+-.BR grub-mkimage (1),
+-.BR grub-mkrescue (1)
+diff --git a/docs/man/grub-syslinux2cfg.h2m b/docs/man/grub-syslinux2cfg.h2m
+deleted file mode 100644
+index ad25c8a..0000000
+--- a/docs/man/grub-syslinux2cfg.h2m
++++ /dev/null
+@@ -1,4 +0,0 @@
+-[NAME]
+-grub-syslinux2cfg \- transform syslinux config into grub.cfg
+-[SEE ALSO]
+-.BR grub-menulst2cfg (8)
+diff --git a/gentpl.py b/gentpl.py
+index bdcae1a..889cc91 100644
+--- a/gentpl.py
++++ b/gentpl.py
+@@ -792,10 +792,7 @@ def manpage(defn, adddeps):
+ 
+     output("if COND_MAN_PAGES\n")
+     gvar_add("man_MANS", name + "." + mansection)
+-    rule(name + "." + mansection, name + " " + adddeps, """
+-chmod a+x """ + name + """
+-PATH=$(builddir):$$PATH pkgdatadir=$(builddir) $(HELP2MAN) --section=""" + mansection + """ -i $(top_srcdir)/docs/man/""" + name + """.h2m -o $@ """ + name + """
+-""")
++    rule(name + "." + mansection, name + " " + adddeps, "cat $(top_srcdir)/util/" + name + "." + mansection + " | $(top_builddir)/config.status --file=$@:-")
+     gvar_add("CLEANFILES", name + "." + mansection)
+     output("endif\n")
+ 
+diff --git a/util/grub-bios-setup.8 b/util/grub-bios-setup.8
+new file mode 100644
+index 0000000..56f582b
+--- /dev/null
++++ b/util/grub-bios-setup.8
+@@ -0,0 +1,54 @@
++.TH GRUB-BIOS-SETUP 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-bios-setup\fR \(em Set up images to boot from a device.
++
++.SH SYNOPSIS
++\fBgrub-bios-setup\fR [-a | --allow-floppy] [-b | --boot-image=\fIFILE\fR]
++.RS 17
++[-c | --core-image=\fIFILE\fR] [-d | --directory=\fIDIR\fR]
++.RE
++.RS 17
++[-f | --force] [-m | --device-map=\fIFILE\fR]
++.RE
++.RS 17
++[-s | --skip-fs-probe] [-v | --verbose] \fIDEVICE\fR
++
++.SH DESCRIPTION
++You should not normally run this program directly.  Use grub-install instead.
++
++.SH OPTIONS
++.TP
++\fB--allow-floppy\fR
++Make the device also bootable as a floppy.  This option is the default for
++/dev/fdX devices.  Some BIOSes will not boot images created with this option.
++
++.TP
++\fB--boot-image\fR=\fIFILE\fR
++Use FILE as the boot image.  The default value is \fBboot.img\fR.
++
++.TP
++\fB--core-image\fR=\fIFILE\fR
++Use FILE as ther core image.  The default value is \fBcore.img\fR.
++
++.TP
++\fB--directory\fR=\fIDIR\fR
++Use GRUB files in the directory DIR.  The default value is \fB/boot/grub\fR.
++
++.TP
++\fB--force\fR
++Install even if problems are detected.
++
++.TP
++\fB--device-map\fR=\fIFILE\fR
++Use FILE as the device map.  The default value is /boot/grub/device.map .
++
++.TP
++\fB--skip-fs-probe\fR
++Do not probe DEVICE for filesystems.
++
++.TP
++\fB--verbose\fR
++Print verbose messages.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-editenv.1 b/util/grub-editenv.1
+new file mode 100644
+index 0000000..8dad33f
+--- /dev/null
++++ b/util/grub-editenv.1
+@@ -0,0 +1,46 @@
++.TH GRUB-EDITENV 1 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-editenv\fR \(em Manage the GRUB environment block.
++
++.SH SYNOPSIS
++\fBgrub-editenv\fR [-v | --verbose] [\fIFILE\fR]
++.RS 14
++<create | list | set \fINAME\fR=\fIVALUE\fR | unset \fINAME\fR>
++
++.SH DESCRIPTION
++\fBgrub-editenv\fR is a command line tool to manage GRUB's stored environment.
++
++.SH OPTIONS
++.TP
++\fB--verbose\fR 
++Print verbose messages.
++
++.TP
++\fBFILE\fR
++.RS 7
++File name to use for grub environment.  Default is /boot/grub/grubenv .
++.RE
++
++.SH COMMANDS
++.TP
++\fBcreate\fR
++.RS 7
++Create a blank environment block file.
++.RE
++
++.TP
++\fBlist\fR
++.RS 7
++List the current variables.
++.RE
++
++.TP
++\fBset\fR [\fINAME\fR=\fIVALUE\fR ...]
++Set variables.
++
++.TP
++\fBunset [\fINAME\fR ...]
++Delete variables.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-file.1 b/util/grub-file.1
+new file mode 100644
+index 0000000..b29cb32
+--- /dev/null
++++ b/util/grub-file.1
+@@ -0,0 +1,165 @@
++.TH GRUB-FILE 1 "Web Feb 26 2014"
++.SH NAME
++\fBgrub-file\fR \(em Check if FILE is of specified type.
++
++.SH SYNOPSIS
++\fBgrub-file\fR (--is-i386-xen-pae-domu | --is-x86_64-xen-domu |
++.RS 11
++--is-x86-xen-dom0 | --is-x86-multiboot |
++.RE
++.RS 11
++--is-x86-multiboot2 | --is-arm-linux | --is-arm64-linux |
++.RE
++.RS 11
++--is-ia64-linux | --is-mips-linux | --is-mipsel-linux |
++.RE
++.RS 11
++--is-sparc64-linux | --is-powerpc-linux | --is-x86-linux |
++.RE
++.RS 11
++--is-x86-linux32 | --is-x86-kfreebsd | --is-i386-kfreebsd |
++.RE
++.RS 11
++--is-x86_64-kfreebsd | --is-x86-knetbsd |
++.RE
++.RS 11
++--is-i386-knetbsd | --is-x86_64-knetbsd | --is-i386-efi |
++.RE
++.RS 11
++--is-x86_64-efi | --is-ia64-efi | --is-arm64-efi |
++.RE
++.RS 11
++--is-arm-efi | --is-hibernated-hiberfil | --is-x86_64-xnu |
++.RE
++.RS 11
++--is-i386-xnu | --is-xnu-hibr | --is-x86-bios-bootsector)
++.RE
++.RS 11
++\fIFILE\fR
++
++.SH DESCRIPTION
++\fBgrub-file\fR is used to check if \fIFILE\fR is of a specified type.
++
++.SH OPTIONS
++.TP
++--is-i386-xen-pae-domu
++Check if FILE can be booted as i386 PAE Xen unprivileged guest kernel
++
++.TP
++--is-x86_64-xen-domu
++Check if FILE can be booted as x86_64 Xen unprivileged guest kernel
++
++.TP
++--is-x86-xen-dom0
++Check if FILE can be used as Xen x86 privileged guest kernel
++
++.TP
++--is-x86-multiboot
++Check if FILE can be used as x86 multiboot kernel
++
++.TP
++--is-x86-multiboot2
++Check if FILE can be used as x86 multiboot2 kernel
++
++.TP
++--is-arm-linux
++Check if FILE is ARM Linux
++
++.TP
++--is-arm64-linux
++Check if FILE is ARM64 Linux
++
++.TP
++--is-ia64-linux
++Check if FILE is IA64 Linux
++
++.TP
++--is-mips-linux
++Check if FILE is MIPS Linux
++
++.TP
++--is-mipsel-linux
++Check if FILE is MIPSEL Linux
++
++.TP
++--is-sparc64-linux
++Check if FILE is SPARC64 Linux
++
++.TP
++--is-powerpc-linux
++Check if FILE is POWERPC Linux
++
++.TP
++--is-x86-linux
++Check if FILE is x86 Linux
++
++.TP
++--is-x86-linux32
++Check if FILE is x86 Linux supporting 32-bit protocol
++
++.TP
++--is-x86-kfreebsd
++Check if FILE is x86 kFreeBSD
++
++.TP
++--is-i386-kfreebsd
++Check if FILE is i386 kFreeBSD
++
++.TP
++--is-x86_64-kfreebsd
++Check if FILE is x86_64 kFreeBSD
++
++.TP
++--is-x86-knetbsd
++Check if FILE is x86 kNetBSD
++
++.TP
++--is-i386-knetbsd
++Check if FILE is i386 kNetBSD
++
++.TP
++--is-x86_64-knetbsd
++Check if FILE is x86_64 kNetBSD
++
++.TP
++--is-i386-efi
++Check if FILE is i386 EFI file
++
++.TP
++--is-x86_64-efi
++Check if FILE is x86_64 EFI file
++
++.TP
++--is-ia64-efi
++Check if FILE is IA64 EFI file
++
++.TP
++--is-arm64-efi
++Check if FILE is ARM64 EFI file
++
++.TP
++--is-arm-efi
++Check if FILE is ARM EFI file
++
++.TP
++--is-hibernated-hiberfil
++Check if FILE is hiberfil.sys in hibernated state
++
++.TP
++--is-x86_64-xnu
++Check if FILE is x86_64 XNU (Mac OS X kernel)
++
++.TP
++--is-i386-xnu
++Check if FILE is i386 XNU (Mac OS X kernel)
++
++.TP
++--is-xnu-hibr
++Check if FILE is XNU (Mac OS X kernel) hibernated image
++
++.TP
++--is-x86-bios-bootsector
++Check if FILE is BIOS bootsector
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-fstest.1 b/util/grub-fstest.1
+new file mode 100644
+index 0000000..792fa78
+--- /dev/null
++++ b/util/grub-fstest.1
+@@ -0,0 +1,99 @@
++.TH GRUB-FSTEST 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-fstest\fR — Debug tool for GRUB's filesystem driver.
++
++.SH SYNOPSIS
++\fBgrub-fstest\fR [-c | --diskcount=\fINUM\fR] [-C | --crypto]
++.RS 13
++[-d | --debug=\fISTRING\fR] [-K | --zfs-key=\fIFILE\fR|\fIprompt\fR]
++.RE
++.RS 13
++[-n | --length=\fINUM\fR] [-r | --root=\fIDEVICE_NAME\fR]
++.RE
++.RS 13
++[-s | --skip=\fINUM\fR] [-u | --uncompress] [-v | --verbose]
++.RE
++.RS 13
++\fIIMAGE_PATH\fR <blocklist \fIFILE\fR | cat \fIFILE\fR |
++.RE
++.RS 13
++cmp \fIFILE\fR \fILOCAL\fR | cp \fIFILE\fR \fILOCAL\fR | crc \fIFILE\fR |
++.RE
++.RS 13
++hex \fIFILE\fR | ls \fIPATH\fR | xnu_uuid \fIDEVICE\fR>
++
++.SH DESCRIPTION
++\fBgrub-fstest\fR is a tool for testing GRUB's filesystem drivers.  You should not normally need to run this program.
++
++.SH OPTIONS
++.TP
++\fB--diskcount\fR=\fINUM\fR
++Specify the number of input files.
++
++.TP
++\fB--crypto\fR
++Mount cryptographic devices.
++
++.TP
++\fB--debug\fR=\fISTRING\fR
++Set debug environment variable.
++
++.TP
++\fB--zfs-key\fR=\fIFILE\fR|\fIprompt\fR
++Load ZFS cryptographic key.
++
++.TP
++\fB--length\fR=\fINUM\fR
++Handle NUM bytes in output file.
++
++.TP
++\fB--root\fR=\fIDEVICE_NAME\fR
++Set root device.
++
++.TP
++\fB--skip\fR=\fINUM\fR
++Skip NUM bytes from output file.
++
++.TP
++\fB--uncompress\fR
++Uncompress data.
++
++.TP
++\fB--verbose\fR
++Print verbose messages.
++
++.SH COMMANDS
++.TP
++\fBblocklist\fR \fIFILE\fR
++Display block list of \fIFILE\fR.
++
++.TP
++\fBcat\fR \fIFILE\fR
++Display \fIFILE\fR on standard output.
++
++.TP
++\fBcmp\fR \fIFILE\fR \fILOCAL\fR
++Compare \fIFILE\fR with local file \fILOCAL\fR.
++
++.TP
++\fBcp\fR \fIFILE\fR \fILOCAL\fR
++Copy \fIFILE\fR to local file \fILOCAL\fR.
++
++.TP
++\fBcrc\fR \fIFILE\fR
++Display the CRC-32 checksum of \fIFILE\fR.
++
++.TP
++\fBhex\fR \fIFILE\fR
++Display contents of \fIFILE\fR in hexidecimal.
++
++.TP
++\fBls\fR \fIPATH\fR
++List files at \fIPATH\fR.
++
++.TP
++\fBxnu_uuid\fR \fIDEVICE\fR
++Display the XNU UUID of \fIDEVICE\fR.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-glue-efi.1 b/util/grub-glue-efi.1
+new file mode 100644
+index 0000000..72bd555
+--- /dev/null
++++ b/util/grub-glue-efi.1
+@@ -0,0 +1,31 @@
++.TH GRUB-GLUE-EFI 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-glue-efi\fR \(em Create an Apple fat EFI binary.
++
++.SH SYNOPSIS
++\fBgrub-glue-efi\fR <-3 | --input32=\fIFILE\fR> <-6 | --input64=\fIFILE\fR>
++.RS 15
++<-o | --output=\fIFILE\fR> [-v | --verbose]
++
++.SH DESCRIPTION
++\fBgrub-glue-efi\fR creates an Apple fat EFI binary from two EFI binaries.
++
++.SH OPTIONS
++.TP
++\fB--input32\fR=\fIFILE\fR
++Read 32-bit binary from \fIFILE\fR.
++
++.TP
++\fB--input64\fR=\fIFILE\fR
++Read 64-bit binary from \fIFILE\fR.
++
++.TP
++\fB--output\fR=\fIFILE\fR
++Write resulting fat binary to \fIFILE\fR.
++
++.TP
++\fB--verbose\fR
++Print verbose messages.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-install.8 b/util/grub-install.8
+new file mode 100644
+index 0000000..76272a3
+--- /dev/null
++++ b/util/grub-install.8
+@@ -0,0 +1,129 @@
++.TH GRUB-INSTALL 1 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-install\fR \(em Install GRUB on a device.
++
++.SH SYNOPSIS
++\fBgrub-install\fR [--modules=\fIMODULES\fR] [--install-modules=\fIMODULES\fR]
++.RS 14
++[--themes=\fITHEMES\fR] [--fonts=\fIFONTS\fR] [--locales=\fILOCALES\fR]
++.RE
++.RS 14
++[--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]] [-d | --directory=\fIDIR\fR]
++.RE
++.RS 14
++[--grub-mkimage=\fIFILE\fR] [--boot-directory=\fIDIR\fR]
++.RE
++.RS 14
++[--target=\fITARGET\fR] [--grub-setup=\fIFILE\fR]
++.RE
++.RS 14
++[--grub-mkrelpath=\fIFILE\fR] [--grub-probe=\fIFILE\fR]
++.RE
++.RS 14
++[--allow-floppy] [--recheck] [--force] [--force-file-id]
++.RE
++.RS 14
++[--disk-module=\fIMODULE\fR] [--no-nvram] [--removable]
++.RE
++.RS 14
++[--bootloader-id=\fIID\fR] [--efi-directory=\fIDIR\fR] \fIINSTALL_DEVICE\fR
++
++.SH DESCRIPTION
++\fBgrub-install\fR installs GRUB onto a device.  This includes copying GRUB images into the target directory (generally \fI/boot/grub\fR), and on some platforms may also include installing GRUB onto a boot sector.
++
++.SH OPTIONS
++.TP
++\fB--modules\fR=\fIMODULES\fR\!
++Pre-load modules specified by \fIMODULES\fR.
++
++.TP
++\fB--install-modules\fR=\fIMODULES\fR
++Install only \fIMODULES\fR and their dependencies.  The default is to install all available modules.
++
++.TP
++\fB--themes\fR=\fITHEMES\fR
++Install \fITHEMES\fR.  The default is to install the \fIstarfield\fR theme, if available.
++
++.TP
++\fB--fonts\fR=\fIFONTS\fR
++Install \fIFONTS\fR.  The default is to install the \fIunicode\fR font.
++
++.TP
++\fB--locales\fR=\fILOCALES\fR
++Install only locales listed in \fILOCALES\fR.  The default is to install all available locales.
++
++.TP
++\fB--compress\fR=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR
++Compress GRUB files using the specified compression algorithm.
++
++.TP
++\fB--directory\fR=\fIDIR\fR
++Use images and modules in \fIDIR\fR.
++
++.TP
++\fB--grub-mkimage\fR=\fIFILE\fR
++Use \fIFILE\fR as \fBgrub-mkimage\fR.  The default is \fI/usr/bin/grub-mkimage\fR.
++
++.TP
++\fB--boot-directory\fR=\fIDIR\fR
++Use \fIDIR\fR as the boot directory.  The default is \fI/boot\fR.  GRUB will put its files in a subdirectory of this directory named \fIgrub\fR.
++
++.TP
++\fB--target\fR=\fITARGET\fR
++Install GRUB for \fITARGET\fR platform.  The default is the platform \fBgrub-install\fR is running on.
++
++.TP
++\fB--grub-setup\fR=\fIFILE\fR
++Use \fIFILE\fR as \fBgrub-setup\fR.  The default is \fI/usr/bin/grub-setup\fR.
++
++.TP
++\fB--grub-mkrelpath\fR=\fIFILE\fR
++Use \fIFILE\fR as \fBgrub-mkrelpath\fR.  The default is \fI/usr/bin/grub-mkrelpath\fR.
++
++.TP
++\fB--grub-probe\fR=\fIFILE\fR
++Use \fIFILE\fR as \fBgrub-probe\fR.  The default is \fI/usr/bin/grub-mkrelpath\fR.
++
++.TP
++\fB--allow-floppy
++Make the device also bootable as a floppy.  This option is the default for /dev/fdX devices. Some BIOSes will not boot images created with this option.
++
++.TP
++\fB--recheck
++Delete any existing device map and create a new one if necessary.
++
++.TP
++\fB--force
++Install even if problems are detected.
++
++.TP
++\fB--force-file-id
++Use identifier file even if UUID is available.
++
++.TP
++\fB--disk-module\fR=\fIMODULE\fR
++Use \fIMODULE\fR for disk access.  This allows you to manually specify either \fIbiosdisk\fR or \fInative\fR disk access.  This option is only available on the BIOS target platform.
++
++.TP
++\fB--no-nvram
++Do not update the \fIboot-device\fR NVRAM variable.  This option is only available on IEEE1275 target platforms.
++
++.TP
++\fB--removable
++Treat the target device as if it is removeable.  This option is only available on the EFI target platform.
++
++.TP
++\fB--bootloader-id\fR=\fIID\fR
++Use \fIID\fR as the bootloader ID.  This opption is only available on the EFI target platform.
++
++.TP
++\fB--efi-directory\fR=\fIDIR\fR
++Use \fIDIR\fR as the EFI System Partition root.  This opption is only available on the EFI ta
++rget platform.
++
++.TP
++\fIINSTALL_DEVICE\fR
++Install GRUB to the block device \fIINSTALL_DEVICE\fR.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-kbdcomp.1 b/util/grub-kbdcomp.1
+new file mode 100644
+index 0000000..0bb969a
+--- /dev/null
++++ b/util/grub-kbdcomp.1
+@@ -0,0 +1,19 @@
++.TH GRUB-KBDCOMP 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-kbdcomp\fR \(em Generate a GRUB keyboard layout file.
++
++.SH SYNOPSIS
++\fBgrub-kbdcomp\fR <-o | --output=\fIFILE\fR> \fICKBMAP_ARGUMENTS\fR
++
++.SH DESCRIPTION
++\fBgrub-kbdcomp\fR processes an X keyboard layout description in
++\fBkeymaps\fR(5) format into a format that can be used by GRUB's \fBkeymap\fR
++command.
++
++.SH OPTIONS
++.TP
++\fB--output\fR=\fIFILE\fR
++Write output to \fIFILE\fR.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-macbless.1 b/util/grub-macbless.1
+new file mode 100644
+index 0000000..41a9618
+--- /dev/null
++++ b/util/grub-macbless.1
+@@ -0,0 +1,22 @@
++.TH GRUB-MACBLESS 1 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-macbless\fR \(em Mac-style bless on HFS or HFS+
++
++.SH SYNOPSIS
++\fBgrub-macbless\fR [-v | --verbose] [-p | --ppc] \fIFILE\fR | [-x | --x86] \fIFILE\fR
++
++.SH OPTIONS
++.TP
++--x86
++Bless for x86 based Macs.
++
++.TP
++--ppc
++Bless for PPC based Macs.
++
++.TP
++--verbose
++Print verbose messages.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-menulst2cfg.1 b/util/grub-menulst2cfg.1
+new file mode 100644
+index 0000000..91e2ef8
+--- /dev/null
++++ b/util/grub-menulst2cfg.1
+@@ -0,0 +1,12 @@
++.TH GRUB-MENULST2CFG 1 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-menulst2cfg\fR \(em Convert a configuration file from GRUB 0.xx to GRUB 2.xx format.
++
++.SH SYNOPSIS
++\fBgrub-menulst2cfg\fR [\fIINFILE\fR [\fIOUTFILE\fR]]
++
++.SH DESCRIPTION
++\fBgrub-menulst2cfg\fR converts a configuration file from GRUB 0.xx to the current format.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8
+new file mode 100644
+index 0000000..a2d1f57
+--- /dev/null
++++ b/util/grub-mkconfig.8
+@@ -0,0 +1,17 @@
++.TH GRUB-MKCONFIG 1 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-mkconfig\fR \(em Generate a GRUB configuration file.
++
++.SH SYNOPSIS
++\fBgrub-mkconfig\fR [-o | --output=\fIFILE\fR]
++
++.SH DESCRIPTION
++\fBgrub-mkconfig\fR generates a configuration file for GRUB.
++
++.SH OPTIONS
++.TP
++\fB--output\fR=\fIFILE\fR
++Write generated output to \fIFILE\fR.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-mkfont.1 b/util/grub-mkfont.1
+new file mode 100644
+index 0000000..3494857
+--- /dev/null
++++ b/util/grub-mkfont.1
+@@ -0,0 +1,87 @@
++.TH GRUB-MKFONT 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-mkfont\fR \(em Convert common font file formats into the PF2 format.
++
++.SH SYNOPSIS
++\fBgrub-mkfont\fR [--ascii-bitmaps] [-a | --force-autohint]
++.RS 13
++[-b | --bold] [-c | --asce=\fINUM\fR] [-d | --desc=\fINUM\fR]
++.RE
++.RS 13
++[-i | --index=\fINUM\fR] [-n | --name=\fINAME\fR] [--no-bitmap]
++.RE
++.RS 13
++[--no-hinting] <-o | --output=\fIFILE\fR>
++.RE
++.RS 13
++[-r | --range=\fIFROM-TO\fR[\fI,FROM-TO\fR]] [-s | --size=\fISIZE\fR]
++.RE
++.RS 13
++[-v | --verbose] [--width-spec] \fIFONT_FILES\fR
++
++.SH DESCRIPTION
++\fBgrub-mkfont\fR converts font files from common formats into the PF2 format used by GRUB.
++
++.SH OPTIONS
++.TP
++--ascii-bitmaps
++Save only bitmaps for ASCII characters.
++
++.TP
++--force-autohint
++Force generation of automatic hinting.
++
++.TP
++--bold
++Convert font to bold.
++
++.TP
++--asce=\fINUM\fR
++Set font ascent to \fINUM\fR.
++
++.TP
++--desc=\fINUM\fR
++Set font descent to \fINUM\fR.
++
++.TP
++--index=\fINUM\fR
++Select face index \fINUM\fR.
++
++.TP
++--name=\fINAME\fR
++Set font family to \fINAME\fR.
++
++.TP
++--no-bitmap
++Ignore bitmap strikes when loading.
++
++.TP
++--no-hinting
++Disable hinting.
++
++.TP
++--output=\fIFILE\fR
++Save ouptut to \fIFILE\fR.  This argument is required.
++
++.TP
++--range=\fIFROM-TO\fR\fI,FROM-TO\fR
++Set the font ranges to each pair of \fIFROM\fR,\fITO\fR.
++
++.TP
++--size=\fISIZE\fR
++Set font size to \fISIZE\fR.
++
++.TP
++--verbose
++Print verbose messages.
++
++.TP
++--width-spec
++Create a width summary file.
++
++.TP
++\fIFONT_FILES\fR
++The input files to be converted.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-mkimage.1 b/util/grub-mkimage.1
+new file mode 100644
+index 0000000..4dea4f5
+--- /dev/null
++++ b/util/grub-mkimage.1
+@@ -0,0 +1,95 @@
++.TH GRUB-MKIMAGE 1 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-mkimage\fR \(em Make a bootable GRUB image.
++
++.SH SYNOPSIS
++\fBgrub-mkimage\fR [-c | --config=\fRFILE\fI] [-C | --compression=(\fIxz\fR,\fInone\fR,\fIauto\fR)]
++.RS 14
++[-d | --directory=\fRDIR\fR] [-k | --pubkey=\fIFILE\fR]
++.RE
++.RS 14
++[-m | --memdisk=\fIFILE\fR] [-n | --note] [-o | --output=\fIFILE\fR]
++.RE
++.RS 14
++[-O | --format=\fIFORMAT\fR] [-p | --prefix=\fIDIR\fR]
++.RE
++.RS 14
++[-v | --verbose] \fIMODULES\fR
++
++.SH DESCRIPTION
++\fBgrub-mkimage\fI builds a bootable image of GRUB.
++
++.SH OPTIONS
++.TP
++--config=\fIFILE\fR
++Embed \fIFILE\fR as the image's initial configuration file.
++
++.TP
++--compression=(\fIxz\fR,\fInone\fR,\fIauto\fR)
++Use one of \fIxz\fR, \fInone\fR, or \fIauto\fR as the compression method for the core image.
++
++.TP
++--directory=\fIDIR\fR
++Use images and modules from \fIDIR\fR.  The default value is \fB/usr/lib/grub/<platform>\fR.
++
++.TP
++--pubkey=\fIFILE\fR
++Embed the public key \fIFILE\fR for signature checking.
++
++.TP
++--memdisk=\fIFILE\fR
++Embed the memdisk image \fIFILE\fR.  If no \fB-p\fR option is also specified, this implies \fI-p (memdisk)/boot/grub\fR.
++
++.TP
++--note
++Add a CHRP \fINOTE\fR section.  This option is only valid on IEEE1275 platforms.
++
++.TP
++--output=\fIFILE\fR
++Write the generated file to \fIFILE\fR.  The default is to write to standard output.
++
++.TP
++--format=\fIFORMAT\fR
++Generate an image in the specified \fIFORMAT\fR.  Valid values are:
++.RS
++.RS 4
++.P
++i386-coreboot,
++i386-multiboot,
++i386-pc,
++i386-pc-pxe,
++i386-efi,
++i386-ieee1275,
++i386-qemu,
++x86_64-efi,
++mipsel-yeeloong-flash,
++mipsel-fuloong2f-flash,
++mipself-loongson-elf,
++powerpc-ieee1275,
++sparc64-ieee1275-raw,
++sparc64-ieee1275-cdcore,
++sparc64-ieee1275-aout,
++ia64-efi,
++mips-arc,
++mipsel-arc,
++mipsel-qemu_mips-elf,
++mips-qemu_mips-flash,
++mipsel-qemu_mips-flash,
++mips-qemu_mips-elf
++.RE
++.RE
++
++.TP
++--prefix=\fIDIR\fR
++Set prefix directory.  The default value is \fI/boot/grub\fR.
++
++.TP
++--verbose
++Print verbose messages.
++
++.TP
++\fIMODULES\fR
++Include \fIMODULES\fR.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-mklayout.1 b/util/grub-mklayout.1
+new file mode 100644
+index 0000000..d1bbc2e
+--- /dev/null
++++ b/util/grub-mklayout.1
+@@ -0,0 +1,27 @@
++.TH GRUB-MKLAYOUT 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-mklayout\fR \(em Generate a GRUB keyboard layout file.
++
++.SH SYNOPSIS
++\fBgrub-mklayout\fR [-i | --input=\fIFILE\fR] [-o | --output=\fIFILE\fR]
++.RS 15
++[-v | --verbose]
++
++.SH DESCRIPTION
++\fBgrub-mklayout\fR generates a GRUB keyboard layout description which corresponds with the Linux console layout description given as input.
++
++.SH OPTIONS
++.TP
++--input=\fIFILE\fR
++Use \fIFILE\fR as the input.  The default value is the standard input device.
++
++.TP
++--output=\fIFILE\fR
++Use \fIFILE\fR as the output.  The default value is the standard output device.
++
++.TP
++--verbose
++Print verbose messages.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-mknetdir.1 b/util/grub-mknetdir.1
+new file mode 100644
+index 0000000..69c2262
+--- /dev/null
++++ b/util/grub-mknetdir.1
+@@ -0,0 +1,12 @@
++.TH GRUB-MKNETDIR 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-mknetdir\fR \(em Prepare a GRUB netboot directory.
++
++.SH SYNOPSIS
++\fBgrub-mknetdir\fR 
++
++.SH DESCRIPTION
++\fBgrub-mknetdir\fR prepares a directory for GRUB to be netbooted from.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-mkpasswd-pbkdf2.1 b/util/grub-mkpasswd-pbkdf2.1
+new file mode 100644
+index 0000000..73c437c
+--- /dev/null
++++ b/util/grub-mkpasswd-pbkdf2.1
+@@ -0,0 +1,27 @@
++.TH GRUB-MKPASSWD-PBKDF2 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-mkpasswd-pbkdf2\fR \(em Generate a PBKDF2 password hash.
++
++.SH SYNOPSIS
++\fBgrub-mkpasswd-pbkdf2\fR [-c | --iteration-count=\fINUM\fR] [-l | --buflen=\fINUM\fR]
++.RS 22
++[-s | --salt=\fINUM\fR]
++
++.SH DESCRIPTION
++\fBgrub-mkpasswd-pbkdf2\fR generates a PBKDF2 password string suitable for use in a GRUB configuration file.
++
++.SH OPTIONS
++.TP
++--iteration-count=\fINUM\fR
++Number of PBKDF2 iterations.
++
++.TP
++--buflen=\fINUM\fR
++Length of generated hash.
++
++.TP
++--salt=\fINUM\fR
++Length of salt to use.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-mkrelpath.1 b/util/grub-mkrelpath.1
+new file mode 100644
+index 0000000..85f1113
+--- /dev/null
++++ b/util/grub-mkrelpath.1
+@@ -0,0 +1,12 @@
++.TH GRUB-MKRELPATH 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-mkrelpath\fR \(em Generate a relative GRUB path given an OS path.
++
++.SH SYNOPSIS
++\fBgrub-mkrelpath\fR \fIFILE\fR
++
++.SH DESCRIPTION
++\fBgrub-mkrelpath\fR takes an OS filesystem path for \fIFILE\fR and returns a relative path suitable for use in a GRUB configuration file.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-mkrescue.1 b/util/grub-mkrescue.1
+new file mode 100644
+index 0000000..4ed9fc7
+--- /dev/null
++++ b/util/grub-mkrescue.1
+@@ -0,0 +1,123 @@
++.TH GRUB-MKRESCUE 3 "Wed Feb 26 2014"
++.SH NAME
++grub-mkrescue \(em Generate a GRUB rescue image using GNU Xorriso.
++
++.SH SYNOPSIS
++\fBgrub-mkrescue\fR [-o | --output=\fIFILE\fR] [--modules=\fIMODULES\fR]
++.RS 15
++[--install-modules=\fIMODULES\fR] [--themes=\fITHEMES\fR]
++.RE
++.RS 15
++[--fonts=\fIFONTS\fR] [--locales=\fILOCALES\fR]
++.RE
++.RS 15
++[--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]] [-d | --directory=\fIDIR\fR]
++.RE
++.RS 15
++[--grub-mkimage=\fIFILE\fR] [--rom-directory=\fIDIR\fR]
++.RE
++.RS 15
++[--xorriso=\fIFILE\fR] [--grub-glue-efi=\fIFILE\fR]
++.RE
++.RS 15
++[--grub-render-label=\fIFILE\fR] [--label-font=\fIFILE\fR]
++.RE
++.RS 15
++[--label-color=\fICOLOR\fR] [--label-bgcolor=\fIFILE\fR]
++.RE
++.RS 15
++[--product-name=\fISTRING\fR] [--product-version=\fISTRING\fR]
++.RE
++.RS 15
++[--sparc-boot] [--arcs-boot]
++
++.SH DESCRIPTION
++\fBgrub-mkrescue\fR can be used to generate a rescue image with the GRUB bootloader.
++
++.SH OPTIONS
++.TP
++\fB--output\fR=\fIFILE\fR
++Write the generated file to \fIFILE\fR.  The default is to write to standard output.
++
++.TP
++\fB--modules\fR=\fIMODULES\fR
++Pre-load modules specified by \fIMODULES\fR.
++
++.TP
++\fB--install-modules\fR=\fIMODULES\fR
++Install only \fIMODULES\fR and their dependencies.  The default is to install all available modules.
++
++.TP
++\fB--themes\fR=\fITHEMES\fR
++Install \fITHEMES\fR.  The default is to install the \fIstarfield\fR theme, if available.
++
++.TP
++\fB--fonts\fR=\fIFONTS\fR
++Install \fIFONTS\fR.  The default is to install the \fIunicode\fR font.
++
++.TP
++\fB--locales\fR=\fILOCALES\fR
++Install only locales listed in \fILOCALES\fR.  The default is to install all available locales.
++
++.TP
++\fB--compress\fR[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]
++Compress GRUB files using the specified compression algorithm.
++
++.TP
++\fB--directory\fR=\fIDIR\fR
++Use images and modules in \fIDIR\fR.
++
++.TP
++\fB--grub-mkimage\fR=\fIFILE\fR
++Use \fIFILE\fR as \fBgrub-mkimage\fR(1).  The default is \fI/usr/bin/grub-mkimage\fR.
++
++.TP
++\fB--rom-directory\fR=\fIDIR\fR
++Save ROM images in \fIDIR\fR.
++
++.TP
++\fB--xorriso\fR=\fIFILE\fR
++Use \fIFILE\fR as \fBxorriso\fI.
++
++.TP
++\fB--grub-glue-efi\fR=\fIFILE\fR
++Use \fIFILE\fR as \fBgrub-glue-efi\fR(3).
++
++.TP
++\fB--grub-render-label\fR=\fIFILE\fR
++Use \fIFILE\fR as \fBgrub-render-label\fR(3).
++
++.TP
++\fB--label-font\fR=\fIFILE\fR
++Use \fIFILE\fR as the font file for generated labels.
++
++.TP
++\fB--label-color\fR=\fICOLOR\fR
++Use \fICOLOR\fI as the color for generated labels.
++
++.TP
++\fB--label-bgcolor\fR=\fICOLOR\fR
++Use \fICOLOR\fR as the background color for generated labels.
++
++.TP
++\fB--product-name\fR=\fISTRING\fR
++Use \fISTRING\fR as the product name in generated labels.
++
++.TP
++\fB--product-version\fR=\fISTRING\fR
++Use \fISTRING\fR as the product version in generated labels.
++
++.TP
++\fB--sparc-boot\fR
++Enable booting the SPARC platform.  This disables HFS+, APM, ARCS, and "boot as disk image" on the \fIi386-pc\fR target platform.
++
++.TP
++\fB--arcs-boot\fR
++Enable ARCS booting.  This is typically for big-endian MIPS machines, and disables HFS+, APM, sparc64, and "boot as disk image" on the \fIi386-pc\fR target platform.
++
++.TP
++\fB--\fR
++All options after a \fB--\fR will be passed directly to xorriso's command line when generating the image.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-mkstandalone.1 b/util/grub-mkstandalone.1
+new file mode 100644
+index 0000000..ba2d2bd
+--- /dev/null
++++ b/util/grub-mkstandalone.1
+@@ -0,0 +1,100 @@
++.TH GRUB-MKSTANDALONE 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-mkstandalone\fR \(em Generate a standalone image in the selected format.
++
++.SH SYNOPSIS
++\fBgrub-mkstandalone\fR [-o | --output=\fIFILE\fR] [-O | --format=\fIFORMAT\fR]
++.RS 19
++[-C | --compression=(\fIxz\fR|\fInone\fR|\fIauto\fR)]
++.RE
++.RS 19
++[--modules=\fIMODULES\fR] [--install-modules=\fIMODULES\fR]
++.RE
++.RS 19
++[--themes=\fITHEMES\fR] [--fonts=\fIFONTS\fR]
++.RE
++.RS 19
++[--locales=\fILOCALES\fR] [--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]]
++.RE
++.RS 19
++[-d | --directory=\fIDIR\fR] [--grub-mkimage=\fIFILE\fR]
++.RE
++.RS 19
++\fISOURCE...\fR
++
++.SH DESCRIPTION
++
++.SH OPTIONS
++.TP
++--output=\fIFILE\fR
++Write the generated file to \fIFILE\fR.  The default is to write to standard output.
++
++.TP
++--format=\fIFORMAT\fR
++Generate an image in the specified \fIFORMAT\fR.  Valid values are:
++.RS
++.RS 4
++.P
++i386-coreboot,
++i386-multiboot,
++i386-pc,
++i386-pc-pxe,
++i386-efi,
++i386-ieee1275,
++i386-qemu,
++x86_64-efi,
++mipsel-yeeloong-flash,
++mipsel-fuloong2f-flash,
++mipself-loongson-elf,
++powerpc-ieee1275,
++sparc64-ieee1275-raw,
++sparc64-ieee1275-cdcore,
++sparc64-ieee1275-aout,
++ia64-efi,
++mips-arc,
++mipsel-arc,
++mipsel-qemu_mips-elf,
++mips-qemu_mips-flash,
++mipsel-qemu_mips-flash,
++mips-qemu_mips-elf
++.RE
++.RE
++
++.TP
++--compression=(\fIxz\fR|\fInone\fR|\fIauto\fR)
++Use one of \fIxz\fR, \fInone\fR, or \fIauto\fR as the compression method for the core image.
++
++.TP
++--modules=\fIMODULES\fR
++Pre-load modules specified by \fIMODULES\fR.
++
++.TP
++--install-modules=\fIMODULES\fR
++Install only \fIMODULES\fR and their dependencies.  The default is to install all available modules.
++
++.TP
++--themes=\fITHEMES\fR
++Install \fITHEMES\fR.  The default is to install the \fIstarfield\fR theme, if available.
++
++.TP
++--fonts=\fIFONTS\fR
++Install \fIFONTS\fR.  The default is to install the \fIunicode\fR font.
++
++.TP
++--locales=\fILOCALES\fR
++Install only locales listed in \fILOCALES\fR.  The default is to install all available locales.
++
++.TP
++--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]
++Compress GRUB files using the specified compression algorithm.
++
++.TP
++--directory=\fIDIR\fR
++Use images and modules in \fIDIR\fR.
++
++.TP
++--grub-mkimage=\fIFILE\fR
++Use \fIFILE\fR as \fBgrub-mkimage\fR.  The default is \fI/usr/bin/grub-mkimage\fR.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-ofpathname.8 b/util/grub-ofpathname.8
+new file mode 100644
+index 0000000..bf3743a
+--- /dev/null
++++ b/util/grub-ofpathname.8
+@@ -0,0 +1,12 @@
++.TH GRUB-OFPATHNAME 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-ofpathname\fR \(em Generate an IEEE-1275 device path for a specified device.
++
++.SH SYNOPSIS
++\fBgrub-ofpathname\fR \fIDEVICE\fR
++
++.SH DESCRIPTION
++\fBgrub-ofpathname\fR generates an IEEE-1275 device path for the specified \fIDEVICE\fR.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-probe.8 b/util/grub-probe.8
+new file mode 100644
+index 0000000..04e26c8
+--- /dev/null
++++ b/util/grub-probe.8
+@@ -0,0 +1,80 @@
++.TH GRUB-PROBE 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-probe\fR \(em Probe device information for a given path.
++
++.SH SYNOPSIS
++\fBgrub-probe\fR \[-d | --device] [-m | --device-map=\fIFILE\fR]
++.RS 12
++[-t | --target=(fs|fs_uuid|fs_label|drive|device|partmap|
++.RE
++.RS 28
++abstraction|cryptodisk_uuid|
++.RE
++.RS 28
++msdos_parttype)]
++.RE
++.RS 12
++[-v | --verbose] (PATH|DEVICE)
++
++.SH DESCRIPTION
++\fBgrub-probe\fR probes a path or device for filesystem and related information.
++
++.SH OPTIONS
++.TP
++--device
++Final option represents a \fIDEVICE\fR, rather than a filesystem \fIPATH\fR.
++.TP
++--device-map=\fIFILE\fR
++Use \fIFILE\fR as the device map.  The default value is \fI/boot/grub/device.map\fR.
++
++.TP
++--target=(fs|fs_uuid|fs_label|drive|device|partmap|msdos_parttype)
++Select among various output definitions.  The default is \fIfs\fR.
++.RS
++.TP
++\fIfs\fR
++filesystem module
++
++.TP
++\fIfs_uuid\fR
++filesystem UUID
++
++.TP
++\fIfs_label\fR
++filesystem label
++
++.TP
++\fIdrive\fR
++GRUB drive name
++
++.TP
++\fIdevice\fR
++System device
++
++.TP
++\fIpartmap\fR
++partition map module
++
++.TP
++\fIabstraction\fR
++abstraction module
++
++.TP
++\fIcryptodisk_uuid\fR
++cryptographic container
++
++.TP
++\fImsdos_partmap\fR
++MS-DOS partition map
++.RE
++
++.TP
++--verbose
++Print verbose output.
++
++.TP
++(\fIPATH\fR|\fIDEVICE\fR)
++If --device is passed, a block \fIDEVICE\fR.  Otherwise, the \fIPATH\fR of a file on the filesystem.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-reboot.8 b/util/grub-reboot.8
+new file mode 100644
+index 0000000..faa5e4e
+--- /dev/null
++++ b/util/grub-reboot.8
+@@ -0,0 +1,21 @@
++.TH GRUB-REBOOT 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-reboot\fR \(em Set the default boot menu entry for the next boot only.
++
++.SH SYNOPSIS
++\fBgrub-reboot\fR [--boot-directory=\fIDIR\fR] \fIMENU_ENTRY\fR
++
++.SH DESCRIPTION
++\fBgrub-reboot\fR sets the default boot menu entry for the next boot, but not further boots after that.  This command only works for GRUB configuration files created with \fIGRUB_DEFAULT=saved\fR in \fI/etc/default/grub\fR.
++
++.SH OPTIONS
++.TP
++--boot-directory=\fIDIR\fR
++Find GRUB images under \fIDIR/grub\fR.  The default value is \fI/boot\fR, resulting in grub images being search for at \fI/boot/grub\fR.
++
++.TP
++\fIMENU_ENTRY\fR
++A number, a menu item title or a menu item identifier.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-render-label.1 b/util/grub-render-label.1
+new file mode 100644
+index 0000000..4d51c8a
+--- /dev/null
++++ b/util/grub-render-label.1
+@@ -0,0 +1,51 @@
++.TH GRUB-RENDER-LABEL 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-render-label\fR \(em Render an Apple disk label.
++
++.SH SYNOPSIS
++\fBgrub-render-label\fR [-b | --bgcolor=\fICOLOR\fR] [-c | --color=\fICOLOR\fR]
++.RS 19
++[-f | --font=\fIFILE\fR] [-i | --input=\fIFILE\fR]
++.RE
++.RS 19
++[-o | --output=\fIFILE\fR] [-t | --text=\fISTRING\fR]
++.RE
++.RS 19
++[-v | --verbose]
++
++.SH DESCRIPTION
++\fBgrub-render-label\fR renders an Apple disk label (.disk_label) file.
++
++
++.SH OPTIONS
++.TP
++\fB--color\fR=\fICOLOR\fR
++Use \fICOLOR\fI as the color for generated labels.
++
++.TP
++\fB--bgcolor\fR=\fICOLOR\fR
++Use \fICOLOR\fR as the background color for generated labels.
++
++.TP
++\fB--font\fR=\fIFILE\fR
++Use \fIFILE\fR as the font file for generated labels.
++
++.TP
++--input=\fIFILE\fR
++Read input text from \fIFILE\fR.
++
++.TP
++--output=\fIFILE\fR
++Render output to \fIFILE\fR.
++
++.TP
++--text=\fISTRING\fR
++Use \fISTRING\fR as input text.
++
++.TP
++--verbose
++Print verbose output.
++
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-script-check.1 b/util/grub-script-check.1
+new file mode 100644
+index 0000000..0f1f625
+--- /dev/null
++++ b/util/grub-script-check.1
+@@ -0,0 +1,21 @@
++.TH GRUB-SCRIPT-CHECK 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-script-check\fR \(em Check GRUB configuration file for syntax errors.
++
++.SH SYNOPSIS
++\fBgrub-script-check\fR [-v | --verbose] \fIPATH\fR
++
++.SH DESCRIPTION
++\fBgrub-script-check\fR verifies that a specified GRUB configuration file does not contain syntax errors.
++
++.SH OPTIONS
++.TP
++--verbose
++Print verbose output.
++
++.TP
++\fIPATH\fR
++Path of the file to use as input.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-set-default.8 b/util/grub-set-default.8
+new file mode 100644
+index 0000000..a96265a
+--- /dev/null
++++ b/util/grub-set-default.8
+@@ -0,0 +1,21 @@
++.TH GRUB-SET-DEFAULT 1 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-set-default\fR \(em Set the default boot menu entry for GRUB.
++
++.SH SYNOPSIS
++\fBgrub-set-default\fR [--boot-directory=\fIDIR\fR] \fIMENU_ENTRY\fR
++
++.SH DESCRIPTION
++\fBgrub-set-default\fR sets the default boot menu entry for all subsequent boots.  This command only works for GRUB configuration files created with \fIGRUB_DEFAULT=saved\fR in \fI/etc/default/grub\fR.
++
++.SH OPTIONS
++.TP
++--boot-directory=\fIDIR\fR
++Find GRUB images under \fIDIR/grub\fR.  The default value is \fI/boot\fR, resulting in grub images being search for at \fI/boot/grub\fR.
++
++.TP
++\fIMENU_ENTRY\fR
++A number, a menu item title or a menu item identifier.
++
++.SH SEE ALSO
++.BR "info grub"
+diff --git a/util/grub-sparc64-setup.8 b/util/grub-sparc64-setup.8
+new file mode 100644
+index 0000000..37ea2dd
+--- /dev/null
++++ b/util/grub-sparc64-setup.8
+@@ -0,0 +1,12 @@
++.TH GRUB-SPARC64-SETUP 3 "Wed Feb 26 2014"
++.SH NAME
++\fBgrub-sparc64-setup\fR \(em Set up a device to boot a sparc64 GRUB image.
++
++.SH SYNOPSIS
++\fBgrub-sparc64-setup\fR [OPTIONS].
++
++.SH DESCRIPTION
++You should not normally run this program directly.  Use grub-install instead.
++
++.SH SEE ALSO
++.BR "info grub"
+-- 
+1.9.3
+
diff --git a/SOURCES/0131-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/SOURCES/0131-use-fw_path-prefix-when-fallback-searching-for-grub-.patch
new file mode 100644
index 0000000..20f0dae
--- /dev/null
+++ b/SOURCES/0131-use-fw_path-prefix-when-fallback-searching-for-grub-.patch
@@ -0,0 +1,45 @@
+From d60083bf794914c4f26f561adcdd107abe80cd7e Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <grub2-owner@fedoraproject.org>
+Date: Wed, 19 Feb 2014 15:58:43 -0500
+Subject: [PATCH 131/143] use fw_path prefix when fallback searching for grub
+ config
+
+When PXE booting via UEFI firmware, grub was searching for grub.cfg
+in the fw_path directory where the grub application was found. If
+that didn't exist, a fallback search would look for config file names
+based on MAC and IP address. However, the search would look in the
+prefix directory which may not be the same fw_path. This patch
+changes that behavior to use the fw_path directory for the fallback
+search. Only if fw_path is NULL will the prefix directory be searched.
+
+Signed-off-by: Mark Salter <msalter@redhat.com>
+---
+ grub-core/normal/main.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
+index f66c03c..5e2ac15 100644
+--- a/grub-core/normal/main.c
++++ b/grub-core/normal/main.c
+@@ -343,7 +343,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
+       char *config;
+       const char *prefix, *fw_path;
+ 
+-      fw_path = grub_env_get ("fw_path");
++      prefix = fw_path = grub_env_get ("fw_path");
+       if (fw_path)
+ 	{
+ 	  config = grub_xasprintf ("%s/grub.cfg", fw_path);
+@@ -366,7 +366,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
+ 	    }
+ 	}
+ 
+-      prefix = grub_env_get ("prefix");
++      if (! prefix)
++	      prefix = grub_env_get ("prefix");
+       if (prefix)
+         {
+           grub_size_t config_len;
+-- 
+1.9.3
+
diff --git a/SOURCES/0132-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/SOURCES/0132-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch
new file mode 100644
index 0000000..23874fc
--- /dev/null
+++ b/SOURCES/0132-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch
@@ -0,0 +1,115 @@
+From 2927c4943326f09bd626744b8a46fc8ee16fea1c Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Thu, 6 Mar 2014 11:51:33 -0500
+Subject: [PATCH 132/143] Try mac/guid/etc before grub.cfg on tftp config
+ files.
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ grub-core/normal/main.c | 80 ++++++++++++++++++++++++++-----------------------
+ 1 file changed, 43 insertions(+), 37 deletions(-)
+
+diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
+index 5e2ac15..4190985 100644
+--- a/grub-core/normal/main.c
++++ b/grub-core/normal/main.c
+@@ -341,53 +341,59 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
+       /* Guess the config filename. It is necessary to make CONFIG static,
+ 	 so that it won't get broken by longjmp.  */
+       char *config;
+-      const char *prefix, *fw_path;
+-
+-      prefix = fw_path = grub_env_get ("fw_path");
+-      if (fw_path)
+-	{
+-	  config = grub_xasprintf ("%s/grub.cfg", fw_path);
+-	  if (config)
+-	    {
+-	      grub_file_t file;
+-
+-	      file = grub_file_open (config);
+-	      if (file)
+-		{
+-		  grub_file_close (file);
+-		  grub_enter_normal_mode (config);
+-		}
+-              else
+-                {
+-                  /*  Ignore all errors.  */
+-                  grub_errno = 0;
+-                }
+-	      grub_free (config);
+-	    }
+-	}
++      const char *prefix;
+ 
++      prefix = grub_env_get ("fw_path");
+       if (! prefix)
+ 	      prefix = grub_env_get ("prefix");
++
+       if (prefix)
+-        {
+-          grub_size_t config_len;
+-          config_len = grub_strlen (prefix) +
+-                      sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
+-          config = grub_malloc (config_len);
++	{
++	  if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
++	    {
++	      grub_size_t config_len;
++	      config_len = grub_strlen (prefix) +
++		sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
++	      config = grub_malloc (config_len);
++
++	      if (! config)
++		goto quit;
+ 
+-          if (! config)
+-            goto quit;
++	      grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
+ 
+-          grub_snprintf (config, config_len, "%s/grub.cfg", prefix);
++	      grub_net_search_configfile (config);
+ 
+-          if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0)
+-            grub_net_search_configfile (config);
++	      grub_enter_normal_mode (config);
++	      grub_free (config);
++	      config = NULL;
++	    }
+ 
+-	  grub_enter_normal_mode (config);
+-	  grub_free (config);
++	  if (!config)
++	    {
++	      config = grub_xasprintf ("%s/grub.cfg", prefix);
++	      if (config)
++		{
++		  grub_file_t file;
++
++		  file = grub_file_open (config);
++		  if (file)
++		    {
++		      grub_file_close (file);
++		      grub_enter_normal_mode (config);
++		    }
++		  else
++		    {
++		      /*  Ignore all errors.  */
++		      grub_errno = 0;
++		    }
++		  grub_free (config);
++		}
++	    }
+ 	}
+       else
+-	grub_enter_normal_mode (0);
++	{
++	  grub_enter_normal_mode (0);
++	}
+     }
+   else
+     grub_enter_normal_mode (argv[0]);
+-- 
+1.9.3
+
diff --git a/SOURCES/0133-trim-arp-packets-with-abnormal-size.patch b/SOURCES/0133-trim-arp-packets-with-abnormal-size.patch
new file mode 100644
index 0000000..8887866
--- /dev/null
+++ b/SOURCES/0133-trim-arp-packets-with-abnormal-size.patch
@@ -0,0 +1,31 @@
+From cf2e819b7059f199075b099260983e8108eea74a Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
+Date: Wed, 5 Feb 2014 09:42:42 -0200
+Subject: [PATCH 133/143] trim arp packets with abnormal size
+
+GRUB uses arp request to create the arp response. If the incoming packet
+is foobared, GRUB needs to trim the arp response packet before sending it.
+---
+ grub-core/net/arp.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
+index d62d0cc..77581f4 100644
+--- a/grub-core/net/arp.c
++++ b/grub-core/net/arp.c
+@@ -162,6 +162,12 @@ grub_net_arp_receive (struct grub_net_buff *nb,
+     if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
+ 	&& grub_be_to_cpu16 (arp_header->op) == ARP_REQUEST)
+       {
++        if ((nb->tail - nb->data) > 50)
++          {
++            grub_dprintf ("net", "arp packet with abnormal size (%ld bytes).\n",
++                         nb->tail - nb->data);
++            nb->tail = nb->data + 50;
++          }
+ 	grub_net_link_level_address_t target;
+ 	/* We've already checked that pln is either 4 or 16.  */
+ 	char tmp[16];
+-- 
+1.9.3
+
diff --git a/SOURCES/0134-Fix-convert-function-to-support-NVMe-devices.patch b/SOURCES/0134-Fix-convert-function-to-support-NVMe-devices.patch
new file mode 100644
index 0000000..a5b9f8d
--- /dev/null
+++ b/SOURCES/0134-Fix-convert-function-to-support-NVMe-devices.patch
@@ -0,0 +1,59 @@
+From f451ce261bcdb24d3428daac54e32e06c698e2f7 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Tue, 18 Feb 2014 11:34:00 -0500
+Subject: [PATCH 134/143] Fix convert function to support NVMe devices
+
+This is adapted from the patch at
+https://bugzilla.redhat.com/show_bug.cgi?id=1019660 , which is against
+the now very old version of convert_system_partition_to_system_disk().
+
+As such, it certainly not the right thing for upstream, but should
+function for now.
+
+Resolves: rhbz#1019660
+
+Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
+---
+ util/getroot.c | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/util/getroot.c b/util/getroot.c
+index 3958105..e700610 100644
+--- a/util/getroot.c
++++ b/util/getroot.c
+@@ -152,6 +152,7 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part)
+ {
+ #if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
+   struct stat st;
++  char *path = xmalloc(PATH_MAX);
+ 
+   if (stat (os_dev, &st) < 0)
+     {
+@@ -164,6 +165,24 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part)
+ 
+   *is_part = 0;
+ 
++  if (realpath(os_dev, path))
++    {
++      if ((strncmp ("/dev/nvme", path, 9) == 0))
++	{
++	  char *p = path + 5;
++	  p = strchr(p, 'p');
++	  if (p)
++	    {
++	      *is_part = 1;
++	      *p = '\0';
++	    }
++	  return path;
++	}
++    }
++
++  grub_free (path);
++  *is_part = 0;
++
+   if (grub_util_device_is_mapped_stat (&st))
+     return grub_util_devmapper_part_to_disk (&st, is_part, os_dev);
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0135-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch b/SOURCES/0135-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch
new file mode 100644
index 0000000..9b8709e
--- /dev/null
+++ b/SOURCES/0135-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch
@@ -0,0 +1,41 @@
+From da07b568a45d2c87ab2f6e498f0e304c73c5d195 Mon Sep 17 00:00:00 2001
+From: Prarit Bhargava <prarit@redhat.com>
+Date: Wed, 12 Mar 2014 10:58:16 -0400
+Subject: [PATCH 135/143] Fix bad test on GRUB_DISABLE_SUBMENU.
+
+The file /etc/grub.d/10_linux does
+
+if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
+
+when it should do
+
+if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
+
+which results in submenus in /boot/grub2/grub.cfg when
+GRUB_DISABLE_SUBMENU="yes".
+
+Resolves: rhbz#1063414
+---
+ util/grub.d/10_linux.in | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 136abd7..3f799e9 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -255,7 +255,11 @@ while [ "x$list" != "x" ] ; do
+     linux_root_device_thisversion=${GRUB_DEVICE}
+   fi
+ 
+-  if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
++  if [ "x${GRUB_DISABLE_SUBMENU}" = "xyes" ] || [ "x${GRUB_DISABLE_SUBMENU}" = "xy" ]; then
++    GRUB_DISABLE_SUBMENU="true"
++  fi
++
++  if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
+     linux_entry "${OS}" "${version}" simple \
+     "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0136-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch b/SOURCES/0136-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch
new file mode 100644
index 0000000..13dfa37
--- /dev/null
+++ b/SOURCES/0136-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch
@@ -0,0 +1,29 @@
+From e7ba5525f976930b792c91132eb5ec96c5379797 Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <grub2-owner@fedoraproject.org>
+Date: Mon, 10 Feb 2014 16:13:10 -0500
+Subject: [PATCH 136/143] Switch to use APM Mustang device tree, for hardware
+ testing.
+
+Signed-off-by: David A. Marlin <d.marlin@redhat.com>
+---
+ util/grub.d/10_linux.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 3f799e9..2639511 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -228,8 +228,8 @@ while [ "x$list" != "x" ] ; do
+ 
+   fdt=
+   for i in "dtb-${version}" "dtb-${alt_version}"; do
+-    if test -e "${dirname}/${i}/foundation-v8.dtb" ; then
+-      fdt="${i}/foundation-v8.dtb"
++    if test -e "${dirname}/${i}/apm-mustang.dtb" ; then
++      fdt="${i}/apm-mustang.dtb"
+       break
+     fi
+   done
+-- 
+1.9.3
+
diff --git a/SOURCES/0137-Use-the-default-device-tree-from-the-grub-default-fi.patch b/SOURCES/0137-Use-the-default-device-tree-from-the-grub-default-fi.patch
new file mode 100644
index 0000000..32d7b61
--- /dev/null
+++ b/SOURCES/0137-Use-the-default-device-tree-from-the-grub-default-fi.patch
@@ -0,0 +1,46 @@
+From 5f1ee8ff7170321250874116eb80cbec83cc70ab Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <grub2-owner@fedoraproject.org>
+Date: Wed, 12 Feb 2014 14:54:04 -0500
+Subject: [PATCH 137/143] Use the default device tree from the grub default
+ file
+
+instead of hardcoding a value.
+
+Signed-off-by: David A. Marlin <dmarlin@redhat.com>
+---
+ util/grub-mkconfig.in   | 3 ++-
+ util/grub.d/10_linux.in | 4 ++--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
+index b00f9e6..beb22de 100644
+--- a/util/grub-mkconfig.in
++++ b/util/grub-mkconfig.in
+@@ -224,7 +224,8 @@ export GRUB_DEFAULT \
+   GRUB_ENABLE_CRYPTODISK \
+   GRUB_BADRAM \
+   GRUB_OS_PROBER_SKIP_LIST \
+-  GRUB_DISABLE_SUBMENU
++  GRUB_DISABLE_SUBMENU \
++  GRUB_DEFAULT_DTB
+ 
+ if test "x${grub_cfg}" != "x"; then
+   rm -f "${grub_cfg}.new"
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 2639511..6480cd6 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -228,8 +228,8 @@ while [ "x$list" != "x" ] ; do
+ 
+   fdt=
+   for i in "dtb-${version}" "dtb-${alt_version}"; do
+-    if test -e "${dirname}/${i}/apm-mustang.dtb" ; then
+-      fdt="${i}/apm-mustang.dtb"
++    if test -f "${dirname}/${i}/${GRUB_DEFAULT_DTB}" ; then
++      fdt="${i}/${GRUB_DEFAULT_DTB}"
+       break
+     fi
+   done
+-- 
+1.9.3
+
diff --git a/SOURCES/0138-reopen-SNP-protocol-for-exclusive-use-by-grub.patch b/SOURCES/0138-reopen-SNP-protocol-for-exclusive-use-by-grub.patch
new file mode 100644
index 0000000..1690be3
--- /dev/null
+++ b/SOURCES/0138-reopen-SNP-protocol-for-exclusive-use-by-grub.patch
@@ -0,0 +1,46 @@
+From f4bbb76f70ceca4e089e926ee44d8d3fe919f040 Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <grub2-owner@fedoraproject.org>
+Date: Sat, 15 Feb 2014 15:10:22 -0500
+Subject: [PATCH 138/143] reopen SNP protocol for exclusive use by grub
+
+---
+ grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
+index 2b344d6..a6e4c79 100644
+--- a/grub-core/net/drivers/efi/efinet.c
++++ b/grub-core/net/drivers/efi/efinet.c
+@@ -223,6 +223,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
+ {
+   struct grub_net_card *card;
+   grub_efi_device_path_t *dp;
++  grub_efi_simple_network_t *net;
+ 
+   dp = grub_efi_get_device_path (hnd);
+   if (! dp)
+@@ -250,6 +251,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
+ 				    &pxe_mode->dhcp_ack,
+ 				    sizeof (pxe_mode->dhcp_ack),
+ 				    1, device, path);
++    net = grub_efi_open_protocol (card->efi_handle, &net_io_guid,
++				  GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
++    if (net) {
++      if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
++	  && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
++	continue;
++
++      if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
++	continue;
++
++      if (net->mode->state == GRUB_EFI_NETWORK_STARTED
++	  && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
++	continue;
++      card->efi_net = net;
++    }
+     return;
+   }
+ }
+-- 
+1.9.3
+
diff --git a/SOURCES/0139-Reduce-timer-event-frequency-by-10.patch b/SOURCES/0139-Reduce-timer-event-frequency-by-10.patch
new file mode 100644
index 0000000..df6e385
--- /dev/null
+++ b/SOURCES/0139-Reduce-timer-event-frequency-by-10.patch
@@ -0,0 +1,40 @@
+From 3aed1012cb8f559a0241569d6ec6b1be23844b05 Mon Sep 17 00:00:00 2001
+From: Mark Salter <msalter@redhat.com>
+Date: Thu, 20 Feb 2014 12:54:52 -0500
+Subject: [PATCH 139/143] Reduce timer event frequency by 10
+
+Timer event to keep grub msec counter was running at 1000HZ. This was too
+fast for UEFI timer driver and resulted in a 10x slowdown in grub time
+versus wallclock. Reduce the timer event frequency and increase tick
+increment accordingly to keep better time.
+
+Signed-off-by: Mark Salter <msalter@redhat.com>
+---
+ grub-core/kern/arm/efi/init.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c
+index a6ae034..0c17d83 100644
+--- a/grub-core/kern/arm/efi/init.c
++++ b/grub-core/kern/arm/efi/init.c
+@@ -38,7 +38,7 @@ static void
+ increment_timer (grub_efi_event_t event __attribute__ ((unused)),
+ 		 void *context __attribute__ ((unused)))
+ {
+-  tmr++;
++  tmr += 10;
+ }
+ 
+ void
+@@ -52,7 +52,7 @@ grub_machine_init (void)
+ 
+   efi_call_5 (b->create_event, GRUB_EFI_EVT_TIMER | GRUB_EFI_EVT_NOTIFY_SIGNAL,
+ 	      GRUB_EFI_TPL_CALLBACK, increment_timer, NULL, &tmr_evt);
+-  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 10000);
++  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 100000);
+ 
+   grub_install_get_time_ms (grub_efi_get_time_ms);
+ }
+-- 
+1.9.3
+
diff --git a/SOURCES/0140-always-return-error-to-UEFI.patch b/SOURCES/0140-always-return-error-to-UEFI.patch
new file mode 100644
index 0000000..78ffebf
--- /dev/null
+++ b/SOURCES/0140-always-return-error-to-UEFI.patch
@@ -0,0 +1,25 @@
+From 36a34ede9dfa34840c59c7b331c1bc8d8ae7442e Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <grub2-owner@fedoraproject.org>
+Date: Wed, 26 Feb 2014 21:49:12 -0500
+Subject: [PATCH 140/143] always return error to UEFI
+
+---
+ grub-core/kern/efi/efi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
+index cd839cc..1a8dba5 100644
+--- a/grub-core/kern/efi/efi.c
++++ b/grub-core/kern/efi/efi.c
+@@ -158,7 +158,7 @@ grub_exit (void)
+ {
+   grub_efi_fini ();
+   efi_call_4 (grub_efi_system_table->boot_services->exit,
+-              grub_efi_image_handle, GRUB_EFI_SUCCESS, 0, 0);
++              grub_efi_image_handle, GRUB_EFI_LOAD_ERROR, 0, 0);
+   for (;;) ;
+ }
+ 
+-- 
+1.9.3
+
diff --git a/SOURCES/0141-Add-powerpc-little-endian-ppc64le-flags.patch b/SOURCES/0141-Add-powerpc-little-endian-ppc64le-flags.patch
new file mode 100644
index 0000000..0a5460d
--- /dev/null
+++ b/SOURCES/0141-Add-powerpc-little-endian-ppc64le-flags.patch
@@ -0,0 +1,96 @@
+From 8014cad21bb2cc986f10f0a927036851f490a8ec Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
+Date: Wed, 13 Aug 2014 18:59:58 +0000
+Subject: [PATCH 141/143] Add powerpc little-endian (ppc64le) flags
+
+libgcc dependency was removed *just* for this target because
+the distros that use ppc64el doesn't have 32-bit support on it.
+
+* configure.ac: Add targets for powerpc64el and skip libgcc.
+* Makefile.am: Likewise.
+---
+ configure.ac          | 17 +++++++++++++++--
+ grub-core/Makefile.am |  2 ++
+ 2 files changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 2632e2d..53fd7c7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -142,6 +142,7 @@ if test "x$with_platform" = x; then
+     x86_64-*) platform=pc ;;
+     powerpc-*) platform=ieee1275 ;;
+     powerpc64-*) platform=ieee1275 ;;
++    powerpc64le-*) platform=ieee1275 ;;
+     sparc64-*) platform=ieee1275 ;;
+     mipsel-*) platform=loongson ;;
+     mips-*) platform=arc ;;
+@@ -160,6 +161,7 @@ case "$target_cpu"-"$platform" in
+   x86_64-xen) ;;
+   x86_64-*) target_cpu=i386 ;;
+   powerpc64-ieee1275) target_cpu=powerpc ;;
++  powerpc64le-ieee1275) target_cpu=powerpc ;;
+ esac
+ 
+ # Check if the platform is supported, make final adjustments.
+@@ -604,6 +606,13 @@ if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
+   TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
+ fi
+ 
++if test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno; then
++	LD_FORCE_LE=1
++	TARGET_CFLAGS="$TARGET_CFLAGS -mbig-endian -DNO_LIBGCC=1"
++	TARGET_CCASFLAGS="$TARGET_CCASFLAGS -mbig-endian"
++	TARGET_LDFLAGS="$TARGET_LDFLAGS -static -mbig-endian"
++fi
++
+ if test "x$target_m32" = x1; then
+   # Force 32-bit mode.
+   TARGET_CFLAGS="$TARGET_CFLAGS -m32"
+@@ -1047,7 +1056,8 @@ else
+ CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
+ fi
+ CPPFLAGS="$TARGET_CPPFLAGS"
+-if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
++if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes \
++	|| ( test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno ); then
+ TARGET_LIBGCC=
+ else
+ TARGET_LIBGCC=-lgcc
+@@ -1631,7 +1641,9 @@ if test x"$enable_werror" != xno ; then
+   HOST_CFLAGS="$HOST_CFLAGS -Werror"
+ fi
+ 
+-if test "x$grub_cv_cc_target_clang" = xno; then
++# if not clang or power LE, use static libgcc
++if test "x$grub_cv_cc_target_clang" = xno \
++   || ! ( test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno ); then
+    TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
+ else
+    TARGET_LDFLAGS_STATIC_LIBGCC=
+@@ -1694,6 +1706,7 @@ AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu =
+ AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
+ AM_CONDITIONAL([COND_sparc64_emu], [test x$target_cpu = xsparc64 -a x$platform = xemu])
+ AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
++AM_CONDITIONAL([COND_powerpc_le], [test x$target_cpu = xpowerpc -a x$ac_cv_c_bigendian = xno])
+ AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
+ AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
+ AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
+diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
+index 5c087c8..cb7fd9f 100644
+--- a/grub-core/Makefile.am
++++ b/grub-core/Makefile.am
+@@ -84,8 +84,10 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
+ if !COND_clang
++if !COND_powerpc_le
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
+ endif
++endif
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
+ 
+ if COND_i386_pc
+-- 
+1.9.3
+
diff --git a/SOURCES/0142-Files-reorganization-and-include-some-libgcc-fuction.patch b/SOURCES/0142-Files-reorganization-and-include-some-libgcc-fuction.patch
new file mode 100644
index 0000000..9d34594
--- /dev/null
+++ b/SOURCES/0142-Files-reorganization-and-include-some-libgcc-fuction.patch
@@ -0,0 +1,439 @@
+From a4ea9134214da4801400129cdf7108a5f9e98a10 Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
+Date: Wed, 13 Aug 2014 19:00:19 +0000
+Subject: [PATCH 142/143] Files reorganization and include some libgcc fuctions
+
+As we avoid libgcc dependency for powerpc64el, we moved some functions
+to other files and add the necessary ones.
+
+* Makefile.core.def: Include compiler-rt.S.
+* misc.c: Add the necessary libgcc functions.
+* compiler-rt.S: New file.
+* libgcc.h: Move some content from here ...
+* compiler.h: ... to here.
+
+Also-By: Brent Baude <bbaude@redhat.com>
+Also-By: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
+---
+ grub-core/Makefile.core.def          |   1 +
+ grub-core/kern/misc.c                | 107 ++++++++++++++++++++++++++++
+ grub-core/kern/powerpc/compiler-rt.S | 130 +++++++++++++++++++++++++++++++++++
+ include/grub/compiler.h              |  61 ++++++++++++++++
+ include/grub/libgcc.h                |  67 ------------------
+ 5 files changed, 299 insertions(+), 67 deletions(-)
+ create mode 100644 grub-core/kern/powerpc/compiler-rt.S
+
+diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
+index 7bf1c8a..9ff9ae5 100644
+--- a/grub-core/Makefile.core.def
++++ b/grub-core/Makefile.core.def
+@@ -252,6 +252,7 @@ kernel = {
+ 
+   powerpc_ieee1275 = kern/powerpc/cache.S;
+   powerpc_ieee1275 = kern/powerpc/dl.c;
++  powerpc_ieee1275 = kern/powerpc/compiler-rt.S;
+ 
+   sparc64_ieee1275 = kern/sparc64/cache.S;
+   sparc64_ieee1275 = kern/sparc64/dl.c;
+diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
+index a56cfe7..a3e5056 100644
+--- a/grub-core/kern/misc.c
++++ b/grub-core/kern/misc.c
+@@ -1345,3 +1345,110 @@ grub_real_boot_time (const char *file,
+   grub_error_pop ();
+ }
+ #endif
++
++#if defined (NO_LIBGCC)
++
++/* Based on libgcc2.c from gcc suite.  */
++int
++__ucmpdi2 (grub_uint64_t a, grub_uint64_t b)
++{
++  union component64 ac, bc;
++  ac.full = a;
++  bc.full = b;
++
++  if (ac.high < bc.high)
++    return 0;
++  else if (ac.high > bc.high)
++    return 2;
++
++  if (ac.low < bc.low)
++    return 0;
++  else if (ac.low > bc.low)
++    return 2;
++  return 1;
++}
++
++
++/* Based on libgcc2.c from gcc suite.  */
++grub_uint64_t
++__lshrdi3 (grub_uint64_t u, int b)
++{
++  if (b == 0)
++    return u;
++
++  const union component64 uu = {.full = u};
++  const int bm = 32 - b;
++  union component64 w;
++
++  if (bm <= 0)
++    {
++      w.high = 0;
++      w.low = (grub_uint32_t) uu.high >> -bm;
++    }
++  else
++    {
++      const grub_uint32_t carries = (grub_uint32_t) uu.high << bm;
++
++      w.high = (grub_uint32_t) uu.high >> b;
++      w.low = ((grub_uint32_t) uu.low >> b) | carries;
++    }
++
++  return w.full;
++}
++
++/* Based on libgcc2.c from gcc suite.  */
++grub_uint64_t
++__ashrdi3 (grub_uint64_t u, int b)
++{
++  if (b == 0)
++    return u;
++
++  const union component64 uu = {.full = u};
++  const int bm = 32 - b;
++  union component64 w;
++
++  if (bm <= 0)
++    {
++      /* w.high = 1..1 or 0..0 */
++      w.high = uu.high >> (32 - 1);
++      w.low = uu.high >> -bm;
++    }
++  else
++    {
++      const grub_uint32_t carries = (grub_uint32_t) uu.high << bm;
++
++      w.high = uu.high >> b;
++      w.low = ((grub_uint32_t) uu.low >> b) | carries;
++    }
++
++  return w.full;
++}
++
++/* Based on libgcc2.c from gcc suite.  */
++grub_uint64_t
++__ashldi3 (grub_uint64_t u, int b)
++{
++  if (b == 0)
++    return u;
++
++  const union component64 uu = {.full = u};
++  const int bm = 32 - b;
++  union component64 w;
++
++  if (bm <= 0)
++    {
++      w.low = 0;
++      w.high = (grub_uint32_t) uu.low << -bm;
++    }
++  else
++    {
++      const grub_uint32_t carries = (grub_uint32_t) uu.low >> bm;
++
++      w.low = (grub_uint32_t) uu.low << b;
++      w.high = ((grub_uint32_t) uu.high << b) | carries;
++    }
++
++  return w.full;
++}
++
++#endif
+diff --git a/grub-core/kern/powerpc/compiler-rt.S b/grub-core/kern/powerpc/compiler-rt.S
+new file mode 100644
+index 0000000..63e3a0d
+--- /dev/null
++++ b/grub-core/kern/powerpc/compiler-rt.S
+@@ -0,0 +1,130 @@
++/*
++ * Special support for eabi and SVR4
++ *
++ *   Copyright (C) 1995-2014 Free Software Foundation, Inc.
++ *   Written By Michael Meissner
++ *   64-bit support written by David Edelsohn
++ *
++ * This file is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation; either version 3, or (at your option) any
++ * later version.
++ *
++ * This file is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * General Public License for more details.
++ *
++ * Under Section 7 of GPL version 3, you are granted additional
++ * permissions described in the GCC Runtime Library Exception, version
++ * 3.1, as published by the Free Software Foundation.
++ *
++ * You should have received a copy of the GNU General Public License and
++ * a copy of the GCC Runtime Library Exception along with this program;
++ * see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
++ * <http://www.gnu.org/licenses/>.
++ */
++
++/* Do any initializations needed for the eabi environment */
++
++#include <grub/symbol.h>
++#include <grub/dl.h>
++
++	.section ".text"
++
++#define CFI_RESTORE(reg)		.cfi_restore reg
++#define CFI_OFFSET(reg, off)		.cfi_offset reg, off
++#define CFI_DEF_CFA_REGISTER(reg)	.cfi_def_cfa_register reg
++#define CFI_STARTPROC			.cfi_startproc
++#define CFI_ENDPROC			.cfi_endproc
++
++/* Routines for restoring integer registers, called by the compiler.  */
++/* Called with r11 pointing to the stack header word of the caller of the */
++/* function, just beyond the end of the integer restore area.  */
++
++CFI_STARTPROC
++CFI_DEF_CFA_REGISTER (11)
++CFI_OFFSET (65, 4)
++CFI_OFFSET (14, -72)
++CFI_OFFSET (15, -68)
++CFI_OFFSET (16, -64)
++CFI_OFFSET (17, -60)
++CFI_OFFSET (18, -56)
++CFI_OFFSET (19, -52)
++CFI_OFFSET (20, -48)
++CFI_OFFSET (21, -44)
++CFI_OFFSET (22, -40)
++CFI_OFFSET (23, -36)
++CFI_OFFSET (24, -32)
++CFI_OFFSET (25, -28)
++CFI_OFFSET (26, -24)
++CFI_OFFSET (27, -20)
++CFI_OFFSET (28, -16)
++CFI_OFFSET (29, -12)
++CFI_OFFSET (30, -8)
++CFI_OFFSET (31, -4)
++FUNCTION(_restgpr_14_x)	lwz	14,-72(11)	/* restore gp registers */
++CFI_RESTORE (14)
++FUNCTION(_restgpr_15_x)	lwz	15,-68(11)
++CFI_RESTORE (15)
++FUNCTION(_restgpr_16_x)	lwz	16,-64(11)
++CFI_RESTORE (16)
++FUNCTION(_restgpr_17_x)	lwz	17,-60(11)
++CFI_RESTORE (17)
++FUNCTION(_restgpr_18_x)	lwz	18,-56(11)
++CFI_RESTORE (18)
++FUNCTION(_restgpr_19_x)	lwz	19,-52(11)
++CFI_RESTORE (19)
++FUNCTION(_restgpr_20_x)	lwz	20,-48(11)
++CFI_RESTORE (20)
++FUNCTION(_restgpr_21_x)	lwz	21,-44(11)
++CFI_RESTORE (21)
++FUNCTION(_restgpr_22_x)	lwz	22,-40(11)
++CFI_RESTORE (22)
++FUNCTION(_restgpr_23_x)	lwz	23,-36(11)
++CFI_RESTORE (23)
++FUNCTION(_restgpr_24_x)	lwz	24,-32(11)
++CFI_RESTORE (24)
++FUNCTION(_restgpr_25_x)	lwz	25,-28(11)
++CFI_RESTORE (25)
++FUNCTION(_restgpr_26_x)	lwz	26,-24(11)
++CFI_RESTORE (26)
++FUNCTION(_restgpr_27_x)	lwz	27,-20(11)
++CFI_RESTORE (27)
++FUNCTION(_restgpr_28_x)	lwz	28,-16(11)
++CFI_RESTORE (28)
++FUNCTION(_restgpr_29_x)	lwz	29,-12(11)
++CFI_RESTORE (29)
++FUNCTION(_restgpr_30_x)	lwz	30,-8(11)
++CFI_RESTORE (30)
++FUNCTION(_restgpr_31_x)	lwz	0,4(11)
++				lwz	31,-4(11)
++CFI_RESTORE (31)
++				mtlr	0
++CFI_RESTORE (65)
++				mr	1,11
++CFI_DEF_CFA_REGISTER (1)
++				blr
++CFI_ENDPROC
++
++CFI_STARTPROC
++FUNCTION(_savegpr_14)	stw	14,-72(11)	/* save gp registers */
++FUNCTION(_savegpr_15)	stw	15,-68(11)
++FUNCTION(_savegpr_16)	stw	16,-64(11)
++FUNCTION(_savegpr_17)	stw	17,-60(11)
++FUNCTION(_savegpr_18)	stw	18,-56(11)
++FUNCTION(_savegpr_19)	stw	19,-52(11)
++FUNCTION(_savegpr_20)	stw	20,-48(11)
++FUNCTION(_savegpr_21)	stw	21,-44(11)
++FUNCTION(_savegpr_22)	stw	22,-40(11)
++FUNCTION(_savegpr_23)	stw	23,-36(11)
++FUNCTION(_savegpr_24)	stw	24,-32(11)
++FUNCTION(_savegpr_25)	stw	25,-28(11)
++FUNCTION(_savegpr_26)	stw	26,-24(11)
++FUNCTION(_savegpr_27)	stw	27,-20(11)
++FUNCTION(_savegpr_28)	stw	28,-16(11)
++FUNCTION(_savegpr_29)	stw	29,-12(11)
++FUNCTION(_savegpr_30)	stw	30,-8(11)
++FUNCTION(_savegpr_31)	stw	31,-4(11)
++			blr
++CFI_ENDPROC
+diff --git a/include/grub/compiler.h b/include/grub/compiler.h
+index c9e1d7a..a9a684c 100644
+--- a/include/grub/compiler.h
++++ b/include/grub/compiler.h
+@@ -48,4 +48,65 @@
+ #  define WARN_UNUSED_RESULT
+ #endif
+ 
++#include "types.h"
++
++union component64
++{
++  grub_uint64_t full;
++  struct
++  {
++#ifdef GRUB_CPU_WORDS_BIGENDIAN
++    grub_uint32_t high;
++    grub_uint32_t low;
++#else
++    grub_uint32_t low;
++    grub_uint32_t high;
++#endif
++  };
++};
++
++#if defined (__powerpc__)
++grub_uint64_t EXPORT_FUNC (__lshrdi3) (grub_uint64_t u, int b);
++grub_uint64_t EXPORT_FUNC (__ashrdi3) (grub_uint64_t u, int b);
++grub_uint64_t EXPORT_FUNC (__ashldi3) (grub_uint64_t u, int b);
++int EXPORT_FUNC(__ucmpdi2) (grub_uint64_t a, grub_uint64_t b);
++void EXPORT_FUNC (_restgpr_14_x) (void);
++void EXPORT_FUNC (_restgpr_15_x) (void);
++void EXPORT_FUNC (_restgpr_16_x) (void);
++void EXPORT_FUNC (_restgpr_17_x) (void);
++void EXPORT_FUNC (_restgpr_18_x) (void);
++void EXPORT_FUNC (_restgpr_19_x) (void);
++void EXPORT_FUNC (_restgpr_20_x) (void);
++void EXPORT_FUNC (_restgpr_21_x) (void);
++void EXPORT_FUNC (_restgpr_22_x) (void);
++void EXPORT_FUNC (_restgpr_23_x) (void);
++void EXPORT_FUNC (_restgpr_24_x) (void);
++void EXPORT_FUNC (_restgpr_25_x) (void);
++void EXPORT_FUNC (_restgpr_26_x) (void);
++void EXPORT_FUNC (_restgpr_27_x) (void);
++void EXPORT_FUNC (_restgpr_28_x) (void);
++void EXPORT_FUNC (_restgpr_29_x) (void);
++void EXPORT_FUNC (_restgpr_30_x) (void);
++void EXPORT_FUNC (_restgpr_31_x) (void);
++void EXPORT_FUNC (_savegpr_14) (void);
++void EXPORT_FUNC (_savegpr_15) (void);
++void EXPORT_FUNC (_savegpr_16) (void);
++void EXPORT_FUNC (_savegpr_17) (void);
++void EXPORT_FUNC (_savegpr_18) (void);
++void EXPORT_FUNC (_savegpr_19) (void);
++void EXPORT_FUNC (_savegpr_20) (void);
++void EXPORT_FUNC (_savegpr_21) (void);
++void EXPORT_FUNC (_savegpr_22) (void);
++void EXPORT_FUNC (_savegpr_23) (void);
++void EXPORT_FUNC (_savegpr_24) (void);
++void EXPORT_FUNC (_savegpr_25) (void);
++void EXPORT_FUNC (_savegpr_26) (void);
++void EXPORT_FUNC (_savegpr_27) (void);
++void EXPORT_FUNC (_savegpr_28) (void);
++void EXPORT_FUNC (_savegpr_29) (void);
++void EXPORT_FUNC (_savegpr_30) (void);
++void EXPORT_FUNC (_savegpr_31) (void);
++
++#endif
++
+ #endif /* ! GRUB_COMPILER_HEADER */
+diff --git a/include/grub/libgcc.h b/include/grub/libgcc.h
+index 8e93b67..5bdb8fb 100644
+--- a/include/grub/libgcc.h
++++ b/include/grub/libgcc.h
+@@ -16,73 +16,6 @@
+  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+  */
+ 
+-/* We need to include config-util.h.in for HAVE_*.  */
+-#ifndef __STDC_VERSION__
+-#define __STDC_VERSION__ 0
+-#endif
+-#include <config-util.h>
+-
+-/* On x86 these functions aren't really needed. Save some space.  */
+-#if !defined (__i386__) && !defined (__x86_64__)
+-# ifdef HAVE___ASHLDI3
+-void EXPORT_FUNC (__ashldi3) (void);
+-# endif
+-# ifdef HAVE___ASHRDI3
+-void EXPORT_FUNC (__ashrdi3) (void);
+-# endif
+-# ifdef HAVE___LSHRDI3
+-void EXPORT_FUNC (__lshrdi3) (void);
+-# endif
+-# ifdef HAVE___UCMPDI2
+-void EXPORT_FUNC (__ucmpdi2) (void);
+-# endif
+-# ifdef HAVE___BSWAPSI2
+-void EXPORT_FUNC (__bswapsi2) (void);
+-# endif
+-# ifdef HAVE___BSWAPDI2
+-void EXPORT_FUNC (__bswapdi2) (void);
+-# endif
+-#endif
+-
+-#ifdef HAVE__RESTGPR_14_X
+-void EXPORT_FUNC (_restgpr_14_x) (void);
+-void EXPORT_FUNC (_restgpr_15_x) (void);
+-void EXPORT_FUNC (_restgpr_16_x) (void);
+-void EXPORT_FUNC (_restgpr_17_x) (void);
+-void EXPORT_FUNC (_restgpr_18_x) (void);
+-void EXPORT_FUNC (_restgpr_19_x) (void);
+-void EXPORT_FUNC (_restgpr_20_x) (void);
+-void EXPORT_FUNC (_restgpr_21_x) (void);
+-void EXPORT_FUNC (_restgpr_22_x) (void);
+-void EXPORT_FUNC (_restgpr_23_x) (void);
+-void EXPORT_FUNC (_restgpr_24_x) (void);
+-void EXPORT_FUNC (_restgpr_25_x) (void);
+-void EXPORT_FUNC (_restgpr_26_x) (void);
+-void EXPORT_FUNC (_restgpr_27_x) (void);
+-void EXPORT_FUNC (_restgpr_28_x) (void);
+-void EXPORT_FUNC (_restgpr_29_x) (void);
+-void EXPORT_FUNC (_restgpr_30_x) (void);
+-void EXPORT_FUNC (_restgpr_31_x) (void);
+-void EXPORT_FUNC (_savegpr_14) (void);
+-void EXPORT_FUNC (_savegpr_15) (void);
+-void EXPORT_FUNC (_savegpr_16) (void);
+-void EXPORT_FUNC (_savegpr_17) (void);
+-void EXPORT_FUNC (_savegpr_18) (void);
+-void EXPORT_FUNC (_savegpr_19) (void);
+-void EXPORT_FUNC (_savegpr_20) (void);
+-void EXPORT_FUNC (_savegpr_21) (void);
+-void EXPORT_FUNC (_savegpr_22) (void);
+-void EXPORT_FUNC (_savegpr_23) (void);
+-void EXPORT_FUNC (_savegpr_24) (void);
+-void EXPORT_FUNC (_savegpr_25) (void);
+-void EXPORT_FUNC (_savegpr_26) (void);
+-void EXPORT_FUNC (_savegpr_27) (void);
+-void EXPORT_FUNC (_savegpr_28) (void);
+-void EXPORT_FUNC (_savegpr_29) (void);
+-void EXPORT_FUNC (_savegpr_30) (void);
+-void EXPORT_FUNC (_savegpr_31) (void);
+-#endif
+-
+ #if defined (__arm__)
+ void EXPORT_FUNC (__aeabi_lasr) (void);
+ void EXPORT_FUNC (__aeabi_llsl) (void);
+-- 
+1.9.3
+
diff --git a/SOURCES/0143-Suport-for-bi-endianess-in-elf-file.patch b/SOURCES/0143-Suport-for-bi-endianess-in-elf-file.patch
new file mode 100644
index 0000000..6971fc9
--- /dev/null
+++ b/SOURCES/0143-Suport-for-bi-endianess-in-elf-file.patch
@@ -0,0 +1,202 @@
+From 9facac630985467ee1ad40beaed07d50ee18062c Mon Sep 17 00:00:00 2001
+From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
+Date: Fri, 15 Aug 2014 14:39:53 -0300
+Subject: [PATCH 143/143] Suport for bi-endianess in elf file
+
+* grub-core/kern/elf.c: check and switch endianess with grub_{be,le}_to
+  cpu functions.
+* grub-core/kern/elfXX.c: Likewise.
+
+Also-by: Tomohiro B Berry <tbberry@us.ibm.com>
+---
+ grub-core/kern/elf.c   | 60 +++++++++++++++++++++++++++++++++++++++--
+ grub-core/kern/elfXX.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 131 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/kern/elf.c b/grub-core/kern/elf.c
+index 5f99c43..de90811 100644
+--- a/grub-core/kern/elf.c
++++ b/grub-core/kern/elf.c
+@@ -28,6 +28,11 @@
+ 
+ GRUB_MOD_LICENSE ("GPLv3+");
+ 
++void grub_elf32_check_endianess (grub_elf_t elf);
++void grub_elf64_check_endianess (grub_elf_t elf);
++grub_err_t grub_elf32_check_version (grub_elf_t elf);
++grub_err_t grub_elf64_check_version (grub_elf_t elf);
++
+ /* Check if EHDR is a valid ELF header.  */
+ static grub_err_t
+ grub_elf_check_header (grub_elf_t elf)
+@@ -38,10 +43,22 @@ grub_elf_check_header (grub_elf_t elf)
+       || e->e_ident[EI_MAG1] != ELFMAG1
+       || e->e_ident[EI_MAG2] != ELFMAG2
+       || e->e_ident[EI_MAG3] != ELFMAG3
+-      || e->e_ident[EI_VERSION] != EV_CURRENT
+-      || e->e_version != EV_CURRENT)
++      || e->e_ident[EI_VERSION] != EV_CURRENT)
+     return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-independent ELF magic"));
+ 
++  if (grub_elf_is_elf32 (elf))
++    {
++      grub_elf32_check_endianess (elf);
++      grub_elf32_check_version (elf);
++    }
++  else if (grub_elf_is_elf64 (elf))
++    {
++      grub_elf64_check_endianess (elf);
++      grub_elf64_check_version (elf);
++    }
++  else
++    return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-dependent ELF magic"));
++
+   return GRUB_ERR_NONE;
+ }
+ 
+@@ -127,7 +144,20 @@ grub_elf_open (const char *name)
+ #define grub_elf_is_elfXX grub_elf_is_elf32
+ #define grub_elfXX_load_phdrs grub_elf32_load_phdrs
+ #define ElfXX_Phdr Elf32_Phdr
++#define ElfXX_Ehdr Elf32_Ehdr
+ #define grub_uintXX_t grub_uint32_t
++#define grub_be_to_halfXX grub_be_to_cpu16
++#define grub_be_to_wordXX grub_be_to_cpu32
++#define grub_be_to_addrXX grub_be_to_cpu32
++#define grub_be_to_offXX grub_be_to_cpu32
++#define grub_be_to_XwordXX grub_be_to_wordXX
++#define grub_le_to_halfXX grub_le_to_cpu16
++#define grub_le_to_wordXX grub_le_to_cpu32
++#define grub_le_to_addrXX grub_le_to_cpu32
++#define grub_le_to_offXX grub_le_to_cpu32
++#define grub_le_to_XwordXX grub_le_to_wordXX
++#define grub_elfXX_check_endianess grub_elf32_check_endianess
++#define grub_elfXX_check_version grub_elf32_check_version
+ 
+ #include "elfXX.c"
+ 
+@@ -140,7 +170,20 @@ grub_elf_open (const char *name)
+ #undef grub_elf_is_elfXX
+ #undef grub_elfXX_load_phdrs
+ #undef ElfXX_Phdr
++#undef ElfXX_Ehdr
+ #undef grub_uintXX_t
++#undef grub_be_to_halfXX
++#undef grub_be_to_wordXX
++#undef grub_be_to_addrXX
++#undef grub_be_to_offXX
++#undef grub_be_to_XwordXX
++#undef grub_le_to_halfXX
++#undef grub_le_to_wordXX
++#undef grub_le_to_addrXX
++#undef grub_le_to_offXX
++#undef grub_le_to_XwordXX
++#undef grub_elfXX_check_endianess
++#undef grub_elfXX_check_version
+ 
+ 
+ /* 64-bit */
+@@ -153,6 +196,19 @@ grub_elf_open (const char *name)
+ #define grub_elf_is_elfXX grub_elf_is_elf64
+ #define grub_elfXX_load_phdrs grub_elf64_load_phdrs
+ #define ElfXX_Phdr Elf64_Phdr
++#define ElfXX_Ehdr Elf64_Ehdr
+ #define grub_uintXX_t grub_uint64_t
++#define grub_be_to_halfXX grub_be_to_cpu16
++#define grub_be_to_wordXX grub_be_to_cpu32
++#define grub_be_to_addrXX grub_be_to_cpu64
++#define grub_be_to_offXX grub_be_to_cpu64
++#define grub_be_to_XwordXX grub_be_to_cpu64
++#define grub_le_to_halfXX grub_le_to_cpu16
++#define grub_le_to_wordXX grub_le_to_cpu32
++#define grub_le_to_addrXX grub_le_to_cpu64
++#define grub_le_to_offXX grub_le_to_cpu64
++#define grub_le_to_XwordXX grub_le_to_cpu64
++#define grub_elfXX_check_endianess grub_elf64_check_endianess
++#define grub_elfXX_check_version grub_elf64_check_version
+ 
+ #include "elfXX.c"
+diff --git a/grub-core/kern/elfXX.c b/grub-core/kern/elfXX.c
+index 1d09971..ecf9df6 100644
+--- a/grub-core/kern/elfXX.c
++++ b/grub-core/kern/elfXX.c
+@@ -154,3 +154,76 @@ grub_elfXX_load (grub_elf_t elf, const char *filename,
+ 
+   return grub_errno;
+ }
++
++void
++grub_elfXX_check_endianess (grub_elf_t elf)
++{
++  ElfXX_Ehdr *e = &(elf->ehdr.ehdrXX);
++  ElfXX_Phdr *phdr;
++
++  if (e->e_ident[EI_DATA] == ELFDATA2MSB)
++    {
++      e->e_type = grub_be_to_halfXX (e->e_type);
++      e->e_machine = grub_be_to_halfXX (e->e_machine);
++      e->e_version = grub_be_to_wordXX (e->e_version);
++      e->e_entry = grub_be_to_addrXX (e->e_entry);
++      e->e_phoff = grub_be_to_offXX (e->e_phoff);
++      e->e_shoff = grub_be_to_offXX (e->e_shoff);
++      e->e_flags = grub_be_to_wordXX (e->e_flags);
++      e->e_ehsize = grub_be_to_halfXX (e->e_ehsize);
++      e->e_phentsize = grub_be_to_halfXX (e->e_phentsize);
++      e->e_phnum = grub_be_to_halfXX (e->e_phnum);
++      e->e_shentsize = grub_be_to_halfXX (e->e_shentsize);
++      e->e_shnum = grub_be_to_halfXX (e->e_shnum);
++      e->e_shstrndx = grub_be_to_halfXX (e->e_shstrndx);
++
++      FOR_ELFXX_PHDRS (elf,phdr)
++        {
++          phdr->p_type = grub_be_to_wordXX (phdr->p_type);
++          phdr->p_flags = grub_be_to_wordXX (phdr->p_flags);
++          phdr->p_offset = grub_be_to_offXX (phdr->p_offset);
++          phdr->p_vaddr = grub_be_to_addrXX (phdr->p_vaddr);
++          phdr->p_paddr = grub_be_to_addrXX (phdr->p_paddr);
++          phdr->p_filesz = grub_be_to_XwordXX (phdr->p_filesz);
++          phdr->p_memsz = grub_be_to_XwordXX (phdr->p_memsz);
++          phdr->p_align = grub_be_to_XwordXX (phdr->p_align);
++        }
++    }
++  else if (e->e_ident[EI_DATA] == ELFDATA2LSB)
++    {
++      e->e_type = grub_le_to_halfXX (e->e_type);
++      e->e_machine = grub_le_to_halfXX (e->e_machine);
++      e->e_version = grub_le_to_wordXX (e->e_version);
++      e->e_entry = grub_le_to_addrXX (e->e_entry);
++      e->e_phoff = grub_le_to_offXX (e->e_phoff);
++      e->e_shoff = grub_le_to_offXX (e->e_shoff);
++      e->e_flags = grub_le_to_wordXX (e->e_flags);
++      e->e_ehsize = grub_le_to_halfXX (e->e_ehsize);
++      e->e_phentsize = grub_le_to_halfXX (e->e_phentsize);
++      e->e_phnum = grub_le_to_halfXX (e->e_phnum);
++      e->e_shentsize = grub_le_to_halfXX (e->e_shentsize);
++      e->e_shnum = grub_le_to_halfXX (e->e_shnum);
++      e->e_shstrndx = grub_le_to_halfXX (e->e_shstrndx);
++
++      FOR_ELFXX_PHDRS (elf,phdr)
++        {
++          phdr->p_type = grub_le_to_wordXX (phdr->p_type);
++          phdr->p_flags = grub_le_to_wordXX (phdr->p_flags);
++          phdr->p_offset = grub_le_to_offXX (phdr->p_offset);
++          phdr->p_vaddr = grub_le_to_addrXX (phdr->p_vaddr);
++          phdr->p_paddr = grub_le_to_addrXX (phdr->p_paddr);
++          phdr->p_filesz = grub_le_to_XwordXX (phdr->p_filesz);
++          phdr->p_memsz = grub_le_to_XwordXX (phdr->p_memsz);
++          phdr->p_align = grub_le_to_XwordXX (phdr->p_align);
++        }
++    }
++}
++
++grub_err_t
++grub_elfXX_check_version (grub_elf_t elf)
++{
++  if (elf->ehdr.ehdrXX.e_version != EV_CURRENT)
++    return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-independent ELF magic"));
++
++  return GRUB_ERR_NONE;
++}
+-- 
+1.9.3
+
diff --git a/SOURCES/0144-Add-grub_util_readlink.patch b/SOURCES/0144-Add-grub_util_readlink.patch
new file mode 100644
index 0000000..6ba75f0
--- /dev/null
+++ b/SOURCES/0144-Add-grub_util_readlink.patch
@@ -0,0 +1,3734 @@
+From a4492dc21cd26878cc5f4a7766275b17b1f0340c Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Wed, 3 Sep 2014 10:01:03 -0400
+Subject: [PATCH 144/145] Add grub_util_readlink()
+
+Add grub_util_readlink().  This requires pulling in stat and readlink from
+gnulib, which pulls in stat and related headers, but after that the
+implementation is straightforward.
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+Reviewed-by: Adam Jackson <ajax@redhat.com>
+---
+ grub-core/gnulib/Makefile.am          | 177 +++++++-
+ grub-core/gnulib/gettimeofday.c       | 154 +++++++
+ grub-core/gnulib/pathmax.h            |  83 ++++
+ grub-core/gnulib/readlink.c           |  74 ++++
+ grub-core/gnulib/stat.c               | 138 +++++++
+ grub-core/gnulib/sys_stat.in.h        | 732 ++++++++++++++++++++++++++++++++++
+ grub-core/gnulib/sys_time.in.h        | 213 ++++++++++
+ grub-core/gnulib/sys_types.in.h       |   2 +
+ grub-core/gnulib/time.h               | 586 +++++++++++++++++++++++++++
+ grub-core/gnulib/time.in.h            | 274 +++++++++++++
+ grub-core/osdep/windows/hostdisk.c    |   6 +
+ include/grub/osdep/hostfile_aros.h    |   6 +
+ include/grub/osdep/hostfile_unix.h    |   6 +
+ include/grub/osdep/hostfile_windows.h |   2 +
+ m4/gettimeofday.m4                    | 138 +++++++
+ m4/gnulib-cache.m4                    |   3 +-
+ m4/gnulib-comp.m4                     |  49 +++
+ m4/largefile.m4                       | 146 +++++++
+ m4/pathmax.m4                         |  42 ++
+ m4/readlink.m4                        |  71 ++++
+ m4/stat.m4                            |  71 ++++
+ m4/sys_stat_h.m4                      |  96 +++++
+ m4/sys_time_h.m4                      | 110 +++++
+ m4/time_h.m4                          | 118 ++++++
+ 24 files changed, 3295 insertions(+), 2 deletions(-)
+ create mode 100644 grub-core/gnulib/gettimeofday.c
+ create mode 100644 grub-core/gnulib/pathmax.h
+ create mode 100644 grub-core/gnulib/readlink.c
+ create mode 100644 grub-core/gnulib/stat.c
+ create mode 100644 grub-core/gnulib/sys_stat.in.h
+ create mode 100644 grub-core/gnulib/sys_time.in.h
+ create mode 100644 grub-core/gnulib/time.h
+ create mode 100644 grub-core/gnulib/time.in.h
+ create mode 100644 m4/gettimeofday.m4
+ create mode 100644 m4/largefile.m4
+ create mode 100644 m4/pathmax.m4
+ create mode 100644 m4/readlink.m4
+ create mode 100644 m4/stat.m4
+ create mode 100644 m4/sys_stat_h.m4
+ create mode 100644 m4/sys_time_h.m4
+ create mode 100644 m4/time_h.m4
+
+diff --git a/grub-core/gnulib/Makefile.am b/grub-core/gnulib/Makefile.am
+index 3444397..b7c5e60 100644
+--- a/grub-core/gnulib/Makefile.am
++++ b/grub-core/gnulib/Makefile.am
+@@ -21,7 +21,7 @@
+ # the same distribution terms as the rest of that program.
+ #
+ # Generated by gnulib-tool.
+-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname regex
++# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname readlink regex
+ 
+ AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
+ 
+@@ -326,6 +326,15 @@ libgnu_a_SOURCES += gettext.h
+ 
+ ## end   gnulib module gettext-h
+ 
++## begin gnulib module gettimeofday
++
++
++EXTRA_DIST += gettimeofday.c
++
++EXTRA_libgnu_a_SOURCES += gettimeofday.c
++
++## end   gnulib module gettimeofday
++
+ ## begin gnulib module havelib
+ 
+ 
+@@ -596,6 +605,13 @@ EXTRA_libgnu_a_SOURCES += nl_langinfo.c
+ 
+ ## end   gnulib module nl_langinfo
+ 
++## begin gnulib module pathmax
++
++
++EXTRA_DIST += pathmax.h
++
++## end   gnulib module pathmax
++
+ ## begin gnulib module progname
+ 
+ libgnu_a_SOURCES += progname.h progname.c
+@@ -611,6 +627,15 @@ EXTRA_libgnu_a_SOURCES += rawmemchr.c
+ 
+ ## end   gnulib module rawmemchr
+ 
++## begin gnulib module readlink
++
++
++EXTRA_DIST += readlink.c
++
++EXTRA_libgnu_a_SOURCES += readlink.c
++
++## end   gnulib module readlink
++
+ ## begin gnulib module realloc-posix
+ 
+ 
+@@ -725,6 +750,15 @@ EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h
+ 
+ ## end   gnulib module snippet/warn-on-use
+ 
++## begin gnulib module stat
++
++
++EXTRA_DIST += stat.c
++
++EXTRA_libgnu_a_SOURCES += stat.c
++
++## end   gnulib module stat
++
+ ## begin gnulib module stdalign
+ 
+ BUILT_SOURCES += $(STDALIGN_H)
+@@ -1280,6 +1314,102 @@ libgnu_a_SOURCES += strnlen1.h strnlen1.c
+ 
+ ## end   gnulib module strnlen1
+ 
++## begin gnulib module sys_stat
++
++BUILT_SOURCES += sys/stat.h
++
++# We need the following in order to create <sys/stat.h> when the system
++# has one that is incomplete.
++sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
++	$(AM_V_at)$(MKDIR_P) sys
++	$(AM_V_GEN)rm -f $@-t $@ && \
++	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
++	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
++	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
++	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
++	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
++	      -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
++	      -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
++	      -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
++	      -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
++	      -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
++	      -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \
++	      -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \
++	      -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \
++	      -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \
++	      -e 's/@''GNULIB_MKFIFO''@/$(GNULIB_MKFIFO)/g' \
++	      -e 's/@''GNULIB_MKFIFOAT''@/$(GNULIB_MKFIFOAT)/g' \
++	      -e 's/@''GNULIB_MKNOD''@/$(GNULIB_MKNOD)/g' \
++	      -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \
++	      -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \
++	      -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \
++	      -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
++	      -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
++	      -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
++	      -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
++	      -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
++	      -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \
++	      -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \
++	      -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \
++	      -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \
++	      -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \
++	      -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \
++	      -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
++	      -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
++	      -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \
++	      -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
++	      -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
++	      -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \
++	      -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
++	      -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
++	      -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
++	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
++	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
++	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
++	      < $(srcdir)/sys_stat.in.h; \
++	} > $@-t && \
++	mv $@-t $@
++MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
++MOSTLYCLEANDIRS += sys
++
++EXTRA_DIST += sys_stat.in.h
++
++## end   gnulib module sys_stat
++
++## begin gnulib module sys_time
++
++BUILT_SOURCES += sys/time.h
++
++# We need the following in order to create <sys/time.h> when the system
++# doesn't have one that works with the given compiler.
++sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
++	$(AM_V_at)$(MKDIR_P) sys
++	$(AM_V_GEN)rm -f $@-t $@ && \
++	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
++	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
++	      -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
++	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
++	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
++	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
++	      -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
++	      -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
++	      -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
++	      -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
++	      -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
++	      -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
++	      -e 's/@''REPLACE_STRUCT_TIMEVAL''@/$(REPLACE_STRUCT_TIMEVAL)/g' \
++	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
++	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
++	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
++	      < $(srcdir)/sys_time.in.h; \
++	} > $@-t && \
++	mv $@-t $@
++MOSTLYCLEANFILES += sys/time.h sys/time.h-t
++
++EXTRA_DIST += sys_time.in.h
++
++## end   gnulib module sys_time
++
+ ## begin gnulib module sys_types
+ 
+ BUILT_SOURCES += sys/types.h
+@@ -1334,6 +1464,51 @@ EXTRA_DIST += sysexits.in.h
+ 
+ ## end   gnulib module sysexits
+ 
++## begin gnulib module time
++
++BUILT_SOURCES += time.h
++
++# We need the following in order to create <time.h> when the system
++# doesn't have one that works with the given compiler.
++time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
++	$(AM_V_GEN)rm -f $@-t $@ && \
++	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
++	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
++	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
++	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
++	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
++	      -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
++	      -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
++	      -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \
++	      -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \
++	      -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \
++	      -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \
++	      -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \
++	      -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
++	      -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \
++	      -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
++	      -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
++	      -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
++	      -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
++	      -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
++	      -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
++	      -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
++	      -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
++	      -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \
++	      -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
++	      -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
++	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
++	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
++	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
++	      < $(srcdir)/time.in.h; \
++	} > $@-t && \
++	mv $@-t $@
++MOSTLYCLEANFILES += time.h time.h-t
++
++EXTRA_DIST += time.in.h
++
++## end   gnulib module time
++
+ ## begin gnulib module unistd
+ 
+ BUILT_SOURCES += unistd.h
+diff --git a/grub-core/gnulib/gettimeofday.c b/grub-core/gnulib/gettimeofday.c
+new file mode 100644
+index 0000000..8b2058e
+--- /dev/null
++++ b/grub-core/gnulib/gettimeofday.c
+@@ -0,0 +1,154 @@
++/* Provide gettimeofday for systems that don't have it or for which it's broken.
++
++   Copyright (C) 2001-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3, or (at your option)
++   any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
++
++/* written by Jim Meyering */
++
++#include <config.h>
++
++/* Specification.  */
++#include <sys/time.h>
++
++#include <time.h>
++
++#if HAVE_SYS_TIMEB_H
++# include <sys/timeb.h>
++#endif
++
++#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME
++
++/* Work around the bug in some systems whereby gettimeofday clobbers
++   the static buffer that localtime uses for its return value.  The
++   gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
++   this problem.  The tzset replacement is necessary for at least
++   Solaris 2.5, 2.5.1, and 2.6.  */
++
++static struct tm tm_zero_buffer;
++static struct tm *localtime_buffer_addr = &tm_zero_buffer;
++
++# undef localtime
++extern struct tm *localtime (time_t const *);
++
++# undef gmtime
++extern struct tm *gmtime (time_t const *);
++
++/* This is a wrapper for localtime.  It is used only on systems for which
++   gettimeofday clobbers the static buffer used for localtime's result.
++
++   On the first call, record the address of the static buffer that
++   localtime uses for its result.  */
++
++struct tm *
++rpl_localtime (time_t const *timep)
++{
++  struct tm *tm = localtime (timep);
++
++  if (localtime_buffer_addr == &tm_zero_buffer)
++    localtime_buffer_addr = tm;
++
++  return tm;
++}
++
++/* Same as above, since gmtime and localtime use the same buffer.  */
++struct tm *
++rpl_gmtime (time_t const *timep)
++{
++  struct tm *tm = gmtime (timep);
++
++  if (localtime_buffer_addr == &tm_zero_buffer)
++    localtime_buffer_addr = tm;
++
++  return tm;
++}
++
++#endif /* GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME */
++
++#if TZSET_CLOBBERS_LOCALTIME
++
++# undef tzset
++extern void tzset (void);
++
++/* This is a wrapper for tzset, for systems on which tzset may clobber
++   the static buffer used for localtime's result.  */
++void
++rpl_tzset (void)
++{
++  /* Save and restore the contents of the buffer used for localtime's
++     result around the call to tzset.  */
++  struct tm save = *localtime_buffer_addr;
++  tzset ();
++  *localtime_buffer_addr = save;
++}
++#endif
++
++/* This is a wrapper for gettimeofday.  It is used only on systems
++   that lack this function, or whose implementation of this function
++   causes problems.  */
++
++int
++gettimeofday (struct timeval *restrict tv, void *restrict tz)
++{
++#undef gettimeofday
++#if HAVE_GETTIMEOFDAY
++# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
++  /* Save and restore the contents of the buffer used for localtime's
++     result around the call to gettimeofday.  */
++  struct tm save = *localtime_buffer_addr;
++# endif
++
++# if defined timeval /* 'struct timeval' overridden by gnulib?  */
++#  undef timeval
++  struct timeval otv;
++  int result = gettimeofday (&otv, (struct timezone *) tz);
++  if (result == 0)
++    {
++      tv->tv_sec = otv.tv_sec;
++      tv->tv_usec = otv.tv_usec;
++    }
++# else
++  int result = gettimeofday (tv, (struct timezone *) tz);
++# endif
++
++# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
++  *localtime_buffer_addr = save;
++# endif
++
++  return result;
++
++#else
++
++# if HAVE__FTIME
++
++  struct _timeb timebuf;
++  _ftime (&timebuf);
++  tv->tv_sec = timebuf.time;
++  tv->tv_usec = timebuf.millitm * 1000;
++
++# else
++
++#  if !defined OK_TO_USE_1S_CLOCK
++#   error "Only 1-second nominal clock resolution found.  Is that intended?" \
++          "If so, compile with the -DOK_TO_USE_1S_CLOCK option."
++#  endif
++  tv->tv_sec = time (NULL);
++  tv->tv_usec = 0;
++
++# endif
++
++  return 0;
++
++#endif
++}
+diff --git a/grub-core/gnulib/pathmax.h b/grub-core/gnulib/pathmax.h
+new file mode 100644
+index 0000000..33fc355
+--- /dev/null
++++ b/grub-core/gnulib/pathmax.h
+@@ -0,0 +1,83 @@
++/* Define PATH_MAX somehow.  Requires sys/types.h.
++   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2014 Free Software
++   Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3, or (at your option)
++   any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
++
++#ifndef _PATHMAX_H
++# define _PATHMAX_H
++
++/* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename,
++   including the terminating NUL byte.
++   <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html>
++   PATH_MAX is not defined on systems which have no limit on filename length,
++   such as GNU/Hurd.
++
++   This file does *not* define PATH_MAX always.  Programs that use this file
++   can handle the GNU/Hurd case in several ways:
++     - Either with a package-wide handling, or with a per-file handling,
++     - Either through a
++         #ifdef PATH_MAX
++       or through a fallback like
++         #ifndef PATH_MAX
++         # define PATH_MAX 8192
++         #endif
++       or through a fallback like
++         #ifndef PATH_MAX
++         # define PATH_MAX pathconf ("/", _PC_PATH_MAX)
++         #endif
++ */
++
++# include <unistd.h>
++
++# include <limits.h>
++
++# ifndef _POSIX_PATH_MAX
++#  define _POSIX_PATH_MAX 256
++# endif
++
++/* Don't include sys/param.h if it already has been.  */
++# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
++#  include <sys/param.h>
++# endif
++
++# if !defined PATH_MAX && defined MAXPATHLEN
++#  define PATH_MAX MAXPATHLEN
++# endif
++
++# ifdef __hpux
++/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename,
++   *not* including the terminating NUL byte, and is set to 1023.
++   Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is
++   not defined at all any more.  */
++#  undef PATH_MAX
++#  define PATH_MAX 1024
++# endif
++
++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
++/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com,
++   section "Maximum Path Length Limitation",
++   <http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath>
++   explains that the maximum size of a filename, including the terminating
++   NUL byte, is 260 = 3 + 256 + 1.
++   This is the same value as
++     - FILENAME_MAX in <stdio.h>,
++     - _MAX_PATH in <stdlib.h>,
++     - MAX_PATH in <windef.h>.
++   Undefine the original value, because mingw's <limits.h> gets it wrong.  */
++#  undef PATH_MAX
++#  define PATH_MAX 260
++# endif
++
++#endif /* _PATHMAX_H */
+diff --git a/grub-core/gnulib/readlink.c b/grub-core/gnulib/readlink.c
+new file mode 100644
+index 0000000..4c49639
+--- /dev/null
++++ b/grub-core/gnulib/readlink.c
+@@ -0,0 +1,74 @@
++/* Stub for readlink().
++   Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
++
++   This program is free software: you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <config.h>
++
++/* Specification.  */
++#include <unistd.h>
++
++#include <errno.h>
++#include <string.h>
++#include <sys/stat.h>
++
++#if !HAVE_READLINK
++
++/* readlink() substitute for systems that don't have a readlink() function,
++   such as DJGPP 2.03 and mingw32.  */
++
++ssize_t
++readlink (const char *name, char *buf _GL_UNUSED,
++          size_t bufsize _GL_UNUSED)
++{
++  struct stat statbuf;
++
++  /* In general we should use lstat() here, not stat().  But on platforms
++     without symbolic links, lstat() - if it exists - would be equivalent to
++     stat(), therefore we can use stat().  This saves us a configure check.  */
++  if (stat (name, &statbuf) >= 0)
++    errno = EINVAL;
++  return -1;
++}
++
++#else /* HAVE_READLINK */
++
++# undef readlink
++
++/* readlink() wrapper that uses correct types, for systems like cygwin
++   1.5.x where readlink returns int, and which rejects trailing slash,
++   for Solaris 9.  */
++
++ssize_t
++rpl_readlink (const char *name, char *buf, size_t bufsize)
++{
++# if READLINK_TRAILING_SLASH_BUG
++  size_t len = strlen (name);
++  if (len && name[len - 1] == '/')
++    {
++      /* Even if name without the slash is a symlink to a directory,
++         both lstat() and stat() must resolve the trailing slash to
++         the directory rather than the symlink.  We can therefore
++         safely use stat() to distinguish between EINVAL and
++         ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat().  */
++      struct stat st;
++      if (stat (name, &st) == 0)
++        errno = EINVAL;
++      return -1;
++    }
++# endif /* READLINK_TRAILING_SLASH_BUG */
++  return readlink (name, buf, bufsize);
++}
++
++#endif /* HAVE_READLINK */
+diff --git a/grub-core/gnulib/stat.c b/grub-core/gnulib/stat.c
+new file mode 100644
+index 0000000..35f4b0b
+--- /dev/null
++++ b/grub-core/gnulib/stat.c
+@@ -0,0 +1,138 @@
++/* Work around platform bugs in stat.
++   Copyright (C) 2009-2014 Free Software Foundation, Inc.
++
++   This program is free software: you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++/* written by Eric Blake */
++
++/* If the user's config.h happens to include <sys/stat.h>, let it include only
++   the system's <sys/stat.h> here, so that orig_stat doesn't recurse to
++   rpl_stat.  */
++#define __need_system_sys_stat_h
++#include <config.h>
++
++/* Get the original definition of stat.  It might be defined as a macro.  */
++#include <sys/types.h>
++#include <sys/stat.h>
++#undef __need_system_sys_stat_h
++
++#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
++# if _GL_WINDOWS_64_BIT_ST_SIZE
++#  undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
++#  define stat _stati64
++#  define REPLACE_FUNC_STAT_DIR 1
++#  undef REPLACE_FUNC_STAT_FILE
++# elif REPLACE_FUNC_STAT_FILE
++/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
++   Bypass it.  */
++#  define stat _stat
++#  define REPLACE_FUNC_STAT_DIR 1
++#  undef REPLACE_FUNC_STAT_FILE
++# endif
++#endif
++
++static int
++orig_stat (const char *filename, struct stat *buf)
++{
++  return stat (filename, buf);
++}
++
++/* Specification.  */
++/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
++   eliminates this include because of the preliminary #include <sys/stat.h>
++   above.  */
++#include "sys/stat.h"
++
++#include <errno.h>
++#include <limits.h>
++#include <stdbool.h>
++#include <string.h>
++#include "dosname.h"
++#include "verify.h"
++
++#if REPLACE_FUNC_STAT_DIR
++# include "pathmax.h"
++  /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
++     have a constant PATH_MAX.  */
++# ifndef PATH_MAX
++#  error "Please port this replacement to your platform"
++# endif
++#endif
++
++/* Store information about NAME into ST.  Work around bugs with
++   trailing slashes.  Mingw has other bugs (such as st_ino always
++   being 0 on success) which this wrapper does not work around.  But
++   at least this implementation provides the ability to emulate fchdir
++   correctly.  */
++
++int
++rpl_stat (char const *name, struct stat *st)
++{
++  int result = orig_stat (name, st);
++#if REPLACE_FUNC_STAT_FILE
++  /* Solaris 9 mistakenly succeeds when given a non-directory with a
++     trailing slash.  */
++  if (result == 0 && !S_ISDIR (st->st_mode))
++    {
++      size_t len = strlen (name);
++      if (ISSLASH (name[len - 1]))
++        {
++          errno = ENOTDIR;
++          return -1;
++        }
++    }
++#endif /* REPLACE_FUNC_STAT_FILE */
++#if REPLACE_FUNC_STAT_DIR
++
++  if (result == -1 && errno == ENOENT)
++    {
++      /* Due to mingw's oddities, there are some directories (like
++         c:\) where stat() only succeeds with a trailing slash, and
++         other directories (like c:\windows) where stat() only
++         succeeds without a trailing slash.  But we want the two to be
++         synonymous, since chdir() manages either style.  Likewise, Mingw also
++         reports ENOENT for names longer than PATH_MAX, when we want
++         ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR.
++         Fortunately, mingw PATH_MAX is small enough for stack
++         allocation.  */
++      char fixed_name[PATH_MAX + 1] = {0};
++      size_t len = strlen (name);
++      bool check_dir = false;
++      verify (PATH_MAX <= 4096);
++      if (PATH_MAX <= len)
++        errno = ENAMETOOLONG;
++      else if (len)
++        {
++          strcpy (fixed_name, name);
++          if (ISSLASH (fixed_name[len - 1]))
++            {
++              check_dir = true;
++              while (len && ISSLASH (fixed_name[len - 1]))
++                fixed_name[--len] = '\0';
++              if (!len)
++                fixed_name[0] = '/';
++            }
++          else
++            fixed_name[len++] = '/';
++          result = orig_stat (fixed_name, st);
++          if (result == 0 && check_dir && !S_ISDIR (st->st_mode))
++            {
++              result = -1;
++              errno = ENOTDIR;
++            }
++        }
++    }
++#endif /* REPLACE_FUNC_STAT_DIR */
++  return result;
++}
+diff --git a/grub-core/gnulib/sys_stat.in.h b/grub-core/gnulib/sys_stat.in.h
+new file mode 100644
+index 0000000..b47a7ff
+--- /dev/null
++++ b/grub-core/gnulib/sys_stat.in.h
+@@ -0,0 +1,732 @@
++/* Provide a more complete sys/stat header file.
++   Copyright (C) 2005-2014 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3, or (at your option)
++   any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
++
++/* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
++
++/* This file is supposed to be used on platforms where <sys/stat.h> is
++   incomplete.  It is intended to provide definitions and prototypes
++   needed by an application.  Start with what the system provides.  */
++
++#if __GNUC__ >= 3
++@PRAGMA_SYSTEM_HEADER@
++#endif
++@PRAGMA_COLUMNS@
++
++#if defined __need_system_sys_stat_h
++/* Special invocation convention.  */
++
++#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
++
++#else
++/* Normal invocation convention.  */
++
++#ifndef _@GUARD_PREFIX@_SYS_STAT_H
++
++/* Get nlink_t.
++   May also define off_t to a 64-bit type on native Windows.  */
++#include <sys/types.h>
++
++/* Get struct timespec.  */
++#include <time.h>
++
++/* The include_next requires a split double-inclusion guard.  */
++#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
++
++#ifndef _@GUARD_PREFIX@_SYS_STAT_H
++#define _@GUARD_PREFIX@_SYS_STAT_H
++
++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
++
++/* The definition of _GL_ARG_NONNULL is copied here.  */
++
++/* The definition of _GL_WARN_ON_USE is copied here.  */
++
++/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
++   headers that may declare mkdir().  Native Windows platforms declare mkdir
++   in <io.h> and/or <direct.h>, not in <unistd.h>.  */
++#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
++# include <io.h>     /* mingw32, mingw64 */
++# include <direct.h> /* mingw64, MSVC 9 */
++#endif
++
++/* Native Windows platforms declare umask() in <io.h>.  */
++#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
++# include <io.h>
++#endif
++
++/* Large File Support on native Windows.  */
++#if @WINDOWS_64_BIT_ST_SIZE@
++# define stat _stati64
++#endif
++
++#ifndef S_IFIFO
++# ifdef _S_IFIFO
++#  define S_IFIFO _S_IFIFO
++# endif
++#endif
++
++#ifndef S_IFMT
++# define S_IFMT 0170000
++#endif
++
++#if STAT_MACROS_BROKEN
++# undef S_ISBLK
++# undef S_ISCHR
++# undef S_ISDIR
++# undef S_ISFIFO
++# undef S_ISLNK
++# undef S_ISNAM
++# undef S_ISMPB
++# undef S_ISMPC
++# undef S_ISNWK
++# undef S_ISREG
++# undef S_ISSOCK
++#endif
++
++#ifndef S_ISBLK
++# ifdef S_IFBLK
++#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
++# else
++#  define S_ISBLK(m) 0
++# endif
++#endif
++
++#ifndef S_ISCHR
++# ifdef S_IFCHR
++#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
++# else
++#  define S_ISCHR(m) 0
++# endif
++#endif
++
++#ifndef S_ISDIR
++# ifdef S_IFDIR
++#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
++# else
++#  define S_ISDIR(m) 0
++# endif
++#endif
++
++#ifndef S_ISDOOR /* Solaris 2.5 and up */
++# define S_ISDOOR(m) 0
++#endif
++
++#ifndef S_ISFIFO
++# ifdef S_IFIFO
++#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
++# else
++#  define S_ISFIFO(m) 0
++# endif
++#endif
++
++#ifndef S_ISLNK
++# ifdef S_IFLNK
++#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
++# else
++#  define S_ISLNK(m) 0
++# endif
++#endif
++
++#ifndef S_ISMPB /* V7 */
++# ifdef S_IFMPB
++#  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
++#  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
++# else
++#  define S_ISMPB(m) 0
++#  define S_ISMPC(m) 0
++# endif
++#endif
++
++#ifndef S_ISMPX /* AIX */
++# define S_ISMPX(m) 0
++#endif
++
++#ifndef S_ISNAM /* Xenix */
++# ifdef S_IFNAM
++#  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
++# else
++#  define S_ISNAM(m) 0
++# endif
++#endif
++
++#ifndef S_ISNWK /* HP/UX */
++# ifdef S_IFNWK
++#  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
++# else
++#  define S_ISNWK(m) 0
++# endif
++#endif
++
++#ifndef S_ISPORT /* Solaris 10 and up */
++# define S_ISPORT(m) 0
++#endif
++
++#ifndef S_ISREG
++# ifdef S_IFREG
++#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
++# else
++#  define S_ISREG(m) 0
++# endif
++#endif
++
++#ifndef S_ISSOCK
++# ifdef S_IFSOCK
++#  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
++# else
++#  define S_ISSOCK(m) 0
++# endif
++#endif
++
++
++#ifndef S_TYPEISMQ
++# define S_TYPEISMQ(p) 0
++#endif
++
++#ifndef S_TYPEISTMO
++# define S_TYPEISTMO(p) 0
++#endif
++
++
++#ifndef S_TYPEISSEM
++# ifdef S_INSEM
++#  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
++# else
++#  define S_TYPEISSEM(p) 0
++# endif
++#endif
++
++#ifndef S_TYPEISSHM
++# ifdef S_INSHD
++#  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
++# else
++#  define S_TYPEISSHM(p) 0
++# endif
++#endif
++
++/* high performance ("contiguous data") */
++#ifndef S_ISCTG
++# define S_ISCTG(p) 0
++#endif
++
++/* Cray DMF (data migration facility): off line, with data  */
++#ifndef S_ISOFD
++# define S_ISOFD(p) 0
++#endif
++
++/* Cray DMF (data migration facility): off line, with no data  */
++#ifndef S_ISOFL
++# define S_ISOFL(p) 0
++#endif
++
++/* 4.4BSD whiteout */
++#ifndef S_ISWHT
++# define S_ISWHT(m) 0
++#endif
++
++/* If any of the following are undefined,
++   define them to their de facto standard values.  */
++#if !S_ISUID
++# define S_ISUID 04000
++#endif
++#if !S_ISGID
++# define S_ISGID 02000
++#endif
++
++/* S_ISVTX is a common extension to POSIX.  */
++#ifndef S_ISVTX
++# define S_ISVTX 01000
++#endif
++
++#if !S_IRUSR && S_IREAD
++# define S_IRUSR S_IREAD
++#endif
++#if !S_IRUSR
++# define S_IRUSR 00400
++#endif
++#if !S_IRGRP
++# define S_IRGRP (S_IRUSR >> 3)
++#endif
++#if !S_IROTH
++# define S_IROTH (S_IRUSR >> 6)
++#endif
++
++#if !S_IWUSR && S_IWRITE
++# define S_IWUSR S_IWRITE
++#endif
++#if !S_IWUSR
++# define S_IWUSR 00200
++#endif
++#if !S_IWGRP
++# define S_IWGRP (S_IWUSR >> 3)
++#endif
++#if !S_IWOTH
++# define S_IWOTH (S_IWUSR >> 6)
++#endif
++
++#if !S_IXUSR && S_IEXEC
++# define S_IXUSR S_IEXEC
++#endif
++#if !S_IXUSR
++# define S_IXUSR 00100
++#endif
++#if !S_IXGRP
++# define S_IXGRP (S_IXUSR >> 3)
++#endif
++#if !S_IXOTH
++# define S_IXOTH (S_IXUSR >> 6)
++#endif
++
++#if !S_IRWXU
++# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
++#endif
++#if !S_IRWXG
++# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
++#endif
++#if !S_IRWXO
++# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
++#endif
++
++/* S_IXUGO is a common extension to POSIX.  */
++#if !S_IXUGO
++# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
++#endif
++
++#ifndef S_IRWXUGO
++# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
++#endif
++
++/* Macros for futimens and utimensat.  */
++#ifndef UTIME_NOW
++# define UTIME_NOW (-1)
++# define UTIME_OMIT (-2)
++#endif
++
++
++#if @GNULIB_FCHMODAT@
++# if !@HAVE_FCHMODAT@
++_GL_FUNCDECL_SYS (fchmodat, int,
++                  (int fd, char const *file, mode_t mode, int flag)
++                  _GL_ARG_NONNULL ((2)));
++# endif
++_GL_CXXALIAS_SYS (fchmodat, int,
++                  (int fd, char const *file, mode_t mode, int flag));
++_GL_CXXALIASWARN (fchmodat);
++#elif defined GNULIB_POSIXCHECK
++# undef fchmodat
++# if HAVE_RAW_DECL_FCHMODAT
++_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
++                 "use gnulib module openat for portability");
++# endif
++#endif
++
++
++#if @GNULIB_FSTAT@
++# if @REPLACE_FSTAT@
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef fstat
++#   define fstat rpl_fstat
++#  endif
++_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
++_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
++# else
++_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
++# endif
++_GL_CXXALIASWARN (fstat);
++#elif @WINDOWS_64_BIT_ST_SIZE@
++/* Above, we define stat to _stati64.  */
++# define fstat _fstati64
++#elif defined GNULIB_POSIXCHECK
++# undef fstat
++# if HAVE_RAW_DECL_FSTAT
++_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
++                 "use gnulib module fstat for portability");
++# endif
++#endif
++
++
++#if @GNULIB_FSTATAT@
++# if @REPLACE_FSTATAT@
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef fstatat
++#   define fstatat rpl_fstatat
++#  endif
++_GL_FUNCDECL_RPL (fstatat, int,
++                  (int fd, char const *name, struct stat *st, int flags)
++                  _GL_ARG_NONNULL ((2, 3)));
++_GL_CXXALIAS_RPL (fstatat, int,
++                  (int fd, char const *name, struct stat *st, int flags));
++# else
++#  if !@HAVE_FSTATAT@
++_GL_FUNCDECL_SYS (fstatat, int,
++                  (int fd, char const *name, struct stat *st, int flags)
++                  _GL_ARG_NONNULL ((2, 3)));
++#  endif
++_GL_CXXALIAS_SYS (fstatat, int,
++                  (int fd, char const *name, struct stat *st, int flags));
++# endif
++_GL_CXXALIASWARN (fstatat);
++#elif defined GNULIB_POSIXCHECK
++# undef fstatat
++# if HAVE_RAW_DECL_FSTATAT
++_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
++                 "use gnulib module openat for portability");
++# endif
++#endif
++
++
++#if @GNULIB_FUTIMENS@
++/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
++   implementation relies on futimesat, which on Solaris 10 makes an invocation
++   to futimens that is meant to invoke the libc's futimens(), not gnulib's
++   futimens().  */
++# if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef futimens
++#   define futimens rpl_futimens
++#  endif
++_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
++_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
++# else
++#  if !@HAVE_FUTIMENS@
++_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
++#  endif
++_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
++# endif
++# if @HAVE_FUTIMENS@
++_GL_CXXALIASWARN (futimens);
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef futimens
++# if HAVE_RAW_DECL_FUTIMENS
++_GL_WARN_ON_USE (futimens, "futimens is not portable - "
++                 "use gnulib module futimens for portability");
++# endif
++#endif
++
++
++#if @GNULIB_LCHMOD@
++/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
++   denotes a symbolic link.  */
++# if !@HAVE_LCHMOD@
++/* The lchmod replacement follows symbolic links.  Callers should take
++   this into account; lchmod should be applied only to arguments that
++   are known to not be symbolic links.  On hosts that lack lchmod,
++   this can lead to race conditions between the check and the
++   invocation of lchmod, but we know of no workarounds that are
++   reliable in general.  You might try requesting support for lchmod
++   from your operating system supplier.  */
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   define lchmod chmod
++#  endif
++/* Need to cast, because on mingw, the second parameter of chmod is
++                                                int mode.  */
++_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
++                         (const char *filename, mode_t mode));
++# else
++#  if 0 /* assume already declared */
++_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
++                               _GL_ARG_NONNULL ((1)));
++#  endif
++_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
++# endif
++# if @HAVE_LCHMOD@
++_GL_CXXALIASWARN (lchmod);
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef lchmod
++# if HAVE_RAW_DECL_LCHMOD
++_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
++                 "use gnulib module lchmod for portability");
++# endif
++#endif
++
++
++#if @GNULIB_LSTAT@
++# if ! @HAVE_LSTAT@
++/* mingw does not support symlinks, therefore it does not have lstat.  But
++   without links, stat does just fine.  */
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   define lstat stat
++#  endif
++_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
++# elif @REPLACE_LSTAT@
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef lstat
++#   define lstat rpl_lstat
++#  endif
++_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
++                              _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
++# else
++_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
++# endif
++# if @HAVE_LSTAT@
++_GL_CXXALIASWARN (lstat);
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef lstat
++# if HAVE_RAW_DECL_LSTAT
++_GL_WARN_ON_USE (lstat, "lstat is unportable - "
++                 "use gnulib module lstat for portability");
++# endif
++#endif
++
++
++#if @REPLACE_MKDIR@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#  undef mkdir
++#  define mkdir rpl_mkdir
++# endif
++_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
++                              _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
++#else
++/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
++   Additionally, it declares _mkdir (and depending on compile flags, an
++   alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
++   which are included above.  */
++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
++
++#  if !GNULIB_defined_rpl_mkdir
++static int
++rpl_mkdir (char const *name, mode_t mode)
++{
++  return _mkdir (name);
++}
++#   define GNULIB_defined_rpl_mkdir 1
++#  endif
++
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   define mkdir rpl_mkdir
++#  endif
++_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
++# else
++_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
++# endif
++#endif
++_GL_CXXALIASWARN (mkdir);
++
++
++#if @GNULIB_MKDIRAT@
++# if !@HAVE_MKDIRAT@
++_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
++                                _GL_ARG_NONNULL ((2)));
++# endif
++_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
++_GL_CXXALIASWARN (mkdirat);
++#elif defined GNULIB_POSIXCHECK
++# undef mkdirat
++# if HAVE_RAW_DECL_MKDIRAT
++_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
++                 "use gnulib module openat for portability");
++# endif
++#endif
++
++
++#if @GNULIB_MKFIFO@
++# if @REPLACE_MKFIFO@
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef mkfifo
++#   define mkfifo rpl_mkfifo
++#  endif
++_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
++                               _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
++# else
++#  if !@HAVE_MKFIFO@
++_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
++                               _GL_ARG_NONNULL ((1)));
++#  endif
++_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
++# endif
++_GL_CXXALIASWARN (mkfifo);
++#elif defined GNULIB_POSIXCHECK
++# undef mkfifo
++# if HAVE_RAW_DECL_MKFIFO
++_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
++                 "use gnulib module mkfifo for portability");
++# endif
++#endif
++
++
++#if @GNULIB_MKFIFOAT@
++# if !@HAVE_MKFIFOAT@
++_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
++                                 _GL_ARG_NONNULL ((2)));
++# endif
++_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
++_GL_CXXALIASWARN (mkfifoat);
++#elif defined GNULIB_POSIXCHECK
++# undef mkfifoat
++# if HAVE_RAW_DECL_MKFIFOAT
++_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
++                 "use gnulib module mkfifoat for portability");
++# endif
++#endif
++
++
++#if @GNULIB_MKNOD@
++# if @REPLACE_MKNOD@
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef mknod
++#   define mknod rpl_mknod
++#  endif
++_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
++                              _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
++# else
++#  if !@HAVE_MKNOD@
++_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
++                              _GL_ARG_NONNULL ((1)));
++#  endif
++/* Need to cast, because on OSF/1 5.1, the third parameter is '...'.  */
++_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
++# endif
++_GL_CXXALIASWARN (mknod);
++#elif defined GNULIB_POSIXCHECK
++# undef mknod
++# if HAVE_RAW_DECL_MKNOD
++_GL_WARN_ON_USE (mknod, "mknod is not portable - "
++                 "use gnulib module mknod for portability");
++# endif
++#endif
++
++
++#if @GNULIB_MKNODAT@
++# if !@HAVE_MKNODAT@
++_GL_FUNCDECL_SYS (mknodat, int,
++                  (int fd, char const *file, mode_t mode, dev_t dev)
++                  _GL_ARG_NONNULL ((2)));
++# endif
++_GL_CXXALIAS_SYS (mknodat, int,
++                  (int fd, char const *file, mode_t mode, dev_t dev));
++_GL_CXXALIASWARN (mknodat);
++#elif defined GNULIB_POSIXCHECK
++# undef mknodat
++# if HAVE_RAW_DECL_MKNODAT
++_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
++                 "use gnulib module mkfifoat for portability");
++# endif
++#endif
++
++
++#if @GNULIB_STAT@
++# if @REPLACE_STAT@
++/* We can't use the object-like #define stat rpl_stat, because of
++   struct stat.  This means that rpl_stat will not be used if the user
++   does (stat)(a,b).  Oh well.  */
++#  if defined _AIX && defined stat && defined _LARGE_FILES
++    /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
++       so we have to replace stat64() instead of stat(). */
++#   undef stat64
++#   define stat64(name, st) rpl_stat (name, st)
++#  elif @WINDOWS_64_BIT_ST_SIZE@
++    /* Above, we define stat to _stati64.  */
++#   if defined __MINGW32__ && defined _stati64
++#    ifndef _USE_32BIT_TIME_T
++      /* The system headers define _stati64 to _stat64.  */
++#     undef _stat64
++#     define _stat64(name, st) rpl_stat (name, st)
++#    endif
++#   elif defined _MSC_VER && defined _stati64
++#    ifdef _USE_32BIT_TIME_T
++      /* The system headers define _stati64 to _stat32i64.  */
++#     undef _stat32i64
++#     define _stat32i64(name, st) rpl_stat (name, st)
++#    else
++      /* The system headers define _stati64 to _stat64.  */
++#     undef _stat64
++#     define _stat64(name, st) rpl_stat (name, st)
++#    endif
++#   else
++#    undef _stati64
++#    define _stati64(name, st) rpl_stat (name, st)
++#   endif
++#  elif defined __MINGW32__ && defined stat
++#   ifdef _USE_32BIT_TIME_T
++     /* The system headers define stat to _stat32i64.  */
++#    undef _stat32i64
++#    define _stat32i64(name, st) rpl_stat (name, st)
++#   else
++     /* The system headers define stat to _stat64.  */
++#    undef _stat64
++#    define _stat64(name, st) rpl_stat (name, st)
++#   endif
++#  elif defined _MSC_VER && defined stat
++#   ifdef _USE_32BIT_TIME_T
++     /* The system headers define stat to _stat32.  */
++#    undef _stat32
++#    define _stat32(name, st) rpl_stat (name, st)
++#   else
++     /* The system headers define stat to _stat64i32.  */
++#    undef _stat64i32
++#    define _stat64i32(name, st) rpl_stat (name, st)
++#   endif
++#  else /* !(_AIX ||__MINGW32__ ||  _MSC_VER) */
++#   undef stat
++#   define stat(name, st) rpl_stat (name, st)
++#  endif /* !_LARGE_FILES */
++_GL_EXTERN_C int stat (const char *name, struct stat *buf)
++                      _GL_ARG_NONNULL ((1, 2));
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef stat
++# if HAVE_RAW_DECL_STAT
++_GL_WARN_ON_USE (stat, "stat is unportable - "
++                 "use gnulib module stat for portability");
++# endif
++#endif
++
++
++#if @GNULIB_UTIMENSAT@
++/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
++   implementation relies on futimesat, which on Solaris 10 makes an invocation
++   to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
++   utimensat().  */
++# if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef utimensat
++#   define utimensat rpl_utimensat
++#  endif
++_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
++                                   struct timespec const times[2], int flag)
++                                  _GL_ARG_NONNULL ((2)));
++_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
++                                   struct timespec const times[2], int flag));
++# else
++#  if !@HAVE_UTIMENSAT@
++_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
++                                   struct timespec const times[2], int flag)
++                                  _GL_ARG_NONNULL ((2)));
++#  endif
++_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
++                                   struct timespec const times[2], int flag));
++# endif
++# if @HAVE_UTIMENSAT@
++_GL_CXXALIASWARN (utimensat);
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef utimensat
++# if HAVE_RAW_DECL_UTIMENSAT
++_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
++                 "use gnulib module utimensat for portability");
++# endif
++#endif
++
++
++#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
++#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
++#endif
+diff --git a/grub-core/gnulib/sys_time.in.h b/grub-core/gnulib/sys_time.in.h
+new file mode 100644
+index 0000000..30057ad
+--- /dev/null
++++ b/grub-core/gnulib/sys_time.in.h
+@@ -0,0 +1,213 @@
++/* Provide a more complete sys/time.h.
++
++   Copyright (C) 2007-2014 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3, or (at your option)
++   any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
++
++/* Written by Paul Eggert.  */
++
++#ifndef _@GUARD_PREFIX@_SYS_TIME_H
++
++#if __GNUC__ >= 3
++@PRAGMA_SYSTEM_HEADER@
++#endif
++@PRAGMA_COLUMNS@
++
++/* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
++   recursively via <sys/select.h>.
++   Simply delegate to the system's header in this case; it is a no-op.
++   Without this extra ifdef, the C++ gettimeofday declaration below
++   would be a forward declaration in gnulib's nested <sys/time.h>.  */
++#if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_
++# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
++#else
++
++/* The include_next requires a split double-inclusion guard.  */
++#if @HAVE_SYS_TIME_H@
++# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
++#endif
++
++#ifndef _@GUARD_PREFIX@_SYS_TIME_H
++#define _@GUARD_PREFIX@_SYS_TIME_H
++
++#if ! @HAVE_SYS_TIME_H@
++# include <time.h>
++#endif
++
++/* On native Windows with MSVC, get the 'struct timeval' type.
++   Also, on native Windows with a 64-bit time_t, where we are overriding the
++   'struct timeval' type, get all declarations of system functions whose
++   signature contains 'struct timeval'.  */
++#if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
++# define _GL_INCLUDING_WINSOCK2_H
++# include <winsock2.h>
++# undef _GL_INCLUDING_WINSOCK2_H
++#endif
++
++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
++
++/* The definition of _GL_ARG_NONNULL is copied here.  */
++
++/* The definition of _GL_WARN_ON_USE is copied here.  */
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
++
++# if @REPLACE_STRUCT_TIMEVAL@
++#  define timeval rpl_timeval
++# endif
++
++# if !GNULIB_defined_struct_timeval
++struct timeval
++{
++  time_t tv_sec;
++  long int tv_usec;
++};
++#  define GNULIB_defined_struct_timeval 1
++# endif
++
++#endif
++
++#ifdef __cplusplus
++}
++#endif
++
++#if @GNULIB_GETTIMEOFDAY@
++# if @REPLACE_GETTIMEOFDAY@
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef gettimeofday
++#   define gettimeofday rpl_gettimeofday
++#  endif
++_GL_FUNCDECL_RPL (gettimeofday, int,
++                  (struct timeval *restrict, void *restrict)
++                  _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (gettimeofday, int,
++                  (struct timeval *restrict, void *restrict));
++# else
++#  if !@HAVE_GETTIMEOFDAY@
++_GL_FUNCDECL_SYS (gettimeofday, int,
++                  (struct timeval *restrict, void *restrict)
++                  _GL_ARG_NONNULL ((1)));
++#  endif
++/* Need to cast, because on glibc systems, by default, the second argument is
++                                                  struct timezone *.  */
++_GL_CXXALIAS_SYS_CAST (gettimeofday, int,
++                       (struct timeval *restrict, void *restrict));
++# endif
++_GL_CXXALIASWARN (gettimeofday);
++#elif defined GNULIB_POSIXCHECK
++# undef gettimeofday
++# if HAVE_RAW_DECL_GETTIMEOFDAY
++_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
++                 "use gnulib module gettimeofday for portability");
++# endif
++#endif
++
++/* Hide some function declarations from <winsock2.h>.  */
++
++#if defined _MSC_VER && @HAVE_WINSOCK2_H@
++# if !defined _@GUARD_PREFIX@_UNISTD_H
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef close
++#   define close close_used_without_including_unistd_h
++#  else
++     _GL_WARN_ON_USE (close,
++                      "close() used without including <unistd.h>");
++#  endif
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef gethostname
++#   define gethostname gethostname_used_without_including_unistd_h
++#  else
++     _GL_WARN_ON_USE (gethostname,
++                      "gethostname() used without including <unistd.h>");
++#  endif
++# endif
++# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef socket
++#   define socket              socket_used_without_including_sys_socket_h
++#   undef connect
++#   define connect             connect_used_without_including_sys_socket_h
++#   undef accept
++#   define accept              accept_used_without_including_sys_socket_h
++#   undef bind
++#   define bind                bind_used_without_including_sys_socket_h
++#   undef getpeername
++#   define getpeername         getpeername_used_without_including_sys_socket_h
++#   undef getsockname
++#   define getsockname         getsockname_used_without_including_sys_socket_h
++#   undef getsockopt
++#   define getsockopt          getsockopt_used_without_including_sys_socket_h
++#   undef listen
++#   define listen              listen_used_without_including_sys_socket_h
++#   undef recv
++#   define recv                recv_used_without_including_sys_socket_h
++#   undef send
++#   define send                send_used_without_including_sys_socket_h
++#   undef recvfrom
++#   define recvfrom            recvfrom_used_without_including_sys_socket_h
++#   undef sendto
++#   define sendto              sendto_used_without_including_sys_socket_h
++#   undef setsockopt
++#   define setsockopt          setsockopt_used_without_including_sys_socket_h
++#   undef shutdown
++#   define shutdown            shutdown_used_without_including_sys_socket_h
++#  else
++     _GL_WARN_ON_USE (socket,
++                      "socket() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (connect,
++                      "connect() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (accept,
++                      "accept() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (bind,
++                      "bind() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (getpeername,
++                      "getpeername() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (getsockname,
++                      "getsockname() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (getsockopt,
++                      "getsockopt() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (listen,
++                      "listen() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (recv,
++                      "recv() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (send,
++                      "send() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (recvfrom,
++                      "recvfrom() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (sendto,
++                      "sendto() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (setsockopt,
++                      "setsockopt() used without including <sys/socket.h>");
++     _GL_WARN_ON_USE (shutdown,
++                      "shutdown() used without including <sys/socket.h>");
++#  endif
++# endif
++# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
++#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#   undef select
++#   define select select_used_without_including_sys_select_h
++#  else
++     _GL_WARN_ON_USE (select,
++                      "select() used without including <sys/select.h>");
++#  endif
++# endif
++#endif
++
++#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
++#endif /* _CYGWIN_SYS_TIME_H */
++#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
+diff --git a/grub-core/gnulib/sys_types.in.h b/grub-core/gnulib/sys_types.in.h
+index d7da356..9520c09 100644
+--- a/grub-core/gnulib/sys_types.in.h
++++ b/grub-core/gnulib/sys_types.in.h
+@@ -23,7 +23,9 @@
+ #ifndef _@GUARD_PREFIX@_SYS_TYPES_H
+ 
+ /* The include_next requires a split double-inclusion guard.  */
++# define _GL_INCLUDING_SYS_TYPES_H
+ #@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
++# undef _GL_INCLUDING_SYS_TYPES_H
+ 
+ #ifndef _@GUARD_PREFIX@_SYS_TYPES_H
+ #define _@GUARD_PREFIX@_SYS_TYPES_H
+diff --git a/grub-core/gnulib/time.h b/grub-core/gnulib/time.h
+new file mode 100644
+index 0000000..b9203d5
+--- /dev/null
++++ b/grub-core/gnulib/time.h
+@@ -0,0 +1,586 @@
++/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
++/* A more-standard <time.h>.
++
++   Copyright (C) 2007-2014 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3, or (at your option)
++   any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
++
++#if __GNUC__ >= 3
++#pragma GCC system_header
++#endif
++
++
++/* Don't get in the way of glibc when it includes time.h merely to
++   declare a few standard symbols, rather than to declare all the
++   symbols.  Also, Solaris 8 <time.h> eventually includes itself
++   recursively; if that is happening, just include the system <time.h>
++   without adding our own declarations.  */
++#if (defined __need_time_t || defined __need_clock_t \
++     || defined __need_timespec \
++     || defined _GL_TIME_H)
++
++# include_next <time.h>
++
++#else
++
++# define _GL_TIME_H
++
++# include_next <time.h>
++
++/* NetBSD 5.0 mis-defines NULL.  */
++# include <stddef.h>
++
++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
++#ifndef _GL_CXXDEFS_H
++#define _GL_CXXDEFS_H
++
++/* The three most frequent use cases of these macros are:
++
++   * For providing a substitute for a function that is missing on some
++     platforms, but is declared and works fine on the platforms on which
++     it exists:
++
++       #if @GNULIB_FOO@
++       # if !@HAVE_FOO@
++       _GL_FUNCDECL_SYS (foo, ...);
++       # endif
++       _GL_CXXALIAS_SYS (foo, ...);
++       _GL_CXXALIASWARN (foo);
++       #elif defined GNULIB_POSIXCHECK
++       ...
++       #endif
++
++   * For providing a replacement for a function that exists on all platforms,
++     but is broken/insufficient and needs to be replaced on some platforms:
++
++       #if @GNULIB_FOO@
++       # if @REPLACE_FOO@
++       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++       #   undef foo
++       #   define foo rpl_foo
++       #  endif
++       _GL_FUNCDECL_RPL (foo, ...);
++       _GL_CXXALIAS_RPL (foo, ...);
++       # else
++       _GL_CXXALIAS_SYS (foo, ...);
++       # endif
++       _GL_CXXALIASWARN (foo);
++       #elif defined GNULIB_POSIXCHECK
++       ...
++       #endif
++
++   * For providing a replacement for a function that exists on some platforms
++     but is broken/insufficient and needs to be replaced on some of them and
++     is additionally either missing or undeclared on some other platforms:
++
++       #if @GNULIB_FOO@
++       # if @REPLACE_FOO@
++       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++       #   undef foo
++       #   define foo rpl_foo
++       #  endif
++       _GL_FUNCDECL_RPL (foo, ...);
++       _GL_CXXALIAS_RPL (foo, ...);
++       # else
++       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
++       _GL_FUNCDECL_SYS (foo, ...);
++       #  endif
++       _GL_CXXALIAS_SYS (foo, ...);
++       # endif
++       _GL_CXXALIASWARN (foo);
++       #elif defined GNULIB_POSIXCHECK
++       ...
++       #endif
++*/
++
++/* _GL_EXTERN_C declaration;
++   performs the declaration with C linkage.  */
++#if defined __cplusplus
++# define _GL_EXTERN_C extern "C"
++#else
++# define _GL_EXTERN_C extern
++#endif
++
++/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
++   declares a replacement function, named rpl_func, with the given prototype,
++   consisting of return type, parameters, and attributes.
++   Example:
++     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
++                                  _GL_ARG_NONNULL ((1)));
++ */
++#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
++  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
++#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
++  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
++
++/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
++   declares the system function, named func, with the given prototype,
++   consisting of return type, parameters, and attributes.
++   Example:
++     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
++                                  _GL_ARG_NONNULL ((1)));
++ */
++#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
++  _GL_EXTERN_C rettype func parameters_and_attributes
++
++/* _GL_CXXALIAS_RPL (func, rettype, parameters);
++   declares a C++ alias called GNULIB_NAMESPACE::func
++   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
++   Example:
++     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
++ */
++#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
++  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
++#if defined __cplusplus && defined GNULIB_NAMESPACE
++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
++    namespace GNULIB_NAMESPACE                                \
++    {                                                         \
++      rettype (*const func) parameters = ::rpl_func;          \
++    }                                                         \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#else
++# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#endif
++
++/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
++   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
++   except that the C function rpl_func may have a slightly different
++   declaration.  A cast is used to silence the "invalid conversion" error
++   that would otherwise occur.  */
++#if defined __cplusplus && defined GNULIB_NAMESPACE
++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
++    namespace GNULIB_NAMESPACE                                     \
++    {                                                              \
++      rettype (*const func) parameters =                           \
++        reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
++    }                                                              \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#else
++# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#endif
++
++/* _GL_CXXALIAS_SYS (func, rettype, parameters);
++   declares a C++ alias called GNULIB_NAMESPACE::func
++   that redirects to the system provided function func, if GNULIB_NAMESPACE
++   is defined.
++   Example:
++     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
++ */
++#if defined __cplusplus && defined GNULIB_NAMESPACE
++  /* If we were to write
++       rettype (*const func) parameters = ::func;
++     like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
++     better (remove an indirection through a 'static' pointer variable),
++     but then the _GL_CXXALIASWARN macro below would cause a warning not only
++     for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
++    namespace GNULIB_NAMESPACE                     \
++    {                                              \
++      static rettype (*func) parameters = ::func;  \
++    }                                              \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#else
++# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#endif
++
++/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
++   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
++   except that the C function func may have a slightly different declaration.
++   A cast is used to silence the "invalid conversion" error that would
++   otherwise occur.  */
++#if defined __cplusplus && defined GNULIB_NAMESPACE
++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
++    namespace GNULIB_NAMESPACE                          \
++    {                                                   \
++      static rettype (*func) parameters =               \
++        reinterpret_cast<rettype(*)parameters>(::func); \
++    }                                                   \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#else
++# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#endif
++
++/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
++   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
++   except that the C function is picked among a set of overloaded functions,
++   namely the one with rettype2 and parameters2.  Two consecutive casts
++   are used to silence the "cannot find a match" and "invalid conversion"
++   errors that would otherwise occur.  */
++#if defined __cplusplus && defined GNULIB_NAMESPACE
++  /* The outer cast must be a reinterpret_cast.
++     The inner cast: When the function is defined as a set of overloaded
++     functions, it works as a static_cast<>, choosing the designated variant.
++     When the function is defined as a single variant, it works as a
++     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
++    namespace GNULIB_NAMESPACE                                                \
++    {                                                                         \
++      static rettype (*func) parameters =                                     \
++        reinterpret_cast<rettype(*)parameters>(                               \
++          (rettype2(*)parameters2)(::func));                                  \
++    }                                                                         \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#else
++# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#endif
++
++/* _GL_CXXALIASWARN (func);
++   causes a warning to be emitted when ::func is used but not when
++   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
++   variants.  */
++#if defined __cplusplus && defined GNULIB_NAMESPACE
++# define _GL_CXXALIASWARN(func) \
++   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
++# define _GL_CXXALIASWARN_1(func,namespace) \
++   _GL_CXXALIASWARN_2 (func, namespace)
++/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
++   we enable the warning only when not optimizing.  */
++# if !__OPTIMIZE__
++#  define _GL_CXXALIASWARN_2(func,namespace) \
++    _GL_WARN_ON_USE (func, \
++                     "The symbol ::" #func " refers to the system function. " \
++                     "Use " #namespace "::" #func " instead.")
++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
++#  define _GL_CXXALIASWARN_2(func,namespace) \
++     extern __typeof__ (func) func
++# else
++#  define _GL_CXXALIASWARN_2(func,namespace) \
++     _GL_EXTERN_C int _gl_cxxalias_dummy
++# endif
++#else
++# define _GL_CXXALIASWARN(func) \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#endif
++
++/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
++   causes a warning to be emitted when the given overloaded variant of ::func
++   is used but not when GNULIB_NAMESPACE::func is used.  */
++#if defined __cplusplus && defined GNULIB_NAMESPACE
++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
++   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
++                        GNULIB_NAMESPACE)
++# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
++   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
++/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
++   we enable the warning only when not optimizing.  */
++# if !__OPTIMIZE__
++#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
++    _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
++                         "The symbol ::" #func " refers to the system function. " \
++                         "Use " #namespace "::" #func " instead.")
++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
++#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
++     extern __typeof__ (func) func
++# else
++#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
++     _GL_EXTERN_C int _gl_cxxalias_dummy
++# endif
++#else
++# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
++    _GL_EXTERN_C int _gl_cxxalias_dummy
++#endif
++
++#endif /* _GL_CXXDEFS_H */
++
++/* The definition of _GL_ARG_NONNULL is copied here.  */
++/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
++   that the values passed as arguments n, ..., m must be non-NULL pointers.
++   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
++#ifndef _GL_ARG_NONNULL
++# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
++#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
++# else
++#  define _GL_ARG_NONNULL(params)
++# endif
++#endif
++
++/* The definition of _GL_WARN_ON_USE is copied here.  */
++#ifndef _GL_WARN_ON_USE
++
++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
++/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
++#  define _GL_WARN_ON_USE(function, message) \
++extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
++/* Verify the existence of the function.  */
++#  define _GL_WARN_ON_USE(function, message) \
++extern __typeof__ (function) function
++# else /* Unsupported.  */
++#  define _GL_WARN_ON_USE(function, message) \
++_GL_WARN_EXTERN_C int _gl_warn_on_use
++# endif
++#endif
++
++/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
++   is like _GL_WARN_ON_USE (function, "string"), except that the function is
++   declared with the given prototype, consisting of return type, parameters,
++   and attributes.
++   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
++   not work in this case.  */
++#ifndef _GL_WARN_ON_USE_CXX
++# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
++#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
++extern rettype function parameters_and_attributes \
++     __attribute__ ((__warning__ (msg)))
++# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
++/* Verify the existence of the function.  */
++#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
++extern rettype function parameters_and_attributes
++# else /* Unsupported.  */
++#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
++_GL_WARN_EXTERN_C int _gl_warn_on_use
++# endif
++#endif
++
++/* _GL_WARN_EXTERN_C declaration;
++   performs the declaration with C linkage.  */
++#ifndef _GL_WARN_EXTERN_C
++# if defined __cplusplus
++#  define _GL_WARN_EXTERN_C extern "C"
++# else
++#  define _GL_WARN_EXTERN_C extern
++# endif
++#endif
++
++/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
++   Or they define it with the wrong member names or define it in <sys/time.h>
++   (e.g., FreeBSD circa 1997).  Stock Mingw prior to 3.0 does not define it,
++   but the pthreads-win32 library defines it in <pthread.h>.  */
++# if ! 1
++#  if 0
++#   include <sys/time.h>
++#  elif 0
++#   include <pthread.h>
++#  else
++
++#   ifdef __cplusplus
++extern "C" {
++#   endif
++
++#   if !GNULIB_defined_struct_timespec
++#    undef timespec
++#    define timespec rpl_timespec
++struct timespec
++{
++  time_t tv_sec;
++  long int tv_nsec;
++};
++#    define GNULIB_defined_struct_timespec 1
++#   endif
++
++#   ifdef __cplusplus
++}
++#   endif
++
++#  endif
++# endif
++
++# if !GNULIB_defined_struct_time_t_must_be_integral
++/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
++   time_t to be an integer type, even though C99 permits floating
++   point.  We don't know of any implementation that uses floating
++   point, and it is much easier to write code that doesn't have to
++   worry about that corner case, so we force the issue.  */
++struct __time_t_must_be_integral {
++  unsigned int __floating_time_t_unsupported : (time_t) 1;
++};
++#  define GNULIB_defined_struct_time_t_must_be_integral 1
++# endif
++
++/* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
++   return -1 and store the remaining time into RMTP.  See
++   <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
++# if 0
++#  if GNULIB_PORTCHECK
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    define nanosleep rpl_nanosleep
++#   endif
++_GL_FUNCDECL_RPL (nanosleep, int,
++                  (struct timespec const *__rqtp, struct timespec *__rmtp)
++                  _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (nanosleep, int,
++                  (struct timespec const *__rqtp, struct timespec *__rmtp));
++#  else
++#   if ! 1
++_GL_FUNCDECL_SYS (nanosleep, int,
++                  (struct timespec const *__rqtp, struct timespec *__rmtp)
++                  _GL_ARG_NONNULL ((1)));
++#   endif
++_GL_CXXALIAS_SYS (nanosleep, int,
++                  (struct timespec const *__rqtp, struct timespec *__rmtp));
++#  endif
++_GL_CXXALIASWARN (nanosleep);
++# endif
++
++/* Return the 'time_t' representation of TP and normalize TP.  */
++# if 0
++#  if GNULIB_PORTCHECK
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    define mktime rpl_mktime
++#   endif
++_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
++#  else
++_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
++#  endif
++_GL_CXXALIASWARN (mktime);
++# endif
++
++/* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
++   <http://www.opengroup.org/susv3xsh/localtime_r.html> and
++   <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
++# if 0
++#  if GNULIB_PORTCHECK
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    undef localtime_r
++#    define localtime_r rpl_localtime_r
++#   endif
++_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
++                                             struct tm *restrict __result)
++                                            _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
++                                             struct tm *restrict __result));
++#  else
++#   if ! 1
++_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
++                                             struct tm *restrict __result)
++                                            _GL_ARG_NONNULL ((1, 2)));
++#   endif
++_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
++                                             struct tm *restrict __result));
++#  endif
++#  if 1
++_GL_CXXALIASWARN (localtime_r);
++#  endif
++#  if GNULIB_PORTCHECK
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    undef gmtime_r
++#    define gmtime_r rpl_gmtime_r
++#   endif
++_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
++                                          struct tm *restrict __result)
++                                         _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
++                                          struct tm *restrict __result));
++#  else
++#   if ! 1
++_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
++                                          struct tm *restrict __result)
++                                         _GL_ARG_NONNULL ((1, 2)));
++#   endif
++_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
++                                          struct tm *restrict __result));
++#  endif
++#  if 1
++_GL_CXXALIASWARN (gmtime_r);
++#  endif
++# endif
++
++/* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
++   <http://www.opengroup.org/susv3xsh/localtime.html> and
++   <http://www.opengroup.org/susv3xsh/gmtime.html>.  */
++# if 1
++#  if 0
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    undef localtime
++#    define localtime rpl_localtime
++#   endif
++_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
++		                          _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
++#  else
++_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
++#  endif
++_GL_CXXALIASWARN (localtime);
++# endif
++
++# if 1
++#  if 0
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    undef gmtime
++#    define gmtime rpl_gmtime
++#   endif
++_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer)
++                                       _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
++#  else
++_GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer));
++#  endif
++_GL_CXXALIASWARN (gmtime);
++# endif
++
++/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
++   the resulting broken-down time into TM.  See
++   <http://www.opengroup.org/susv3xsh/strptime.html>.  */
++# if 0
++#  if ! 1
++_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
++                                     char const *restrict __format,
++                                     struct tm *restrict __tm)
++                                    _GL_ARG_NONNULL ((1, 2, 3)));
++#  endif
++_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
++                                     char const *restrict __format,
++                                     struct tm *restrict __tm));
++_GL_CXXALIASWARN (strptime);
++# endif
++
++/* Convert TM to a time_t value, assuming UTC.  */
++# if 0
++#  if GNULIB_PORTCHECK
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    undef timegm
++#    define timegm rpl_timegm
++#   endif
++_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
++#  else
++#   if ! 1
++_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
++#   endif
++_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
++#  endif
++_GL_CXXALIASWARN (timegm);
++# endif
++
++/* Encourage applications to avoid unsafe functions that can overrun
++   buffers when given outlandish struct tm values.  Portable
++   applications should use strftime (or even sprintf) instead.  */
++# if defined GNULIB_POSIXCHECK
++#  undef asctime
++_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
++                 "better use strftime (or even sprintf) instead");
++# endif
++# if defined GNULIB_POSIXCHECK
++#  undef asctime_r
++_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - "
++                 "better use strftime (or even sprintf) instead");
++# endif
++# if defined GNULIB_POSIXCHECK
++#  undef ctime
++_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - "
++                 "better use strftime (or even sprintf) instead");
++# endif
++# if defined GNULIB_POSIXCHECK
++#  undef ctime_r
++_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - "
++                 "better use strftime (or even sprintf) instead");
++# endif
++
++#endif
+diff --git a/grub-core/gnulib/time.in.h b/grub-core/gnulib/time.in.h
+new file mode 100644
+index 0000000..81abdf4
+--- /dev/null
++++ b/grub-core/gnulib/time.in.h
+@@ -0,0 +1,274 @@
++/* A more-standard <time.h>.
++
++   Copyright (C) 2007-2014 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3, or (at your option)
++   any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
++
++#if __GNUC__ >= 3
++@PRAGMA_SYSTEM_HEADER@
++#endif
++@PRAGMA_COLUMNS@
++
++/* Don't get in the way of glibc when it includes time.h merely to
++   declare a few standard symbols, rather than to declare all the
++   symbols.  Also, Solaris 8 <time.h> eventually includes itself
++   recursively; if that is happening, just include the system <time.h>
++   without adding our own declarations.  */
++#if (defined __need_time_t || defined __need_clock_t \
++     || defined __need_timespec \
++     || defined _@GUARD_PREFIX@_TIME_H)
++
++# @INCLUDE_NEXT@ @NEXT_TIME_H@
++
++#else
++
++# define _@GUARD_PREFIX@_TIME_H
++
++# @INCLUDE_NEXT@ @NEXT_TIME_H@
++
++/* NetBSD 5.0 mis-defines NULL.  */
++# include <stddef.h>
++
++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
++
++/* The definition of _GL_ARG_NONNULL is copied here.  */
++
++/* The definition of _GL_WARN_ON_USE is copied here.  */
++
++/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
++   Or they define it with the wrong member names or define it in <sys/time.h>
++   (e.g., FreeBSD circa 1997).  Stock Mingw prior to 3.0 does not define it,
++   but the pthreads-win32 library defines it in <pthread.h>.  */
++# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
++#  if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
++#   include <sys/time.h>
++#  elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
++#   include <pthread.h>
++#  else
++
++#   ifdef __cplusplus
++extern "C" {
++#   endif
++
++#   if !GNULIB_defined_struct_timespec
++#    undef timespec
++#    define timespec rpl_timespec
++struct timespec
++{
++  time_t tv_sec;
++  long int tv_nsec;
++};
++#    define GNULIB_defined_struct_timespec 1
++#   endif
++
++#   ifdef __cplusplus
++}
++#   endif
++
++#  endif
++# endif
++
++# if !GNULIB_defined_struct_time_t_must_be_integral
++/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
++   time_t to be an integer type, even though C99 permits floating
++   point.  We don't know of any implementation that uses floating
++   point, and it is much easier to write code that doesn't have to
++   worry about that corner case, so we force the issue.  */
++struct __time_t_must_be_integral {
++  unsigned int __floating_time_t_unsupported : (time_t) 1;
++};
++#  define GNULIB_defined_struct_time_t_must_be_integral 1
++# endif
++
++/* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
++   return -1 and store the remaining time into RMTP.  See
++   <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
++# if @GNULIB_NANOSLEEP@
++#  if @REPLACE_NANOSLEEP@
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    define nanosleep rpl_nanosleep
++#   endif
++_GL_FUNCDECL_RPL (nanosleep, int,
++                  (struct timespec const *__rqtp, struct timespec *__rmtp)
++                  _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (nanosleep, int,
++                  (struct timespec const *__rqtp, struct timespec *__rmtp));
++#  else
++#   if ! @HAVE_NANOSLEEP@
++_GL_FUNCDECL_SYS (nanosleep, int,
++                  (struct timespec const *__rqtp, struct timespec *__rmtp)
++                  _GL_ARG_NONNULL ((1)));
++#   endif
++_GL_CXXALIAS_SYS (nanosleep, int,
++                  (struct timespec const *__rqtp, struct timespec *__rmtp));
++#  endif
++_GL_CXXALIASWARN (nanosleep);
++# endif
++
++/* Return the 'time_t' representation of TP and normalize TP.  */
++# if @GNULIB_MKTIME@
++#  if @REPLACE_MKTIME@
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    define mktime rpl_mktime
++#   endif
++_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
++#  else
++_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
++#  endif
++_GL_CXXALIASWARN (mktime);
++# endif
++
++/* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
++   <http://www.opengroup.org/susv3xsh/localtime_r.html> and
++   <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
++# if @GNULIB_TIME_R@
++#  if @REPLACE_LOCALTIME_R@
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    undef localtime_r
++#    define localtime_r rpl_localtime_r
++#   endif
++_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
++                                             struct tm *restrict __result)
++                                            _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
++                                             struct tm *restrict __result));
++#  else
++#   if ! @HAVE_DECL_LOCALTIME_R@
++_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
++                                             struct tm *restrict __result)
++                                            _GL_ARG_NONNULL ((1, 2)));
++#   endif
++_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
++                                             struct tm *restrict __result));
++#  endif
++#  if @HAVE_DECL_LOCALTIME_R@
++_GL_CXXALIASWARN (localtime_r);
++#  endif
++#  if @REPLACE_LOCALTIME_R@
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    undef gmtime_r
++#    define gmtime_r rpl_gmtime_r
++#   endif
++_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
++                                          struct tm *restrict __result)
++                                         _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
++                                          struct tm *restrict __result));
++#  else
++#   if ! @HAVE_DECL_LOCALTIME_R@
++_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
++                                          struct tm *restrict __result)
++                                         _GL_ARG_NONNULL ((1, 2)));
++#   endif
++_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
++                                          struct tm *restrict __result));
++#  endif
++#  if @HAVE_DECL_LOCALTIME_R@
++_GL_CXXALIASWARN (gmtime_r);
++#  endif
++# endif
++
++/* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
++   <http://www.opengroup.org/susv3xsh/localtime.html> and
++   <http://www.opengroup.org/susv3xsh/gmtime.html>.  */
++# if @GNULIB_GETTIMEOFDAY@
++#  if @REPLACE_LOCALTIME@
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    undef localtime
++#    define localtime rpl_localtime
++#   endif
++_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
++		                          _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
++#  else
++_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
++#  endif
++_GL_CXXALIASWARN (localtime);
++# endif
++
++# if @GNULIB_GETTIMEOFDAY@
++#  if @REPLACE_GMTIME@
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    undef gmtime
++#    define gmtime rpl_gmtime
++#   endif
++_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer)
++                                       _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
++#  else
++_GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer));
++#  endif
++_GL_CXXALIASWARN (gmtime);
++# endif
++
++/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
++   the resulting broken-down time into TM.  See
++   <http://www.opengroup.org/susv3xsh/strptime.html>.  */
++# if @GNULIB_STRPTIME@
++#  if ! @HAVE_STRPTIME@
++_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
++                                     char const *restrict __format,
++                                     struct tm *restrict __tm)
++                                    _GL_ARG_NONNULL ((1, 2, 3)));
++#  endif
++_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
++                                     char const *restrict __format,
++                                     struct tm *restrict __tm));
++_GL_CXXALIASWARN (strptime);
++# endif
++
++/* Convert TM to a time_t value, assuming UTC.  */
++# if @GNULIB_TIMEGM@
++#  if @REPLACE_TIMEGM@
++#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++#    undef timegm
++#    define timegm rpl_timegm
++#   endif
++_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
++#  else
++#   if ! @HAVE_TIMEGM@
++_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
++#   endif
++_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
++#  endif
++_GL_CXXALIASWARN (timegm);
++# endif
++
++/* Encourage applications to avoid unsafe functions that can overrun
++   buffers when given outlandish struct tm values.  Portable
++   applications should use strftime (or even sprintf) instead.  */
++# if defined GNULIB_POSIXCHECK
++#  undef asctime
++_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
++                 "better use strftime (or even sprintf) instead");
++# endif
++# if defined GNULIB_POSIXCHECK
++#  undef asctime_r
++_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - "
++                 "better use strftime (or even sprintf) instead");
++# endif
++# if defined GNULIB_POSIXCHECK
++#  undef ctime
++_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - "
++                 "better use strftime (or even sprintf) instead");
++# endif
++# if defined GNULIB_POSIXCHECK
++#  undef ctime_r
++_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - "
++                 "better use strftime (or even sprintf) instead");
++# endif
++
++#endif
+diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c
+index d390b25..9127e92 100644
+--- a/grub-core/osdep/windows/hostdisk.c
++++ b/grub-core/osdep/windows/hostdisk.c
+@@ -353,6 +353,12 @@ grub_util_mkdir (const char *dir)
+   free (windows_name);
+ }
+ 
++ssize_t
++grub_util_readlink (const char *name, char *buf, size_t bufsize)
++{
++  return readlink(name, buf, bufsize);
++}
++
+ int
+ grub_util_rename (const char *from, const char *to)
+ {
+diff --git a/include/grub/osdep/hostfile_aros.h b/include/grub/osdep/hostfile_aros.h
+index a059c0f..161fbb7 100644
+--- a/include/grub/osdep/hostfile_aros.h
++++ b/include/grub/osdep/hostfile_aros.h
+@@ -68,6 +68,12 @@ grub_util_rename (const char *from, const char *to)
+   return rename (from, to);
+ }
+ 
++static inline ssize_t
++grub_util_readlink (const char *name, char *buf, size_t bufsize)
++{
++  return readlink(name, buf, bufsize);
++}
++
+ #define grub_util_mkdir(a) mkdir ((a), 0755)
+ 
+ struct grub_util_fd
+diff --git a/include/grub/osdep/hostfile_unix.h b/include/grub/osdep/hostfile_unix.h
+index 9ffe46f..17cd3aa 100644
+--- a/include/grub/osdep/hostfile_unix.h
++++ b/include/grub/osdep/hostfile_unix.h
+@@ -71,6 +71,12 @@ grub_util_rename (const char *from, const char *to)
+   return rename (from, to);
+ }
+ 
++static inline ssize_t
++grub_util_readlink (const char *name, char *buf, size_t bufsize)
++{
++  return readlink(name, buf, bufsize);
++}
++
+ #define grub_util_mkdir(a) mkdir ((a), 0755)
+ 
+ #if defined (__NetBSD__)
+diff --git a/include/grub/osdep/hostfile_windows.h b/include/grub/osdep/hostfile_windows.h
+index bf6451b..8c92d05 100644
+--- a/include/grub/osdep/hostfile_windows.h
++++ b/include/grub/osdep/hostfile_windows.h
+@@ -41,6 +41,8 @@ typedef struct grub_util_fd_dir *grub_util_fd_dir_t;
+ 
+ int
+ grub_util_rename (const char *from, const char *to);
++ssize_t
++grub_util_readlink (const char *name, char *buf, size_t bufsize);
+ int
+ grub_util_unlink (const char *name);
+ void
+diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4
+new file mode 100644
+index 0000000..1c2d66e
+--- /dev/null
++++ b/m4/gettimeofday.m4
+@@ -0,0 +1,138 @@
++# serial 21
++
++# Copyright (C) 2001-2003, 2005, 2007, 2009-2014 Free Software Foundation, Inc.
++# This file is free software; the Free Software Foundation
++# gives unlimited permission to copy and/or distribute it,
++# with or without modifications, as long as this notice is preserved.
++
++dnl From Jim Meyering.
++
++AC_DEFUN([gl_FUNC_GETTIMEOFDAY],
++[
++  AC_REQUIRE([AC_C_RESTRICT])
++  AC_REQUIRE([gl_HEADER_SYS_TIME_H])
++  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
++  AC_CHECK_FUNCS_ONCE([gettimeofday])
++
++  gl_gettimeofday_timezone=void
++  if test $ac_cv_func_gettimeofday != yes; then
++    HAVE_GETTIMEOFDAY=0
++  else
++    gl_FUNC_GETTIMEOFDAY_CLOBBER
++    AC_CACHE_CHECK([for gettimeofday with POSIX signature],
++      [gl_cv_func_gettimeofday_posix_signature],
++      [AC_COMPILE_IFELSE(
++         [AC_LANG_PROGRAM(
++            [[#include <sys/time.h>
++              struct timeval c;
++              int gettimeofday (struct timeval *restrict, void *restrict);
++            ]],
++            [[/* glibc uses struct timezone * rather than the POSIX void *
++                 if _GNU_SOURCE is defined.  However, since the only portable
++                 use of gettimeofday uses NULL as the second parameter, and
++                 since the glibc definition is actually more typesafe, it is
++                 not worth wrapping this to get a compliant signature.  */
++              int (*f) (struct timeval *restrict, void *restrict)
++                = gettimeofday;
++              int x = f (&c, 0);
++              return !(x | c.tv_sec | c.tv_usec);
++            ]])],
++          [gl_cv_func_gettimeofday_posix_signature=yes],
++          [AC_COMPILE_IFELSE(
++            [AC_LANG_PROGRAM(
++              [[#include <sys/time.h>
++int gettimeofday (struct timeval *restrict, struct timezone *restrict);
++              ]])],
++            [gl_cv_func_gettimeofday_posix_signature=almost],
++            [gl_cv_func_gettimeofday_posix_signature=no])])])
++    if test $gl_cv_func_gettimeofday_posix_signature = almost; then
++      gl_gettimeofday_timezone='struct timezone'
++    elif test $gl_cv_func_gettimeofday_posix_signature != yes; then
++      REPLACE_GETTIMEOFDAY=1
++    fi
++    dnl If we override 'struct timeval', we also have to override gettimeofday.
++    if test $REPLACE_STRUCT_TIMEVAL = 1; then
++      REPLACE_GETTIMEOFDAY=1
++    fi
++    m4_ifdef([gl_FUNC_TZSET_CLOBBER], [
++      gl_FUNC_TZSET_CLOBBER
++      case "$gl_cv_func_tzset_clobber" in
++        *yes)
++          REPLACE_GETTIMEOFDAY=1
++          gl_GETTIMEOFDAY_REPLACE_LOCALTIME
++          AC_DEFINE([tzset], [rpl_tzset],
++            [Define to rpl_tzset if the wrapper function should be used.])
++          AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
++            [Define if tzset clobbers localtime's static buffer.])
++          ;;
++      esac
++    ])
++  fi
++  AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone],
++    [Define this to 'void' or 'struct timezone' to match the system's
++     declaration of the second argument to gettimeofday.])
++])
++
++
++dnl See if gettimeofday clobbers the static buffer that localtime uses
++dnl for its return value.  The gettimeofday function from Mac OS X 10.0.4
++dnl (i.e., Darwin 1.3.7) has this problem.
++dnl
++dnl If it does, then arrange to use gettimeofday and localtime only via
++dnl the wrapper functions that work around the problem.
++
++AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
++[
++ AC_REQUIRE([gl_HEADER_SYS_TIME_H])
++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
++
++ AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer],
++  [gl_cv_func_gettimeofday_clobber],
++  [AC_RUN_IFELSE(
++     [AC_LANG_PROGRAM(
++        [[#include <string.h>
++          #include <sys/time.h>
++          #include <time.h>
++          #include <stdlib.h>
++        ]],
++        [[
++          time_t t = 0;
++          struct tm *lt;
++          struct tm saved_lt;
++          struct timeval tv;
++          lt = localtime (&t);
++          saved_lt = *lt;
++          gettimeofday (&tv, NULL);
++          return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0;
++        ]])],
++     [gl_cv_func_gettimeofday_clobber=no],
++     [gl_cv_func_gettimeofday_clobber=yes],
++     [# When cross-compiling:
++      case "$host_os" in
++                # Guess all is fine on glibc systems.
++        *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
++                # If we don't know, assume the worst.
++        *)      gl_cv_func_gettimeofday_clobber="guessing yes" ;;
++      esac
++     ])])
++
++ case "$gl_cv_func_gettimeofday_clobber" in
++   *yes)
++     REPLACE_GETTIMEOFDAY=1
++     gl_GETTIMEOFDAY_REPLACE_LOCALTIME
++     AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1],
++       [Define if gettimeofday clobbers the localtime buffer.])
++     ;;
++ esac
++])
++
++AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [
++  REPLACE_GMTIME=1
++  REPLACE_LOCALTIME=1
++])
++
++# Prerequisites of lib/gettimeofday.c.
++AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [
++  AC_CHECK_HEADERS([sys/timeb.h])
++  AC_CHECK_FUNCS([_ftime])
++])
+diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
+index 4089184..ef2ec5b 100644
+--- a/m4/gnulib-cache.m4
++++ b/m4/gnulib-cache.m4
+@@ -27,7 +27,7 @@
+ 
+ 
+ # Specification in the form of a command-line invocation:
+-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname regex
++#   gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname readlink regex
+ 
+ # Specification in the form of a few gnulib-tool.m4 macro invocations:
+ gl_LOCAL_DIR([])
+@@ -39,6 +39,7 @@ gl_MODULES([
+   getline
+   gettext
+   progname
++  readlink
+   regex
+ ])
+ gl_AVOID([])
+diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
+index 7a19f60..66fd0ed 100644
+--- a/m4/gnulib-comp.m4
++++ b/m4/gnulib-comp.m4
+@@ -60,10 +60,13 @@ AC_DEFUN([gl_EARLY],
+   # Code from module getopt-posix:
+   # Code from module gettext:
+   # Code from module gettext-h:
++  # Code from module gettimeofday:
+   # Code from module havelib:
+   # Code from module include_next:
+   # Code from module intprops:
+   # Code from module langinfo:
++  # Code from module largefile:
++  AC_REQUIRE([AC_SYS_LARGEFILE])
+   # Code from module localcharset:
+   # Code from module locale:
+   # Code from module localeconv:
+@@ -81,8 +84,10 @@ AC_DEFUN([gl_EARLY],
+   # Code from module multiarch:
+   # Code from module nl_langinfo:
+   # Code from module nocrash:
++  # Code from module pathmax:
+   # Code from module progname:
+   # Code from module rawmemchr:
++  # Code from module readlink:
+   # Code from module realloc-posix:
+   # Code from module regex:
+   # Code from module size_max:
+@@ -92,6 +97,7 @@ AC_DEFUN([gl_EARLY],
+   # Code from module snippet/c++defs:
+   # Code from module snippet/warn-on-use:
+   # Code from module ssize_t:
++  # Code from module stat:
+   # Code from module stdalign:
+   # Code from module stdbool:
+   # Code from module stddef:
+@@ -108,8 +114,11 @@ AC_DEFUN([gl_EARLY],
+   # Code from module strndup:
+   # Code from module strnlen:
+   # Code from module strnlen1:
++  # Code from module sys_stat:
++  # Code from module sys_time:
+   # Code from module sys_types:
+   # Code from module sysexits:
++  # Code from module time:
+   # Code from module unistd:
+   # Code from module unitypes:
+   # Code from module uniwidth/base:
+@@ -211,7 +220,14 @@ AC_DEFUN([gl_INIT],
+   AM_GNU_GETTEXT_VERSION([0.18.1])
+   AC_SUBST([LIBINTL])
+   AC_SUBST([LTLIBINTL])
++  gl_FUNC_GETTIMEOFDAY
++  if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then
++    AC_LIBOBJ([gettimeofday])
++    gl_PREREQ_GETTIMEOFDAY
++  fi
++  gl_SYS_TIME_MODULE_INDICATOR([gettimeofday])
+   gl_LANGINFO_H
++  AC_REQUIRE([gl_LARGEFILE])
+   gl_LOCALCHARSET
+   LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\""
+   AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
+@@ -284,6 +300,7 @@ AC_DEFUN([gl_INIT],
+     AC_LIBOBJ([nl_langinfo])
+   fi
+   gl_LANGINFO_MODULE_INDICATOR([nl_langinfo])
++  gl_PATHMAX
+   AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>])
+   AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
+   gl_FUNC_RAWMEMCHR
+@@ -292,6 +309,12 @@ AC_DEFUN([gl_INIT],
+     gl_PREREQ_RAWMEMCHR
+   fi
+   gl_STRING_MODULE_INDICATOR([rawmemchr])
++  gl_FUNC_READLINK
++  if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
++    AC_LIBOBJ([readlink])
++    gl_PREREQ_READLINK
++  fi
++  gl_UNISTD_MODULE_INDICATOR([readlink])
+   gl_FUNC_REALLOC_POSIX
+   if test $REPLACE_REALLOC = 1; then
+     AC_LIBOBJ([realloc])
+@@ -309,6 +332,12 @@ AC_DEFUN([gl_INIT],
+   fi
+   gl_UNISTD_MODULE_INDICATOR([sleep])
+   gt_TYPE_SSIZE_T
++  gl_FUNC_STAT
++  if test $REPLACE_STAT = 1; then
++    AC_LIBOBJ([stat])
++    gl_PREREQ_STAT
++  fi
++  gl_SYS_STAT_MODULE_INDICATOR([stat])
+   gl_STDALIGN_H
+   AM_STDBOOL_H
+   gl_STDDEF_H
+@@ -355,9 +384,14 @@ AC_DEFUN([gl_INIT],
+     gl_PREREQ_STRNLEN
+   fi
+   gl_STRING_MODULE_INDICATOR([strnlen])
++  gl_HEADER_SYS_STAT_H
++  AC_PROG_MKDIR_P
++  gl_HEADER_SYS_TIME_H
++  AC_PROG_MKDIR_P
+   gl_SYS_TYPES_H
+   AC_PROG_MKDIR_P
+   gl_SYSEXITS
++  gl_HEADER_TIME_H
+   gl_UNISTD_H
+   gl_LIBUNISTRING_LIBHEADER([0.9], [unitypes.h])
+   gl_LIBUNISTRING_LIBHEADER([0.9], [uniwidth.h])
+@@ -562,6 +596,7 @@ AC_DEFUN([gl_FILE_LIST], [
+   lib/getopt1.c
+   lib/getopt_int.h
+   lib/gettext.h
++  lib/gettimeofday.c
+   lib/intprops.h
+   lib/itold.c
+   lib/langinfo.in.h
+@@ -587,6 +622,7 @@ AC_DEFUN([gl_FILE_LIST], [
+   lib/msvc-nothrow.c
+   lib/msvc-nothrow.h
+   lib/nl_langinfo.c
++  lib/pathmax.h
+   lib/printf-args.c
+   lib/printf-args.h
+   lib/printf-parse.c
+@@ -595,6 +631,7 @@ AC_DEFUN([gl_FILE_LIST], [
+   lib/progname.h
+   lib/rawmemchr.c
+   lib/rawmemchr.valgrind
++  lib/readlink.c
+   lib/realloc.c
+   lib/ref-add.sin
+   lib/ref-del.sin
+@@ -606,6 +643,7 @@ AC_DEFUN([gl_FILE_LIST], [
+   lib/regexec.c
+   lib/size_max.h
+   lib/sleep.c
++  lib/stat.c
+   lib/stdalign.in.h
+   lib/stdbool.in.h
+   lib/stddef.in.h
+@@ -627,8 +665,11 @@ AC_DEFUN([gl_FILE_LIST], [
+   lib/strnlen.c
+   lib/strnlen1.c
+   lib/strnlen1.h
++  lib/sys_stat.in.h
++  lib/sys_time.in.h
+   lib/sys_types.in.h
+   lib/sysexits.in.h
++  lib/time.in.h
+   lib/unistd.c
+   lib/unistd.in.h
+   lib/unitypes.in.h
+@@ -667,6 +708,7 @@ AC_DEFUN([gl_FILE_LIST], [
+   m4/getline.m4
+   m4/getopt.m4
+   m4/gettext.m4
++  m4/gettimeofday.m4
+   m4/glibc2.m4
+   m4/glibc21.m4
+   m4/gnulib-common.m4
+@@ -681,6 +723,7 @@ AC_DEFUN([gl_FILE_LIST], [
+   m4/inttypes-pri.m4
+   m4/inttypes_h.m4
+   m4/langinfo_h.m4
++  m4/largefile.m4
+   m4/lcmessage.m4
+   m4/lib-ld.m4
+   m4/lib-link.m4
+@@ -712,16 +755,19 @@ AC_DEFUN([gl_FILE_LIST], [
+   m4/nls.m4
+   m4/nocrash.m4
+   m4/off_t.m4
++  m4/pathmax.m4
+   m4/po.m4
+   m4/printf-posix.m4
+   m4/printf.m4
+   m4/progtest.m4
+   m4/rawmemchr.m4
++  m4/readlink.m4
+   m4/realloc.m4
+   m4/regex.m4
+   m4/size_max.m4
+   m4/sleep.m4
+   m4/ssize_t.m4
++  m4/stat.m4
+   m4/stdalign.m4
+   m4/stdbool.m4
+   m4/stddef_h.m4
+@@ -737,9 +783,12 @@ AC_DEFUN([gl_FILE_LIST], [
+   m4/strndup.m4
+   m4/strnlen.m4
+   m4/sys_socket_h.m4
++  m4/sys_stat_h.m4
++  m4/sys_time_h.m4
+   m4/sys_types_h.m4
+   m4/sysexits.m4
+   m4/threadlib.m4
++  m4/time_h.m4
+   m4/uintmax_t.m4
+   m4/unistd_h.m4
+   m4/vasnprintf.m4
+diff --git a/m4/largefile.m4 b/m4/largefile.m4
+new file mode 100644
+index 0000000..a1b564a
+--- /dev/null
++++ b/m4/largefile.m4
+@@ -0,0 +1,146 @@
++# Enable large files on systems where this is not the default.
++
++# Copyright 1992-1996, 1998-2014 Free Software Foundation, Inc.
++# This file is free software; the Free Software Foundation
++# gives unlimited permission to copy and/or distribute it,
++# with or without modifications, as long as this notice is preserved.
++
++# The following implementation works around a problem in autoconf <= 2.69;
++# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5,
++# or configures them incorrectly in some cases.
++m4_version_prereq([2.70], [] ,[
++
++# _AC_SYS_LARGEFILE_TEST_INCLUDES
++# -------------------------------
++m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
++[@%:@include <sys/types.h>
++ /* Check that off_t can represent 2**63 - 1 correctly.
++    We can't simply define LARGE_OFF_T to be 9223372036854775807,
++    since some C++ compilers masquerading as C compilers
++    incorrectly reject 9223372036854775807.  */
++@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
++  int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
++                       && LARGE_OFF_T % 2147483647 == 1)
++                      ? 1 : -1]];[]dnl
++])
++
++
++# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
++#                               CACHE-VAR,
++#                               DESCRIPTION,
++#                               PROLOGUE, [FUNCTION-BODY])
++# --------------------------------------------------------
++m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
++[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
++[while :; do
++  m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
++    [AC_LANG_PROGRAM([$5], [$6])],
++    [$3=no; break])
++  m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
++    [AC_LANG_PROGRAM([@%:@define $1 $2
++$5], [$6])],
++    [$3=$2; break])
++  $3=unknown
++  break
++done])
++case $$3 in #(
++  no | unknown) ;;
++  *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
++esac
++rm -rf conftest*[]dnl
++])# _AC_SYS_LARGEFILE_MACRO_VALUE
++
++
++# AC_SYS_LARGEFILE
++# ----------------
++# By default, many hosts won't let programs access large files;
++# one must use special compiler options to get large-file access to work.
++# For more details about this brain damage please see:
++# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
++AC_DEFUN([AC_SYS_LARGEFILE],
++[AC_ARG_ENABLE(largefile,
++               [  --disable-largefile     omit support for large files])
++if test "$enable_largefile" != no; then
++
++  AC_CACHE_CHECK([for special C compiler options needed for large files],
++    ac_cv_sys_largefile_CC,
++    [ac_cv_sys_largefile_CC=no
++     if test "$GCC" != yes; then
++       ac_save_CC=$CC
++       while :; do
++         # IRIX 6.2 and later do not support large files by default,
++         # so use the C compiler's -n32 option if that helps.
++         AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
++         AC_COMPILE_IFELSE([], [break])
++         CC="$CC -n32"
++         AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
++         break
++       done
++       CC=$ac_save_CC
++       rm -f conftest.$ac_ext
++    fi])
++  if test "$ac_cv_sys_largefile_CC" != no; then
++    CC=$CC$ac_cv_sys_largefile_CC
++  fi
++
++  _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
++    ac_cv_sys_file_offset_bits,
++    [Number of bits in a file offset, on hosts where this is settable.],
++    [_AC_SYS_LARGEFILE_TEST_INCLUDES])
++  if test $ac_cv_sys_file_offset_bits = unknown; then
++    _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
++      ac_cv_sys_large_files,
++      [Define for large files, on AIX-style hosts.],
++      [_AC_SYS_LARGEFILE_TEST_INCLUDES])
++  fi
++
++  AC_DEFINE([_DARWIN_USE_64_BIT_INODE], [1],
++    [Enable large inode numbers on Mac OS X 10.5.])
++fi
++])# AC_SYS_LARGEFILE
++])# m4_version_prereq 2.70
++
++# Enable large files on systems where this is implemented by Gnulib, not by the
++# system headers.
++# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib
++# overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively.
++AC_DEFUN([gl_LARGEFILE],
++[
++  AC_REQUIRE([AC_CANONICAL_HOST])
++  case "$host_os" in
++    mingw*)
++      dnl Native Windows.
++      dnl mingw64 defines off_t to a 64-bit type already, if
++      dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE.
++      AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64],
++        [AC_COMPILE_IFELSE(
++           [AC_LANG_PROGRAM(
++              [[#include <sys/types.h>
++                int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1];
++              ]],
++              [[]])],
++           [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no])
++        ])
++      if test $gl_cv_type_off_t_64 = no; then
++        WINDOWS_64_BIT_OFF_T=1
++      else
++        WINDOWS_64_BIT_OFF_T=0
++      fi
++      dnl But all native Windows platforms (including mingw64) have a 32-bit
++      dnl st_size member in 'struct stat'.
++      WINDOWS_64_BIT_ST_SIZE=1
++      ;;
++    *)
++      dnl Nothing to do on gnulib's side.
++      dnl A 64-bit off_t is
++      dnl   - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX,
++      dnl     OSF/1, Cygwin,
++      dnl   - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on
++      dnl     glibc, HP-UX, Solaris,
++      dnl   - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX,
++      dnl   - impossible to achieve on Minix 3.1.8.
++      WINDOWS_64_BIT_OFF_T=0
++      WINDOWS_64_BIT_ST_SIZE=0
++      ;;
++  esac
++])
+diff --git a/m4/pathmax.m4 b/m4/pathmax.m4
+new file mode 100644
+index 0000000..114f91f
+--- /dev/null
++++ b/m4/pathmax.m4
+@@ -0,0 +1,42 @@
++# pathmax.m4 serial 10
++dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation,
++dnl Inc.
++dnl This file is free software; the Free Software Foundation
++dnl gives unlimited permission to copy and/or distribute it,
++dnl with or without modifications, as long as this notice is preserved.
++
++AC_DEFUN([gl_PATHMAX],
++[
++  dnl Prerequisites of lib/pathmax.h.
++  AC_CHECK_HEADERS_ONCE([sys/param.h])
++])
++
++# Expands to a piece of C program that defines PATH_MAX in the same way as
++# "pathmax.h" will do.
++AC_DEFUN([gl_PATHMAX_SNIPPET], [[
++/* Arrange to define PATH_MAX, like "pathmax.h" does. */
++#if HAVE_UNISTD_H
++# include <unistd.h>
++#endif
++#include <limits.h>
++#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
++# include <sys/param.h>
++#endif
++#if !defined PATH_MAX && defined MAXPATHLEN
++# define PATH_MAX MAXPATHLEN
++#endif
++#ifdef __hpux
++# undef PATH_MAX
++# define PATH_MAX 1024
++#endif
++#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
++# undef PATH_MAX
++# define PATH_MAX 260
++#endif
++]])
++
++# Prerequisites of gl_PATHMAX_SNIPPET.
++AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ],
++[
++  AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h])
++])
+diff --git a/m4/readlink.m4 b/m4/readlink.m4
+new file mode 100644
+index 0000000..f9ce868
+--- /dev/null
++++ b/m4/readlink.m4
+@@ -0,0 +1,71 @@
++# readlink.m4 serial 12
++dnl Copyright (C) 2003, 2007, 2009-2014 Free Software Foundation, Inc.
++dnl This file is free software; the Free Software Foundation
++dnl gives unlimited permission to copy and/or distribute it,
++dnl with or without modifications, as long as this notice is preserved.
++
++AC_DEFUN([gl_FUNC_READLINK],
++[
++  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
++  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
++  AC_CHECK_FUNCS_ONCE([readlink])
++  if test $ac_cv_func_readlink = no; then
++    HAVE_READLINK=0
++  else
++    AC_CACHE_CHECK([whether readlink signature is correct],
++      [gl_cv_decl_readlink_works],
++      [AC_COMPILE_IFELSE(
++         [AC_LANG_PROGRAM(
++           [[#include <unistd.h>
++      /* Cause compilation failure if original declaration has wrong type.  */
++      ssize_t readlink (const char *, char *, size_t);]])],
++         [gl_cv_decl_readlink_works=yes], [gl_cv_decl_readlink_works=no])])
++    dnl Solaris 9 ignores trailing slash.
++    dnl FreeBSD 7.2 dereferences only one level of links with trailing slash.
++    AC_CACHE_CHECK([whether readlink handles trailing slash correctly],
++      [gl_cv_func_readlink_works],
++      [# We have readlink, so assume ln -s works.
++       ln -s conftest.no-such conftest.link
++       ln -s conftest.link conftest.lnk2
++       AC_RUN_IFELSE(
++         [AC_LANG_PROGRAM(
++           [[#include <unistd.h>
++]], [[char buf[20];
++      return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])],
++         [gl_cv_func_readlink_works=yes], [gl_cv_func_readlink_works=no],
++         [case "$host_os" in
++                    # Guess yes on glibc systems.
++            *-gnu*) gl_cv_func_readlink_works="guessing yes" ;;
++                    # If we don't know, assume the worst.
++            *)      gl_cv_func_readlink_works="guessing no" ;;
++          esac
++         ])
++      rm -f conftest.link conftest.lnk2])
++    case "$gl_cv_func_readlink_works" in
++      *yes)
++        if test "$gl_cv_decl_readlink_works" != yes; then
++          REPLACE_READLINK=1
++        fi
++        ;;
++      *)
++        AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink
++          fails to recognize a trailing slash.])
++        REPLACE_READLINK=1
++        ;;
++    esac
++  fi
++])
++
++# Like gl_FUNC_READLINK, except prepare for separate compilation
++# (no REPLACE_READLINK, no AC_LIBOBJ).
++AC_DEFUN([gl_FUNC_READLINK_SEPARATE],
++[
++  AC_CHECK_FUNCS_ONCE([readlink])
++  gl_PREREQ_READLINK
++])
++
++# Prerequisites of lib/readlink.c.
++AC_DEFUN([gl_PREREQ_READLINK],
++[
++  :
++])
+diff --git a/m4/stat.m4 b/m4/stat.m4
+new file mode 100644
+index 0000000..1ae327b
+--- /dev/null
++++ b/m4/stat.m4
+@@ -0,0 +1,71 @@
++# serial 11
++
++# Copyright (C) 2009-2014 Free Software Foundation, Inc.
++#
++# This file is free software; the Free Software Foundation
++# gives unlimited permission to copy and/or distribute it,
++# with or without modifications, as long as this notice is preserved.
++
++AC_DEFUN([gl_FUNC_STAT],
++[
++  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
++  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
++  AC_CHECK_FUNCS_ONCE([lstat])
++  dnl mingw is the only known platform where stat(".") and stat("./") differ
++  AC_CACHE_CHECK([whether stat handles trailing slashes on directories],
++      [gl_cv_func_stat_dir_slash],
++      [AC_RUN_IFELSE(
++         [AC_LANG_PROGRAM(
++           [[#include <sys/stat.h>
++]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])],
++         [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no],
++         [case $host_os in
++            mingw*) gl_cv_func_stat_dir_slash="guessing no";;
++            *) gl_cv_func_stat_dir_slash="guessing yes";;
++          esac])])
++  dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").
++  dnl (For mingw, this is due to a broken stat() override in libmingwex.a.)
++  dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/").
++  AC_CACHE_CHECK([whether stat handles trailing slashes on files],
++      [gl_cv_func_stat_file_slash],
++      [touch conftest.tmp
++       # Assume that if we have lstat, we can also check symlinks.
++       if test $ac_cv_func_lstat = yes; then
++         ln -s conftest.tmp conftest.lnk
++       fi
++       AC_RUN_IFELSE(
++         [AC_LANG_PROGRAM(
++           [[#include <sys/stat.h>
++]], [[int result = 0;
++      struct stat st;
++      if (!stat ("conftest.tmp/", &st))
++        result |= 1;
++#if HAVE_LSTAT
++      if (!stat ("conftest.lnk/", &st))
++        result |= 2;
++#endif
++      return result;
++           ]])],
++         [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
++         [case "$host_os" in
++                    # Guess yes on glibc systems.
++            *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;;
++                    # If we don't know, assume the worst.
++            *)      gl_cv_func_stat_file_slash="guessing no" ;;
++          esac
++         ])
++       rm -f conftest.tmp conftest.lnk])
++  case $gl_cv_func_stat_dir_slash in
++    *no) REPLACE_STAT=1
++      AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs
++        help when passed a directory name with a trailing slash]);;
++  esac
++  case $gl_cv_func_stat_file_slash in
++    *no) REPLACE_STAT=1
++      AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
++        help when passed a file name with a trailing slash]);;
++  esac
++])
++
++# Prerequisites of lib/stat.c.
++AC_DEFUN([gl_PREREQ_STAT], [:])
+diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4
+new file mode 100644
+index 0000000..eaa7642
+--- /dev/null
++++ b/m4/sys_stat_h.m4
+@@ -0,0 +1,96 @@
++# sys_stat_h.m4 serial 28   -*- Autoconf -*-
++dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
++dnl This file is free software; the Free Software Foundation
++dnl gives unlimited permission to copy and/or distribute it,
++dnl with or without modifications, as long as this notice is preserved.
++
++dnl From Eric Blake.
++dnl Provide a GNU-like <sys/stat.h>.
++
++AC_DEFUN([gl_HEADER_SYS_STAT_H],
++[
++  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
++
++  dnl Check for broken stat macros.
++  AC_REQUIRE([AC_HEADER_STAT])
++
++  gl_CHECK_NEXT_HEADERS([sys/stat.h])
++
++  dnl Ensure the type mode_t gets defined.
++  AC_REQUIRE([AC_TYPE_MODE_T])
++
++  dnl Whether to override 'struct stat'.
++  m4_ifdef([gl_LARGEFILE], [
++    AC_REQUIRE([gl_LARGEFILE])
++  ], [
++    WINDOWS_64_BIT_ST_SIZE=0
++  ])
++  AC_SUBST([WINDOWS_64_BIT_ST_SIZE])
++  if test $WINDOWS_64_BIT_ST_SIZE = 1; then
++    AC_DEFINE([_GL_WINDOWS_64_BIT_ST_SIZE], [1],
++      [Define to 1 if Gnulib overrides 'struct stat' on Windows so that
++       struct stat.st_size becomes 64-bit.])
++  fi
++
++  dnl Define types that are supposed to be defined in <sys/types.h> or
++  dnl <sys/stat.h>.
++  AC_CHECK_TYPE([nlink_t], [],
++    [AC_DEFINE([nlink_t], [int],
++       [Define to the type of st_nlink in struct stat, or a supertype.])],
++    [#include <sys/types.h>
++     #include <sys/stat.h>])
++
++  dnl Check for declarations of anything we want to poison if the
++  dnl corresponding gnulib module is not in use.
++  gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
++    ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
++    mknod mknodat stat utimensat])
++]) # gl_HEADER_SYS_STAT_H
++
++AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
++[
++  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
++  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
++  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
++  dnl Define it also as a C macro, for the benefit of the unit tests.
++  gl_MODULE_INDICATOR_FOR_TESTS([$1])
++])
++
++AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
++[
++  AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
++  GNULIB_FCHMODAT=0;    AC_SUBST([GNULIB_FCHMODAT])
++  GNULIB_FSTAT=0;       AC_SUBST([GNULIB_FSTAT])
++  GNULIB_FSTATAT=0;     AC_SUBST([GNULIB_FSTATAT])
++  GNULIB_FUTIMENS=0;    AC_SUBST([GNULIB_FUTIMENS])
++  GNULIB_LCHMOD=0;      AC_SUBST([GNULIB_LCHMOD])
++  GNULIB_LSTAT=0;       AC_SUBST([GNULIB_LSTAT])
++  GNULIB_MKDIRAT=0;     AC_SUBST([GNULIB_MKDIRAT])
++  GNULIB_MKFIFO=0;      AC_SUBST([GNULIB_MKFIFO])
++  GNULIB_MKFIFOAT=0;    AC_SUBST([GNULIB_MKFIFOAT])
++  GNULIB_MKNOD=0;       AC_SUBST([GNULIB_MKNOD])
++  GNULIB_MKNODAT=0;     AC_SUBST([GNULIB_MKNODAT])
++  GNULIB_STAT=0;        AC_SUBST([GNULIB_STAT])
++  GNULIB_UTIMENSAT=0;   AC_SUBST([GNULIB_UTIMENSAT])
++  dnl Assume proper GNU behavior unless another module says otherwise.
++  HAVE_FCHMODAT=1;      AC_SUBST([HAVE_FCHMODAT])
++  HAVE_FSTATAT=1;       AC_SUBST([HAVE_FSTATAT])
++  HAVE_FUTIMENS=1;      AC_SUBST([HAVE_FUTIMENS])
++  HAVE_LCHMOD=1;        AC_SUBST([HAVE_LCHMOD])
++  HAVE_LSTAT=1;         AC_SUBST([HAVE_LSTAT])
++  HAVE_MKDIRAT=1;       AC_SUBST([HAVE_MKDIRAT])
++  HAVE_MKFIFO=1;        AC_SUBST([HAVE_MKFIFO])
++  HAVE_MKFIFOAT=1;      AC_SUBST([HAVE_MKFIFOAT])
++  HAVE_MKNOD=1;         AC_SUBST([HAVE_MKNOD])
++  HAVE_MKNODAT=1;       AC_SUBST([HAVE_MKNODAT])
++  HAVE_UTIMENSAT=1;     AC_SUBST([HAVE_UTIMENSAT])
++  REPLACE_FSTAT=0;      AC_SUBST([REPLACE_FSTAT])
++  REPLACE_FSTATAT=0;    AC_SUBST([REPLACE_FSTATAT])
++  REPLACE_FUTIMENS=0;   AC_SUBST([REPLACE_FUTIMENS])
++  REPLACE_LSTAT=0;      AC_SUBST([REPLACE_LSTAT])
++  REPLACE_MKDIR=0;      AC_SUBST([REPLACE_MKDIR])
++  REPLACE_MKFIFO=0;     AC_SUBST([REPLACE_MKFIFO])
++  REPLACE_MKNOD=0;      AC_SUBST([REPLACE_MKNOD])
++  REPLACE_STAT=0;       AC_SUBST([REPLACE_STAT])
++  REPLACE_UTIMENSAT=0;  AC_SUBST([REPLACE_UTIMENSAT])
++])
+diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4
+new file mode 100644
+index 0000000..5c79300
+--- /dev/null
++++ b/m4/sys_time_h.m4
+@@ -0,0 +1,110 @@
++# Configure a replacement for <sys/time.h>.
++# serial 8
++
++# Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
++# This file is free software; the Free Software Foundation
++# gives unlimited permission to copy and/or distribute it,
++# with or without modifications, as long as this notice is preserved.
++
++# Written by Paul Eggert and Martin Lambers.
++
++AC_DEFUN([gl_HEADER_SYS_TIME_H],
++[
++  dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement
++  dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1
++  dnl statements that occur in other macros.
++  AC_REQUIRE([gl_HEADER_SYS_TIME_H_BODY])
++])
++
++AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
++[
++  AC_REQUIRE([AC_C_RESTRICT])
++  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
++  AC_CHECK_HEADERS_ONCE([sys/time.h])
++  gl_CHECK_NEXT_HEADERS([sys/time.h])
++
++  if test $ac_cv_header_sys_time_h != yes; then
++    HAVE_SYS_TIME_H=0
++  fi
++
++  dnl On native Windows with MSVC, 'struct timeval' is defined in <winsock2.h>
++  dnl only. So include that header in the list.
++  gl_PREREQ_SYS_H_WINSOCK2
++  AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
++    [AC_COMPILE_IFELSE(
++       [AC_LANG_PROGRAM(
++          [[#if HAVE_SYS_TIME_H
++             #include <sys/time.h>
++            #endif
++            #include <time.h>
++            #if HAVE_WINSOCK2_H
++            # include <winsock2.h>
++            #endif
++          ]],
++          [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
++       [gl_cv_sys_struct_timeval=yes],
++       [gl_cv_sys_struct_timeval=no])
++    ])
++  if test $gl_cv_sys_struct_timeval != yes; then
++    HAVE_STRUCT_TIMEVAL=0
++  else
++    dnl On native Windows with a 64-bit 'time_t', 'struct timeval' is defined
++    dnl (in <sys/time.h> and <winsock2.h> for mingw64, in <winsock2.h> only
++    dnl for MSVC) with a tv_sec field of type 'long' (32-bit!), which is
++    dnl smaller than the 'time_t' type mandated by POSIX.
++    dnl On OpenBSD 5.1 amd64, tv_sec is 64 bits and time_t 32 bits, but
++    dnl that is good enough.
++    AC_CACHE_CHECK([for wide-enough struct timeval.tv_sec member],
++      [gl_cv_sys_struct_timeval_tv_sec],
++      [AC_COMPILE_IFELSE(
++         [AC_LANG_PROGRAM(
++            [[#if HAVE_SYS_TIME_H
++               #include <sys/time.h>
++              #endif
++              #include <time.h>
++              #if HAVE_WINSOCK2_H
++              # include <winsock2.h>
++              #endif
++            ]],
++            [[static struct timeval x;
++              typedef int verify_tv_sec_type[
++                sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1
++              ];
++            ]])],
++         [gl_cv_sys_struct_timeval_tv_sec=yes],
++         [gl_cv_sys_struct_timeval_tv_sec=no])
++      ])
++    if test $gl_cv_sys_struct_timeval_tv_sec != yes; then
++      REPLACE_STRUCT_TIMEVAL=1
++    fi
++  fi
++
++  dnl Check for declarations of anything we want to poison if the
++  dnl corresponding gnulib module is not in use.
++  gl_WARN_ON_USE_PREPARE([[
++#if HAVE_SYS_TIME_H
++# include <sys/time.h>
++#endif
++#include <time.h>
++    ]], [gettimeofday])
++])
++
++AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR],
++[
++  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
++  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
++  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
++  dnl Define it also as a C macro, for the benefit of the unit tests.
++  gl_MODULE_INDICATOR_FOR_TESTS([$1])
++])
++
++AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS],
++[
++  GNULIB_GETTIMEOFDAY=0;     AC_SUBST([GNULIB_GETTIMEOFDAY])
++  dnl Assume POSIX behavior unless another module says otherwise.
++  HAVE_GETTIMEOFDAY=1;       AC_SUBST([HAVE_GETTIMEOFDAY])
++  HAVE_STRUCT_TIMEVAL=1;     AC_SUBST([HAVE_STRUCT_TIMEVAL])
++  HAVE_SYS_TIME_H=1;         AC_SUBST([HAVE_SYS_TIME_H])
++  REPLACE_GETTIMEOFDAY=0;    AC_SUBST([REPLACE_GETTIMEOFDAY])
++  REPLACE_STRUCT_TIMEVAL=0;  AC_SUBST([REPLACE_STRUCT_TIMEVAL])
++])
+diff --git a/m4/time_h.m4 b/m4/time_h.m4
+new file mode 100644
+index 0000000..9852778
+--- /dev/null
++++ b/m4/time_h.m4
+@@ -0,0 +1,118 @@
++# Configure a more-standard replacement for <time.h>.
++
++# Copyright (C) 2000-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
++
++# serial 8
++
++# This file is free software; the Free Software Foundation
++# gives unlimited permission to copy and/or distribute it,
++# with or without modifications, as long as this notice is preserved.
++
++# Written by Paul Eggert and Jim Meyering.
++
++AC_DEFUN([gl_HEADER_TIME_H],
++[
++  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
++  dnl once only, before all statements that occur in other macros.
++  AC_REQUIRE([gl_HEADER_TIME_H_BODY])
++])
++
++AC_DEFUN([gl_HEADER_TIME_H_BODY],
++[
++  AC_REQUIRE([AC_C_RESTRICT])
++  AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
++  gl_NEXT_HEADERS([time.h])
++  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
++])
++
++dnl Check whether 'struct timespec' is declared
++dnl in time.h, sys/time.h, or pthread.h.
++
++AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
++[
++  AC_CHECK_HEADERS_ONCE([sys/time.h])
++  AC_CACHE_CHECK([for struct timespec in <time.h>],
++    [gl_cv_sys_struct_timespec_in_time_h],
++    [AC_COMPILE_IFELSE(
++       [AC_LANG_PROGRAM(
++          [[#include <time.h>
++          ]],
++          [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
++       [gl_cv_sys_struct_timespec_in_time_h=yes],
++       [gl_cv_sys_struct_timespec_in_time_h=no])])
++
++  TIME_H_DEFINES_STRUCT_TIMESPEC=0
++  SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
++  PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
++  if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
++    TIME_H_DEFINES_STRUCT_TIMESPEC=1
++  else
++    AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
++      [gl_cv_sys_struct_timespec_in_sys_time_h],
++      [AC_COMPILE_IFELSE(
++         [AC_LANG_PROGRAM(
++            [[#include <sys/time.h>
++            ]],
++            [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
++         [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
++         [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
++    if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
++      SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
++    else
++      AC_CACHE_CHECK([for struct timespec in <pthread.h>],
++        [gl_cv_sys_struct_timespec_in_pthread_h],
++        [AC_COMPILE_IFELSE(
++           [AC_LANG_PROGRAM(
++              [[#include <pthread.h>
++              ]],
++              [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
++           [gl_cv_sys_struct_timespec_in_pthread_h=yes],
++           [gl_cv_sys_struct_timespec_in_pthread_h=no])])
++      if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
++        PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
++      fi
++    fi
++  fi
++  AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
++  AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
++  AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC])
++])
++
++AC_DEFUN([gl_TIME_MODULE_INDICATOR],
++[
++  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
++  AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
++  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
++  dnl Define it also as a C macro, for the benefit of the unit tests.
++  gl_MODULE_INDICATOR_FOR_TESTS([$1])
++])
++
++AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
++[
++  GNULIB_MKTIME=0;                       AC_SUBST([GNULIB_MKTIME])
++  GNULIB_NANOSLEEP=0;                    AC_SUBST([GNULIB_NANOSLEEP])
++  GNULIB_STRPTIME=0;                     AC_SUBST([GNULIB_STRPTIME])
++  GNULIB_TIMEGM=0;                       AC_SUBST([GNULIB_TIMEGM])
++  GNULIB_TIME_R=0;                       AC_SUBST([GNULIB_TIME_R])
++  dnl Assume proper GNU behavior unless another module says otherwise.
++  HAVE_DECL_LOCALTIME_R=1;               AC_SUBST([HAVE_DECL_LOCALTIME_R])
++  HAVE_NANOSLEEP=1;                      AC_SUBST([HAVE_NANOSLEEP])
++  HAVE_STRPTIME=1;                       AC_SUBST([HAVE_STRPTIME])
++  HAVE_TIMEGM=1;                         AC_SUBST([HAVE_TIMEGM])
++  dnl If another module says to replace or to not replace, do that.
++  dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
++  dnl this lets maintainers check for portability.
++  REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;  AC_SUBST([REPLACE_LOCALTIME_R])
++  REPLACE_MKTIME=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_MKTIME])
++  REPLACE_NANOSLEEP=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_NANOSLEEP])
++  REPLACE_TIMEGM=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_TIMEGM])
++
++  dnl Hack so that the time module doesn't depend on the sys_time module.
++  dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent.
++  : ${GNULIB_GETTIMEOFDAY=0};            AC_SUBST([GNULIB_GETTIMEOFDAY])
++  dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME
++  dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier
++  dnl is no longer a big deal.
++  REPLACE_GMTIME=0;                      AC_SUBST([REPLACE_GMTIME])
++  REPLACE_LOCALTIME=0;                   AC_SUBST([REPLACE_LOCALTIME])
++])
+-- 
+1.9.3
+
diff --git a/SOURCES/0145-Make-editenv-chase-symlinks-including-those-across-d.patch b/SOURCES/0145-Make-editenv-chase-symlinks-including-those-across-d.patch
new file mode 100644
index 0000000..ce4b06c
--- /dev/null
+++ b/SOURCES/0145-Make-editenv-chase-symlinks-including-those-across-d.patch
@@ -0,0 +1,106 @@
+From 4ebb0b512d9cf934ace9478fde7890cebb33f56d Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Wed, 3 Sep 2014 10:38:00 -0400
+Subject: [PATCH 145/145] Make editenv chase symlinks including those across
+ devices.
+
+This lets us make /boot/grub2/grubenv a symlink to
+/boot/efi/EFI/fedora/grubenv even though they're different mount points,
+which allows /usr/bin/grub2-editenv to be the same across platforms
+(i.e. UEFI vs BIOS).
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+Reviewed-by: Adam Jackson <ajax@redhat.com>
+---
+ Makefile.util.def |  9 +++++++++
+ util/editenv.c    | 46 ++++++++++++++++++++++++++++++++++++++++++++--
+ 2 files changed, 53 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.util.def b/Makefile.util.def
+index 8f40e78..87029a1 100644
+--- a/Makefile.util.def
++++ b/Makefile.util.def
+@@ -228,8 +228,17 @@ program = {
+ 
+   common = util/grub-editenv.c;
+   common = util/editenv.c;
++  common = util/grub-install-common.c;
+   common = grub-core/osdep/init.c;
++  common = grub-core/osdep/compress.c;
++  extra_dist = grub-core/osdep/unix/compress.c;
++  extra_dist = grub-core/osdep/basic/compress.c;
++  common = util/mkimage.c;
++  common = grub-core/osdep/config.c;
++  common = util/config.c;
++  common = util/resolve.c;
+ 
++  ldadd = '$(LIBLZMA)';
+   ldadd = libgrubmods.a;
+   ldadd = libgrubgcry.a;
+   ldadd = libgrubkern.a;
+diff --git a/util/editenv.c b/util/editenv.c
+index c6f8d22..d8d1dad 100644
+--- a/util/editenv.c
++++ b/util/editenv.c
+@@ -37,6 +37,7 @@ grub_util_create_envblk_file (const char *name)
+   FILE *fp;
+   char *buf;
+   char *namenew;
++  char *rename_target = xstrdup(name);
+ 
+   buf = xmalloc (DEFAULT_ENVBLK_SIZE);
+ 
+@@ -59,7 +60,48 @@ grub_util_create_envblk_file (const char *name)
+   free (buf);
+   fclose (fp);
+ 
+-  if (grub_util_rename (namenew, name) < 0)
+-    grub_util_error (_("cannot rename the file %s to %s"), namenew, name);
++  ssize_t size = 1;
++  while (1)
++    {
++      char *linkbuf;
++      ssize_t retsize;
++
++      linkbuf = xmalloc(size+1);
++      retsize = grub_util_readlink (rename_target, linkbuf, size);
++      if (retsize < 0 && (errno == ENOENT || errno == EINVAL))
++	{
++	  free (linkbuf);
++	  break;
++	}
++      else if (retsize < 0)
++	{
++	  grub_util_error (_("cannot rename the file %s to %s: %m"), namenew, name);
++	  free (linkbuf);
++	  free (namenew);
++	  return;
++	}
++      else if (retsize == size)
++	{
++	  free(linkbuf);
++	  size += 128;
++	  continue;
++	}
++
++      free (rename_target);
++      linkbuf[retsize] = '\0';
++      rename_target = linkbuf;
++    }
++
++  int rc = grub_util_rename (namenew, rename_target);
++  if (rc < 0 && errno == EXDEV)
++    {
++      rc = grub_install_copy_file (namenew, rename_target, 1);
++      grub_util_unlink (namenew);
++    }
++
++  if (rc < 0)
++    grub_util_error (_("cannot rename the file %s to %s: %m"), namenew, name);
++
+   free (namenew);
++  free (rename_target);
+ }
+-- 
+1.9.3
+
diff --git a/SOURCES/centos.cer b/SOURCES/centos.cer
deleted file mode 100644
index 00a5580..0000000
Binary files a/SOURCES/centos.cer and /dev/null differ
diff --git a/SOURCES/gitignore b/SOURCES/gitignore
new file mode 100644
index 0000000..c21ee5f
--- /dev/null
+++ b/SOURCES/gitignore
@@ -0,0 +1,242 @@
+00_header
+10_*
+!10_*.in
+20_linux_xen
+30_os-prober
+40_custom
+41_custom
+*.[[:digit:]]
+!util/*.[[:digit:]]
+aclocal.m4
+ahci_test
+ascii.bitmaps
+ascii.h
+autom4te.cache
+build-grub-gen-asciih
+build-grub-gen-widthspec
+build-grub-mkfont
+cdboot_test
+cmp_test
+config.cache
+config.guess
+config.h
+config-util.h
+config-util.h.in
+config.log
+config.status
+config.sub
+configure
+core_compress_test
+DISTLIST
+docs/*.info
+docs/stamp-vti
+docs/version.texi
+ehci_test
+example_grub_script_test
+example_scripted_test
+example_unit_test
+*.exec
+*.exec.exe
+fddboot_test
+genkernsyms.sh
+gensymlist.sh
+gentrigtables
+gentrigtables.exe
+gettext_strings_test
+grub-bin2h
+/grub-bios-setup
+/grub-bios-setup.exe
+grub_cmd_date
+grub_cmd_echo
+grub_cmd_regexp
+grub_cmd_set_date
+grub_cmd_sleep
+/grub-editenv
+/grub-editenv.exe
+grub-emu
+grub-emu-lite
+grub-emu.exe
+grub-emu-lite.exe
+grub_emu_init.c
+grub_emu_init.h
+grub-fstest
+grub-fstest.exe
+grub_fstest_init.c
+grub_fstest_init.h
+grub_func_test
+grub-install
+grub-install.exe
+grub-kbdcomp
+grub-macho2img
+/grub-menulst2cfg
+/grub-menulst2cfg.exe
+/grub-mk*
+grub-mount
+/grub-ofpathname
+/grub-ofpathname.exe
+grub-core/build-grub-pe2elf.exe
+/grub-probe
+/grub-probe.exe
+grub_probe_init.c
+grub_probe_init.h
+/grub-reboot
+grub_script_blanklines
+grub_script_blockarg
+grub_script_break
+grub-script-check
+grub-script-check.exe
+grub_script_check_init.c
+grub_script_check_init.h
+grub_script_comments
+grub_script_continue
+grub_script_dollar
+grub_script_echo1
+grub_script_echo_keywords
+grub_script_escape_comma
+grub_script_eval
+grub_script_expansion
+grub_script_final_semicolon
+grub_script_for1
+grub_script_functions
+grub_script_gettext
+grub_script_if
+grub_script_leading_whitespace
+grub_script_no_commands
+grub_script_not
+grub_script_return
+grub_script_setparams
+grub_script_shift
+grub_script_strcmp
+grub_script_test
+grub_script_vars1
+grub_script_while1
+grub_script.tab.c
+grub_script.tab.h
+grub_script.yy.c
+grub_script.yy.h
+grub-set-default
+grub_setup_init.c
+grub_setup_init.h
+grub-shell
+grub-shell-tester
+grub-sparc64-setup
+grub-sparc64-setup.exe
+gzcompress_test
+hddboot_test
+help_test
+*.img
+*.image
+*.image.exe
+include/grub/cpu
+include/grub/machine
+install-sh
+lib/libgcrypt-grub
+libgrub_a_init.c
+*.log
+*.lst
+lzocompress_test
+*.marker
+Makefile
+*.mod
+mod-*.c
+missing
+netboot_test
+*.o
+*.a
+ohci_test
+partmap_test
+pata_test
+*.pf2
+*.pp
+po/*.mo
+po/grub.pot
+po/POTFILES
+po/stamp-po
+printf_test
+priority_queue_unit_test
+pseries_test
+stamp-h
+stamp-h1
+stamp-h.in
+symlist.c
+symlist.h
+trigtables.c
+*.trs
+uhci_test
+update-grub_lib
+unidata.c
+xzcompress_test
+Makefile.in
+GPATH
+GRTAGS
+GSYMS
+GTAGS
+compile
+depcomp
+mdate-sh
+texinfo.tex
+grub-core/lib/libgcrypt-grub
+.deps
+.deps-util
+.deps-core
+.dirstamp
+Makefile.util.am
+contrib
+grub-core/bootinfo.txt
+grub-core/Makefile.core.am
+grub-core/Makefile.gcry.def
+grub-core/contrib
+grub-core/gdb_grub
+grub-core/genmod.sh
+grub-core/gensyminfo.sh
+grub-core/gmodule.pl
+grub-core/grub.chrp
+grub-core/modinfo.sh
+grub-core/*.module
+grub-core/*.module.exe
+grub-core/*.pp
+util/bash-completion.d/grub
+grub-core/gnulib/alloca.h
+grub-core/gnulib/arg-nonnull.h
+grub-core/gnulib/c++defs.h
+grub-core/gnulib/charset.alias
+grub-core/gnulib/configmake.h
+grub-core/gnulib/float.h
+grub-core/gnulib/getopt.h
+grub-core/gnulib/langinfo.h
+grub-core/gnulib/ref-add.sed
+grub-core/gnulib/ref-del.sed
+grub-core/gnulib/stdio.h
+grub-core/gnulib/stdlib.h
+grub-core/gnulib/string.h
+grub-core/gnulib/strings.h
+grub-core/gnulib/sys
+grub-core/gnulib/unistd.h
+grub-core/gnulib/warn-on-use.h
+grub-core/gnulib/wchar.h
+grub-core/gnulib/wctype.h
+grub-core/rs_decoder.h
+widthspec.bin
+widthspec.h
+docs/stamp-1
+docs/version-dev.texi
+Makefile.utilgcry.def
+po/*.po
+po/*.gmo
+po/LINGUAS
+po/remove-potcdate.sed
+include/grub/gcrypt/gcrypt.h
+include/grub/gcrypt/g10lib.h
+po/POTFILES.in
+po/POTFILES-shell.in
+/grub-glue-efi
+/grub-render-label
+/grub-glue-efi.exe
+/grub-render-label.exe
+grub-core/gnulib/locale.h
+grub-core/gnulib/unitypes.h
+grub-core/gnulib/uniwidth.h
+build-aux/test-driver
+/garbage-gen
+/garbage-gen.exe
+/grub-fs-tester
diff --git a/SOURCES/secureboot.cer b/SOURCES/secureboot.cer
new file mode 100644
index 0000000..4ff8b79
Binary files /dev/null and b/SOURCES/secureboot.cer differ
diff --git a/SOURCES/securebootca.cer b/SOURCES/securebootca.cer
new file mode 100644
index 0000000..b235400
Binary files /dev/null and b/SOURCES/securebootca.cer differ
diff --git a/SPECS/grub2.spec b/SPECS/grub2.spec
index 89ce8fb..f8b3aab 100644
--- a/SPECS/grub2.spec
+++ b/SPECS/grub2.spec
@@ -13,18 +13,19 @@
 
 %if ! 0%{?efi}
 
-%global efiarchs x86_64
+%global efi_only aarch64
+%global efiarchs x86_64 ia64 %{efi_only}
 
-%ifarch %{ix86}
-%global grubefiarch i386-efi
-%global grubefiname grubia32.efi
-%global grubeficdname gcdia32.efi
-%endif
 %ifarch x86_64
 %global grubefiarch %{_arch}-efi
 %global grubefiname grubx64.efi
 %global grubeficdname gcdx64.efi
 %endif
+%ifarch aarch64
+%global grubefiarch arm64-efi
+%global grubefiname grubaa64.efi
+%global grubeficdname gcdaa64.efi
+%endif
 
 %if 0%{?rhel}
 %global efidir redhat
@@ -32,9 +33,6 @@
 %if 0%{?fedora}
 %global efidir fedora
 %endif
-%if 0%{?centos}
-%global efidir centos
-%endif
 
 %endif
 
@@ -44,7 +42,7 @@
 Name:           grub2
 Epoch:          1
 Version:        2.02
-Release:        0.2.10%{?dist}.1
+Release:        0.16%{?dist}
 Summary:        Bootloader with support for Linux, Multiboot and more
 
 Group:          System Environment/Base
@@ -53,60 +51,172 @@ URL:            http://www.gnu.org/software/grub/
 Obsoletes:	grub < 1:0.98
 Source0:        ftp://alpha.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz
 #Source0:	ftp://ftp.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz
-
-Source1:	centos.cer
+Source1:	securebootca.cer
+Source2:	secureboot.cer
 Source4:	http://unifoundry.com/unifont-5.1.20080820.pcf.gz
 Source5:	theme.tar.bz2
+Source6:	gitignore
 #Source6:	grub-cd.cfg
-Patch0001: 0001-Migrate-PPC-from-Yaboot-to-Grub2.patch
-Patch0002: 0002-Add-fw_path-variable-revised.patch
-Patch0003: 0003-Add-support-for-linuxefi.patch
-Patch0004: 0004-Use-linuxefi-and-initrdefi-where-appropriate.patch
-Patch0005: 0005-Don-t-allow-insmod-when-secure-boot-is-enabled.patch
-Patch0006: 0006-Pass-x-hex-hex-straight-through-unmolested.patch
-Patch0007: 0007-Fix-crash-on-http.patch
-Patch0008: 0008-IBM-client-architecture-CAS-reboot-support.patch
-Patch0009: 0009-Add-vlan-tag-support.patch
-Patch0010: 0010-Add-X-option-to-printf-functions.patch
-Patch0011: 0011-DHCP-client-ID-and-UUID-options-added.patch
-Patch0012: 0012-Search-for-specific-config-file-for-netboot.patch
-Patch0013: 0013-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch
-Patch0014: 0014-Move-bash-completion-script-922997.patch
-Patch0015: 0015-for-ppc-reset-console-display-attr-when-clear-screen.patch
-Patch0016: 0016-Don-t-write-messages-to-the-screen.patch
-Patch0017: 0017-Don-t-print-GNU-GRUB-header.patch
-Patch0018: 0018-Don-t-add-to-highlighted-row.patch
-Patch0019: 0019-Don-t-add-to-highlighted-row.patch
-Patch0020: 0020-Message-string-cleanups.patch
-Patch0021: 0021-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch
-Patch0022: 0022-Use-the-correct-indentation-for-the-term-help-text.patch
-Patch0023: 0023-Indent-menu-entries.patch
-Patch0024: 0024-Fix-margins.patch
-Patch0025: 0025-Add-support-for-UEFI-operating-systems-returned-by-o.patch
-Patch0026: 0026-Disable-GRUB-video-support-for-IBM-power-machines.patch
-Patch0027: 0027-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch
-Patch0028: 0028-Use-linux16-when-appropriate-880840.patch
-Patch0029: 0029-Enable-pager-by-default.-985860.patch
-Patch0030: 0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch
-Patch0031: 0031-Don-t-say-GNU-Linux-in-generated-menus.patch
-Patch0032: 0032-Don-t-draw-a-border-around-the-menu.patch
-Patch0033: 0033-Use-the-standard-margin-for-the-timeout-string.patch
-Patch0034: 0034-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch
-Patch0035: 0001-Honor-a-symlink-when-generating-configuration-by-gru.patch
-Patch0036: 0001-Don-t-require-a-password-to-boot-entries-generated-b.patch
-Patch0037: 0001-Don-t-emit-Booting-.-message.patch
-Patch0038: 0001-change-stop-condition-to-avoid-infinite-loops.patch
-Patch0039: 0001-increase-network-try-interval-gradually.patch
-Patch0040: 0001-trim-arp-packets-with-abnormal-size.patch
-Patch0041: 0001-Fix-convert-function-to-support-NVMe-devices.patch
-Patch0042: 0001-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch
-Patch0043: 0001-May-as-well-try-it.patch
-Patch0044: 0001-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch
+
+Patch0001: 0001-fix-EFI-detection-on-Windows.patch
+Patch0002: 0002-grub-core-kern-arm-cache_armv6.S-Remove-.arch-direct.patch
+Patch0003: 0003-INSTALL-Cross-compiling-the-GRUB-Fix-some-spelling-m.patch
+Patch0004: 0004-NEWS-First-draft-of-2.02-entry.patch
+Patch0005: 0005-Merge-branch-master-of-git.sv.gnu.org-srv-git-grub.patch
+Patch0006: 0006-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch
+Patch0007: 0007-remove-unused-error.h-from-kern-emu-misc.c.patch
+Patch0008: 0008-Don-t-abort-on-unavailable-coreboot-tables-if-not-ru.patch
+Patch0009: 0009-NEWS-Add-few-missing-entries.-Correct-existing-ones.patch
+Patch0010: 0010-strip-.eh_frame-section-from-arm64-efi-kernel.patch
+Patch0011: 0011-use-grub-boot-aa64.efi-for-boot-images-on-AArch64.patch
+Patch0012: 0012-fix-32-bit-compilation-on-MinGW-w64.patch
+Patch0013: 0013-Change-grub-mkrescue-to-use-bootaa64.efi-too.patch
+Patch0014: 0014-arm64-set-correct-length-of-device-path-end-entry.patch
+Patch0015: 0015-Makefile.util.def-grub-macbless-Change-mansection-to.patch
+Patch0016: 0016-add-part_apple-to-EFI-rescue-image-to-fix-missing-pr.patch
+Patch0017: 0017-freebsd-hostdisk.c-is-only-ever-compiled-on-FreeBSD.patch
+Patch0018: 0018-Prefer-more-portable-test-1-constructs.patch
+Patch0019: 0019-NEWS-Add-few-missing-entries.patch
+Patch0020: 0020-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch
+Patch0021: 0021-util-grub-mount.c-Extend-GCC-warning-workaround-to-g.patch
+Patch0022: 0022-reintroduce-BUILD_LDFLAGS-for-the-cross-compile-case.patch
+Patch0023: 0023-grub-core-term-terminfo.c-Recognize-keys-F1-F12.patch
+Patch0024: 0024-Fix-ChangeLog-date.patch
+Patch0025: 0025-Use-_W64-to-detect-MinGW-W64-32-instead-of-_FILE_OFF.patch
+Patch0026: 0026-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch
+Patch0027: 0027-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch
+Patch0028: 0028-grub-core-commands-macbless.c-Rename-FILE-and-DIR-to.patch
+Patch0029: 0029-Makefile.util.def-Link-grub-ofpathname-with-zfs-libs.patch
+Patch0030: 0030-Makefile.am-default_payload.elf-Add-modules.patch
+Patch0031: 0031-fix-removal-of-cpu-machine-links-on-mingw-msys.patch
+Patch0032: 0032-grub-core-normal-main.c-read_config_file-Buffer-conf.patch
+Patch0033: 0033-util-grub-install.c-Fix-a-typo.patch
+Patch0034: 0034-use-MODULE_FILES-for-genemuinit-instead-of-MOD_FILES.patch
+Patch0035: 0035-Ignore-EPERM-when-modifying-kern.geom.debugflags.patch
+Patch0036: 0036-change-stop-condition-to-avoid-infinite-loops.patch
+Patch0037: 0037-increase-network-try-interval-gradually.patch
+Patch0038: 0038-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch
+Patch0039: 0039-Show-detected-path-to-DejaVuSans-in-configure-summar.patch
+Patch0040: 0040-add-GRUB_WINDOWS_EXTRA_DIST-to-allow-shipping-runtim.patch
+Patch0041: 0041-util-grub-install.c-write_to_disk-Add-an-info-messag.patch
+Patch0042: 0042-util-grub-install.c-List-available-targets.patch
+Patch0043: 0043-Fix-several-translatable-strings.patch
+Patch0044: 0044-do-not-set-default-prefix-in-grub-mkimage.patch
+Patch0045: 0045-fix-Mingw-W64-32-cross-compile-failure-due-to-printf.patch
+Patch0046: 0046-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch
+Patch0047: 0047-grub-install-support-for-partitioned-partx-loop-devi.patch
+Patch0048: 0048-grub-core-term-at_keyboard.c-Tolerate-missing-keyboa.patch
+Patch0049: 0049-.gitignore-add-missing-files-and-.exe-variants.patch
+Patch0050: 0050-util-grub-mkfont.c-Downgrade-warnings-about-unhandle.patch
+Patch0051: 0051-grub-core-disk-ahci.c-Do-not-enable-I-O-decoding-and.patch
+Patch0052: 0052-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch
+Patch0053: 0053-grub-core-disk-ahci.c-Add-safety-cleanups.patch
+Patch0054: 0054-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch
+Patch0055: 0055-grub-core-disk-ahci.c-Increase-timeout.-Some-SSDs-ta.patch
+Patch0056: 0056-util-grub-mkfont.c-Build-fix-for-argp.h-with-older-g.patch
+Patch0057: 0057-util-grub-mkrescue.c-Build-fix-for-argp.h-with-older.patch
+Patch0058: 0058-add-grub_env_set_net_property-function.patch
+Patch0059: 0059-add-bootpath-parser-for-open-firmware.patch
+Patch0060: 0060-grub-core-disk-ahci.c-Ignore-NPORTS-field-and-rely-o.patch
+Patch0061: 0061-grub-core-kern-i386-coreboot-mmap.c-Filter-out-0xa00.patch
+Patch0062: 0062-grub-core-loader-i386-multiboot_mbi.c-grub_multiboot.patch
+Patch0063: 0063-grub-core-mmap-i386-uppermem.c-lower_hook-COREBOOT-I.patch
+Patch0064: 0064-grub-core-kern-i386-pc-mmap.c-Fallback-to-EISA-memor.patch
+Patch0065: 0065-include-grub-i386-openbsd_bootarg.h-Add-addr-and-fre.patch
+Patch0066: 0066-ieee1275-check-for-IBM-pseries-emulated-machine.patch
+Patch0067: 0067-grub-core-loader-arm64-linux.c-Remove-redundant-0x.patch
+Patch0068: 0068-grub-core-lib-relocator.c-Fix-the-case-when-end-of-l.patch
+Patch0069: 0069-Fix-grub-probe-0-option.patch
+Patch0070: 0070-Fix-partmap-cryptodisk-and-abstraction-handling-in-g.patch
+Patch0071: 0071-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch
+Patch0072: 0072-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch
+Patch0073: 0073-Replace-few-instances-of-memcmp-memcpy-in-the-code-t.patch
+Patch0074: 0074-include-grub-libgcc.h-Remove-ctzsi2-and-ctzdi2.-They.patch
+Patch0075: 0075-Add-missing-endif.patch
+Patch0076: 0076-grub-core-lib-syslinux_parse.c-Fix-timeout-quoting.patch
+Patch0077: 0077-Improve-LVM-logical_volumes-string-matching.patch
+Patch0078: 0078-Tolerate-devices-with-no-filesystem-UUID-returned-by.patch
+Patch0079: 0079-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch
+Patch0080: 0080-grub-core-kern-misc.c-__bzero-Don-t-compile-in-GRUB_.patch
+Patch0081: 0081-grub-core-commands-verify.c-grub_pubkey_open-Fix-mem.patch
+Patch0082: 0082-grub-core-commands-verify.c-grub_pubkey_open-Trust-p.patch
+Patch0083: 0083-util-grub-gen-asciih.c-add_glyph-Fix-uninitialised-v.patch
+Patch0084: 0084-grub-core-commands-efi-lsefisystab.c-grub_cmd_lsefis.patch
+Patch0085: 0085-grub-core-loader-i386-bsd.c-grub_netbsd_boot-Pass-po.patch
+Patch0086: 0086-util-grub-install.c-Fix-handling-of-disk-module.patch
+Patch0087: 0087-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch
+Patch0088: 0088-NEWS-The-cmosclean-command-in-fact-dates-back-to-1.9.patch
+Patch0089: 0089-Migrate-PPC-from-Yaboot-to-Grub2.patch
+Patch0090: 0090-Add-fw_path-variable-revised.patch
+Patch0091: 0091-Add-support-for-linuxefi.patch
+Patch0092: 0092-Use-linuxefi-and-initrdefi-where-appropriate.patch
+Patch0093: 0093-Don-t-allow-insmod-when-secure-boot-is-enabled.patch
+Patch0094: 0094-Pass-x-hex-hex-straight-through-unmolested.patch
+Patch0095: 0095-Fix-crash-on-http.patch
+Patch0096: 0096-IBM-client-architecture-CAS-reboot-support.patch
+Patch0097: 0097-Add-vlan-tag-support.patch
+Patch0098: 0098-Add-X-option-to-printf-functions.patch
+Patch0099: 0099-DHCP-client-ID-and-UUID-options-added.patch
+Patch0100: 0100-Search-for-specific-config-file-for-netboot.patch
+Patch0101: 0101-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch
+Patch0102: 0102-Move-bash-completion-script-922997.patch
+Patch0103: 0103-for-ppc-reset-console-display-attr-when-clear-screen.patch
+Patch0104: 0104-Don-t-write-messages-to-the-screen.patch
+Patch0105: 0105-Don-t-print-GNU-GRUB-header.patch
+Patch0106: 0106-Don-t-add-to-highlighted-row.patch
+Patch0107: 0107-Message-string-cleanups.patch
+Patch0108: 0108-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch
+Patch0109: 0109-Use-the-correct-indentation-for-the-term-help-text.patch
+Patch0110: 0110-Indent-menu-entries.patch
+Patch0111: 0111-Fix-margins.patch
+Patch0112: 0112-Add-support-for-UEFI-operating-systems-returned-by-o.patch
+Patch0113: 0113-Disable-GRUB-video-support-for-IBM-power-machines.patch
+Patch0114: 0114-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch
+Patch0115: 0115-Use-linux16-when-appropriate-880840.patch
+Patch0116: 0116-Enable-pager-by-default.-985860.patch
+Patch0117: 0117-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch
+Patch0118: 0118-Don-t-say-GNU-Linux-in-generated-menus.patch
+Patch0119: 0119-Don-t-draw-a-border-around-the-menu.patch
+Patch0120: 0120-Use-the-standard-margin-for-the-timeout-string.patch
+Patch0121: 0121-Fix-grub_script_execute_sourcecode-usage-on-ppc.patch
+Patch0122: 0122-Add-.eh_frame-to-list-of-relocations-stripped.patch
+Patch0123: 0123-Make-10_linux-work-with-our-changes-for-linux16-and-.patch
+Patch0124: 0124-Don-t-print-during-fdt-loading-method.patch
+Patch0125: 0125-Honor-a-symlink-when-generating-configuration-by-gru.patch
+Patch0126: 0126-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch
+Patch0127: 0127-Don-t-require-a-password-to-boot-entries-generated-b.patch
+Patch0128: 0128-Don-t-emit-Booting-.-message.patch
+Patch0129: 0129-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch
+Patch0130: 0130-May-as-well-try-it.patch
+Patch0131: 0131-use-fw_path-prefix-when-fallback-searching-for-grub-.patch
+Patch0132: 0132-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch
+Patch0133: 0133-trim-arp-packets-with-abnormal-size.patch
+Patch0134: 0134-Fix-convert-function-to-support-NVMe-devices.patch
+Patch0135: 0135-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch
+Patch0136: 0136-Switch-to-use-APM-Mustang-device-tree-for-hardware-t.patch
+Patch0137: 0137-Use-the-default-device-tree-from-the-grub-default-fi.patch
+Patch0138: 0138-reopen-SNP-protocol-for-exclusive-use-by-grub.patch
+Patch0139: 0139-Reduce-timer-event-frequency-by-10.patch
+Patch0140: 0140-always-return-error-to-UEFI.patch
+Patch0141: 0141-Add-powerpc-little-endian-ppc64le-flags.patch
+Patch0142: 0142-Files-reorganization-and-include-some-libgcc-fuction.patch
+Patch0143: 0143-Suport-for-bi-endianess-in-elf-file.patch
+Patch0144: 0001-Fix-exit-back-to-EFI-firmware.patch
+Patch0145: 0144-Add-grub_util_readlink.patch
+Patch0146: 0145-Make-editenv-chase-symlinks-including-those-across-d.patch
+Patch0147: 0001-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch
+Patch0148: 0001-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch
+Patch0149: 0001-Add-GRUB_DISABLE_UUID.patch
+Patch0150: 0001-Allow-fallback-to-include-entries-by-title-not-just-.patch
+Patch0151: 0001-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch
+Patch0152: 0002-Load-arm-with-SB-enabled.patch
+Patch0153: 0001-Fix-up-some-man-pages-rpmdiff-noticed.patch
+Patch0154: 0001-Try-prefix-if-fw_path-doesn-t-work.patch
 
 BuildRequires:  flex bison binutils python
-BuildRequires:  ncurses-devel xz-devel
+BuildRequires:  ncurses-devel xz-devel bzip2-devel
 BuildRequires:  freetype-devel libusb-devel
-%ifarch %{sparc} x86_64
+%ifarch %{sparc} x86_64 aarch64 ppc64le
 # sparc builds need 64 bit glibc-devel - also for 32 bit userland
 BuildRequires:  /usr/lib64/crt1.o glibc-static
 %else
@@ -119,8 +229,10 @@ BuildRequires:	texinfo
 BuildRequires:	dejavu-sans-fonts
 BuildRequires:	help2man
 %ifarch %{efiarchs}
+%ifnarch aarch64
 BuildRequires:	pesign >= 0.109-3.el7
 %endif
+%endif
 
 Requires:	gettext os-prober which file
 Requires:	%{name}-tools = %{epoch}:%{version}-%{release}
@@ -128,7 +240,7 @@ Requires(pre):  dracut
 Requires(post): dracut
 
 ExcludeArch:	s390 s390x %{arm}
-Obsoletes:	grub2 <= 2.00-20%{?dist}
+Obsoletes:	grub2 <= 1:2.00-20%{?dist}
 
 %description
 The GRand Unified Bootloader (GRUB) is a highly configurable and customizable
@@ -141,38 +253,37 @@ provides support for PC BIOS systems.
 Summary:	GRUB for EFI systems.
 Group:		System Environment/Base
 Requires:	%{name}-tools = %{epoch}:%{version}-%{release}
-Obsoletes:	grub2-efi <= 2.00-20%{?dist}
+Obsoletes:	grub2-efi <= 1:2.00-20%{?dist}
 
 %description efi
 The GRand Unified Bootloader (GRUB) is a highly configurable and customizable
 bootloader with modular architecture.  It support rich varietyof kernel formats,
 file systems, computer architectures and hardware devices.  This subpackage
 provides support for EFI systems.
-%endif
 
-%package tools
-Summary:	Support tools for GRUB.
+%package efi-modules
+Summary:	Modules used to build custom grub.efi images
 Group:		System Environment/Base
-Requires:	gettext os-prober which file system-logos
+Requires:	%{name}-tools = %{epoch}:%{version}-%{release}
+Obsoletes:	grub2-efi <= 1:2.00-20%{?dist}
 
-%description tools
+%description efi-modules
 The GRand Unified Bootloader (GRUB) is a highly configurable and customizable
 bootloader with modular architecture.  It support rich varietyof kernel formats,
 file systems, computer architectures and hardware devices.  This subpackage
-provides tools for support of all platforms.
+provides support for rebuilding your own grub.efi on EFI systems.
+%endif
 
-%package starfield-theme
-Summary:	An example theme for GRUB.
+%package tools
+Summary:	Support tools for GRUB.
 Group:		System Environment/Base
-Requires:	system-logos
-Obsoletes:	grub2 <= 2.00-20%{?dist}
-Obsoletes:	grub2-efi <= 2.00-20%{?dist}
+Requires:	gettext os-prober which file system-logos
 
-%description starfield-theme
+%description tools
 The GRand Unified Bootloader (GRUB) is a highly configurable and customizable
 bootloader with modular architecture.  It support rich varietyof kernel formats,
 file systems, computer architectures and hardware devices.  This subpackage
-provides an example theme for the grub screen.
+provides tools for support of all platforms.
 
 %prep
 %setup -T -c -n grub-%{tarversion}
@@ -181,25 +292,32 @@ provides an example theme for the grub screen.
 cd grub-%{tarversion}
 # place unifont in the '.' from which configure is run
 cp %{SOURCE4} unifont.pcf.gz
+cp %{SOURCE6} .gitignore
 git init
-git config user.email "grub2-owner@fedoraproject.org"
-git config user.name "Fedora Ninjas"
+git config user.email "example@example.com"
+git config user.name "RHEL Ninjas"
 git add .
 git commit -a -q -m "%{tarversion} baseline."
 git am %{patches}
 cd ..
 mv grub-%{tarversion} grub-efi-%{tarversion}
 %endif
+
+%ifarch %{efi_only}
+ln -s grub-efi-%{tarversion} grub-%{tarversion}
+%else
 %setup -D -q -T -a 0 -n grub-%{tarversion}
 cd grub-%{tarversion}
 # place unifont in the '.' from which configure is run
 cp %{SOURCE4} unifont.pcf.gz
+cp %{SOURCE6} .gitignore
 git init
-git config user.email "grub2-owner@fedoraproject.org"
-git config user.name "Fedora Ninjas"
+git config user.email "example@example.com"
+git config user.name "RHEL Ninjas"
 git add .
 git commit -a -q -m "%{tarversion} baseline."
 git am %{patches}
+%endif
 
 %build
 %ifarch %{efiarchs}
@@ -224,24 +342,35 @@ make %{?_smp_mflags}
 
 GRUB_MODULES="	all_video boot btrfs cat chain configfile echo efifwsetup \
 		efinet ext2 fat font gfxmenu gfxterm gzio halt hfsplus iso9660 \
-		jpeg linuxefi lvm minicmd normal part_apple part_msdos \
-		part_gpt password_pbkdf2 png reboot search search_fs_uuid \
-		search_fs_file search_label sleep test video xfs \
-		mdraid09 mdraid1x blscfg multiboot2 multiboot tftp"
-./grub-mkimage -O %{grubefiarch} -o %{grubeficdname}.orig -p /EFI/BOOT \
-		-d grub-core ${GRUB_MODULES}
-%pesign -s -i %{grubeficdname}.orig -o %{grubeficdname} -a %{SOURCE1} -c %{SOURCE1} -n redhatsecureboot301
+		jpeg loadenv lvm mdraid09 mdraid1x minicmd normal part_apple \
+		part_msdos part_gpt password_pbkdf2 png reboot search \
+		search_fs_uuid search_fs_file search_label sleep syslinuxcfg \
+		test tftp regexp video xfs"
+%ifarch aarch64
+GRUB_MODULES="${GRUB_MODULES} linux"
+%else
+GRUB_MODULES="${GRUB_MODULES} linuxefi multiboot2 multiboot"
+%endif
 ./grub-mkimage -O %{grubefiarch} -o %{grubefiname}.orig -p /EFI/%{efidir} \
 		-d grub-core ${GRUB_MODULES}
-%pesign -s -i %{grubefiname}.orig -o %{grubefiname} -a %{SOURCE1} -c %{SOURCE1} -n redhatsecureboot301
+./grub-mkimage -O %{grubefiarch} -o %{grubeficdname}.orig -p /EFI/BOOT \
+		-d grub-core ${GRUB_MODULES}
+%ifarch aarch64
+mv %{grubefiname}.orig %{grubefiname}
+mv %{grubeficdname}.orig %{grubeficdname}
+%else
+%pesign -s -i %{grubefiname}.orig -o %{grubefiname} -a %{SOURCE1} -c %{SOURCE2} -n redhatsecureboot301
+%pesign -s -i %{grubeficdname}.orig -o %{grubeficdname} -a %{SOURCE1} -c %{SOURCE2} -n redhatsecureboot301
+%endif
 cd ..
 %endif
 
 cd grub-%{tarversion}
+%ifnarch %{efi_only}
 ./autogen.sh
 # -static is needed so that autoconf script is able to link
 # test that looks for _start symbol on 64 bit platforms
-%ifarch %{sparc} ppc ppc64
+%ifarch %{sparc} ppc ppc64 ppc64le
 %define platform ieee1275
 %else
 %define platform pc
@@ -261,10 +390,11 @@ cd grub-%{tarversion}
         --with-platform=%{platform}				\
 	--with-grubdir=%{name}					\
         --program-transform-name=s,grub,%{name},		\
-	--enable-man-pages					\
 	--disable-grub-mount					\
 	--disable-werror
+
 make %{?_smp_mflags}
+%endif
 
 sed -i -e 's,(grub),(%{name}),g' \
 	-e 's,grub.info,%{name}.info,g' \
@@ -314,12 +444,14 @@ cd ..
 %endif
 
 cd grub-%{tarversion}
+%ifnarch %{efi_only}
 make DESTDIR=$RPM_BUILD_ROOT install
 
 # Ghost config file
 install -d $RPM_BUILD_ROOT/boot/%{name}
 touch $RPM_BUILD_ROOT/boot/%{name}/grub.cfg
 ln -s ../boot/%{name}/grub.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.cfg
+%endif
 
 cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot $RPM_BUILD_ROOT%{_datarootdir}/locale/en
 
@@ -370,6 +502,11 @@ cat << EOF > ${RPM_BUILD_ROOT}%{_sysconfdir}/prelink.conf.d/grub2.conf
 -b /usr/sbin/grub2-sparc64-setup
 EOF
 
+%ifarch %{efiarchs}
+mkdir -p boot/efi/EFI/%{efidir}/
+ln -s /boot/efi/EFI/%{efidir}/grubenv boot/grub2/grubenv
+%endif
+
 %clean    
 rm -rf $RPM_BUILD_ROOT
 
@@ -410,22 +547,32 @@ if [ "$1" = 0 ]; then
 	/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/%{name}-dev.info.gz || :
 fi
 
+%ifnarch %{efi_only}
 %files -f grub.lang
 %defattr(-,root,root,-)
 %{_libdir}/grub/*-%{platform}/
 %config(noreplace) %{_sysconfdir}/%{name}.cfg
 %ghost %config(noreplace) /boot/%{name}/grub.cfg
 %doc grub-%{tarversion}/COPYING
+%config(noreplace) %ghost /boot/grub2/grubenv
+%endif
 
 %ifarch %{efiarchs}
 %files efi
 %defattr(-,root,root,-)
-%{_libdir}/grub/%{grubefiarch}
 %config(noreplace) %{_sysconfdir}/%{name}-efi.cfg
 %attr(0755,root,root)/boot/efi/EFI/%{efidir}
 %attr(0755,root,root)/boot/efi/EFI/%{efidir}/fonts
 %ghost %config(noreplace) /boot/efi/EFI/%{efidir}/grub.cfg
 %doc grub-%{tarversion}/COPYING
+/boot/grub2/grubenv
+# I know 0700 seems strange, but it lives on FAT so that's what it'll
+# get no matter what we do.
+%config(noreplace) %ghost %attr(0700,root,root)/boot/efi/EFI/%{efidir}/grubenv
+
+%files efi-modules
+%defattr(-,root,root,-)
+%{_libdir}/grub/%{grubefiarch}
 %endif
 
 %files tools -f grub.lang
@@ -480,24 +627,68 @@ fi
 %doc grub-%{tarversion}/THANKS grub-%{tarversion}/TODO
 %doc grub-%{tarversion}/grub.html
 %doc grub-%{tarversion}/grub-dev.html grub-%{tarversion}/docs/font_char_metrics.png
-%doc grub-%{tarversion}/themes/starfield/COPYING.CC-BY-SA-3.0
-%{_mandir}/man1/*
-%exclude %{_mandir}/man1/*syslinux2cfg.1*
-%{_mandir}/man8/*
-
-%files starfield-theme
+%doc %{_mandir}/man1/*
+%doc %{_mandir}/man8/*
 %dir /boot/%{name}/themes/
 %dir %{_datarootdir}/grub/themes
-%dir %{_datarootdir}/grub/themes/starfield
-/boot/%{name}/themes/
-%{_datarootdir}/grub/themes/
+%exclude %{_datarootdir}/grub/themes/starfield
 
 %changelog
-* Mon Jun 30 2014 Karanbir Singh <kbsingh@centos.org> - 2.02-0.2.10.el7.centos.1
-- Move the edidir to be CentOS, so people can co-install fedora, rhel and centos
-
-* Fri Jun 20 2014 Karanbir Singh <kbsingh@centos.org> - 2.02-0.2.10.el7.centos
-- Roll in CentOS Secureboot keys
+* Thu Oct 09 2014 Peter Jones <pjones@redhat.com> - 2.02-0.16
+- ... and build it on the right target.
+  Related: rhbz#1148652
+
+* Thu Oct 09 2014 Peter Jones <pjones@redhat.com> - 2.02-0.15
+- Make netbooting do a better job of picking the config path *again*.
+  Resolves: rhbz#1148652
+
+* Sat Oct 04 2014 Peter Jones <pjones@redhat.com> - 2.02-0.14
+- Be sure to *install* gcdaa64.efi
+  Related: rhbz#1100048
+
+* Fri Sep 26 2014 Peter Jones <pjones@redhat.com> - 2.02-0.13
+- Make sure to build a gcdaa64.efi
+  Related: rhbz#1100048
+
+* Tue Sep 23 2014 Peter Jones <pjones@redhat.com> - 2.02-0.12
+- Fix minor problems rpmdiff found.
+  Related: rhbz#1125540
+
+* Mon Sep 22 2014 Peter Jones <pjones@redhat.com> - 2.02-0.11
+- Fix grub2 segfault when root isn't set.
+  Resolves: rhbz#1084536
+- Make the aarch64 loader be SB-aware.
+  Related: rhbz#1100048
+- Enable regexp module
+  Resolves: rhbz#1125916
+
+* Thu Sep 04 2014 Peter Jones <pjones@redhat.com> - 2.02-0.10
+- Make editenv utilities (grub2-editenv, grub2-set-default, etc.) from
+  non-UEFI builds work with UEFI builds as well, since they're shared
+  from grub2-tools.
+  Resolves: rhbz#1119943
+- Make more grub2-mkconfig generate menu entries with the OS name and version
+  included.
+  Resolves: rhbz#996794
+- Minimize the sort ordering for .debug and -rescue- kernels.
+  Resolves: rhbz#1065360
+- Add GRUB_DISABLE_UUID to disable filesystem searching by UUID.
+  Resolves: rhbz#1027833
+- Allow "fallback" to specify titles like the documentation says
+  Resolves: rhbz#1026084
+
+* Wed Aug 27 2014 Peter Jones <pjones@redhat.com> - 2.02-0.9.1
+- A couple of patches for aarch64 got missed.
+  Related: rhbz#967937
+
+* Wed Aug 27 2014 Peter Jones <pjones@redhat.com> - 2.02-0.9
+- Once again, I have built with the wrong target.
+  Related: rhbz#1125540
+  Resolves: rhbz#967937
+
+* Fri Aug 22 2014 Peter Jones <pjones@redhat.com> - 2.02-0.8
+- Add patches for ppc64le
+  Related: rhbz#1125540
 
 * Thu Mar 20 2014 Peter Jones <pjones@redhat.com> - 2.02-0.2.10
 - Fix GRUB_DISABLE_SUBMENU one more time.