SHA256
1
0
forked from pool/grub2
grub2/grub2-cdpath.patch
Andrei Borzenkov 9a5891bd62 Accepting request 150514 from home:michael-chang:branches:Base:System
- sync from SLE-11 SP3 to date
- set empty prefix to grub.efi for looking up in current directory
- grub2-cdpath.patch: fix the grub.cfg not found when booting from
  optical disk
- put grub.efi in grub2's source module directory
- create links in system's efi directory to grub.efi
- arvidjaar: do not overwrite device path in grub2-cdpath.patch

OBS-URL: https://build.opensuse.org/request/show/150514
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=12
2013-01-31 08:53:45 +00:00

51 lines
1.5 KiB
Diff

From: Matthew Garrett <mjg@redhat.com>
Date: 2012-07-10 11:58:52 EDT
Subject: [PATCH] Add support for crappy cd craparino
References: fate#314485
Patch-Mainline: no
Signed-off-by: Michael Chang <mchang@suse.com>
Follow other code in this function and duplicate device path
before overwriting it.
Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
Index: grub-2.00/grub-core/disk/efi/efidisk.c
===================================================================
--- grub-2.00.orig/grub-core/disk/efi/efidisk.c
+++ grub-2.00/grub-core/disk/efi/efidisk.c
@@ -820,6 +820,31 @@ grub_efidisk_get_device_name (grub_efi_h
return dev_name;
}
+ else if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE &&
+ (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE))
+ {
+ grub_efi_device_path_t *dup_dp, *dup_ldp;
+
+ /* It is necessary to duplicate the device path so that GRUB
+ can overwrite it. */
+ dup_dp = duplicate_device_path (dp);
+ if (! dup_dp)
+ return 0;
+
+ dup_ldp = find_last_device_path (dup_dp);
+ dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
+ dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
+ dup_ldp->length[0] = 4;
+ dup_ldp->length[1] = 0;
+
+ if (!get_diskname_from_path (dup_dp, device_name))
+ {
+ grub_free (dup_dp);
+ return 0;
+ }
+ grub_free (dup_dp);
+ return grub_strdup (device_name);
+ }
else
{
/* This should be an entire disk. */