grub2/grub2-install-remove-useless-check-PReP-partition-is-empty.patch
Michael Chang 8ee92f5194 Accepting request 1105405 from home:michael-chang:grub:2.12rc1
- Implement NV index mode for TPM 2.0 key protector
  0001-protectors-Implement-NV-index.patch
- Fall back to passphrase mode when the key protector fails to
  unlock the disk
  0002-cryptodisk-Fallback-to-passphrase.patch
- Wipe out the cached key cleanly
  0003-cryptodisk-wipe-out-the-cached-keys-from-protectors.patch
- Make diskfiler to look up cryptodisk devices first
  0004-diskfilter-look-up-cryptodisk-devices-first.patch

- Version bump to 2.12~rc1
  * Added:
    - grub-2.12~rc1.tar.xz
  * Removed:
    - grub-2.06.tar.xz
  * Patch dropped merged by new version:
    - grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch
    - grub2-s390x-02-kexec-module-added-to-emu.patch
    - grub2-efi-chainloader-root.patch
    - grub2-Fix-incorrect-netmask-on-ppc64.patch
    - 0001-osdep-Introduce-include-grub-osdep-major.h-and-use-i.patch
    - 0002-osdep-linux-hostdisk-Use-stat-instead-of-udevadm-for.patch
    - 0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch
    - grub2-s390x-10-keep-network-at-kexec.patch
    - 0001-Fix-build-error-in-binutils-2.36.patch
    - 0001-emu-fix-executable-stack-marking.patch
    - 0046-squash-verifiers-Move-verifiers-API-to-kernel-image.patch
    - 0001-30_uefi-firmware-fix-printf-format-with-null-byte.patch
    - 0001-tpm-Pass-unknown-error-as-non-fatal-but-debug-print-.patch
    - 0001-Filter-out-POSIX-locale-for-translation.patch

OBS-URL: https://build.opensuse.org/request/show/1105405
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=458
2023-08-24 03:25:56 +00:00

78 lines
2.4 KiB
Diff

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(-)
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -759,34 +759,6 @@
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_native_sectors (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)
{
@@ -1980,18 +1952,9 @@
{
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"));
- grub_set_install_backup_ponr ();
- }
- else
- {
- 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);
- }
+ if (write_to_disk (ins_dev, imgfile))
+ grub_util_error ("%s", _("failed to copy Grub to the PReP partition"));
+ grub_set_install_backup_ponr ();
grub_device_close (ins_dev);
if (update_nvram)
grub_install_register_ieee1275 (1, grub_util_get_os_disk (install_device),