SHA256
1
0
forked from pool/grub2

Accepting request 540121 from Base:System

OBS-URL: https://build.opensuse.org/request/show/540121
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=171
This commit is contained in:
Dominique Leuenberger 2017-11-10 13:42:35 +00:00 committed by Git OBS Bridge
parent 55f8d164bd
commit 1974a6df7e
4 changed files with 104 additions and 4 deletions

View File

@ -0,0 +1,79 @@
From b57af595c94db6d7babb7623c1530ee4f5b956f0 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Tue, 31 Oct 2017 14:28:54 +0100
Subject: [PATCH] grub-install: remove useless check PReP partition is empty.
References: bsc#1065738
The grub-install rewrite in commit cd46aa6cefab checks that the PPeP
partition does not install an ELF binary before writing grub to it. This
causes regression in installer scripts that expect to be able to
reinstall bootloaders without first witping the partition by hand.
Fixes: cd46aa6cefab ("Rewrite grub-install, grub-mkrescue,
grub-mkstandalone and grub-mknetdir ")
---
util/grub-install.c | 39 ++-------------------------------------
1 file changed, 2 insertions(+), 37 deletions(-)
diff --git a/util/grub-install.c b/util/grub-install.c
index 75e3e5ba6f07..ae859476e3da 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -731,34 +731,6 @@ is_prep_partition (grub_device_t dev)
return 0;
}
-static int
-is_prep_empty (grub_device_t dev)
-{
- grub_disk_addr_t dsize, addr;
- grub_uint32_t buffer[32768];
-
- dsize = grub_disk_get_size (dev->disk);
- for (addr = 0; addr < dsize;
- addr += sizeof (buffer) / GRUB_DISK_SECTOR_SIZE)
- {
- grub_size_t sz = sizeof (buffer);
- grub_uint32_t *ptr;
-
- if (sizeof (buffer) / GRUB_DISK_SECTOR_SIZE > dsize - addr)
- sz = (dsize - addr) * GRUB_DISK_SECTOR_SIZE;
- grub_disk_read (dev->disk, addr, 0, sz, buffer);
-
- if (addr == 0 && grub_memcmp (buffer, ELFMAG, SELFMAG) == 0)
- return 1;
-
- for (ptr = buffer; ptr < buffer + sz / sizeof (*buffer); ptr++)
- if (*ptr)
- return 0;
- }
-
- return 1;
-}
-
static void
bless (grub_device_t dev, const char *path, int x86)
{
@@ -1772,16 +1744,9 @@ main (int argc, char *argv[])
{
grub_util_error ("%s", _("the chosen partition is not a PReP partition"));
}
- if (is_prep_empty (ins_dev))
- {
- if (write_to_disk (ins_dev, imgfile))
- grub_util_error ("%s", _("failed to copy Grub to the PReP partition"));
- }
- else
+ if (write_to_disk (ins_dev, imgfile))
{
- char *s = xasprintf ("dd if=/dev/zero of=%s", install_device);
- grub_util_error (_("the PReP partition is not empty. If you are sure you want to use it, run dd to clear it: `%s'"),
- s);
+ grub_util_error ("%s", _("failed to copy Grub to the PReP partition"));
}
grub_device_close (ins_dev);
if (update_nvram)
--
2.13.6

View File

@ -138,15 +138,15 @@ if [ -n "${suse_cddev}" ]; then
} }
elif [ -f "${suse_kern}" -a -f "$suse_initrd" ]; then elif [ -f "${suse_kern}" -a -f "$suse_initrd" ]; then
menuentry "${suse_cddev} SUSE Install" { menuentry "${suse_cddev} SUSE Install" {
linux "${suse_kern}" linemode=1 xencons=hvc0 linux "${suse_kern}" xencons=hvc0
initrd "${suse_initrd}" initrd "${suse_initrd}"
} }
menuentry "${suse_cddev} SUSE Rescue" { menuentry "${suse_cddev} SUSE Rescue" {
linux "${suse_kern}" linemode=1 xencons=hvc0 rescue=1 linux "${suse_kern}" xencons=hvc0 rescue=1
initrd "${suse_initrd}" initrd "${suse_initrd}"
} }
menuentry "${suse_cddev} SUSE Upgrade" { menuentry "${suse_cddev} SUSE Upgrade" {
linux "${suse_kern}" linemode=1 xencons=hvc0 upgrade=1 linux "${suse_kern}" xencons=hvc0 upgrade=1
initrd "${suse_initrd}" initrd "${suse_initrd}"
} }
else else

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Wed Nov 8 09:37:12 UTC 2017 - olaf@aepfle.de
- grub2-xen-pv-firmware.cfg: remove linemode=1 from cmdline for
SUSE installer. openQA expects ncurses interface. (bsc#1066919)
-------------------------------------------------------------------
Mon Nov 6 15:34:03 UTC 2017 - jmatejek@suse.com
- use python3 for autogen.sh (fate#323526)
-------------------------------------------------------------------
Tue Oct 31 13:36:02 UTC 2017 - msuchanek@suse.com
- Do not check that PReP partition does not contain an ELF during installation
(bsc#1065738).
* grub2-install-remove-useless-check-PReP-partition-is-empty.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Sep 26 06:35:50 UTC 2017 - mchang@suse.com Tue Sep 26 06:35:50 UTC 2017 - mchang@suse.com

View File

@ -44,7 +44,7 @@ BuildRequires: makeinfo
%else %else
BuildRequires: texinfo BuildRequires: texinfo
%endif %endif
BuildRequires: python BuildRequires: python3
BuildRequires: xz-devel BuildRequires: xz-devel
%ifarch x86_64 %ifarch x86_64
%if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110 %if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110
@ -212,6 +212,7 @@ Patch81: grub2-lvm-allocate-metadata-buffer-from-raw-contents.patch
Patch82: grub2-diskfilter-support-pv-without-metadatacopies.patch Patch82: grub2-diskfilter-support-pv-without-metadatacopies.patch
Patch83: grub2-efi-uga-64bit-fb.patch Patch83: grub2-efi-uga-64bit-fb.patch
Patch84: grub2-s390x-09-improve-zipl-setup.patch Patch84: grub2-s390x-09-improve-zipl-setup.patch
Patch85: grub2-install-remove-useless-check-PReP-partition-is-empty.patch
# Btrfs snapshot booting related patches # Btrfs snapshot booting related patches
Patch101: grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch Patch101: grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch
Patch102: grub2-btrfs-02-export-subvolume-envvars.patch Patch102: grub2-btrfs-02-export-subvolume-envvars.patch
@ -484,6 +485,7 @@ swap partition while in resuming
%patch82 -p1 %patch82 -p1
%patch83 -p1 %patch83 -p1
%patch84 -p1 %patch84 -p1
%patch85 -p1
%patch101 -p1 %patch101 -p1
%patch102 -p1 %patch102 -p1
%patch103 -p1 %patch103 -p1
@ -564,6 +566,7 @@ mkdir build-emu
%endif %endif
%build %build
export PYTHON=%{_bindir}/python3
# autogen calls autoreconf -vi # autogen calls autoreconf -vi
./autogen.sh ./autogen.sh
# Not yet: # Not yet: