bin/120990: [PATCH] support "BIOS Boot" partition type in gpt(8)

Robert Millan rmh at aybabtu.com
Sat Feb 23 12:20:01 UTC 2008


>Number:         120990
>Category:       bin
>Synopsis:       [PATCH] support "BIOS Boot" partition type in gpt(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 23 12:20:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Robert Millan
>Release:        
>Organization:
>Environment:
>Description:

This patch adds support to gpt(8) partition editor for BIOS Boot Partition.

This partition type is roughly equivalent to FreeBSD Boot; it is used by GRUB 2 and aimed at standarization.  More details at:

  http://en.wikipedia.org/wiki/BIOS_Boot_Partition_(GPT)

>How-To-Repeat:

>Fix:
Patch attached.

Patch attached with submission follows:

diff -ur src/sbin/gpt/gpt.c src.new/sbin/gpt/gpt.c
--- src/sbin/gpt/gpt.c	2008-01-30 14:29:10.000000000 +0100
+++ src.new/sbin/gpt/gpt.c	2008-02-23 13:02:32.000000000 +0100
@@ -275,6 +275,12 @@
 			return (0);
 		}
 		break;
+		if (strcmp(s, "bios_boot") == 0) {
+			uuid_t bios_boot = GPT_ENT_TYPE_BIOS_BOOT;
+			*uuid = bios_boot;
+			return (0);
+		}
+		break;
 	case 'e':
 		if (strcmp(s, "efi") == 0) {
 			uuid_t efi = GPT_ENT_TYPE_EFI;
diff -ur src/sbin/gpt/show.c src.new/sbin/gpt/show.c
--- src/sbin/gpt/show.c	2008-02-06 00:37:42.000000000 +0100
+++ src.new/sbin/gpt/show.c	2008-02-23 13:00:25.000000000 +0100
@@ -55,6 +55,7 @@
 friendly(uuid_t *t)
 {
 	static uuid_t boot = GPT_ENT_TYPE_FREEBSD_BOOT;
+	static uuid_t bios_boot = GPT_ENT_TYPE_BIOS_BOOT;
 	static uuid_t efi_slice = GPT_ENT_TYPE_EFI;
 	static uuid_t mslinux = GPT_ENT_TYPE_MS_BASIC_DATA;
 	static uuid_t freebsd = GPT_ENT_TYPE_FREEBSD;
@@ -75,6 +76,8 @@
 		return ("EFI System");
 	if (uuid_equal(t, &boot, NULL))
 		return ("FreeBSD boot");
+	if (uuid_equal(t, &bios_boot, NULL))
+		return ("BIOS boot");
 	if (uuid_equal(t, &swap, NULL))
 		return ("FreeBSD swap");
 	if (uuid_equal(t, &ufs, NULL))
diff -ur src/sys/sys/gpt.h src.new/sys/sys/gpt.h
--- src/sys/sys/gpt.h	2007-10-24 23:32:56.000000000 +0200
+++ src.new/sys/sys/gpt.h	2008-02-23 13:00:25.000000000 +0100
@@ -120,4 +120,11 @@
 #define	GPT_ENT_TYPE_APPLE_HFS		\
 	{0x48465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
 
+/*
+ * Same functionality as GPT_ENT_TYPE_FREEBSD_BOOT.  Used for others such as
+ * GRUB 2, but aimed at standarization.
+ */
+#define	GPT_ENT_TYPE_BIOS_BOOT		\
+	{0x21686148,0x6449,0x6e6f,0x74,0x4e,{0x65,0x65,0x64,0x45,0x46,0x49}}
+
 #endif /* _SYS_GPT_H_ */


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list