grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] Fix prefix autodetection when booting from EFI CD-ROM
Date: Fri, 5 Apr 2013 19:28:06 +0400	[thread overview]
Message-ID: <20130405192806.71aa4014@opensuse.site> (raw)
In-Reply-To: <515ECDBA.40507@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2867 bytes --]

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

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

> phcoder@debian.x201.phnet: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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2013-04-05 15:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31 12:24 [PATCH] Fix prefix autodetection when booting from EFI CD-ROM Andrey Borzenkov
2013-02-03 20:13 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-04-05 13:12 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-04-05 15:28   ` Andrey Borzenkov [this message]
2013-10-14 15:07 ` Vladimir 'φ-coder/phcoder' Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130405192806.71aa4014@opensuse.site \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).