shithub: riscv

Download patch

ref: 42484b6ef276f6c69b58712a19ffdfa3d64d1a21
parent: 52c6b751c07b8de53479a311bd372eabe763052d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun May 31 15:30:38 EDT 2015

disk/fdisk: learn about EFI system partition (type 0xEF), honor protective mbr (type 0xEE)

efi systems may use traditional dos partition table
with an esp (efi system partition). otherwise, honor
the protective mbr partition (0xEE) and exit when we
encounter it.

--- a/sys/src/cmd/disk/prep/fdisk.c
+++ b/sys/src/cmd/disk/prep/fdisk.c
@@ -239,6 +239,10 @@
 	TypeDellRecovery= 0xDE,
 	TypeSPEEDSTOR12	= 0xE1,
 	TypeSPEEDSTOR16	= 0xE4,
+
+	TypeGPT		= 0xEE,		/* protective MBR */
+	TypeESP		= 0xEF,		/* EFI system partition */
+
 	TypeLANSTEP	= 0xFE,
 
 	Type9		= 0x39,
@@ -319,6 +323,10 @@
 	[TypeDellRecovery]	{ "DELLRECOVERY", "dell" },
 	[TypeSPEEDSTOR12]	{ "SPEEDSTOR12", "speedstor" },
 	[TypeSPEEDSTOR16]	{ "SPEEDSTOR16", "speedstor" },
+
+	[TypeGPT]		{ "GPT", "" },
+	[TypeESP]		{ "ESP", "esp" },
+
 	[TypeLANSTEP]		{ "LANSTEP", "lanstep" },
 
 	[Type9]			{ "PLAN9", "plan9" },
@@ -515,6 +523,9 @@
 		case TypeLINUXEXT:
 			rdpart(edit, xbase, xbase+getle32(tp->xlba), tp->type);
 			break;
+		case TypeGPT:
+			fprint(2, "disk uses GPT partition format, use disk/edisk\n");
+			exits("gptformat");
 		default:
 			p = mkpart(nil, ebrstart+getle32(tp->xlba), getle32(tp->xsize), tp, ebrstart, ebrtype);
 			if(err = addpart(edit, p))