From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UO8Yz-0005dw-Eu for mharc-grub-devel@gnu.org; Fri, 05 Apr 2013 11:28:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO8Yv-0005dH-NZ for grub-devel@gnu.org; Fri, 05 Apr 2013 11:28:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UO8Yl-0007Tc-4l for grub-devel@gnu.org; Fri, 05 Apr 2013 11:28:21 -0400 Received: from mail-lb0-f171.google.com ([209.85.217.171]:32820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO8Yk-0007Su-QD for grub-devel@gnu.org; Fri, 05 Apr 2013 11:28:11 -0400 Received: by mail-lb0-f171.google.com with SMTP id v10so3851043lbd.2 for ; Fri, 05 Apr 2013 08:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:in-reply-to:references :x-mailer:mime-version:content-type; bh=AmjxL/udGP9F+a4IdLmSRY8FmgkfY/s9ysjBqad2uU4=; b=TOjanOhJgaYXcJAnhAVNHbdVH65ErWaDZigu6tS2f+JTZxWsEWks0Cy3GDQBVh8m/t lkWP/oGcPxHOQkabqA+rc8pHQx2aSfIjct4/byEDV2Cq1pA3r7L60Y0AhF4NZ64Ko9OY UoLPokR7bknRaEy2jS40qrjlQRsuXkX2jFdhlHXDF0ZZuLV+KaIy8CnXHSTW9vOLxzTx nKXDbSKLf0IsU+7q1QE6Mcee5uPo8cJQCsG6+KwwS6WspTHn9dufLKKiBeYu7WlRF2P7 b3IChHRbkPHB0hadXeZKRfV1WCVT0rYfn8Z/uW29EN2dNEwDftqqcwDpQiQMaKBoMB5R 7eaw== X-Received: by 10.152.6.229 with SMTP id e5mr2001815laa.6.1365175689071; Fri, 05 Apr 2013 08:28:09 -0700 (PDT) Received: from opensuse.site ([94.29.72.160]) by mx.google.com with ESMTPS id fz10sm5625754lbb.12.2013.04.05.08.28.08 (version=SSLv3 cipher=RC4-SHA bits=128/128); Fri, 05 Apr 2013 08:28:08 -0700 (PDT) Date: Fri, 5 Apr 2013 19:28:06 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: Re: [PATCH] Fix prefix autodetection when booting from EFI CD-ROM Message-ID: <20130405192806.71aa4014@opensuse.site> In-Reply-To: <515ECDBA.40507@gmail.com> References: <1359635040-23786-1-git-send-email-arvidjaar@gmail.com> <515ECDBA.40507@gmail.com> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.14; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/7lw9mDT59EJOvFVwZa_8IU5"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.217.171 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Apr 2013 15:28:23 -0000 --Sig_/7lw9mDT59EJOvFVwZa_8IU5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Fri, 05 Apr 2013 15:12:26 +0200 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > On 31.01.2013 13:24, Andrey Borzenkov wrote: >=20 > > Fix autodetection of $prefix when booted from EFI CD-ROM. > >=20 > > Based on patch from Matthew Garrett, modified to not overwrite > > memory returned by device path protocol handler and rebased to > > current trunk. > >=20 > > Additionally fixes potential memory leak - dup_dp was not deallocated > > if device path was not found. >=20 > Why any special treatement for CD-ROMs? They can have partitions and do > so on CD-ROMs intended for macs. What about following patch: >=20 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 > =3D=3D=3D 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; >=20 > 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) > =3D=3D GRUB_EFI_MEDIA_DEVICE_PATH_TYPE) > && (GRUB_EFI_DEVICE_PATH_SUBTYPE (c->last_device_path) > - =3D=3D GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE) > + =3D=3D GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE > + || GRUB_EFI_DEVICE_PATH_SUBTYPE (c->last_device_path) > + =3D=3D GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE) > && (grub_partition_get_start (disk->partition) > =3D=3D (hd.partition_start << (disk->log_sector_size > - GRUB_DISK_SECTOR_BITS))) > @@ -770,7 +769,9 @@ >=20 > if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) =3D=3D GRUB_EFI_MEDIA_DEVICE_PATH_= TYPE > && (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) > - =3D=3D GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)) > + =3D=3D GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE > + || GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) > + =3D=3D GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE)) > { > struct grub_efidisk_get_device_name_ctx ctx; > char *dev_name; >=20 >=20 >=20 --Sig_/7lw9mDT59EJOvFVwZa_8IU5 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlFe7YYACgkQR6LMutpd94zx8gCgqiSClg+RuMa3pqP6ifCu3GOt l9MAn3kI+TFvOrSga/ZypKD8GyWzUPTW =cEWA -----END PGP SIGNATURE----- --Sig_/7lw9mDT59EJOvFVwZa_8IU5--