[PATCH 1/3] partitions: efi: Allow to create barebox environment partition

Sascha Hauer s.hauer at pengutronix.de
Mon Feb 19 06:51:57 PST 2024


We have a GUID for partitions to use for barebox environment. Add an
option for parted to create these.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 commands/parted.c       | 2 +-
 common/partitions/efi.c | 3 +++
 include/efi/partition.h | 3 +++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/commands/parted.c b/commands/parted.c
index 02bb1cff0c..6af18cdc57 100644
--- a/commands/parted.c
+++ b/commands/parted.c
@@ -360,7 +360,7 @@ BAREBOX_CMD_HELP_TEXT("")
 BAREBOX_CMD_HELP_TEXT("<unit> can be one of \"s\" (sectors), \"B\" (bytes), \"kB\", \"MB\", \"GB\", \"TB\",")
 BAREBOX_CMD_HELP_TEXT("\"KiB\", \"MiB\", \"GiB\" or \"TiB\"")
 BAREBOX_CMD_HELP_TEXT("<type> must be \"gpt\"")
-BAREBOX_CMD_HELP_TEXT("<fstype> can be one of  \"ext2\", \"ext3\", \"ext4\", \"fat16\" or \"fat32\"")
+BAREBOX_CMD_HELP_TEXT("<fstype> can be one of  \"ext2\", \"ext3\", \"ext4\", \"fat16\", \"fat32\" or \"bbenv\"")
 BAREBOX_CMD_HELP_TEXT("<name> for MBR partition tables can be one of \"primary\", \"extended\" or")
 BAREBOX_CMD_HELP_TEXT("\"logical\". For GPT this is a name string.")
 BAREBOX_CMD_HELP_END
diff --git a/common/partitions/efi.c b/common/partitions/efi.c
index 67d4978244..d102370b24 100644
--- a/common/partitions/efi.c
+++ b/common/partitions/efi.c
@@ -559,6 +559,7 @@ static __maybe_unused struct partition_desc *efi_partition_create_table(struct b
 
 static guid_t partition_linux_data_guid = PARTITION_LINUX_DATA_GUID;
 static guid_t partition_basic_data_guid = PARTITION_BASIC_DATA_GUID;
+static guid_t partition_barebox_env_gui = PARTITION_BAREBOX_ENVIRONMENT_GUID;
 
 static const guid_t *fs_type_to_guid(const char *fstype)
 {
@@ -572,6 +573,8 @@ static const guid_t *fs_type_to_guid(const char *fstype)
 		return &partition_basic_data_guid;
 	if (!strcmp(fstype, "fat32"))
 		return &partition_basic_data_guid;
+	if (!strcmp(fstype, "bbenv"))
+		return &partition_barebox_env_gui;
 
 	return NULL;
 }
diff --git a/include/efi/partition.h b/include/efi/partition.h
index 40ff4c557f..184b4fd961 100644
--- a/include/efi/partition.h
+++ b/include/efi/partition.h
@@ -57,6 +57,9 @@
 #define PARTITION_LINUX_LVM_GUID \
 	GUID_INIT( 0xe6d6d379, 0xf507, 0x44c2, \
 		0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28)
+#define PARTITION_BAREBOX_ENVIRONMENT_GUID \
+	GUID_INIT( 0x6c3737f2, 0x07f8, 0x45d1, \
+		0xad, 0x45, 0x15, 0xd2, 0x60, 0xaa, 0xb2, 0x4d)
 
 /* based on linux/include/genhd.h */
 struct legacy_partition {
-- 
2.39.2




More information about the barebox mailing list