Hi,

afaik Android doesn't have sepc's, just advices and maybe "rules to allow
the OEM to install Google services", but there actually are some reasons
not to use GUID's.

First off, the names aren't always the same, heck not even the number of
partitions is the same. some vendors use boot and recovery, some have boot,
boot1, recovery(dualboot), some just have boot(recovery integrated into the
main OS), and some even haven boot, recovery, laf(this is a special
download mode).

Another reason is that it's important that these names are readable and
easy to type because u actually use them alot. i.e. for both manual and
automatic flashing partitions are identified by their type:
fastboot: fastboot flash boot boot.img
recovery script: package_extract_file("boot.img",
"/dev/block/platform/msm_sdcc.1/by-name/boot");
fstab: /dev/block/platform/msm_sdcc.1/by-name/boot         /boot
emmc    defaults
 defaults

And I totally agree with that, GUID's are only good if you never need to
use them outside the code, (like GRUB and linux use filesystem GUID's, but
the configs are generated so it doesn't matter for user and devs).

Michael

On Thu, Sep 10, 2015 at 2:54 AM, Tian, Feng <feng.t...@intel.com> wrote:

> Michael
>
>
>
> Is there a spec about the GPT partition naming rule in Android world?
> Could you share the link?
>
>
>
> If these GPT partitions have special naming rules (boot, recovery…), why
> they don’t define specific partition type guid just like EFI SYSTEM
> PARTITION to distinguish them?
>
>
>
> For example, EFI System Partition type guid is defined by UEFI as
> C12A7328-F81F-11D2-BA4B-00A0C93EC93B
>
>
>
> Thanks
>
> Feng
>
>
>
> *From:* Michael Zimmermann [mailto:sigmaepsilo...@gmail.com]
> *Sent:* Wednesday, September 09, 2015 17:34
>
> *To:* Tian, Feng
> *Cc:* Ni, Ruiyu; edk2-devel@lists.01.org
> *Subject:* Re: [edk2] [PATCH] MdeModulePkg: add PartitionName protocol
>
>
>
> The name is reliable because it's used by all OEM's :)
>
> I'm the founder of EFIDroid, a port of UEFI to Qualcomm based Android
> devices.
>
> https://github.com/efidroid
>
> https://plus.google.com/u/0/communities/114053643671219382368
>
>
>
> Android boot images(a container for kernel,ramdisk, devicetree and
> bootargs) are stored as a raw binary on named partitions(boot,
> recovery,...). Naming partitions is standard in Android and every single
> partition has a name. neither GPT GUID's nor file system labels(these
> actually can change with every format depending on the tools used). are
> persistent or reliable.
>
>
>
> On Wed, Sep 9, 2015 at 10:50 AM, Tian, Feng <feng.t...@intel.com> wrote:
>
> My concern is the name string is also not reliable. Different partition
> tools may have different naming rules.
>
> Yes, "private protocol" I meant is using it as your local implementation.
>
> Last, still  has a little curious on your usage model, could you explain
> it more? Maybe there is a better way to solve your problem.
>
> Thanks
> Feng
>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Michael Zimmermann
>
> Sent: Wednesday, September 09, 2015 15:48
> To: Tian, Feng
> Cc: Ni, Ruiyu; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH] MdeModulePkg: add PartitionName protocol
>
> UniquePartitionGUID isn't suitable because the device vendor's don't set
> proper values(they're auto generated each time the partition table changes).
> Instead names like "boot" are used so you can find the correct partition.
>
> by "Implement it as a private protocol" do u just mean "use your own fork"
> or is there some different protocol type?
>
> On Wed, Sep 9, 2015 at 9:34 AM, Tian, Feng <feng.t...@intel.com> wrote:
>
> > Michael,
> >
> > IMHO, I don't think it's valuable to introducing this new protocol to
> > get a name string. It's too burden. If only you have this use case, I
> > would suggest you implement it as a private protocol rather than the
> public one.
> >
> > PS: Why UniquePartitionGUID doesn't work for your case?
> >
> > Thanks
> > Feng
> >
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > Michael Zimmermann
> > Sent: Wednesday, September 09, 2015 15:28
> > To: Ni, Ruiyu
> > Cc: edk2-devel@lists.01.org
> > Subject: Re: [edk2] [PATCH] MdeModulePkg: add PartitionName protocol
> >
> > Hi,
> >
> > I need the partition name because I need to boot from partitions by
> > their GPT label(filesystem label and GUID aren't set/reliable).
> >
> > Usually I would've just added a name field to the existing DiskIo
> > Protocol, but since it's a UEFI standard we can't/shouldn't do this.
> >
> > I chose option 3 over 1/2 because the others would mean that u have to
> > parse the whole partition table again which would lead to redundant code.
> >
> >
> > Michael
> >
> > On Sun, Sep 6, 2015 at 8:33 AM, Ni, Ruiyu <ruiyu...@intel.com> wrote:
> >
> > > Zimmermann,
> > > There are three options to get the name of a partition:
> > > 1. Directly use BlockIo interface to access the GPT meta data.
> > > 2. Group the above code into a library 3. Group the above code into
> > > a driver and expose the partition name as a protocol.
> > >
> > > I really do not think we need to go to option 3 directly. Can you
> > > tell us the reason why a protocol is needed?
> > >
> > > Thanks,
> > > Ray
> > >
> > > -----Original Message-----
> > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf
> > > Of Michael Zimmermann
> > > Sent: Thursday, September 3, 2015 2:23 PM
> > > To: edk2-devel@lists.01.org
> > > Subject: [edk2] [PATCH] MdeModulePkg: add PartitionName protocol
> > >
> > > This allows to retrieve the name of a partition.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > Signed-off-by: Michael Zimmermann <cecil.she n...@hp.com>
> > > ---
> > >  MdeModulePkg/Include/Protocol/PartitionName.h      | 42
> > > ++++++++++++++++++++++
> > >  MdeModulePkg/MdeModulePkg.dec                      |  3 ++
> > >  .../Universal/Disk/PartitionDxe/ElTorito.c         |  3 +-
> > >  MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c     |  3 +-
> > >  MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c     |  6 ++--
> > >  .../Universal/Disk/PartitionDxe/Partition.c        | 13 ++++++-
> > >  .../Universal/Disk/PartitionDxe/Partition.h        |  5 ++-
> > >  .../Universal/Disk/PartitionDxe/PartitionDxe.inf   |  2 ++
> > >  8 files changed, 71 insertions(+), 6 deletions(-)  create mode
> > > 100644 MdeModulePkg/Include/Protocol/PartitionName.h
> > >
> > > diff --git a/MdeModulePkg/Include/Protocol/PartitionName.h
> > > b/MdeModulePkg/Include/Protocol/PartitionName.h
> > > new file mode 100644
> > > index 0000000..460ab27
> > > --- /dev/null
> > > +++ b/MdeModulePkg/Include/Protocol/PartitionName.h
> > > @@ -0,0 +1,42 @@
> > > +#ifndef __PARTITION_NAME_H__
> > > +#define __PARTITION_NAME_H__
> > > +
> > > +#include <Uefi/UefiSpec.h>
> > > +
> > > +#define EFI_PARTITION_NAME_PROTOCOL_GUID \
> > > +  { \
> > > +    0xf3287350, 0x384a, 0x44ec, {0x95, 0xcf, 0xdb, 0x4b, 0x86,
>
> > > +0x7c, 0x96,
>
> > > 0x8c } \
> > > +  }
> > > +
> > > +typedef struct _EFI_PARTITION_NAME_PROTOCOL
> > > +EFI_PARTITION_NAME_PROTOCOL;
> > > +
> > > +///
> > > +/// Protocol GUID name
> > > +///
> > > +#define PARTITION_NAME_PROTOCOL       EFI_PARTITION_NAME_PROTOCOL_GUID
> > > +
> > > +///
> > > +/// Protocol
> > > +///
> > > +typedef EFI_PARTITION_NAME_PROTOCOL   EFI_PARTITION_NAME;
> > > +
> > > +#define EFI_PARTITION_NAME_PROTOCOL_REVISION  0x00010000 #define
> > > +EFI_PARTITION_NAME_PROTOCOL_REVISION2 0x00020001 #define
> > > +EFI_PARTITION_NAME_PROTOCOL_REVISION3 0x00020031
> > > +
> > > +///
> > > +/// Revision
> > > +///
> > > +#define EFI_PARTITION_NAME_INTERFACE_REVISION
> > > EFI_PARTITION_NAME_PROTOCOL_REVISION
> > > +
> > > +///
> > > +///  This protocol provides the name of a partition /// struct
> > > +_EFI_PARTITION_NAME_PROTOCOL {
> > > +  CHAR16              Name[36];
> > > +};
> > > +
> > > +extern EFI_GUID gEfiPartitionNameProtocolGuid;
> > > +
> > > +#endif
> > > +
> > > diff --git a/MdeModulePkg/MdeModulePkg.dec
> > > b/MdeModulePkg/MdeModulePkg.dec index 5c1d29a..290ecaf 100644
> > > --- a/MdeModulePkg/MdeModulePkg.dec
> > > +++ b/MdeModulePkg/MdeModulePkg.dec
> > > @@ -449,6 +449,9 @@
> > >    ## Include/Protocol/SmmReadyToBoot.h
> > >    gEdkiiSmmReadyToBootProtocolGuid = { 0x6e057ecf, 0xfa99, 0x4f39,
> > > { 0x95, 0xbc, 0x59, 0xf9, 0x92, 0x1d, 0x17, 0xe4 } }
> > >
> > > +  ## Include/Protocol/PartitionName.h
> > > +  gEfiPartitionNameProtocolGuid    = { 0xf3287350, 0x384a, 0x44ec, {
> > 0x95,
> > > 0xcf, 0xdb, 0x4b, 0x86, 0x7c, 0x96, 0x8c } }
> > > +
> > >  #
> > >  # [Error.gEfiMdeModulePkgTokenSpaceGuid]
> > >  #   0x80000001 | Invalid value provided.
> > > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
> > > b/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
> > > index 2238449..094ef09 100644
> > > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
> > > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
> > > @@ -260,7 +260,8 @@ PartitionInstallElToritoChildHandles (
> > >                  Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),
> > >                  MultU64x32 (Catalog->Boot.Lba + CdDev.PartitionSize
> > > - 1, SIZE_2KB / Media->BlockSize),
> > >                  SubBlockSize,
> > > -                FALSE
> > > +                FALSE,
> > > +                NULL
> > >                  );
> > >        if (!EFI_ERROR (Status)) {
> > >          Found = EFI_SUCCESS;
> > > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> > > b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> > > index 3586051..6e1c4ea 100644
> > > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> > > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> > > @@ -410,7 +410,8 @@ PartitionInstallGptChildHandles (
> > >                 Entry->StartingLBA,
> > >                 Entry->EndingLBA,
> > >                 BlockSize,
> > > -               CompareGuid(&Entry->PartitionTypeGUID,
> > > &gEfiPartTypeSystemPartGuid)
> > > +               CompareGuid(&Entry->PartitionTypeGUID,
> > > &gEfiPartTypeSystemPartGuid),
> > > +               Entry->PartitionName
> > >                 );
> > >    }
> > >
> > > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
> > > b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
> > > index 4b0159c..c7fb51f 100644
> > > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
> > > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
> > > @@ -240,7 +240,8 @@ PartitionInstallMbrChildHandles (
> > >                  HdDev.PartitionStart,
> > >                  HdDev.PartitionStart + HdDev.PartitionSize - 1,
> > >                  MBR_SIZE,
> > > -                (BOOLEAN) (Mbr->Partition[Index].OSIndicator ==
> > > EFI_PARTITION)
> > > +                (BOOLEAN) (Mbr->Partition[Index].OSIndicator ==
> > > EFI_PARTITION),
> > > +                NULL
> > >                  );
> > >
> > >        if (!EFI_ERROR (Status)) {
> > > @@ -302,7 +303,8 @@ PartitionInstallMbrChildHandles (
> > >                   HdDev.PartitionStart - ParentHdDev.PartitionStart,
> > >                   HdDev.PartitionStart - ParentHdDev.PartitionStart
> > > + HdDev.PartitionSize - 1,
> > >                   MBR_SIZE,
> > > -                 (BOOLEAN) (Mbr->Partition[0].OSIndicator ==
> > > EFI_PARTITION)
> > > +                 (BOOLEAN) (Mbr->Partition[0].OSIndicator ==
> > > EFI_PARTITION),
> > > +                 NULL
> > >                   );
> > >        if (!EFI_ERROR (Status)) {
> > >          Found = EFI_SUCCESS;
> > > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > > b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > > index 89cc540..b2f41b5 100644
> > > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > > @@ -1060,6 +1060,7 @@ PartitionFlushBlocksEx (
> > >    @param[in]  End               End Block.
> > >    @param[in]  BlockSize         Child block size.
> > >    @param[in]  InstallEspGuid    Flag to install EFI System Partition
> > GUID
> > > on handle.
> > > +  @param[in]  PartitionName     Name of the partition if it was read
> > from
> > > GPT
> > >
> > >    @retval EFI_SUCCESS       A child handle was added.
> > >    @retval other             A child handle was not added.
> > > @@ -1078,7 +1079,8 @@ PartitionInstallChildHandle (
> > >    IN  EFI_LBA                      Start,
> > >    IN  EFI_LBA                      End,
> > >    IN  UINT32                       BlockSize,
> > > -  IN  BOOLEAN                      InstallEspGuid
> > > +  IN  BOOLEAN                      InstallEspGuid,
> > > +  IN  CHAR16                       *PartitionName
> > >    )
> > >  {
> > >    EFI_STATUS              Status;
> > > @@ -1160,6 +1162,11 @@ PartitionInstallChildHandle (
> > >      }
> > >    }
> > >
> > > +  Private->PartitionName.Name[0] = 0;  if (PartitionName != NULL) {
> > > +    CopyMem(Private->PartitionName.Name, PartitionName,
> > > sizeof(Private->PartitionName.Name));
> > > +  }
> > > +
> > >    Private->DevicePath     = AppendDevicePathNode (ParentDevicePath,
> > > DevicePathNode);
> > >
> > >    if (Private->DevicePath == NULL) { @@ -1189,6 +1196,8 @@
> > > PartitionInstallChildHandle (
> > >                      &Private->BlockIo,
> > >                      &gEfiBlockIo2ProtocolGuid,
> > >                      &Private->BlockIo2,
> > > +                    &gEfiPartitionNameProtocolGuid,
> > > +                    &Private->PartitionName,
> > >                      Private->EspGuid,
> > >                      NULL,
> > >                      NULL
> > > @@ -1200,6 +1209,8 @@ PartitionInstallChildHandle (
> > >                      Private->DevicePath,
> > >                      &gEfiBlockIoProtocolGuid,
> > >                      &Private->BlockIo,
> > > +                    &gEfiPartitionNameProtocolGuid,
> > > +                    &Private->PartitionName,
> > >                      Private->EspGuid,
> > >                      NULL,
> > >                      NULL
> > > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
> > > b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
> > > index 06470f6..12dce32 100644
> > > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
> > > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
> > > @@ -27,6 +27,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > > EITHER EXPRESS OR IMPLIED.
> > >  #include <Protocol/DriverBinding.h>  #include <Protocol/DiskIo.h>
> > > #include <Protocol/DiskIo2.h>
> > > +#include <Protocol/PartitionName.h>
> > >  #include <Library/DebugLib.h>
> > >  #include <Library/UefiDriverEntryPoint.h>  #include
> > > <Library/BaseLib.h> @@ -53,6 +54,7 @@ typedef struct {
> > >    EFI_BLOCK_IO2_PROTOCOL    BlockIo2;
> > >    EFI_BLOCK_IO_MEDIA        Media;
> > >    EFI_BLOCK_IO_MEDIA        Media2;//For BlockIO2
> > > +  EFI_PARTITION_NAME_PROTOCOL PartitionName;
> > >
> > >    EFI_DISK_IO_PROTOCOL      *DiskIo;
> > >    EFI_DISK_IO2_PROTOCOL     *DiskIo2;
> > > @@ -342,7 +344,8 @@ PartitionInstallChildHandle (
> > >    IN  EFI_LBA                      Start,
> > >    IN  EFI_LBA                      End,
> > >    IN  UINT32                       BlockSize,
> > > -  IN  BOOLEAN                      InstallEspGuid
> > > +  IN  BOOLEAN                      InstallEspGuid,
> > > +  IN  CHAR16                       *PartitionName
> > >    );
> > >
> > >  /**
> > > diff --git
> > > a/MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> > > b/MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> > > index 6806263..d9cfc95 100644
> > > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> > > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> > > @@ -52,6 +52,7 @@
> > >
> > >  [Packages]
> > >    MdePkg/MdePkg.dec
> > > +  MdeModulePkg/MdeModulePkg.dec
> > >
> > >
> > >  [LibraryClasses]
> > > @@ -84,6 +85,7 @@
> > >    gEfiDevicePathProtocolGuid
> > >    gEfiDiskIoProtocolGuid                        ## TO_START
> > >    gEfiDiskIo2ProtocolGuid                       ## TO_START
> > > +  gEfiPartitionNameProtocolGuid                 ## TO_START
> > >
> > >  [UserExtensions.TianoCore."ExtraFiles"]
> > >    PartitionDxeExtra.uni
> > > --
> > > 2.5.1
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel
> > >
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
> >
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>
>
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to