grub2/0013-build-Use-AC_HEADER_MAJOR-to-find-device-macros.patch
Peter Jones ce21efa858 Change TSC calibration driver preference (prefer pmtimer over PIT)
- Pull in fixes for TSC calibration driver preference (prefer pmtimer
  over PIT) to boot on Apollo Lake systems with no PIT
- Fix pmtimer calibration to not take forever to fail on kvm.

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-01-17 12:43:35 -05:00

107 lines
3.1 KiB
Diff

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 013/123] 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(-)
diff --git a/configure.ac b/configure.ac
index 57e17138e..9ddfc5323 100644
--- a/configure.ac
+++ b/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>
diff --git a/grub-core/osdep/devmapper/getroot.c b/grub-core/osdep/devmapper/getroot.c
index 05eda500a..72e558275 100644
--- a/grub-core/osdep/devmapper/getroot.c
+++ b/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>
diff --git a/grub-core/osdep/devmapper/hostdisk.c b/grub-core/osdep/devmapper/hostdisk.c
index 19c1101fd..a697bcb4d 100644
--- a/grub-core/osdep/devmapper/hostdisk.c
+++ b/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>
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 10480b646..09e7e6e6d 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/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>
diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c
index 1079a919d..4bf37b027 100644
--- a/grub-core/osdep/unix/getroot.c
+++ b/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)
--
2.14.3