grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix prefix autodetection when booting from EFI CD-ROM


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: [PATCH] Fix prefix autodetection when booting from EFI CD-ROM
Date: Fri, 05 Apr 2013 15:12:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12

On 31.01.2013 13:24, Andrey Borzenkov wrote:

> Fix autodetection of $prefix when booted from EFI CD-ROM.
> 
> Based on patch from Matthew Garrett, modified to not overwrite
> memory returned by device path protocol handler and rebased to
> current trunk.
> 
> Additionally fixes potential memory leak - dup_dp was not deallocated
> if device path was not found.

Why any special treatement for CD-ROMs? They can have partitions and do
so on CD-ROMs intended for macs. What about following patch:

address@hidden:15:02:18:~/grub2/bzr/mainline$ bzr diff
=== modified file 'grub-core/disk/efi/efidisk.c'
--- grub-core/disk/efi/efidisk.c        2013-04-05 08:59:26 +0000
+++ grub-core/disk/efi/efidisk.c        2013-04-05 13:07:39 +0000
@@ -633,9 +633,6 @@
       return d->handle;

     case 'c':
-      /* FIXME: probably this is not correct.  */
-      return d->handle;
-
     case 'h':
       /* If this is the whole disk, just return its own data.  */
       if (! disk->partition)
@@ -657,7 +654,9 @@
            if ((GRUB_EFI_DEVICE_PATH_TYPE (c->last_device_path)
                 == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE)
                && (GRUB_EFI_DEVICE_PATH_SUBTYPE (c->last_device_path)
-                   == GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)
+                   == GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE
+                   || GRUB_EFI_DEVICE_PATH_SUBTYPE (c->last_device_path)
+                   == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE)
                && (grub_partition_get_start (disk->partition)
                    == (hd.partition_start << (disk->log_sector_size
                                               - GRUB_DISK_SECTOR_BITS)))
@@ -770,7 +769,9 @@

   if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE
       && (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp)
-         == GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE))
+         == GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE
+         || GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp)
+         == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE))
     {
       struct grub_efidisk_get_device_name_ctx ctx;
       char *dev_name;



Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]