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: Andrey Borzenkov
Subject: Re: [PATCH] Fix prefix autodetection when booting from EFI CD-ROM
Date: Fri, 5 Apr 2013 19:28:06 +0400

В Fri, 05 Apr 2013 15:12:26 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <address@hidden> пишет:

> 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:
> 

CD-ROM media device path in UEFI is defined for a single boot catalog
entry - EFI system partition. EFI will *always* return this when booted
from CD. But we do *not* want this "partition" - we want full CD
access here. This ESP image normally exists just to load grub off it.
Everything else is part of normal ISO on CD-ROM.

Also there is no partition label that can be detected and points to
this boot catalog entry; so partition matching code will simply fail.

So we want a) skip partition search based on media device subpath and
b) strip media device subpath.

I'm not sure what partitions on MAC are but I suspect they are not boot
catalog entries.

> 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: PGP signature


reply via email to

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