[edk2-devel] [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Put the UDF check ahead of MBR

Gao, Zhichao posted 3 patches 5 years, 6 months ago
[edk2-devel] [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Put the UDF check ahead of MBR
Posted by Gao, Zhichao 5 years, 6 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823

Refer to UEFI spec 2.8, Section 13.3.2, a block device should
be scanned as below order:
1. GPT
2. ISO 9660 (El Torito) (UDF should aslo be here)
3. MBR
4. no partition found
Note: UDF is using the same boot method as CD, so put it in
the same priority with ISO 9660.

This would also solve the issue that ISO image with MBR would
be treat as MBR device instead of CD/DVD. That would make the
behavior of the image boot different:
If the CD/DVD's MBR be handled correctly, it would be enumerated
as a bootable device with MBR path and FAT filesystem. Some Linux
Distributions boot from such path (FAT with MBR path for ISO) would
come into the grub console instead of the installation selection.
With this change, the CD/DVD would always be enumerated with CD path.
And it would always boot to the installation selection.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Gary Lin <glin@suse.com>
Cc: Andrew Fish <afish@apple.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
---
 MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
index 6a43c3cafb..473e091320 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
@@ -35,11 +35,19 @@ EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
 
 //
 // Prioritized function list to detect partition table.
+// Refer to UEFI Spec 13.3.2 Partition Discovery, the block device
+// should be scanned in below order:
+// 1. GPT
+// 2. ISO 9660 (El Torito) (or UDF)
+// 3. MBR
+// 4. no partiton found
+// Note: UDF is using a same method as booting from CD-ROM, so put it along
+//        with CD-ROM check.
 //
 PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {
   PartitionInstallGptChildHandles,
-  PartitionInstallMbrChildHandles,
   PartitionInstallUdfChildHandles,
+  PartitionInstallMbrChildHandles,
   NULL
 };
 
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64024): https://edk2.groups.io/g/devel/message/64024
Mute This Topic: https://groups.io/mt/76139479/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Put the UDF check ahead of MBR
Posted by Ni, Ray 5 years, 6 months ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gao, Zhichao
> Sent: Wednesday, August 12, 2020 9:21 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gary Lin
> <glin@suse.com>; Andrew Fish <afish@apple.com>
> Subject: [edk2-devel] [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Put the UDF check ahead of MBR
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823
> 
> Refer to UEFI spec 2.8, Section 13.3.2, a block device should
> be scanned as below order:
> 1. GPT
> 2. ISO 9660 (El Torito) (UDF should aslo be here)
> 3. MBR
> 4. no partition found
> Note: UDF is using the same boot method as CD, so put it in
> the same priority with ISO 9660.
> 
> This would also solve the issue that ISO image with MBR would
> be treat as MBR device instead of CD/DVD. That would make the
> behavior of the image boot different:
> If the CD/DVD's MBR be handled correctly, it would be enumerated
> as a bootable device with MBR path and FAT filesystem. Some Linux
> Distributions boot from such path (FAT with MBR path for ISO) would
> come into the grub console instead of the installation selection.
> With this change, the CD/DVD would always be enumerated with CD path.
> And it would always boot to the installation selection.
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Gary Lin <glin@suse.com>
> Cc: Andrew Fish <afish@apple.com>
> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> ---
>  MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> index 6a43c3cafb..473e091320 100644
> --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> @@ -35,11 +35,19 @@ EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
> 
>  //
>  // Prioritized function list to detect partition table.
> +// Refer to UEFI Spec 13.3.2 Partition Discovery, the block device
> +// should be scanned in below order:
> +// 1. GPT
> +// 2. ISO 9660 (El Torito) (or UDF)
> +// 3. MBR
> +// 4. no partiton found
> +// Note: UDF is using a same method as booting from CD-ROM, so put it along
> +//        with CD-ROM check.
>  //
>  PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {
>    PartitionInstallGptChildHandles,
> -  PartitionInstallMbrChildHandles,
>    PartitionInstallUdfChildHandles,
> +  PartitionInstallMbrChildHandles,
>    NULL
>  };
> 
> --
> 2.21.0.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64044): https://edk2.groups.io/g/devel/message/64044
Mute This Topic: https://groups.io/mt/76139479/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Put the UDF check ahead of MBR
Posted by Wu, Hao A 5 years, 6 months ago
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gao,
> Zhichao
> Sent: Wednesday, August 12, 2020 9:21 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gary Lin
> <glin@suse.com>; Andrew Fish <afish@apple.com>
> Subject: [edk2-devel] [PATCH V2 1/3] MdeModulePkg/PartitionDxe: Put the
> UDF check ahead of MBR
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823
> 
> Refer to UEFI spec 2.8, Section 13.3.2, a block device should be scanned as
> below order:
> 1. GPT
> 2. ISO 9660 (El Torito) (UDF should aslo be here) 3. MBR 4. no partition found
> Note: UDF is using the same boot method as CD, so put it in the same priority
> with ISO 9660.
> 
> This would also solve the issue that ISO image with MBR would be treat as
> MBR device instead of CD/DVD. That would make the behavior of the image
> boot different:
> If the CD/DVD's MBR be handled correctly, it would be enumerated as a
> bootable device with MBR path and FAT filesystem. Some Linux Distributions
> boot from such path (FAT with MBR path for ISO) would come into the grub
> console instead of the installation selection.
> With this change, the CD/DVD would always be enumerated with CD path.
> And it would always boot to the installation selection.
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Gary Lin <glin@suse.com>
> Cc: Andrew Fish <afish@apple.com>
> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> ---
>  MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> index 6a43c3cafb..473e091320 100644
> --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> @@ -35,11 +35,19 @@ EFI_DRIVER_BINDING_PROTOCOL
> gPartitionDriverBinding = {
> 
>  //
>  // Prioritized function list to detect partition table.
> +// Refer to UEFI Spec 13.3.2 Partition Discovery, the block device //
> +should be scanned in below order:
> +// 1. GPT
> +// 2. ISO 9660 (El Torito) (or UDF)
> +// 3. MBR
> +// 4. no partiton found
> +// Note: UDF is using a same method as booting from CD-ROM, so put it
> along
> +//        with CD-ROM check.
>  //
>  PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {
>    PartitionInstallGptChildHandles,
> -  PartitionInstallMbrChildHandles,
>    PartitionInstallUdfChildHandles,
> +  PartitionInstallMbrChildHandles,


Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu


>    NULL
>  };
> 
> --
> 2.21.0.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64049): https://edk2.groups.io/g/devel/message/64049
Mute This Topic: https://groups.io/mt/76139479/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-