All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Robinson <pbrobinson@gmail.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: trini@konsulko.com, sjg@chromium.org,
	ilias.apalodimas@linaro.org,  u-boot@lists.denx.de
Subject: Re: [PATCH] disk: dos: Add all options for EFI System Partitions
Date: Mon, 19 Feb 2024 10:53:22 +0000	[thread overview]
Message-ID: <CALeDE9OPB5XSPvHKXJd-TXgd+gkBTBeji-hWpRTNQBppLz1OEw@mail.gmail.com> (raw)
In-Reply-To: <878r3gn44l.fsf@bloch.sibelius.xs4all.nl>

On Mon, 19 Feb 2024 at 10:24, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>
> > From: Peter Robinson <pbrobinson@gmail.com>
> > Date: Mon, 19 Feb 2024 09:12:15 +0000
> >
> > The EFI spec states that the ESP can be any of FAT12/16/32 but for
> > compatibility doesn't necssarily require the partition to be the
> > EFI partition table ID of 0xef. A number of arm devices will not
> > find their firmware on a FAT partition with an ID of 0xef so also
> > allow the original FAT12/16/32 partition IDs as they are also
> > permissable for an ESP.
>
> Hi Peter,
>
> Any reason not to include 0x0c as well?  That is what we use on
> OpenBSD/armv7 and OpenBSD/arm64.  And as far as I know all UEFI
> implementations (on arm64 at least) boot from such a partition.

I wasn't 100% the support with LBA so I erred with caution, but no
reason I can't add it.

> (And yes, we use that partition type because we want to have a
> bootable image that works on the various Raspberry Pi models).

Yes, that is the same reason for us, plus a few other random other Arm
devices that won't recognise EF as VFAT and won't boot.

> That said, what problem does this fix?  And what happens if we have
> both a 0xea and a 0x01/0x06/0x0b/0x0c partition?  In that case U-Boot
> should probably prefer the 0xea over the others as the ESP.

The reason is because the support to write EFI vars on ESP, and yes I
realise it's got security issues but for most boards it's the least of
their problem, as the support won't do that without the flag and you
get a bunch of these on boot:

No EFI system partition
Failed to persist EFI variables

As for multiple partitions UEFI should handle that and I believe the
EFI var support has logic around which partition it chooses.

> Oh, and while your're at it, the hex constants are a bit inconsistent
> (0x1/0x6 vs. 0x0b).

Will fix with v2 when I add 0x0c, I'll await other feedback for a bit.

Thanks,
Peter

> Cheers,
>
> Mark
>
> > Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
> > ---
> >  disk/part_dos.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/disk/part_dos.c b/disk/part_dos.c
> > index 567ead7511d..303eb1d13ee 100644
> > --- a/disk/part_dos.c
> > +++ b/disk/part_dos.c
> > @@ -40,6 +40,12 @@ static int get_bootable(dos_partition_t *p)
> >  {
> >       int ret = 0;
> >
> > +     if (p->sys_ind == 0x1)
> > +             ret |= PART_EFI_SYSTEM_PARTITION;
> > +     if (p->sys_ind == 0x6)
> > +             ret |= PART_EFI_SYSTEM_PARTITION;
> > +     if (p->sys_ind == 0x0b)
> > +             ret |= PART_EFI_SYSTEM_PARTITION;
> >       if (p->sys_ind == 0xef)
> >               ret |= PART_EFI_SYSTEM_PARTITION;
> >       if (p->boot_ind == 0x80)
> > --
> > 2.43.1
> >
> >

  reply	other threads:[~2024-02-19 10:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19  9:12 [PATCH] disk: dos: Add all options for EFI System Partitions Peter Robinson
2024-02-19 10:24 ` Mark Kettenis
2024-02-19 10:53   ` Peter Robinson [this message]
2024-02-19 12:58     ` Ilias Apalodimas

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=CALeDE9OPB5XSPvHKXJd-TXgd+gkBTBeji-hWpRTNQBppLz1OEw@mail.gmail.com \
    --to=pbrobinson@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.