patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Cc: Yuriy Nesterov <yuriy.nesterov@unikie.com>,
	Ville Ilvonen <ville.ilvonen@unikie.com>,
	Samuel Dionne-Riel <samuel@dionne-riel.com>
Subject: Re: [PATCH] scripts/make-gpt.sh: reserve 8 MiB at start of GPT
Date: Sun, 28 Aug 2022 16:49:57 +0000	[thread overview]
Message-ID: <20220828164957.p3743hvijjrkm66b@x220.qyliss.net> (raw)
In-Reply-To: <20220826130923.1840670-1-hi@alyssa.is>

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

On Fri, Aug 26, 2022 at 01:09:25PM +0000, Alyssa Ross wrote:
> In some cases (e.g. a product built on Spectrum where updates to both
> firmware and OS are delivered by the same vendor), it makes sense to
> include firmware in the same image as the OS.  This firmware tends to
> live in the start of the image, after the GPT header.  (The exact
> location varies by board.)
>
> The 1 MiB reserved by sfdisk by default is not enough for this.  The
> conventional value seems to be 8 MiB.  On NixOS, this is configurable
> with the sdImage.firmwarePartitionOffset option, but this defaults to
> 8 MiB and I wasn't able to find any examples in searches on DuckDuckGo
> and GitHub of anybody using any other value, so it looks like 8 MiB is
> broadly acceptable.

Update: following some discussion in #spectrum, I'm now aware of a
couple of changes we'd want to make if we went down this path:

 * We should use a "protective partition" in the GPT to identify
   firmware regions, rather than just offsetting the first partition,
   so it's clearer that that space is there and what it's used for, as
   described in the Embedded Boot Base Requirements (EBBR) spec[1].

 * 8 MiB isn't enough for all boards.  Specifically, with Rockchip +
   mainline U-Boot, the U-Boot image _starts_ at 8 MiB, so we'd want to
   reserve at least 16 MiB, and possibly more for forward compatibility.

But another approach that was identified, that might work better, would
be for "ports" of Spectrum that want to install firmware in the same
image to just make their own GPTs, with space reserved for firmware as
required, and copy the partitions from the Spectrum image into this new
partition table.  This way, we can avoid trying to find a
one-size-fits-all solution to a problem that varies by platform, and
avoid introducing configuration knobs unnecessarily.  In Spectrum,
partitions are always identified by UUID anyway, so it wouldn't matter
if a downstream or end user moves them around as required.  And we'll
need to end up doing something like this at some point _anyway_, because
to support dual boot setups our installer would need to be able to copy
Spectrum partitions into place on the user's existing GPT.

So I think that should be the path forward for Spectrum product images:
have a script that creates a GPT, adds a partition for the platform
firmware, then copies all the partitions from the Spectrum images into
place after it.

But as always, I'm open to further discussion if there's a problem with
this approach. :)

[1]: https://arm-software.github.io/ebbr/index.html#partitioning-of-shared-storage

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-08-28 16:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26 13:09 Alyssa Ross
2022-08-28 16:49 ` Alyssa Ross [this message]
2022-09-26 15:06 ` Ville Ilvonen

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=20220828164957.p3743hvijjrkm66b@x220.qyliss.net \
    --to=hi@alyssa.is \
    --cc=devel@spectrum-os.org \
    --cc=samuel@dionne-riel.com \
    --cc=ville.ilvonen@unikie.com \
    --cc=yuriy.nesterov@unikie.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

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