Hi!
This patch adds support for BIOS Boot partition [1] in GPT. It is exposed to
the user as "boot_bios" flag.
Marking partitions as bootable by BIOS allows bootloaders to know they can put
their code in them (much as they would in the 63 sector gap that DOS labels used
to provide).
GRUB 2 already embeds itself in this area whenever found (as of current CVS).
[1] Not to be confused with hybrid MBR-GPT hacks! ;-)
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
diff -ur parted-1.7.1.old/include/parted/disk.h parted-1.7.1/include/parted/disk.h
--- parted-1.7.1.old/include/parted/disk.h 2006-05-25 19:28:43.000000000 +0200
+++ parted-1.7.1/include/parted/disk.h 2008-02-18 20:33:22.000000000 +0100
@@ -64,9 +64,10 @@
PED_PARTITION_PALO=9,
PED_PARTITION_PREP=10,
PED_PARTITION_MSFT_RESERVED=11
+ PED_PARTITION_BOOT_BIOS=12,
} PedPartitionFlag;
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_MSFT_RESERVED
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_BOOT_BIOS
typedef enum {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff -ur parted-1.7.1.old/libparted/disk.c parted-1.7.1/libparted/disk.c
--- parted-1.7.1.old/libparted/disk.c 2006-05-25 19:29:06.000000000 +0200
+++ parted-1.7.1/libparted/disk.c 2008-02-18 20:40:22.000000000 +0100
@@ -2145,6 +2145,8 @@
switch (flag) {
case PED_PARTITION_BOOT:
return N_("boot");
+ case PED_PARTITION_BOOT_BIOS:
+ return N_("boot_bios");
case PED_PARTITION_ROOT:
return N_("root");
case PED_PARTITION_SWAP:
diff -ur parted-1.7.1.old/libparted/labels/gpt.c parted-1.7.1/libparted/labels/gpt.c
--- parted-1.7.1.old/libparted/labels/gpt.c 2007-03-06 10:08:52.000000000 +0100
+++ parted-1.7.1/libparted/labels/gpt.c 2008-02-18 20:43:20.000000000 +0100
@@ -84,6 +84,10 @@
((efi_guid_t) { PED_CPU_TO_LE32 (0xC12A7328), PED_CPU_TO_LE16 (0xF81F), \
PED_CPU_TO_LE16 (0x11d2), 0xBA, 0x4B, \
{ 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B }})
+#define PARTITION_BOOT_BIOS_GUID \
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0x21686148), PED_CPU_TO_LE16 (0x6449), \
+ PED_CPU_TO_LE16 (0x6E6f), 0x74, 0x4E, \
+ { 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 }})
#define LEGACY_MBR_PARTITION_GUID \
((efi_guid_t) { PED_CPU_TO_LE32 (0x024DEE41), PED_CPU_TO_LE16 (0x33E7), \
PED_CPU_TO_LE16 (0x11d3, 0x9D, 0x69, \
@@ -1126,6 +1130,10 @@
gpt_part_data->type = PARTITION_SYSTEM_GUID;
return 1;
}
+ if (gpt_part_data->boot_bios) {
+ gpt_part_data->type = PARTITION_BOOT_BIOS_GUID;
+ return 1;
+ }
if (gpt_part_data->hp_service) {
gpt_part_data->type = PARTITION_HPSERVICE_GUID;
return 1;
@@ -1221,6 +1229,16 @@
if (state)
gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->boot_bios
+ = gpt_part_data->hp_service
+ = gpt_part_data->msftres = 0;
+ return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_BOOT_BIOS:
+ gpt_part_data->boot_bios = state;
+ if (state)
+ gpt_part_data->raid
+ = gpt_part_data->lvm
+ = gpt_part_data->boot
= gpt_part_data->hp_service
= gpt_part_data->msftres = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1229,6 +1247,7 @@
if (state)
gpt_part_data->boot
= gpt_part_data->lvm
+ = gpt_part_data->boot_bios
= gpt_part_data->hp_service
= gpt_part_data->msftres = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1237,6 +1256,7 @@
if (state)
gpt_part_data->boot
= gpt_part_data->raid
+ = gpt_part_data->boot_bios
= gpt_part_data->hp_service
= gpt_part_data->msftres = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1246,6 +1266,7 @@
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->boot_bios
= gpt_part_data->msftres = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_RESERVED:
@@ -1254,6 +1275,7 @@
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->boot_bios
= gpt_part_data->hp_service = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HIDDEN:
@@ -1282,6 +1304,8 @@
return gpt_part_data->lvm;
case PED_PARTITION_BOOT:
return gpt_part_data->boot;
+ case PED_PARTITION_BOOT_BIOS:
+ return gpt_part_data->boot_bios;
case PED_PARTITION_HPSERVICE:
return gpt_part_data->hp_service;
case PED_PARTITION_MSFT_RESERVED:
@@ -1305,6 +1329,7 @@
case PED_PARTITION_RAID:
case PED_PARTITION_LVM:
case PED_PARTITION_BOOT:
+ case PED_PARTITION_BOOT_BIOS:
case PED_PARTITION_HPSERVICE:
case PED_PARTITION_MSFT_RESERVED:
case PED_PARTITION_HIDDEN:
_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel