git: b162fc3f3094 - main - gpart: Add u-boot-env alias for U-Boot's environment GPT partition UUID

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Mon, 02 Sep 2024 22:22:04 UTC
The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=b162fc3f3094c50c8ed47ab50981c5448cf0052c

commit b162fc3f3094c50c8ed47ab50981c5448cf0052c
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-09-02 22:21:18 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2024-09-02 22:21:18 +0000

    gpart: Add u-boot-env alias for U-Boot's environment GPT partition UUID
    
    This is a platform-independent UUID, and this is the name U-Boot uses.
    
    MFC after:      1 week
---
 lib/geom/part/gpart.8      | 7 ++++++-
 sys/geom/part/g_part.c     | 1 +
 sys/geom/part/g_part.h     | 1 +
 sys/geom/part/g_part_gpt.c | 2 ++
 sys/sys/disk/gpt.h         | 3 +++
 5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/lib/geom/part/gpart.8 b/lib/geom/part/gpart.8
index fa0b247c6174..121e6d6a5119 100644
--- a/lib/geom/part/gpart.8
+++ b/lib/geom/part/gpart.8
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd July 26, 2023
+.Dd September 2, 2024
 .Dt GPART 8
 .Os
 .Sh NAME
@@ -1008,6 +1008,11 @@ A illumos/Solaris partition dedicated to reserved space.
 The scheme-specific type is
 .Qq Li "!6a945a3b-1dd2-11b2-99a6-080020736631"
 for GPT.
+.It Cm u-boot-env
+A raw partition dedicated to U-Boot for storing its environment.
+The scheme-specific type is
+.Qq Li "!3de21764-95bd-54bd-a5c3-4abe786f38a8"
+for GPT.
 .It Cm vmware-vmfs
 A partition that contains a VMware File System (VMFS).
 The scheme-specific types are
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c
index f0807c83dacf..d72efa09c46d 100644
--- a/sys/geom/part/g_part.c
+++ b/sys/geom/part/g_part.c
@@ -130,6 +130,7 @@ struct g_part_alias_list {
         { "solaris-home", G_PART_ALIAS_SOLARIS_HOME },
         { "solaris-altsec", G_PART_ALIAS_SOLARIS_ALTSEC },
 	{ "solaris-reserved", G_PART_ALIAS_SOLARIS_RESERVED },
+	{ "u-boot-env", G_PART_ALIAS_U_BOOT_ENV },
 	{ "vmware-reserved", G_PART_ALIAS_VMRESERVED },
 	{ "vmware-vmfs", G_PART_ALIAS_VMFS },
 	{ "vmware-vmkdiag", G_PART_ALIAS_VMKDIAG },
diff --git a/sys/geom/part/g_part.h b/sys/geom/part/g_part.h
index ffeeca9022fe..13bbb1e4126a 100644
--- a/sys/geom/part/g_part.h
+++ b/sys/geom/part/g_part.h
@@ -103,6 +103,7 @@ enum g_part_alias {
 	G_PART_ALIAS_SOLARIS_HOME,	/* A Solaris /home partition entry. */
 	G_PART_ALIAS_SOLARIS_ALTSEC,	/* A Solaris alternate sector partition entry. */
 	G_PART_ALIAS_SOLARIS_RESERVED,	/* A Solaris reserved partition entry. */
+	G_PART_ALIAS_U_BOOT_ENV,	/* A U-Boot environment partition entry. */
 	G_PART_ALIAS_VMFS,		/* A VMware VMFS partition entry */
 	G_PART_ALIAS_VMKDIAG,		/* A VMware vmkDiagnostic partition entry */
 	G_PART_ALIAS_VMRESERVED,	/* A VMware reserved partition entry */
diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
index b269faee276c..a856a34f99d9 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -223,6 +223,7 @@ static struct uuid gpt_uuid_solaris_var = GPT_ENT_TYPE_SOLARIS_VAR;
 static struct uuid gpt_uuid_solaris_home = GPT_ENT_TYPE_SOLARIS_HOME;
 static struct uuid gpt_uuid_solaris_altsec = GPT_ENT_TYPE_SOLARIS_ALTSEC;
 static struct uuid gpt_uuid_solaris_reserved = GPT_ENT_TYPE_SOLARIS_RESERVED;
+static struct uuid gpt_uuid_u_boot_env = GPT_ENT_TYPE_U_BOOT_ENV;
 static struct uuid gpt_uuid_unused = GPT_ENT_TYPE_UNUSED;
 static struct uuid gpt_uuid_vmfs = GPT_ENT_TYPE_VMFS;
 static struct uuid gpt_uuid_vmkdiag = GPT_ENT_TYPE_VMKDIAG;
@@ -295,6 +296,7 @@ static struct g_part_uuid_alias {
 	{ &gpt_uuid_solaris_home,	G_PART_ALIAS_SOLARIS_HOME,	 0 },
 	{ &gpt_uuid_solaris_altsec,	G_PART_ALIAS_SOLARIS_ALTSEC,	 0 },
 	{ &gpt_uuid_solaris_reserved,	G_PART_ALIAS_SOLARIS_RESERVED,	 0 },
+	{ &gpt_uuid_u_boot_env,		G_PART_ALIAS_U_BOOT_ENV,	 0 },
 	{ &gpt_uuid_vmfs,		G_PART_ALIAS_VMFS,		 0 },
 	{ &gpt_uuid_vmkdiag,		G_PART_ALIAS_VMKDIAG,		 0 },
 	{ &gpt_uuid_vmreserved,		G_PART_ALIAS_VMRESERVED,	 0 },
diff --git a/sys/sys/disk/gpt.h b/sys/sys/disk/gpt.h
index 596a5cba1681..426ae835c0c1 100644
--- a/sys/sys/disk/gpt.h
+++ b/sys/sys/disk/gpt.h
@@ -259,6 +259,9 @@ CTASSERT(sizeof(struct gpt_ent) == 128);
 #define GPT_ENT_TYPE_HIFIVE_BBL		\
 	{0x2e54b353,0x1271,0x4842,0x80,0x6f,{0xe4,0x36,0xd6,0xaf,0x69,0x85}}
 
+#define GPT_ENT_TYPE_U_BOOT_ENV		\
+	{0x3de21764,0x95bd,0x54bd,0xa5,0xc3,{0x4a,0xbe,0x78,0x6f,0x38,0xa8}}
+
 /*
  * Boot partition used by GRUB 2.
  */