forked from pool/grub2
Accepting request 455663 from home:michael-chang:branches:Base:System
- Fix build error on glibc-2.25 * 0001-build-Use-AC_HEADER_MAJOR-to-find-device-macros.patch * 0002-configure-fix-check-for-sys-sysmacros.h-under-glibc-.patch - Fix fwpath in efi netboot (fate#321993) (bsc#1022294) * 0001-Fix-fwpath-in-efi-netboot.patch OBS-URL: https://build.opensuse.org/request/show/455663 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=251
This commit is contained in:
parent
8456dc36e5
commit
562453147a
46
0001-Fix-fwpath-in-efi-netboot.patch
Normal file
46
0001-Fix-fwpath-in-efi-netboot.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 562c406763d6c078ccf9fad1058e6d618b2456da Mon Sep 17 00:00:00 2001
|
||||
From: Michael Chang <mchang@suse.com>
|
||||
Date: Mon, 19 Dec 2016 17:09:04 +0800
|
||||
Subject: [PATCH] Fix fwpath in efi netboot
|
||||
|
||||
The path returned by grub_efi_net_config has already been stripped for the
|
||||
directory part extracted from cached bootp packet. We should just return the
|
||||
result to avoild it be stripped again.
|
||||
|
||||
It fixed the problem that grub.efi as NBP image always looking for grub.cfg and
|
||||
platform directory in upper folder rather than current one it gets loaded while
|
||||
$prefix is empty. The behavior is inconsistent with other architecture and how
|
||||
we would expect empty $prefix going to be in general.
|
||||
|
||||
The only exception to the general rule of empty $prefix is that when loaded
|
||||
from platform directory itself, the platform part is stripped thus upper folder
|
||||
is used for looking up files. It meets the case for how grub-mknetdir lay out
|
||||
the files under tftp root directory, but also hide away this issue to be
|
||||
identified as it appears to be just works.
|
||||
|
||||
Also fix possible memory leak by moving grub_efi_get_filename() call after
|
||||
grub_efi_net_config().
|
||||
---
|
||||
grub-core/kern/efi/init.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: grub-2.02~beta3/grub-core/kern/efi/init.c
|
||||
===================================================================
|
||||
--- grub-2.02~beta3.orig/grub-core/kern/efi/init.c
|
||||
+++ grub-2.02~beta3/grub-core/kern/efi/init.c
|
||||
@@ -121,10 +121,13 @@ grub_machine_get_bootlocation (char **de
|
||||
if (!image)
|
||||
return;
|
||||
*device = grub_efidisk_get_device_name (image->device_handle);
|
||||
- *path = grub_efi_get_filename (image->file_path);
|
||||
if (!*device && grub_efi_net_config)
|
||||
- grub_efi_net_config (image->device_handle, device, path);
|
||||
+ {
|
||||
+ grub_efi_net_config (image->device_handle, device, path);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
+ *path = grub_efi_get_filename (image->file_path);
|
||||
if (*path)
|
||||
{
|
||||
/* Get the directory. */
|
121
0001-build-Use-AC_HEADER_MAJOR-to-find-device-macros.patch
Normal file
121
0001-build-Use-AC_HEADER_MAJOR-to-find-device-macros.patch
Normal file
@ -0,0 +1,121 @@
|
||||
From 7a5b301e3adb8e054288518a325135a1883c1c6c Mon Sep 17 00:00:00 2001
|
||||
From: Mike Gilbert <floppym@gentoo.org>
|
||||
Date: Tue, 19 Apr 2016 14:27:22 -0400
|
||||
Subject: [PATCH] build: Use AC_HEADER_MAJOR to find device macros
|
||||
|
||||
Depending on the OS/libc, device macros are defined in different
|
||||
headers. This change ensures we include the right one.
|
||||
|
||||
sys/types.h - BSD
|
||||
sys/mkdev.h - Sun
|
||||
sys/sysmacros.h - glibc (Linux)
|
||||
|
||||
glibc currently pulls sys/sysmacros.h into sys/types.h, but this may
|
||||
change in a future release.
|
||||
|
||||
https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html
|
||||
---
|
||||
configure.ac | 3 ++-
|
||||
grub-core/osdep/devmapper/getroot.c | 6 ++++++
|
||||
grub-core/osdep/devmapper/hostdisk.c | 5 +++++
|
||||
grub-core/osdep/linux/getroot.c | 6 ++++++
|
||||
grub-core/osdep/unix/getroot.c | 4 +++-
|
||||
5 files changed, 22 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: grub-2.02~beta3/configure.ac
|
||||
===================================================================
|
||||
--- grub-2.02~beta3.orig/configure.ac
|
||||
+++ grub-2.02~beta3/configure.ac
|
||||
@@ -388,7 +388,8 @@ fi
|
||||
|
||||
# Check for functions and headers.
|
||||
AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
|
||||
-AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
|
||||
+AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h)
|
||||
+AC_HEADER_MAJOR
|
||||
|
||||
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
|
||||
#include <sys/param.h>
|
||||
Index: grub-2.02~beta3/grub-core/osdep/devmapper/getroot.c
|
||||
===================================================================
|
||||
--- grub-2.02~beta3.orig/grub-core/osdep/devmapper/getroot.c
|
||||
+++ grub-2.02~beta3/grub-core/osdep/devmapper/getroot.c
|
||||
@@ -40,6 +40,12 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
+#if defined(MAJOR_IN_MKDEV)
|
||||
+#include <sys/mkdev.h>
|
||||
+#elif defined(MAJOR_IN_SYSMACROS)
|
||||
+#include <sys/sysmacros.h>
|
||||
+#endif
|
||||
+
|
||||
#include <libdevmapper.h>
|
||||
|
||||
#include <grub/types.h>
|
||||
Index: grub-2.02~beta3/grub-core/osdep/devmapper/hostdisk.c
|
||||
===================================================================
|
||||
--- grub-2.02~beta3.orig/grub-core/osdep/devmapper/hostdisk.c
|
||||
+++ grub-2.02~beta3/grub-core/osdep/devmapper/hostdisk.c
|
||||
@@ -24,6 +24,11 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
+#if defined(MAJOR_IN_MKDEV)
|
||||
+#include <sys/mkdev.h>
|
||||
+#elif defined(MAJOR_IN_SYSMACROS)
|
||||
+#include <sys/sysmacros.h>
|
||||
+#endif
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
# include <libdevmapper.h>
|
||||
Index: grub-2.02~beta3/grub-core/osdep/linux/getroot.c
|
||||
===================================================================
|
||||
--- grub-2.02~beta3.orig/grub-core/osdep/linux/getroot.c
|
||||
+++ grub-2.02~beta3/grub-core/osdep/linux/getroot.c
|
||||
@@ -35,6 +35,12 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
+#if defined(MAJOR_IN_MKDEV)
|
||||
+#include <sys/mkdev.h>
|
||||
+#elif defined(MAJOR_IN_SYSMACROS)
|
||||
+#include <sys/sysmacros.h>
|
||||
+#endif
|
||||
+
|
||||
#include <grub/types.h>
|
||||
#include <sys/ioctl.h> /* ioctl */
|
||||
#include <sys/mount.h>
|
||||
Index: grub-2.02~beta3/grub-core/osdep/unix/getroot.c
|
||||
===================================================================
|
||||
--- grub-2.02~beta3.orig/grub-core/osdep/unix/getroot.c
|
||||
+++ grub-2.02~beta3/grub-core/osdep/unix/getroot.c
|
||||
@@ -51,8 +51,10 @@
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
-#if defined(HAVE_SYS_MKDEV_H)
|
||||
+#if defined(MAJOR_IN_MKDEV)
|
||||
#include <sys/mkdev.h>
|
||||
+#elif defined(MAJOR_IN_SYSMACROS)
|
||||
+#include <sys/sysmacros.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
|
||||
Index: grub-2.02~beta3/grub-core/osdep/linux/hostdisk.c
|
||||
===================================================================
|
||||
--- grub-2.02~beta3.orig/grub-core/osdep/linux/hostdisk.c
|
||||
+++ grub-2.02~beta3/grub-core/osdep/linux/hostdisk.c
|
||||
@@ -45,6 +45,12 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
+#if defined(MAJOR_IN_MKDEV)
|
||||
+#include <sys/mkdev.h>
|
||||
+#elif defined(MAJOR_IN_SYSMACROS)
|
||||
+#include <sys/sysmacros.h>
|
||||
+#endif
|
||||
+
|
||||
# include <sys/ioctl.h> /* ioctl */
|
||||
# include <sys/mount.h>
|
||||
# ifndef BLKFLSBUF
|
@ -0,0 +1,43 @@
|
||||
From 07662af7aed55bcec448bc2a6610de1f0cb62100 Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Borzenkov <arvidjaar@gmail.com>
|
||||
Date: Thu, 22 Dec 2016 22:48:25 +0300
|
||||
Subject: [PATCH] configure: fix check for sys/sysmacros.h under glibc 2.25+
|
||||
|
||||
glibc 2.25 still includes sys/sysmacros.h in sys/types.h but also emits
|
||||
deprecation warning. So test for sys/types.h succeeds in configure but later
|
||||
compilation fails because we use -Werror by default.
|
||||
|
||||
While this is fixed in current autoconf GIT, we really cannot force everyone
|
||||
to use bleeding edge (that is not even released right now). So run test under
|
||||
-Werror as well to force proper detection.
|
||||
|
||||
This should have no impact on autoconf 2.70+ as AC_HEADER_MAJOR in this version
|
||||
simply checks for header existence.
|
||||
|
||||
Reported and tested by Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
configure.ac | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index dc56564..4e980c5 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -389,7 +389,14 @@ fi
|
||||
# Check for functions and headers.
|
||||
AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
|
||||
AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h)
|
||||
+
|
||||
+# glibc 2.25 still includes sys/sysmacros.h in sys/types.h but emits deprecation
|
||||
+# warning which causes compilation failure later with -Werror. So use -Werror here
|
||||
+# as well to force proper sys/sysmacros.h detection.
|
||||
+SAVED_CFLAGS="$CFLAGS"
|
||||
+CFLAGS="$HOST_CFLAGS -Werror"
|
||||
AC_HEADER_MAJOR
|
||||
+CFLAGS="$SAVED_CFLAGS"
|
||||
|
||||
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
|
||||
#include <sys/param.h>
|
||||
--
|
||||
2.6.6
|
||||
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 9 03:45:16 UTC 2017 - mchang@suse.com
|
||||
|
||||
- Fix build error on glibc-2.25
|
||||
* 0001-build-Use-AC_HEADER_MAJOR-to-find-device-macros.patch
|
||||
* 0002-configure-fix-check-for-sys-sysmacros.h-under-glibc-.patch
|
||||
- Fix fwpath in efi netboot (fate#321993) (bsc#1022294)
|
||||
* 0001-Fix-fwpath-in-efi-netboot.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 3 08:18:30 UTC 2017 - mchang@suse.com
|
||||
|
||||
|
@ -188,6 +188,9 @@ Patch71: grub2-menu-unrestricted.patch
|
||||
Patch72: grub2-mkconfig-arm.patch
|
||||
Patch73: 0001-dns-fix-buffer-overflow-for-data-addresses-in-recv_h.patch
|
||||
Patch74: grub2-accept-empty-module.patch
|
||||
Patch75: 0001-build-Use-AC_HEADER_MAJOR-to-find-device-macros.patch
|
||||
Patch76: 0002-configure-fix-check-for-sys-sysmacros.h-under-glibc-.patch
|
||||
Patch77: 0001-Fix-fwpath-in-efi-netboot.patch
|
||||
# Btrfs snapshot booting related patches
|
||||
Patch101: grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch
|
||||
Patch102: grub2-btrfs-02-export-subvolume-envvars.patch
|
||||
@ -452,6 +455,9 @@ swap partition while in resuming
|
||||
%patch72 -p1
|
||||
%patch73 -p1
|
||||
%patch74 -p1
|
||||
%patch75 -p1
|
||||
%patch76 -p1
|
||||
%patch77 -p1
|
||||
%patch101 -p1
|
||||
%patch102 -p1
|
||||
%patch103 -p1
|
||||
|
Loading…
Reference in New Issue
Block a user