NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

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



>Number:         38094
>Category:       bin
>Synopsis:       [PATCH] support "BIOS Boot" partition type in gpt(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 23 23:05:00 +0000 2008
>Originator:     Robert Millan
>Release:        
>Organization:
>Environment:
>Description:
This patch adds support to gpt(8) partition editor for BIOS Boot Partition.

This partition type 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:
diff -ur src/sbin/gpt/gpt.c src.new/sbin/gpt/gpt.c
--- src/sbin/gpt/gpt.c  2007-12-28 20:53:10.000000000 +0100
+++ src.new/sbin/gpt/gpt.c      2008-02-23 21:56:35.000000000 +0100
@@ -280,6 +280,13 @@
                return (0);
 
        switch (*s) {
+       case 'b':
+               if (strcmp(s, "bios") == 0) {
+                       uuid_t bios = GPT_ENT_TYPE_BIOS;
+                       *uuid = bios;
+                       return (0);
+               }
+               break;
        case 'c':
                if (strcmp(s, "ccd") == 0) {
                        uuid_t ccd = GPT_ENT_TYPE_NETBSD_CCD;
diff -ur src/sbin/gpt/show.c src.new/sbin/gpt/show.c
--- src/sbin/gpt/show.c 2007-12-28 20:53:10.000000000 +0100
+++ src.new/sbin/gpt/show.c     2008-02-23 21:57:21.000000000 +0100
@@ -62,6 +62,7 @@
 friendly(uuid_t *t)
 {
        static uuid_t efi_slice = GPT_ENT_TYPE_EFI;
+       static uuid_t bios_boot = GPT_ENT_TYPE_BIOS;
        static uuid_t mslinux = GPT_ENT_TYPE_MS_BASIC_DATA;
        static uuid_t freebsd = GPT_ENT_TYPE_FREEBSD;
        static uuid_t hfs = GPT_ENT_TYPE_APPLE_HFS;
@@ -84,6 +85,8 @@
 
        if (uuid_equal(t, &efi_slice, NULL))
                return ("EFI System");
+       if (uuid_equal(t, &bios_boot, NULL))
+               return ("BIOS Boot");
        if (uuid_equal(t, &nb_swap, NULL))
                return ("NetBSD swap");
        if (uuid_equal(t, &nb_ufs, NULL))
diff -ur src/sys/sys/disklabel_gpt.h src.new/sys/sys/disklabel_gpt.h
--- src/sys/sys/disklabel_gpt.h 2007-12-28 20:53:09.000000000 +0100
+++ src.new/sys/sys/disklabel_gpt.h     2008-02-23 21:57:32.000000000 +0100
@@ -148,4 +148,10 @@
 #define        GPT_ENT_TYPE_APPLE_HFS          \
        {0x48465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
 
+/*
+ * Used by GRUB 2.
+ */
+#define GPT_ENT_TYPE_BIOS              \
+       {0x21686148,0x6449,0x6e6f,0x74,0x4e,{0x65,0x65,0x64,0x45,0x46,0x49}}
+
 #endif /* _SYS_DISKLABEL_GPT_H_ */



Home | Main Index | Thread Index | Old Index