From 53aee3d6dfee49c4096b63684a134c6cb876ada9d852ca6c5515aeeb99f81fb0 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Tue, 8 May 2012 09:14:39 +0000 Subject: [PATCH] Accepting request 116247 from devel:openSUSE:Factory - grub2-automake-1-11-2.patch : fix grub2 build error on newer autotools (automake >= 1.11.2) - call ./autogen.sh - grub2-probe-disk-mountby.patch : fix grub2-probe fails on probing mount-by devices under /dev/disk/by-(id|uuid|path). (bnc#757746) OBS-URL: https://build.opensuse.org/request/show/116247 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=33 --- grub2-automake-1-11-2.patch | 178 +++++++++++++++++++ grub2-probe-disk-mountby.patch | 316 +++++++++++++++++++++++++++++++++ grub2.changes | 14 ++ grub2.spec | 17 +- 4 files changed, 519 insertions(+), 6 deletions(-) create mode 100644 grub2-automake-1-11-2.patch create mode 100644 grub2-probe-disk-mountby.patch diff --git a/grub2-automake-1-11-2.patch b/grub2-automake-1-11-2.patch new file mode 100644 index 0000000..3586adb --- /dev/null +++ b/grub2-automake-1-11-2.patch @@ -0,0 +1,178 @@ +Index: grub-1.99/Makefile.am +=================================================================== +--- grub-1.99.orig/Makefile.am ++++ grub-1.99/Makefile.am +@@ -101,8 +101,8 @@ CLEANFILES += widthspec.h + # Install config.h into platformdir + platform_HEADERS = config.h + +-pkglib_DATA += grub-mkconfig_lib +-pkglib_DATA += update-grub_lib ++pkgdata_DATA += grub-mkconfig_lib ++pkgdata_DATA += update-grub_lib + + + if COND_i386_coreboot +Index: grub-1.99/conf/Makefile.common +=================================================================== +--- grub-1.99.orig/conf/Makefile.common ++++ grub-1.99/conf/Makefile.common +@@ -137,7 +137,7 @@ KERNEL_HEADER_FILES = + + man_MANS = + noinst_DATA = +-pkglib_DATA = ++pkgdata_DATA = + bin_SCRIPTS = + sbin_SCRIPTS = + bin_PROGRAMS = +@@ -147,7 +147,7 @@ check_SCRIPTS = + grubconf_DATA = + check_PROGRAMS = + noinst_SCRIPTS = +-pkglib_SCRIPTS = ++pkgdata_SCRIPTS = + noinst_PROGRAMS = + grubconf_SCRIPTS = + noinst_LIBRARIES = +Index: grub-1.99/util/grub-mkconfig.in +=================================================================== +--- grub-1.99.orig/util/grub-mkconfig.in ++++ grub-1.99/util/grub-mkconfig.in +@@ -95,7 +95,7 @@ do + esac + done + +-. ${libdir}/grub/grub-mkconfig_lib ++. ${datadir}/grub/grub-mkconfig_lib + + if [ "x$EUID" = "x" ] ; then + EUID=`id -u` +Index: grub-1.99/util/grub.d/00_header.in +=================================================================== +--- grub-1.99.orig/util/grub.d/00_header.in ++++ grub-1.99/util/grub.d/00_header.in +@@ -22,10 +22,11 @@ transform="@program_transform_name@" + prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ ++datadir=@datadir@ + locale_dir=`echo ${GRUB_PREFIX}/locale | sed ${transform}` + grub_lang=`echo $LANG | cut -d . -f 1` + +-. ${libdir}/grub/grub-mkconfig_lib ++. ${datadir}/grub/grub-mkconfig_lib + + # Do this as early as possible, since other commands might depend on it. + # (e.g. the `loadfont' command might need lvm or raid modules) +Index: grub-1.99/util/grub.d/10_hurd.in +=================================================================== +--- grub-1.99.orig/util/grub.d/10_hurd.in ++++ grub-1.99/util/grub.d/10_hurd.in +@@ -20,7 +20,8 @@ set -e + prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ +-. ${libdir}/grub/grub-mkconfig_lib ++datadir=@datadir@ ++. ${datadir}/grub/grub-mkconfig_lib + + CLASS="--class gnu --class os" + +Index: grub-1.99/util/grub.d/10_kfreebsd.in +=================================================================== +--- grub-1.99.orig/util/grub.d/10_kfreebsd.in ++++ grub-1.99/util/grub.d/10_kfreebsd.in +@@ -21,7 +21,8 @@ prefix=@prefix@ + exec_prefix=@exec_prefix@ + bindir=@bindir@ + libdir=@libdir@ +-. ${libdir}/grub/grub-mkconfig_lib ++datadir=@datadir@ ++. ${datadir}/grub/grub-mkconfig_lib + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR=@localedir@ +Index: grub-1.99/util/grub.d/10_linux.in +=================================================================== +--- grub-1.99.orig/util/grub.d/10_linux.in ++++ grub-1.99/util/grub.d/10_linux.in +@@ -21,7 +21,8 @@ prefix=@prefix@ + exec_prefix=@exec_prefix@ + bindir=@bindir@ + libdir=@libdir@ +-. ${libdir}/grub/grub-mkconfig_lib ++datadir=@datadir@ ++. ${datadir}/grub/grub-mkconfig_lib + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR=@localedir@ +Index: grub-1.99/util/grub.d/10_netbsd.in +=================================================================== +--- grub-1.99.orig/util/grub.d/10_netbsd.in ++++ grub-1.99/util/grub.d/10_netbsd.in +@@ -21,7 +21,8 @@ prefix=@prefix@ + exec_prefix=@exec_prefix@ + bindir=@bindir@ + libdir=@libdir@ +-. ${libdir}/grub/grub-mkconfig_lib ++datadir=@datadir@ ++. ${datadir}/grub/grub-mkconfig_lib + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR=@localedir@ +Index: grub-1.99/util/grub.d/10_windows.in +=================================================================== +--- grub-1.99.orig/util/grub.d/10_windows.in ++++ grub-1.99/util/grub.d/10_windows.in +@@ -20,7 +20,8 @@ set -e + prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ +-. ${libdir}/grub/grub-mkconfig_lib ++datadir=@datadir@ ++. ${datadir}/grub/grub-mkconfig_lib + + case "`uname 2>/dev/null`" in + CYGWIN*) ;; +Index: grub-1.99/util/grub.d/20_linux_xen.in +=================================================================== +--- grub-1.99.orig/util/grub.d/20_linux_xen.in ++++ grub-1.99/util/grub.d/20_linux_xen.in +@@ -21,7 +21,8 @@ prefix=@prefix@ + exec_prefix=@exec_prefix@ + bindir=@bindir@ + libdir=@libdir@ +-. ${libdir}/grub/grub-mkconfig_lib ++datadir=@datadir@ ++. ${datadir}/grub/grub-mkconfig_lib + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR=@localedir@ +Index: grub-1.99/util/grub.d/30_os-prober.in +=================================================================== +--- grub-1.99.orig/util/grub.d/30_os-prober.in ++++ grub-1.99/util/grub.d/30_os-prober.in +@@ -20,8 +20,9 @@ set -e + prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ ++datadir=@datadir@ + +-. ${libdir}/grub/grub-mkconfig_lib ++. ${datadir}/grub/grub-mkconfig_lib + + if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then + exit 0 +Index: grub-1.99/util/update-grub_lib.in +=================================================================== +--- grub-1.99.orig/util/update-grub_lib.in ++++ grub-1.99/util/update-grub_lib.in +@@ -18,6 +18,6 @@ prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ + +-. ${libdir}/grub/grub-mkconfig_lib ++. ${datadir}/grub/grub-mkconfig_lib + + grub_warn "update-grub_lib is deprecated, use grub-mkconfig_lib instead" diff --git a/grub2-probe-disk-mountby.patch b/grub2-probe-disk-mountby.patch new file mode 100644 index 0000000..8bba9d4 --- /dev/null +++ b/grub2-probe-disk-mountby.patch @@ -0,0 +1,316 @@ +Index: grub-1.99/grub-core/kern/emu/hostdisk.c +=================================================================== +--- grub-1.99.orig/grub-core/kern/emu/hostdisk.c ++++ grub-1.99/grub-core/kern/emu/hostdisk.c +@@ -1150,10 +1150,14 @@ make_device_name (int drive, int dos_par + } + + static char * +-convert_system_partition_to_system_disk (const char *os_dev, struct stat *st) ++convert_system_partition_to_system_disk (const char *os_dev, struct stat *st, ++ int *is_part) + { + #if defined(__linux__) + char *path = xmalloc (PATH_MAX); ++ ++ *is_part = 0; ++ + if (! realpath (os_dev, path)) + return NULL; + +@@ -1166,7 +1170,10 @@ convert_system_partition_to_system_disk + { + p = strstr (p, "part"); + if (p) +- strcpy (p, "disc"); ++ { ++ *is_part = 1; ++ strcpy (p, "disc"); ++ } + + return path; + } +@@ -1176,7 +1183,10 @@ convert_system_partition_to_system_disk + { + p = strstr (p, "part"); + if (p) +- strcpy (p, "disc"); ++ { ++ *is_part = 1; ++ strcpy (p, "disc"); ++ } + + return path; + } +@@ -1187,7 +1197,10 @@ convert_system_partition_to_system_disk + /* /dev/rd/c[0-9]+d[0-9]+(p[0-9]+)? */ + p = strchr (p, 'p'); + if (p) +- *p = '\0'; ++ { ++ *is_part = 1; ++ *p = '\0'; ++ } + + return path; + } +@@ -1198,7 +1211,10 @@ convert_system_partition_to_system_disk + /* /dev/rd/c[0-9]+d[0-9]+(p[0-9]+)? */ + p = strchr (p, 'p'); + if (p) +- *p = '\0'; ++ { ++ *is_part = 1; ++ *p = '\0'; ++ } + + return path; + } +@@ -1208,7 +1224,10 @@ convert_system_partition_to_system_disk + /* /dev/cciss/c[0-9]+d[0-9]+(p[0-9]+)? */ + p = strchr (p, 'p'); + if (p) +- *p = '\0'; ++ { ++ *is_part = 1; ++ *p = '\0'; ++ } + + return path; + } +@@ -1219,7 +1238,10 @@ convert_system_partition_to_system_disk + /* /dev/ida/c[0-9]+d[0-9]+(p[0-9]+)? */ + p = strchr (p, 'p'); + if (p) +- *p = '\0'; ++ { ++ *is_part = 1; ++ *p = '\0'; ++ } + + return path; + } +@@ -1228,6 +1250,8 @@ convert_system_partition_to_system_disk + if (strncmp ("i2o/hd", p, sizeof ("i2o/hd") - 1) == 0) + { + /* /dev/i2o/hd[a-z]([0-9]+)? */ ++ if (p[sizeof ("i2o/hda") - 1]) ++ *is_part = 1; + p[sizeof ("i2o/hda") - 1] = '\0'; + return path; + } +@@ -1238,7 +1262,10 @@ convert_system_partition_to_system_disk + /* /dev/mmcblk[0-9]+(p[0-9]+)? */ + p = strchr (p, 'p'); + if (p) +- *p = '\0'; ++ { ++ *is_part = 1; ++ *p = '\0'; ++ } + + return path; + } +@@ -1249,6 +1276,8 @@ convert_system_partition_to_system_disk + char *ptr = p + 2; + while (*ptr >= '0' && *ptr <= '9') + ptr++; ++ if (*ptr) ++ *is_part = 1; + *ptr = 0; + return path; + } +@@ -1258,6 +1287,8 @@ convert_system_partition_to_system_disk + && p[5] >= 'a' && p[5] <= 'z') + { + /* /dev/vdisk[a-z][0-9]* */ ++ if (p[6]) ++ *is_part = 1; + p[6] = '\0'; + return path; + } +@@ -1269,6 +1300,8 @@ convert_system_partition_to_system_disk + char *pp = p + 2; + while (*pp >= 'a' && *pp <= 'z') + pp++; ++ if (*pp) ++ *is_part = 1; + /* /dev/[hsv]d[a-z]+[0-9]* */ + *pp = '\0'; + return path; +@@ -1280,16 +1313,16 @@ convert_system_partition_to_system_disk + char *pp = p + 3; + while (*pp >= 'a' && *pp <= 'z') + pp++; ++ if (*pp) ++ *is_part = 1; + /* /dev/xvd[a-z]+[0-9]* */ + *pp = '\0'; + return path; + } + + #ifdef HAVE_DEVICE_MAPPER +- /* If this is a DM-RAID device. +- Compare os_dev rather than path here, since nodes under +- /dev/mapper/ are often symlinks. */ +- if ((strncmp ("/dev/mapper/", os_dev, 12) == 0)) ++ if ((strncmp ("/dev/mapper/", path, sizeof ("/dev/mapper/") - 1) == 0) ++ || (strncmp ("/dev/dm-", path, sizeof ("/dev/dm-") - 1) == 0)) + { + struct dm_tree *tree; + uint32_t maj, min; +@@ -1388,14 +1421,21 @@ devmapper_out: + { + char *p = strchr (path + 7, 's'); + if (p) +- *p = '\0'; ++ { ++ *is_part = 1; ++ *p = '\0'; ++ } + } + return path; + + #elif defined(__CYGWIN__) + char *path = xstrdup (os_dev); +- if (strncmp ("/dev/sd", path, 7) == 0 && 'a' <= path[7] && path[7] <= 'z') +- path[8] = 0; ++ if (strncmp ("/dev/sd", path, 7) == 0 && 'a' <= path[7] && path[7] <= 'z' ++ && path[8]) ++ { ++ *is_part = 1; ++ path[8] = 0; ++ } + return path; + + #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +@@ -1404,6 +1444,8 @@ devmapper_out: + return xstrdup (os_dev); + follow_geom_up (os_dev + sizeof ("/dev/") - 1, NULL, &out); + ++ if (grub_strcmp (os_dev + sizeof ("/dev/") - 1, out) != 0) ++ *is_part = 1; + out2 = xasprintf ("/dev/%s", out); + free (out); + +@@ -1418,7 +1460,10 @@ devmapper_out: + { + p = strpbrk (p, "sp"); + if (p) +- *p = '\0'; ++ { ++ *is_part = 1; ++ *p = '\0'; ++ } + break; + } + } +@@ -1445,7 +1490,11 @@ devmapper_out: + rawpart = getrawpartition(); + # endif /* HAVE_GETRAWPARTITION */ + if (rawpart >= 0) +- *p = 'a' + rawpart; ++ { ++ if (*p != 'a' + rawpart) ++ *is_part = 1; ++ *p = 'a' + rawpart; ++ } + } + } + } +@@ -1457,67 +1506,15 @@ devmapper_out: + #endif + } + +-#if defined(__linux__) || defined(__CYGWIN__) +-static int +-device_is_wholedisk (const char *os_dev) +-{ +- int len = strlen (os_dev); +- +- if (os_dev[len - 1] < '0' || os_dev[len - 1] > '9') +- return 1; +- return 0; +-} +-#endif +- +-#if defined(__NetBSD__) +-/* Try to determine whether a given device name corresponds to a whole disk. +- This function should give in most cases a definite answer, but it may +- actually give an approximate one in the following sense: if the return +- value is 0 then the device name does not correspond to a whole disk. */ +-static int +-device_is_wholedisk (const char *os_dev) +-{ +- int len = strlen (os_dev); +- int rawpart = -1; +- +-# ifdef HAVE_GETRAWPARTITION +- rawpart = getrawpartition(); +-# endif /* HAVE_GETRAWPARTITION */ +- if (rawpart < 0) +- return 1; +- return (os_dev[len - 1] == ('a' + rawpart)); +-} +-#endif /* defined(__NetBSD__) */ +- +-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +-static int +-device_is_wholedisk (const char *os_dev) +-{ +- const char *p; +- +- if (strncmp (os_dev, "/dev/", sizeof ("/dev/") - 1) != 0) +- return 0; +- +- for (p = os_dev + sizeof ("/dev/") - 1; *p; ++p) +- if (grub_isdigit (*p)) +- { +- if (strchr (p, 's')) +- return 0; +- break; +- } +- +- return 1; +-} +-#endif /* defined(__FreeBSD__) || defined(__FreeBSD_kernel__) */ +- + static int + find_system_device (const char *os_dev, struct stat *st, int convert, int add) + { + unsigned int i; + char *os_disk; ++ int is_part; + + if (convert) +- os_disk = convert_system_partition_to_system_disk (os_dev, st); ++ os_disk = convert_system_partition_to_system_disk (os_dev, st, &is_part); + else + os_disk = xstrdup (os_dev); + if (! os_disk) +@@ -1560,6 +1557,7 @@ grub_util_biosdisk_get_grub_dev (const c + { + struct stat st; + int drive; ++ int is_part; + + if (stat (os_dev, &st) < 0) + { +@@ -1578,7 +1576,7 @@ grub_util_biosdisk_get_grub_dev (const c + } + + if (grub_strcmp (os_dev, +- convert_system_partition_to_system_disk (os_dev, &st)) == 0) ++ convert_system_partition_to_system_disk (os_dev, &st, &is_part)) == 0) + return make_device_name (drive, -1, -1); + + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__) +@@ -1645,7 +1643,7 @@ grub_util_biosdisk_get_grub_dev (const c + + grub_util_info ("%s starts from %lu", os_dev, start); + +- if (start == 0 && device_is_wholedisk (os_dev)) ++ if (start == 0 && !is_part) + return name; + + grub_util_info ("opening the device %s", name); diff --git a/grub2.changes b/grub2.changes index 898aa97..b024837 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Wed May 2 03:17:21 UTC 2012 - mchang@suse.com + +- grub2-automake-1-11-2.patch : fix grub2 build error on newer + autotools (automake >= 1.11.2) +- call ./autogen.sh + +------------------------------------------------------------------- +Thu Apr 19 11:28:44 UTC 2012 - mchang@suse.com + +- grub2-probe-disk-mountby.patch : fix grub2-probe fails on + probing mount-by devices under /dev/disk/by-(id|uuid|path). + (bnc#757746) + ------------------------------------------------------------------- Thu Mar 29 07:08:38 UTC 2012 - mchang@suse.com diff --git a/grub2.spec b/grub2.spec index f1da955..ad9bd94 100644 --- a/grub2.spec +++ b/grub2.spec @@ -42,6 +42,8 @@ BuildRequires: gnu-unifont BuildRequires: lzma BuildRequires: ruby BuildRequires: xz +BuildRequires: autogen +BuildRequires: python # Modules always contain just 32-bit code %define _libdir %{_exec_prefix}/lib @@ -78,6 +80,8 @@ Patch6: grub2-iterate-and-hook-for-extended-partition.patch Patch7: grub2-install-opt-skip-fs-probe.patch Patch8: grub2-gcc47.patch Patch9: os-prober_osx.patch +Patch10: grub2-probe-disk-mountby.patch +Patch11: grub2-automake-1-11-2.patch PreReq: perl-Bootloader Requires: gettext-runtime Requires: os-prober @@ -129,7 +133,7 @@ provides support for EFI systems. sed 's,@setfilename grub.info,@setfilename grub2.info,' grub-%{version}/docs/grub.texi >grub-%{version}/docs/grub2.texi sed -i 's,grub.texi,grub2.texi,' grub-%{version}/docs/Makefile.am ## fix unifont location so grub-mkfont can create *.pf2 files -sed -i 's|/usr/share/fonts/unifont|/usr/share/fonts/uni|g' grub-%{version}/configure +sed -i 's|/usr/share/fonts/unifont|/usr/share/fonts/uni|g' grub-%{version}/configure.ac cd grub-%{version} %patch0 -p1 %patch2 -p1 @@ -140,6 +144,8 @@ cd grub-%{version} %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 +%patch11 -p1 cd .. # README.openSUSE @@ -151,6 +157,7 @@ cp -a grub-%{version} grub-efi-%{version} %build %ifarch %{efi} cd grub-efi-%{version} +./autogen.sh # we don't want to let rpm to override *FLAGS by bogus ones CFLAGS="-fno-strict-aliasing " CXXFLAGS=" " @@ -173,7 +180,7 @@ make %{?_smp_mflags} cd .. %endif cd grub-%{version} -#./autogen.sh +./autogen.sh # we don't want to let rpm to override *FLAGS by bogus ones CFLAGS="-fno-strict-aliasing " @@ -295,8 +302,9 @@ fi %files -f grub-%{version}/grub.lang %defattr(-,root,root,-) %{_libdir}/%{name} -%{_libdir}/grub/ %{_sbindir}/%{name}-* +%{_datadir}/%{name} +%{_datadir}/grub %ifarch %{efi} %exclude %{_sbindir}/grub2-efi-* %endif @@ -319,8 +327,6 @@ fi %doc grub-%{version}/ChangeLog grub-%{version}/README.openSUSE %{_infodir}/grub-dev.info* %{_infodir}/%{name}.info* -%dir %{_datadir}/%{name} -%{_datadir}/%{name}/*.pf2 %ifarch %{efi} @@ -365,7 +371,6 @@ fi %doc grub-%{version}/COPYING grub-%{version}/NEWS %doc grub-%{version}/README grub-%{version}/THANKS grub-%{version}/TODO %doc grub-%{version}/ChangeLog grub-%{version}/README.openSUSE -%exclude %{_mandir} %dir %{_datadir}/%{name}-efi %{_datadir}/%{name}-efi/*.pf2 %endif