summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/meta/recipes-bsp/grub
diff options
context:
space:
mode:
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-bsp/grub')
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch53
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch81
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch30
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch33
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/cfg2
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch33
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-endianness-problem.patch44
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch21
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-texinfo.patch32
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch53
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch27
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch24
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch131
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch32
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-install.in.patch20
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-no-unused-result.patch19
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-fix-initrd-size-bug.patch48
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-remove-sparc64-setup-from-x86-builds.patch104
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/remove-gets.patch20
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/autohell.patch21
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch101
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch74
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch31
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch40
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-efi_2.00.bb69
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch46
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch56
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch34
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub2.inc69
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub_0.97.bb35
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub_2.00.bb16
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub_git.bb52
32 files changed, 1451 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch
new file mode 100644
index 000000000..65ddcaf12
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch
@@ -0,0 +1,53 @@
+Upstream-Status: Accepted
+CVE: CVE-2015-8370
+Signed-off-by: Awais Belal <awais_belal@mentor.com>
+
+From 451d80e52d851432e109771bb8febafca7a5f1f2 Mon Sep 17 00:00:00 2001
+From: Hector Marco-Gisbert <hecmargi@upv.es>
+Date: Wed, 16 Dec 2015 04:57:18 +0000
+Subject: Fix security issue when reading username and password
+
+This patch fixes two integer underflows at:
+ * grub-core/lib/crypto.c
+ * grub-core/normal/auth.c
+
+CVE-2015-8370
+
+Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
+Signed-off-by: Ismael Ripoll-Ripoll <iripoll@disca.upv.es>
+Also-By: Andrey Borzenkov <arvidjaar@gmail.com>
+---
+diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c
+index 010e550..683a8aa 100644
+--- a/grub-core/lib/crypto.c
++++ b/grub-core/lib/crypto.c
+@@ -470,7 +470,8 @@ grub_password_get (char buf[], unsigned buf_size)
+
+ if (key == '\b')
+ {
+- cur_len--;
++ if (cur_len)
++ cur_len--;
+ continue;
+ }
+
+diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c
+index c6bd96e..8615c48 100644
+--- a/grub-core/normal/auth.c
++++ b/grub-core/normal/auth.c
+@@ -174,8 +174,11 @@ grub_username_get (char buf[], unsigned buf_size)
+
+ if (key == '\b')
+ {
+- cur_len--;
+- grub_printf ("\b");
++ if (cur_len)
++ {
++ cur_len--;
++ grub_printf ("\b");
++ }
+ continue;
+ }
+
+--
+cgit v0.9.0.2
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
new file mode 100644
index 000000000..9eabce977
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
@@ -0,0 +1,81 @@
+From 3bac4caa2bc64db313aaee54fffb90383e118517 Mon Sep 17 00:00:00 2001
+From: Felix Janda <felix.janda@posteo.de>
+Date: Thu, 22 Jan 2015 19:54:36 +0100
+Subject: [PATCH] Remove direct _llseek code and require long filesystem libc.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Backport
+ configure.ac | 8 ++++++++
+ grub-core/osdep/unix/hostdisk.c | 24 ------------------------
+ 4 files changed, 13 insertions(+), 24 deletions(-)
+
+Index: grub-2.00/configure.ac
+===================================================================
+--- grub-2.00.orig/configure.ac
++++ grub-2.00/configure.ac
+@@ -306,6 +306,14 @@ if test x$grub_cv_apple_cc = xyes ; then
+ HOST_LDFLAGS="$HOST_LDFLAGS -Wl,-allow_stack_execute"
+ fi
+
++case "$host_os" in
++ cygwin | windows* | mingw32* | aros*)
++ ;;
++ *)
++ AC_CHECK_SIZEOF(off_t)
++ test x"$ac_cv_sizeof_off_t" = x8 || AC_MSG_ERROR([Large file support is required]);;
++esac
++
+ if test x$USE_NLS = xno; then
+ HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
+ fi
+Index: grub-2.00/grub-core/kern/emu/hostdisk.c
+===================================================================
+--- grub-2.00.orig/grub-core/kern/emu/hostdisk.c
++++ grub-2.00/grub-core/kern/emu/hostdisk.c
+@@ -44,11 +44,6 @@
+ #ifdef __linux__
+ # include <sys/ioctl.h> /* ioctl */
+ # include <sys/mount.h>
+-# if !defined(__GLIBC__) || \
+- ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
+-/* Maybe libc doesn't have large file support. */
+-# include <linux/unistd.h> /* _llseek */
+-# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */
+ # ifndef BLKFLSBUF
+ # define BLKFLSBUF _IO (0x12,97) /* flush buffer cache */
+ # endif /* ! BLKFLSBUF */
+@@ -761,25 +756,6 @@ linux_find_partition (char *dev, grub_di
+ }
+ #endif /* __linux__ */
+
+-#if defined(__linux__) && (!defined(__GLIBC__) || \
+- ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))))
+- /* Maybe libc doesn't have large file support. */
+-grub_err_t
+-grub_util_fd_seek (int fd, const char *name, grub_uint64_t off)
+-{
+- loff_t offset, result;
+- static int _llseek (uint filedes, ulong hi, ulong lo,
+- loff_t *res, uint wh);
+- _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,
+- loff_t *, res, uint, wh);
+-
+- offset = (loff_t) off;
+- if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
+- return grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot seek `%s': %s"),
+- name, strerror (errno));
+- return GRUB_ERR_NONE;
+-}
+-#else
+ grub_err_t
+ grub_util_fd_seek (int fd, const char *name, grub_uint64_t off)
+ {
+@@ -790,7 +766,6 @@ grub_util_fd_seek (int fd, const char *n
+ name, strerror (errno));
+ return 0;
+ }
+-#endif
+
+ static void
+ flush_initial_buffer (const char *os_dev __attribute__ ((unused)))
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch
new file mode 100644
index 000000000..67dc11549
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch
@@ -0,0 +1,30 @@
+From b9565dc2fe0c4f7daaec91b7e83bc7313dee2f4a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 13 Apr 2015 17:02:13 -0700
+Subject: [PATCH] Unset need_charset_alias when building for musl
+
+localcharset uses ac_cv_gnu_library_2_1 from glibc21.m4
+which actually shoudl be fixed in gnulib and then all downstream
+projects will get it eventually. For now we apply the fix to
+coreutils
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/gnulib.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: grub-2.00/grub-core/gnulib/Makefile.am
+===================================================================
+--- grub-2.00.orig/grub-core/gnulib/Makefile.am
++++ grub-2.00/grub-core/gnulib/Makefile.am
+@@ -410,7 +410,7 @@ install-exec-localcharset: all-local
+ case '$(host_os)' in \
+ darwin[56]*) \
+ need_charset_alias=true ;; \
+- darwin* | cygwin* | mingw* | pw32* | cegcc*) \
++ darwin* | cygwin* | mingw* | pw32* | cegcc* | linux-musl*) \
+ need_charset_alias=false ;; \
+ *) \
+ need_charset_alias=true ;; \
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch
new file mode 100644
index 000000000..255e3eb7d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch
@@ -0,0 +1,33 @@
+Upstream-Status: Backport
+
+Original commit: http://git.savannah.gnu.org/cgit/grub.git/commit/grub-core/net/bootp.c?id=f06c2172c0b32052f22e37523445cf8e7affaea3
+
+From 149d2a14f4723778ced23f439487201ccbf1a2c9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 23 Apr 2015 07:03:34 +0000
+Subject: [PATCH] parse_dhcp_vendor: Add missing const qualifiers.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ grub-core/net/bootp.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
+index bc07d53..44131ed 100644
+--- a/grub-core/net/bootp.c
++++ b/grub-core/net/bootp.c
+@@ -52,9 +52,9 @@ set_env_limn_ro (const char *intername, const char *suffix,
+ }
+
+ static void
+-parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask)
++parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
+ {
+- grub_uint8_t *ptr, *ptr0;
++ const grub_uint8_t *ptr, *ptr0;
+
+ ptr = ptr0 = vend;
+
+--
+2.1.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/cfg b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/cfg
new file mode 100644
index 000000000..8ca53d24d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/cfg
@@ -0,0 +1,2 @@
+search.file ($cmdpath)/EFI/BOOT/grub.cfg root
+set prefix=($root)/EFI/BOOT
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch
new file mode 100644
index 000000000..0eece082f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch
@@ -0,0 +1,33 @@
+Disable liblzma if --enable-liblzma=no
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -1029,10 +1029,20 @@ fi
+
+ AC_SUBST([LIBGEOM])
+
+-AC_CHECK_LIB([lzma], [lzma_code],
+- [LIBLZMA="-llzma"
+- AC_DEFINE([HAVE_LIBLZMA], [1],
+- [Define to 1 if you have the LZMA library.])],)
++AC_ARG_ENABLE([liblzma],
++ [AS_HELP_STRING([--enable-liblzma],
++ [enable liblzma integration (default=guessed)])])
++if test x"$enable_liblzma" = xno ; then
++ liblzma_excuse="explicitly disabled"
++fi
++
++if test x"$liblzma_excuse" = x ; then
++ AC_CHECK_LIB([lzma], [lzma_code],
++ [LIBLZMA="-llzma"
++ AC_DEFINE([HAVE_LIBLZMA], [1],
++ [Define to 1 if you have the LZMA library.])],)
++fi
++
+ AC_SUBST([LIBLZMA])
+
+ AC_ARG_ENABLE([libzfs],
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-endianness-problem.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-endianness-problem.patch
new file mode 100644
index 000000000..079992afb
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-endianness-problem.patch
@@ -0,0 +1,44 @@
+grub-core/net/tftp.c: fix endianness problem.
+
+ * grub-core/net/tftp.c (ack): Fix endianness problem.
+ (tftp_receive): Likewise.
+ Reported by: Michael Davidsaver.
+
+Upstream-Status: Backport
+
+diff --git a/ChangeLog b/ChangeLog
+index 81bdae9..c2f42d5 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,9 @@
++2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
++
++ * grub-core/net/tftp.c (ack): Fix endianness problem.
++ (tftp_receive): Likewise.
++ Reported by: Michael Davidsaver.
++
+ 2012-06-27 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * configure.ac: Bump version to 2.00.
+diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
+index 9c70efb..d0f39ea 100644
+--- a/grub-core/net/tftp.c
++++ b/grub-core/net/tftp.c
+@@ -143,7 +143,7 @@ ack (tftp_data_t data, grub_uint16_t block)
+
+ tftph_ack = (struct tftphdr *) nb_ack.data;
+ tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
+- tftph_ack->u.ack.block = block;
++ tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
+
+ err = grub_net_send_udp_packet (data->sock, &nb_ack);
+ if (err)
+@@ -225,7 +225,7 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
+ grub_priority_queue_pop (data->pq);
+
+ if (file->device->net->packs.count < 50)
+- err = ack (data, tftph->u.data.block);
++ err = ack (data, data->block + 1);
+ else
+ {
+ file->device->net->stall = 1;
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch
new file mode 100644
index 000000000..61ae2f537
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch
@@ -0,0 +1,21 @@
+Upstream-Status: Backport
+
+This fixes compilation issues when using flex-2.5.37. It was taken from upstream.
+
+Original author is: Vladimir Serbinenko <phcoder@gmail.com>
+
+Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
+
+Index: grub-2.00/grub-core/script/yylex.l
+===================================================================
+--- grub-2.00.orig/grub-core/script/yylex.l 2012-06-08 23:24:15.000000000 +0300
++++ grub-2.00/grub-core/script/yylex.l 2013-07-31 14:34:40.708100982 +0300
+@@ -29,6 +29,8 @@
+ #pragma GCC diagnostic ignored "-Wmissing-prototypes"
+ #pragma GCC diagnostic ignored "-Wmissing-declarations"
+ #pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
++#pragma GCC diagnostic ignored "-Wunused-function"
++#pragma GCC diagnostic ignored "-Wsign-compare"
+
+ #define yyfree grub_lexer_yyfree
+ #define yyalloc grub_lexer_yyalloc
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-texinfo.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-texinfo.patch
new file mode 100644
index 000000000..b911d7370
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-texinfo.patch
@@ -0,0 +1,32 @@
+The tarball has a texi file that doesn't parse with current texinfo, so if it's
+being re-generated the build will fail. Take a patch from upstream to fix the
+texi.
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From d4c4b8e1a085f92afcec36f6e590c6dfc51d0a1c Mon Sep 17 00:00:00 2001
+From: Bryan Hundven <bryanhundven@gmail.com>
+Date: Mon, 08 Apr 2013 13:23:07 +0000
+Subject: * docs/grub-dev.texi: Move @itemize after @subsection to satisfy
+
+ texinfo-5.1.
+---
+(limited to 'docs/grub-dev.texi')
+
+diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
+index a4a3820..f74c966 100644
+--- a/docs/grub-dev.texi
++++ b/docs/grub-dev.texi
+@@ -1394,8 +1394,8 @@ grub_video_blit_glyph (&glyph, color, 0, 0);
+
+ @node Bitmap API
+ @section Bitmap API
+-@itemize
+ @subsection grub_video_bitmap_create
++@itemize
+ @item Prototype:
+ @example
+ grub_err_t grub_video_bitmap_create (struct grub_video_bitmap **bitmap, unsigned int width, unsigned int height, enum grub_video_blit_format blit_format)
+--
+cgit v0.9.0.2
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch
new file mode 100644
index 000000000..eb8916cb7
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch
@@ -0,0 +1,53 @@
+From 7ab576a7c61406b7e63739d1b11017ae336b9008 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Mon, 3 Mar 2014 03:34:48 -0500
+Subject: [PATCH] grub.d/10_linux.in: add oe's kernel name
+
+Our kernel's name is bzImage, we need add it to grub.d/10_linux.in so
+that the grub-mkconfig and grub-install can work correctly.
+
+We only need add the bzImage to util/grub.d/10_linux.in, but also add it
+to util/grub.d/20_linux_xen.in to keep compatibility.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ util/grub.d/10_linux.in | 4 ++--
+ util/grub.d/20_linux_xen.in | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 14402e8..c58f417 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -153,11 +153,11 @@ EOF
+ machine=`uname -m`
+ case "x$machine" in
+ xi?86 | xx86_64)
+- list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
++ list=`for i in /boot/bzImage-* /bzImage-* /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+ done` ;;
+ *)
+- list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
++ list=`for i in /boot/bzImage-* /boot/vmlinuz-* /boot/vmlinux-* /bzImage-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+ done` ;;
+ esac
+diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
+index 1d94502..b2decf3 100644
+--- a/util/grub.d/20_linux_xen.in
++++ b/util/grub.d/20_linux_xen.in
+@@ -138,7 +138,7 @@ EOF
+ EOF
+ }
+
+-linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
++linux_list=`for i in /boot/bzImage[xz]-* /bzImage[xz]-* /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
+ if grub_file_is_not_garbage "$i"; then
+ basename=$(basename $i)
+ version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
+--
+1.7.10.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch
new file mode 100644
index 000000000..09ef4dbff
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch
@@ -0,0 +1,27 @@
+Upstream-Status: Pending
+
+
+This patch avoids this configure failure
+
+configure:20306: checking whether `ccache i586-poky-linux-gcc -m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse --sysroot=/builddisk/build/build0/tmp/sysroots/emenlow' generates calls to `__enable_execute_stack()'
+configure:20320: ccache i586-poky-linux-gcc -m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse --sysroot=/builddisk/build/build0/tmp/sysroots/emenlow -O2 -pipe -g -feliminate-unused-debug-types -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g -falign-jumps=1 -falign-loops=1 -falign-functions=1 -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -mfpmath=387 -fno-dwarf2-cfi-asm -m32 -fno-stack-protector -mno-stack-arg-probe -Werror -Wno-trampolines -falign-loops=1 -S conftest.c
+conftest.c:308:6: error: no previous prototype for 'g' [-Werror=missing-prototypes]
+cc1: all warnings being treated as errors
+configure:20323: $? = 1
+configure:20327: error: ccache i586-poky-linux-gcc -m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse --sysroot=/builddisk/build/build0/tmp/sysroots/emenlow failed to produce assembly code
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
+2012/04/13
+
+Index: grub-2.00/acinclude.m4
+===================================================================
+--- grub-2.00.orig/acinclude.m4
++++ grub-2.00/acinclude.m4
+@@ -317,6 +317,7 @@ dnl Check if the C compiler generates ca
+ AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
+ AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
+ AC_LANG_CONFTEST([AC_LANG_SOURCE([[
++void g (int);
+ void f (int (*p) (void));
+ void g (int i)
+ {
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch
new file mode 100644
index 000000000..c557f13e2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch
@@ -0,0 +1,24 @@
+Upstream-Status: pending
+
+This patch fixes this configure issue for grub when -mfpmath=sse is in the gcc parameters.
+
+configure:20574: i586-poky-linux-gcc -m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse --sysroot=/usr/local/dev/yocto/grubtest2/build/tmp/sysroots/emenlow -o conftest -O2 -pipe -g -feliminate-unused-debug-types -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g -falign-jumps=1 -falign-loops=1 -falign-functions=1 -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -fno-dwarf2-cfi-asm -m32 -fno-stack-protector -mno-stack-arg-probe -Werror -nostdlib -Wl,--defsym,___main=0x8100 -Wall -W -I$(top_srcdir)/include -I$(top_builddir)/include -DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed conftest.c >&5
+conftest.c:1:0: error: SSE instruction set disabled, using 387 arithmetics [-Werror]
+cc1: all warnings being treated as errors
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
+2012/04/13
+
+Index: grub-1.99/configure.ac
+===================================================================
+--- grub-1.99.orig/configure.ac
++++ grub-1.99/configure.ac
+@@ -378,7 +378,7 @@ if test "x$target_cpu" = xi386; then
+
+ # Some toolchains enable these features by default, but they need
+ # registers that aren't set up properly in GRUB.
+- TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
++ TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -mfpmath=387"
+ fi
+
+ # By default, GCC 4.4 generates .eh_frame sections containing unwind
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
new file mode 100644
index 000000000..4588fca4b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
@@ -0,0 +1,131 @@
+Allow a compilation without -mcmodel=large
+
+It's provided by Vladimir Serbinenko, and he will commit
+it upstream so it should be backport patch.
+
+Upstream-Status: Backport
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+
+--
+diff --git a/configure.ac b/configure.ac
+index 9f8fb8a..2c5e6ed 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -723,9 +723,7 @@ if test "$target_cpu" = x86_64; then
+ [grub_cv_cc_mcmodel=yes],
+ [grub_cv_cc_mcmodel=no])
+ ])
+- if test "x$grub_cv_cc_mcmodel" = xno; then
+- AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
+- else
++ if test "x$grub_cv_cc_mcmodel" = xyes; then
+ TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
+ fi
+ fi
+diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
+index 1409b5d..6e9dace 100644
+--- a/grub-core/kern/efi/mm.c
++++ b/grub-core/kern/efi/mm.c
+@@ -32,6 +32,12 @@
+ #define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12)
+ #define PAGES_TO_BYTES(pages) ((pages) << 12)
+
++#if defined (__code_model_large__) || !defined (__x86_64__)
++#define MAX_USABLE_ADDRESS 0xffffffff
++#else
++#define MAX_USABLE_ADDRESS 0x7fffffff
++#endif
++
+ /* The size of a memory map obtained from the firmware. This must be
+ a multiplier of 4KB. */
+ #define MEMORY_MAP_SIZE 0x3000
+@@ -58,7 +64,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
+
+ #if 1
+ /* Limit the memory access to less than 4GB for 32-bit platforms. */
+- if (address > 0xffffffff)
++ if (address > MAX_USABLE_ADDRESS)
+ return 0;
+ #endif
+
+@@ -66,7 +72,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
+ if (address == 0)
+ {
+ type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
+- address = 0xffffffff;
++ address = MAX_USABLE_ADDRESS;
+ }
+ else
+ type = GRUB_EFI_ALLOCATE_ADDRESS;
+@@ -86,7 +92,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
+ {
+ /* Uggh, the address 0 was allocated... This is too annoying,
+ so reallocate another one. */
+- address = 0xffffffff;
++ address = MAX_USABLE_ADDRESS;
+ status = efi_call_4 (b->allocate_pages, type, GRUB_EFI_LOADER_DATA, pages, &address);
+ grub_efi_free_pages (0, pages);
+ if (status != GRUB_EFI_SUCCESS)
+@@ -319,7 +325,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
+ {
+ if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
+ #if 1
+- && desc->physical_start <= 0xffffffff
++ && desc->physical_start <= MAX_USABLE_ADDRESS
+ #endif
+ && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
+ && desc->num_pages != 0)
+@@ -337,9 +343,9 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
+ #if 1
+ if (BYTES_TO_PAGES (filtered_desc->physical_start)
+ + filtered_desc->num_pages
+- > BYTES_TO_PAGES (0x100000000LL))
++ > BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL))
+ filtered_desc->num_pages
+- = (BYTES_TO_PAGES (0x100000000LL)
++ = (BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL)
+ - BYTES_TO_PAGES (filtered_desc->physical_start));
+ #endif
+
+diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
+index 65f09ef..17c1215 100644
+--- a/grub-core/kern/x86_64/dl.c
++++ b/grub-core/kern/x86_64/dl.c
+@@ -100,14 +100,32 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
+ break;
+
+ case R_X86_64_PC32:
+- *addr32 += rel->r_addend + sym->st_value -
+- (Elf64_Xword) seg->addr - rel->r_offset;
++ {
++ grub_int64_t value;
++ value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
++ (Elf64_Xword) seg->addr - rel->r_offset;
++ if (value != (grub_int32_t) value)
++ return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
++ *addr32 = value;
++ }
+ break;
+
+ case R_X86_64_32:
++ {
++ grub_uint64_t value = *addr32 + rel->r_addend + sym->st_value;
++ if (value != (grub_uint32_t) value)
++ return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
++ *addr32 = value;
++ }
++ break;
+ case R_X86_64_32S:
+- *addr32 += rel->r_addend + sym->st_value;
+- break;
++ {
++ grub_int64_t value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value;
++ if (value != (grub_int32_t) value)
++ return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
++ *addr32 = value;
++ }
++ break;
+
+ default:
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch
new file mode 100644
index 000000000..4f12628a4
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch
@@ -0,0 +1,32 @@
+From eb6368e65f6988eebad26cebdec057f797bceb40 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Tue, 9 Sep 2014 00:02:30 -0700
+Subject: [PATCH] Fix build with glibc 2.20
+
+* grub-core/kern/emu/hostfs.c: squahes below warning
+ warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
+
+Upstream-Status: Submitted
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ grub-core/kern/emu/hostfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c
+index 3cb089c..a51ee32 100644
+--- a/grub-core/kern/emu/hostfs.c
++++ b/grub-core/kern/emu/hostfs.c
+@@ -16,7 +16,7 @@
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+-#define _BSD_SOURCE
++#define _DEFAULT_SOURCE
+ #include <grub/fs.h>
+ #include <grub/file.h>
+ #include <grub/disk.h>
+--
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-install.in.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-install.in.patch
new file mode 100644
index 000000000..326951df4
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-install.in.patch
@@ -0,0 +1,20 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+Our use of grub-install doesn't require the -x option, so we should be
+be able make use of grep versions that don't support it.
+
+Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
+
+Index: grub-1.99/util/grub-install.in
+===================================================================
+--- grub-1.99.orig/util/grub-install.in 2011-09-09 22:37:20.093906679 -0500
++++ grub-1.99/util/grub-install.in 2011-09-09 22:37:30.854737882 -0500
+@@ -510,7 +510,7 @@
+
+ if [ "x${devabstraction_module}" = "x" ] ; then
+ if [ x"${install_device}" != x ]; then
+- if echo "${install_device}" | grep -qx "(.*)" ; then
++ if echo "${install_device}" | grep -q "(.*)" ; then
+ install_drive="${install_device}"
+ else
+ install_drive="`"$grub_probe" --device-map="${device_map}" --target=drive --device "${install_device}"`" || exit 1
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-no-unused-result.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-no-unused-result.patch
new file mode 100644
index 000000000..4cbd0838d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-no-unused-result.patch
@@ -0,0 +1,19 @@
+Signed-off-by: Radu Moisan <radu.moisan@intel.com>
+Upstream-Status: Pending
+
+I had an error because of an unused return value for read().
+I added -Wno-unused-result.
+
+Index: grub-2.00/configure.ac
+===================================================================
+--- grub-2.00.orig/configure.ac 2012-08-13 16:32:33.000000000 +0300
++++ grub-2.00/configure.ac 2012-08-13 16:38:22.000000000 +0300
+@@ -394,7 +394,7 @@
+ LIBS=""
+
+ # debug flags.
+-WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
++WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wno-unused-result -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
+ HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
+ TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
+ TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-fix-initrd-size-bug.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-fix-initrd-size-bug.patch
new file mode 100644
index 000000000..d114f4847
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-fix-initrd-size-bug.patch
@@ -0,0 +1,48 @@
+From 8fbb150a56966edde4dc07b8d01be5eb149b65ab Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Sun, 20 Jan 2013 23:03:35 +0000
+Subject: [PATCH 1/1] * grub-core/loader/i386/linux.c (grub_cmd_initrd): Don't
+ add the initrd size to addr_min, since the initrd will be allocated after
+ this address.
+
+commit 6a0debbd9167e8f79cdef5497a73d23e580c0cd4 upstream
+
+Upstream-Status: Backport
+
+Signed-off-by: Shan Hai <shan.hai@windriver.com>
+---
+ ChangeLog | 6 ++++++
+ grub-core/loader/i386/linux.c | 3 +--
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index c2f42d5..40cb508 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,9 @@
++2013-01-20 Colin Watson <cjwatson@ubuntu.com>
++
++ * grub-core/loader/i386/linux.c (grub_cmd_initrd): Don't add the
++ initrd size to addr_min, since the initrd will be allocated after
++ this address.
++
+ 2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/net/tftp.c (ack): Fix endianness problem.
+diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
+index 62087cf..e2425c8 100644
+--- a/grub-core/loader/i386/linux.c
++++ b/grub-core/loader/i386/linux.c
+@@ -1098,8 +1098,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+ worse than that of Linux 2.3.xx, so avoid the last 64kb. */
+ addr_max -= 0x10000;
+
+- addr_min = (grub_addr_t) prot_mode_target + prot_init_space
+- + page_align (size);
++ addr_min = (grub_addr_t) prot_mode_target + prot_init_space;
+
+ /* Put the initrd as high as possible, 4KiB aligned. */
+ addr = (addr_max - size) & ~0xFFF;
+--
+1.8.5.2.233.g932f7e4
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-remove-sparc64-setup-from-x86-builds.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-remove-sparc64-setup-from-x86-builds.patch
new file mode 100644
index 000000000..6259a1abe
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-remove-sparc64-setup-from-x86-builds.patch
@@ -0,0 +1,104 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+remove the grub-sparc64-setup files from the x86 builds.
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
+
+--- a/Makefile.util.am 2014-08-15 11:41:02.441011278 -0700
++++ b/Makefile.util.am 2014-08-15 11:44:26.245021142 -0700
+@@ -4692,9 +4692,9 @@
+ endif
+
+ if COND_emu
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4715,9 +4715,9 @@
+ endif
+
+ if COND_i386_pc
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4738,9 +4738,9 @@
+ endif
+
+ if COND_i386_efi
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4761,9 +4761,9 @@
+ endif
+
+ if COND_i386_qemu
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4784,9 +4784,9 @@
+ endif
+
+ if COND_i386_coreboot
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4807,9 +4807,9 @@
+ endif
+
+ if COND_i386_multiboot
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4830,9 +4830,9 @@
+ endif
+
+ if COND_i386_ieee1275
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4853,9 +4853,9 @@
+ endif
+
+ if COND_x86_64_efi
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/remove-gets.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/remove-gets.patch
new file mode 100644
index 000000000..463f7847a
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/remove-gets.patch
@@ -0,0 +1,20 @@
+ISO C11 removes the specification of gets() from the C language, eglibc 2.16+ removed it
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+Index: grub-1.99/grub-core/gnulib/stdio.in.h
+===================================================================
+--- grub-1.99.orig/grub-core/gnulib/stdio.in.h 2010-12-01 06:45:43.000000000 -0800
++++ grub-1.99/grub-core/gnulib/stdio.in.h 2012-07-04 12:25:02.057099107 -0700
+@@ -140,8 +140,10 @@
+ /* It is very rare that the developer ever has full control of stdin,
+ so any use of gets warrants an unconditional warning. Assume it is
+ always declared, since it is required by C89. */
++#if defined gets
+ #undef gets
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
++#endif
+
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/autohell.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/autohell.patch
new file mode 100644
index 000000000..d66207ae6
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/autohell.patch
@@ -0,0 +1,21 @@
+Upstream-Status: Inappropriate [configuration]
+
+---
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: grub-0.97/configure.ac
+===================================================================
+--- grub-0.97.orig/configure.ac 2008-09-12 17:39:52.000000000 +0200
++++ grub-0.97/configure.ac 2008-09-12 17:40:21.000000000 +0200
+@@ -60,8 +60,8 @@ AC_PROG_CC
+ _AM_DEPENDENCIES(CC)
+
+ dnl Because recent automake complains about AS, set it here.
+-CCAS="$CC"
+-AC_SUBST(CCAS)
++AM_PROG_AS
++AC_SUBST(AS)
+
+ AC_ARG_WITH(binutils,
+ [ --with-binutils=DIR search the directory DIR to find binutils])
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch
new file mode 100644
index 000000000..d225d13dc
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch
@@ -0,0 +1,101 @@
+Upstream-Status: Inappropriate [No Longer Maintained]
+
+diff -Naur grub-0.97-800/stage2/fsys_ext2fs.c grub-0.97-810/stage2/fsys_ext2fs.c
+--- grub-0.97-800/stage2/fsys_ext2fs.c 2008-07-21 00:40:21.668879475 -0600
++++ grub-0.97-810/stage2/fsys_ext2fs.c 2008-07-21 01:01:11.063953773 -0600
+@@ -79,7 +79,52 @@
+ __u32 s_rev_level; /* Revision level */
+ __u16 s_def_resuid; /* Default uid for reserved blocks */
+ __u16 s_def_resgid; /* Default gid for reserved blocks */
+- __u32 s_reserved[235]; /* Padding to the end of the block */
++ /*
++ * These fields are for EXT2_DYNAMIC_REV superblocks only.
++ *
++ * Note: the difference between the compatible feature set and
++ * the incompatible feature set is that if there is a bit set
++ * in the incompatible feature set that the kernel doesn't
++ * know about, it should refuse to mount the filesystem.
++ *
++ * e2fsck's requirements are more strict; if it doesn't know
++ * about a feature in either the compatible or incompatible
++ * feature set, it must abort and not try to meddle with
++ * things it doesn't understand...
++ */
++ __u32 s_first_ino; /* First non-reserved inode */
++ __u16 s_inode_size; /* size of inode structure */
++ __u16 s_block_group_nr; /* block group # of this superblock */
++ __u32 s_feature_compat; /* compatible feature set */
++ __u32 s_feature_incompat; /* incompatible feature set */
++ __u32 s_feature_ro_compat; /* readonly-compatible feature set */
++ __u8 s_uuid[16]; /* 128-bit uuid for volume */
++ char s_volume_name[16]; /* volume name */
++ char s_last_mounted[64]; /* directory where last mounted */
++ __u32 s_algorithm_usage_bitmap; /* For compression */
++ /*
++ * Performance hints. Directory preallocation should only
++ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
++ */
++ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
++ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
++ __u16 s_reserved_gdt_blocks;/* Per group table for online growth */
++ /*
++ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
++ */
++ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
++ __u32 s_journal_inum; /* inode number of journal file */
++ __u32 s_journal_dev; /* device number of journal file */
++ __u32 s_last_orphan; /* start of list of inodes to delete */
++ __u32 s_hash_seed[4]; /* HTREE hash seed */
++ __u8 s_def_hash_version; /* Default hash version to use */
++ __u8 s_jnl_backup_type; /* Default type of journal backup */
++ __u16 s_reserved_word_pad;
++ __u32 s_default_mount_opts;
++ __u32 s_first_meta_bg; /* First metablock group */
++ __u32 s_mkfs_time; /* When the filesystem was created */
++ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
++ __u32 s_reserved[172]; /* Padding to the end of the block */
+ };
+
+ struct ext2_group_desc
+@@ -218,6 +263,14 @@
+ #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
+ #define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s)))
+
++#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
++#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
++#define EXT2_GOOD_OLD_INODE_SIZE 128
++#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
++ EXT2_GOOD_OLD_INODE_SIZE : \
++ (s)->s_inode_size)
++#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
++
+ /* linux/ext2_fs.h */
+ #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
+ /* kind of from ext2/super.c */
+@@ -553,7 +606,7 @@
+ gdp = GROUP_DESC;
+ ino_blk = gdp[desc].bg_inode_table +
+ (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
+- >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
++ >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
+ #ifdef E2DEBUG
+ printf ("inode table fsblock=%d\n", ino_blk);
+ #endif /* E2DEBUG */
+@@ -565,13 +618,12 @@
+ /* reset indirect blocks! */
+ mapblock2 = mapblock1 = -1;
+
+- raw_inode = INODE +
+- ((current_ino - 1)
+- & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1));
++ raw_inode = (struct ext2_inode *)((char *)INODE +
++ ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) *
++ EXT2_INODE_SIZE (SUPERBLOCK));
+ #ifdef E2DEBUG
+ printf ("ipb=%d, sizeof(inode)=%d\n",
+- (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)),
+- sizeof (struct ext2_inode));
++ EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK));
+ printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
+ printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
+ for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch
new file mode 100644
index 000000000..0cf7dc96d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch
@@ -0,0 +1,74 @@
+Upstream-Status: Inappropriate
+
+Subject: [PATCH] grub: fix for automake-1.12
+
+automake 1.12 has depricated automatic de-ANSI-fication support
+
+this patch avoids these kinds of errors:
+
+| stage1/Makefile.am:2: error: 'pkglibdir' is not a legitimate directory for 'DATA'
+| stage2/Makefile.am:35: error: 'pkglibdir' is not a legitimate directory for 'DATA'
+| stage2/Makefile.am:46: error: 'pkglibdir' is not a legitimate directory for 'DATA'
+| autoreconf: automake failed with exit status: 1
+| ERROR: autoreconf execution failed.
+
+The upstream status is marked as 'Inappropriate' because this problem is not uncommon,
+it has been there for a long time and no change in upstream.
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+Index: grub-0.97/stage1/Makefile.am
+===================================================================
+--- a/stage1/Makefile.am
++++ b/stage1/Makefile.am
+@@ -1,7 +1,7 @@
+-pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
+-nodist_pkglib_DATA = stage1
++pkgdatadir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
++nodist_pkgdata_DATA = stage1
+
+-CLEANFILES = $(nodist_pkglib_DATA)
++CLEANFILES = $(nodist_pkgdata_DATA)
+
+ # We can't use builtins or standard includes.
+ AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
+Index: grub-0.97/stage2/Makefile.am
+===================================================================
+--- a/stage2/Makefile.am
++++ b/stage2/Makefile.am
+@@ -27,12 +27,12 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
+ -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
+
+ # Stage 2 and Stage 1.5's.
+-pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
++pkgdatadir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
+
+ EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec
+
+ if DISKLESS_SUPPORT
+-pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
++pkgdata_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
+ ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
+ reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \
+ nbgrub pxegrub
+@@ -43,7 +43,7 @@ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
+ reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
+ xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec
+ else
+-pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
++pkgdata_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
+ ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
+ reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
+ noinst_DATA = pre_stage2 start start_eltorito
+@@ -105,7 +105,7 @@ else
+ BUILT_SOURCES = stage2_size.h
+ endif
+
+-CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES)
++CLEANFILES = $(pkgdata_DATA) $(noinst_DATA) $(BUILT_SOURCES)
+
+ stage2_size.h: pre_stage2
+ -rm -f stage2_size.h
+--
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch
new file mode 100644
index 000000000..70037e47c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch
@@ -0,0 +1,31 @@
+Upstream-Status: Inappropriate [disable feature]
+
+After the commit "tcmode-default: switch to gcc 4.6.0 for x86, x86-64 & arm",
+we got bug 1099 (http://bugzilla.yoctoproject.org/show_bug.cgi?id=1099):
+
+Running "install --stage2=/ssd/boot/grub/stage2 /boot/grub/stage1(hd0)
+ /boot/grub/stage2 p /boot/grub/menu list" failed
+Error 6: Mismatched or corrupt version of stage1/stage2
+
+This turned out to be a gcc's bug. See
+https://bugs.gentoo.org/show_bug.cgi?id=360513
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
+
+Upstream gcc seems uninterested in the bug, so at present we can disable the
+option as a workaround. Thanks Ryan Hill for the investigation and the
+workaround patch.
+
+Dexuan Cui <dexuan.cui@intel.com>
+Wed Jun 29 20:21:39 CST 2011
+
+--- grub-0.97/stage2/Makefile.am.orig
++++ grub-0.97/stage2/Makefile.am
+@@ -79,7 +79,7 @@
+ HERCULES_FLAGS =
+ endif
+
+-STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
++STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-reorder-functions -fno-builtin -nostdinc \
+ $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
+
+ STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch
new file mode 100644
index 000000000..bd8e0a89f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch
@@ -0,0 +1,40 @@
+
+This patch is from ubuntu:
+ * objcopy-absolute.diff (update): Remove .note, .comment, and
+ .note.gnu.build-id sections from images (LP: #444703).
+
+Upstream-Status: Inappropriate [no longer maintained]
+
+Index: b/acinclude.m4
+===================================================================
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -61,7 +61,7 @@
+ else
+ AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
+ fi
+- if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then :
++ if AC_TRY_COMMAND([${OBJCOPY-objcopy} --only-section=.text -O binary conftest.exec conftest]); then :
+ else
+ AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
+ fi
+Index: b/stage1/Makefile.am
+===================================================================
+--- a/stage1/Makefile.am
++++ b/stage1/Makefile.am
+@@ -12,4 +12,4 @@
+
+ SUFFIXES = .exec
+ .exec:
+- $(OBJCOPY) -O binary $< $@
++ $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
+Index: b/stage2/Makefile.am
+===================================================================
+--- a/stage2/Makefile.am
++++ b/stage2/Makefile.am
+@@ -293,4 +293,4 @@
+ # General rule for making a raw binary.
+ SUFFIXES = .exec
+ .exec:
+- $(OBJCOPY) -O binary $< $@
++ $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-efi_2.00.bb b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-efi_2.00.bb
new file mode 100644
index 000000000..5a0dc954a
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-efi_2.00.bb
@@ -0,0 +1,69 @@
+require grub2.inc
+
+DEPENDS_class-target = "grub-efi-native"
+RDEPENDS_${PN}_class-target = "diffutils freetype"
+PR = "r3"
+
+SRC_URI += " \
+ file://cfg \
+ "
+
+S = "${WORKDIR}/grub-${PV}"
+
+# Determine the target arch for the grub modules
+python __anonymous () {
+ import re
+ target = d.getVar('TARGET_ARCH', True)
+ if target == "x86_64":
+ grubtarget = 'x86_64'
+ grubimage = "bootx64.efi"
+ elif re.match('i.86', target):
+ grubtarget = 'i386'
+ grubimage = "bootia32.efi"
+ else:
+ raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target)
+ d.setVar("GRUB_TARGET", grubtarget)
+ d.setVar("GRUB_IMAGE", grubimage)
+}
+
+inherit deploy
+
+CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN="
+EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
+ --enable-efiemu=no --program-prefix='' \
+ --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
+
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '--enable-largefile', '--disable-largefile', d)}"
+
+# ldm.c:114:7: error: trampoline generated for nested function 'hook' [-Werror=trampolines]
+# and many other places in the grub code when compiled with some native gcc compilers (specifically, gentoo)
+CFLAGS_append_class-native = " -Wno-error=trampolines"
+
+do_install_class-native() {
+ install -d ${D}${bindir}
+ install -m 755 grub-mkimage ${D}${bindir}
+}
+
+GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search"
+
+do_deploy() {
+ # Search for the grub.cfg on the local boot media by using the
+ # built in cfg file provided via this recipe
+ grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
+ -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
+ ${GRUB_BUILDIN}
+ install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
+}
+
+do_deploy_class-native() {
+ :
+}
+
+addtask deploy after do_install before do_build
+
+FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \
+ ${datadir}/grub \
+ "
+
+BBCLASSEXTEND = "native"
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch
new file mode 100644
index 000000000..87ec29e32
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch
@@ -0,0 +1,46 @@
+From fb7b827a56b1f92f882d0f5ef130acc968b23293 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 19:17:31 +0000
+Subject: [PATCH] Disable -mfpmath=sse as well when SSE is disabled
+
+Fixes
+
+configure:20574: i586-poky-linux-gcc -m32 -march=core2 -msse3
+-mtune=generic -mfpmath=sse
+--sysroot=/usr/local/dev/yocto/grubtest2/build/tmp/sysroots/emenlow -o
+conftest -O2 -pipe -g -feliminate-unused-debug-types -Wall -W -Wshadow
+-Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g
+-falign-jumps=1 -falign-loops=1 -falign-functions=1 -mno-mmx -mno-sse
+-mno-sse2 -mno-3dnow -fno-dwarf2-cfi-asm -m32 -fno-stack-protector
+-mno-stack-arg-probe -Werror -nostdlib -Wl,--defsym,___main=0x8100
+-Wall -W -I$(top_srcdir)/include -I$(top_builddir)/include
+-DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC -Wl,-O1
+-Wl,--hash-style=gnu -Wl,--as-needed conftest.c >&5
+conftest.c:1:0: error: SSE instruction set disabled, using 387
+arithmetics [-Werror]
+cc1: all warnings being treated as errors
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 26d2f33..9ce56de 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -783,7 +783,7 @@ fi
+ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
+ # Some toolchains enable these features by default, but they need
+ # registers that aren't set up properly in GRUB.
+- TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow"
++ TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -mfpmath=387"
+ fi
+
+ # GRUB doesn't use float or doubles at all. Yet some toolchains may decide
+--
+2.7.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch
new file mode 100644
index 000000000..d5bfaa177
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch
@@ -0,0 +1,56 @@
+From b512c77222a8b133d7dd71a0dcef081a921d97d4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 19:28:00 +0000
+Subject: [PATCH] grub.d/10_linux.in: add oe's kernel name
+
+Our kernel's name is bzImage, we need add it to grub.d/10_linux.in so
+that the grub-mkconfig and grub-install can work correctly.
+
+We only need add the bzImage to util/grub.d/10_linux.in, but also add it
+to util/grub.d/20_linux_xen.in to keep compatibility.
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Inappropriate [OE specific]
+
+ util/grub.d/10_linux.in | 6 +++---
+ util/grub.d/20_linux_xen.in | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 859b608..946be5d 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -148,12 +148,12 @@ machine=`uname -m`
+ case "x$machine" in
+ xi?86 | xx86_64)
+ list=
+- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
++ for i in /boot/bzImage-* /bzImage-* /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
+ done ;;
+- *)
++ *)
+ list=
+- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
++ for i in /boot/bzImage-* /boot/vmlinuz-* /boot/vmlinux-* /bzImage-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
+ done ;;
+ esac
+diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
+index f532fb9..1994244 100644
+--- a/util/grub.d/20_linux_xen.in
++++ b/util/grub.d/20_linux_xen.in
+@@ -138,7 +138,7 @@ EOF
+ }
+
+ linux_list=
+-for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
++for i in /boot/bzImage[xz]-* /bzImage[xz]-* /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
+ if grub_file_is_not_garbage "$i"; then
+ basename=$(basename $i)
+ version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
+--
+2.7.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch
new file mode 100644
index 000000000..fc5aa4e31
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch
@@ -0,0 +1,34 @@
+From ff8f68cc48fd3c30d55e1d570d51f2e0952c968e Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Sat, 25 Jan 2014 23:49:44 -0500
+Subject: [PATCH] autogen.sh: exclude .pc from po/POTFILES.in
+
+Exclude the .pc from po/POTFILES.in since quilt uses "patch --backup",
+which will create the backup file under .pc, this may cause unexpected
+errors, for example, on CentOS 5.x, if the backup file is null
+(newfile), it's mode will be 000, then we will get errors when xgettext
+try to read it.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ autogen.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/autogen.sh b/autogen.sh
+index 7424428..843619e 100755
+--- a/autogen.sh
++++ b/autogen.sh
+@@ -5,7 +5,7 @@ set -e
+ export LC_COLLATE=C
+ unset LC_ALL
+
+-find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' |sort > po/POTFILES.in
++find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -path './.pc/*' | sort > po/POTFILES.in
+ find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in
+
+ echo "Importing unicode..."
+--
+1.7.10.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub2.inc b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub2.inc
new file mode 100644
index 000000000..146dde60c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub2.inc
@@ -0,0 +1,69 @@
+SUMMARY = "GRUB2 is the next-generation GRand Unified Bootloader"
+
+DESCRIPTION = "GRUB2 is the next generaion of a GPLed bootloader \
+intended to unify bootloading across x86 operating systems. In \
+addition to loading the Linux kernel, it implements the Multiboot \
+standard, which allows for flexible loading of multiple boot images."
+
+HOMEPAGE = "http://www.gnu.org/software/grub/"
+SECTION = "bootloaders"
+
+LICENSE = "GPLv3"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
+
+SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
+ file://grub-2.00-fpmath-sse-387-fix.patch \
+ file://check-if-liblzma-is-disabled.patch \
+ file://fix-issue-with-flex-2.5.37.patch \
+ file://grub-2.00-add-oe-kernel.patch \
+ file://grub-install.in.patch \
+ file://remove-gets.patch \
+ file://fix-endianness-problem.patch \
+ file://grub2-remove-sparc64-setup-from-x86-builds.patch \
+ file://grub-2.00-fix-enable_execute_stack-check.patch \
+ file://grub-no-unused-result.patch \
+ file://grub-efi-allow-a-compilation-without-mcmodel-large.patch \
+ file://grub-efi-fix-with-glibc-2.20.patch \
+ file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
+ file://0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch \
+ file://grub2-fix-initrd-size-bug.patch \
+ file://0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch \
+ file://0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch \
+ file://fix-texinfo.patch \
+ "
+
+DEPENDS = "flex-native bison-native"
+
+SRC_URI[md5sum] = "e927540b6eda8b024fb0391eeaa4091c"
+SRC_URI[sha256sum] = "65b39a0558f8c802209c574f4d02ca263a804e8a564bc6caf1cd0fd3b3cc11e3"
+
+COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)'
+
+inherit autotools gettext texinfo
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[grub-mount] = "--enable-grub-mount,--disable-grub-mount,fuse"
+PACKAGECONFIG[device-mapper] = "--enable-device-mapper,--disable-device-mapper,lvm2"
+
+# grub2 creates its own set of -nostdinc / -isystem / -ffreestanding CFLAGS and
+# OE's default BUILD_CFLAGS (assigned to CFLAGS for native builds) etc, conflict
+# with that. Note that since BUILD_CFLAGS etc are not used by grub2 target
+# builds, it's safe to clear them unconditionally for both target and native.
+BUILD_CPPFLAGS = ""
+BUILD_CFLAGS = ""
+BUILD_CXXFLAGS = ""
+BUILD_LDFLAGS = ""
+
+do_configure_prepend() {
+ # The grub2 configure script uses variables such as TARGET_CFLAGS etc
+ # for its own purposes. Remove the OE versions from the environment to
+ # avoid conflicts.
+ unset TARGET_CPPFLAGS TARGET_CFLAGS TARGET_CXXFLAGS TARGET_LDFLAGS
+}
+
+# grub and grub-efi's sysroot/${datadir}/grub/grub-mkconfig_lib are
+# conflicted, remove it since no one uses it.
+SYSROOT_PREPROCESS_FUNCS_class-target += "remove_sysroot_mkconfig_lib"
+remove_sysroot_mkconfig_lib() {
+ rm -r "${SYSROOT_DESTDIR}${datadir}/grub/grub-mkconfig_lib"
+}
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_0.97.bb b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_0.97.bb
new file mode 100644
index 000000000..997a045b2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_0.97.bb
@@ -0,0 +1,35 @@
+SUMMARY = "GRUB is the GRand Unified Bootloader"
+DESCRIPTION = "GRUB is a GPLed bootloader intended to unify bootloading across x86 \
+operating systems. In addition to loading the Linux kernel, it implements the Multiboot \
+standard, which allows for flexible loading of multiple boot images."
+HOMEPAGE = "http://www.gnu.org/software/grub/"
+SECTION = "bootloaders"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b \
+ file://grub/main.c;beginline=3;endline=9;md5=22a5f28d2130fff9f2a17ed54be90ed6"
+
+RDEPENDS_${PN} = "diffutils"
+PR = "r6"
+
+SRC_URI = "ftp://alpha.gnu.org/gnu/grub/grub-${PV}.tar.gz; \
+ file://no-reorder-functions.patch \
+ file://autohell.patch \
+ file://grub_fix_for_automake-1.12.patch \
+ file://objcopy-absolute.patch \
+ file://grub-support-256byte-inode.patch \
+"
+
+SRC_URI[md5sum] = "cd3f3eb54446be6003156158d51f4884"
+SRC_URI[sha256sum] = "4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b"
+
+inherit autotools texinfo
+
+COMPATIBLE_HOST = "i.86.*-linux"
+
+EXTRA_OECONF = "--without-curses"
+
+do_install_append_vmware() {
+ mkdir -p ${D}/boot/
+ ln -sf ../usr/lib/grub/{$TARGET_ARCH}{$TARGET_VENDOR}/ ${D}/boot/grub
+}
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_2.00.bb b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_2.00.bb
new file mode 100644
index 000000000..778074a38
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_2.00.bb
@@ -0,0 +1,16 @@
+require grub2.inc
+
+RDEPENDS_${PN} = "diffutils freetype"
+PR = "r1"
+
+EXTRA_OECONF = "--with-platform=pc --disable-grub-mkfont --program-prefix="" \
+ --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
+
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '--enable-largefile', '--disable-largefile', d)}"
+
+do_install_append () {
+ install -d ${D}${sysconfdir}/grub.d
+}
+
+INSANE_SKIP_${PN} = "arch"
+INSANE_SKIP_${PN}-dbg = "arch"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_git.bb b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_git.bb
new file mode 100644
index 000000000..6919c9a35
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_git.bb
@@ -0,0 +1,52 @@
+require grub2.inc
+
+DEPENDS += "autogen-native"
+
+DEFAULT_PREFERENCE = "-1"
+DEFAULT_PREFERENCE_arm = "1"
+
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/grub-git:"
+
+PV = "2.00+${SRCPV}"
+SRCREV = "b95e92678882f56056c64ae29092bc9cf129905f"
+SRC_URI = "git://git.savannah.gnu.org/grub.git \
+ file://0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch \
+ file://autogen.sh-exclude-pc.patch \
+ file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
+ "
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
+
+inherit autotools gettext texinfo
+
+# configure.ac has code to set this automagically from the target tuple
+# but the OE freeform one (core2-foo-bar-linux) don't work with that.
+
+GRUBPLATFORM_arm = "uboot"
+GRUBPLATFORM_aarch64 = "efi"
+GRUBPLATFORM ??= "pc"
+
+EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} --disable-grub-mkfont --program-prefix="" \
+ --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
+
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '--enable-largefile', '--disable-largefile', d)}"
+
+do_configure_prepend() {
+ ( cd ${S}
+ ${S}/autogen.sh )
+}
+
+do_install_append () {
+ install -d ${D}${sysconfdir}/grub.d
+ rm -rf ${D}${libdir}/charset.alias
+}
+
+# debugedit chokes on bare metal binaries
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+RDEPENDS_${PN} = "diffutils freetype"
+
+INSANE_SKIP_${PN} = "arch"
+INSANE_SKIP_${PN}-dbg = "arch"
OpenPOWER on IntegriCloud