This patch makes fdisk -A preserve BIOS boot partition.

When PolarFire SoC boots, the Hart Software Services (HSS) firmware
loads HSS payload that contains U-Boot (and possibly OpenSBI) from eMMC
or SD card.

If there is a valid GPT header, the payload is loaded from GPT partition
with type 21686148-6449-6e6f-744e-656564454649 (BIOS boot). If the
partition is not found, HSS tries loading from sector 0.

When installing OpenBSD, the HSS payload should be preserved.
Overwriting it would essentially brick the boot medium.

The GUID type 21686148-6449-6e6f-744e-656564454649 was originally (?)
used by GRUB. The HSS' reuse of the GUID feels unfortunate.

If this change is acceptable, the next step is to modify the installer.

Index: sbin/fdisk/fdisk.8
===================================================================
RCS file: src/sbin/fdisk/fdisk.8,v
retrieving revision 1.108
diff -u -p -r1.108 fdisk.8
--- sbin/fdisk/fdisk.8  26 Nov 2021 03:31:38 -0000      1.108
+++ sbin/fdisk/fdisk.8  31 Jan 2022 14:50:08 -0000
@@ -65,6 +65,7 @@ all existing partitions except the boot 
 .Sq APFS ISC ,
 .Sq APFS ,
 .Sq APFS Recovry ,
+.Sq BIOS Boot ,
 .Sq HiFive FSBL
 and
 .Sq HiFive BBL .
Index: sbin/fdisk/part.c
===================================================================
RCS file: src/sbin/fdisk/part.c,v
retrieving revision 1.113
diff -u -p -r1.113 part.c
--- sbin/fdisk/part.c   27 Jan 2022 16:26:32 -0000      1.113
+++ sbin/fdisk/part.c   31 Jan 2022 14:50:08 -0000
@@ -152,7 +152,7 @@ const struct gpt_type               gpt_types[] = {
        { 0x07, 0, "NTFS        ", "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7" },
        { 0x0B, 0, "FAT32       ", "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7" },
        { 0x0C, 0, "FAT32L      ", "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7" },
-       { 0x0D, 0, "BIOS Boot   ", "21686148-6449-6e6f-744e-656564454649" },
+       { 0x0D, 1, "BIOS Boot   ", "21686148-6449-6e6f-744e-656564454649" },
        { 0x0E, 0, "FAT16L      ", "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7" },
        { 0x11, 0, "OS/2 hidden ", "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7" },
        { 0x14, 0, "OS/2 hidden ", "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7" },

Reply via email to