Control: retitle -1 u-boot-sunxi: Allow u-boot-install-sunxi on GPT

Hi all,

I discovered the GPT vs U-Boot overlapping issue while using the Debian installer because the default disk label (partition table) type defined in partman-partitioning is GPT on EFI or arm64 platforms. I intend to submit patches against partman-partitioning to set MSDOS as default if GPT would overwrite U-Boot, but it would be nice if u-boot-install-sunxi could use the GPT-friendly alternate boot location on platforms which support it.

On Sun, 3 Dec 2023 12:19:38 +0100 [email protected] wrote:
On 2019-05-08 07:34 UTC, Domenico Andreoli wrote:
Salsa MR #6 adds support for GPT partition tables with up to 4 entries
to u-boot-install-sunxi64.

I think that as long as the partition entry size is the standard 128 bytes
it's OK to have up to 56 entries, because the total size of MBR + GPT header +
GPT entries still doesn't exceed 8K. u-boot-install-sunxi does already work
with such a GPT if the user specifies the -f option.

Right, but the partition entry array offset and even the partition entry size are defined in the GPT header and may vary. A safe non-overlapping requirement check should be:

(u-boot offset >= partition entry array offset + (partition entry size * partition entry count)) or (partition array offset >= U-Boot offset + image size)

But it would be good if the script could support a standard-sized GPT, and a
possible way is suggested by this note in doc/board/allwinner/sunxi.rst:

  The traditional SD card location the Allwinner BootROM loads from is 8KB
  (sector 16). This works fine with the old MBR partitioning scheme, which most
  SD cards come formatted with. However this is in the middle of a potential
  GPT partition table, which will become invalid in this step. Newer SoCs
  (starting with the H3 from late 2014) also support booting from 128KB, which
  is beyond even a GPT and thus a safer location.

True with H3, A64, H5 and H6 but H616 (and maybe other SOCs) set the alternate boot location at 256KiB instead of 128KiB. I do not see any image for this SoC in u-boot-sunxi packages though.

So perhaps there could be a new command-line option that made dd write to 128K
instead of 8K, and the error message upon detecting a GPT could suggest using
that option. I've suggested a simple patch below. (It assumes that the GPT
doesn't extend beyond 128K.)

Or/and maybe the offset could be automatically selected based on the SoC model ?

Reply via email to