#pragma ident "@(#)gpt-label.txt 1.17 08/08/22 SMI" OBP GUID Partition Table (GPT) Support 1. Introduction. This document describes changes to the disk-label package in order to support booting from GPT labeled disks. The GPT label is defined in chapter 5 of the UEFI 2.10 Specification [4]. 1.1. References [1] IEEE 1275-1994: Standard for Boot (Initialization, Configuration) Firmware: Core Requirements and Practices. [2] IEEE 1275.1: Standard for Boot (Initialization, Configuration) Firmware: SPARC Binding [3] /ws/obp4.x-gate/obp/doc/sun4u/obp-info.doc Document describes additional file formats supported by the "load" user interface. This document adds elf32 and elf64 to [2] as supported file types for the load user interface. [4] Unified Extensible Firmware Interface (UEFI) Specification, Version 2.10, Dec 11, 2007. [5] RFC 4122 - A Universally Unique IDentifier (UUID) URN Namespace. Defines the GUID format used by [4]. 1.2 Definitions "disk-label" - Package defined by [1] used by block device drivers to interpret disk labels, including the Sun Label. GPT - GUID Partition Table - Disk label format defined by the UEFI Spec. The GPT label starts at LBA 1 on the media. The GPT label and its associated backup labels and partition tables are not part of any GPT-defined partition. GUID - Globally Unique ID - A 128-bit globally unique value as described in Appendix A of [4] and in RFC 4122. LBA - Logical Block Address - A method of disk block addressing, where the first block on the disk uses address 0, the next block uses address 1, and so on. Despite the name, LBA uses physical block numbers numbered from the beginning of the media. Sun Label - The current VTOC8 as defined in /usr/include/sys/dklabel.h The Sun Label exists in block 0 on the media. (There may also be backup locations on the media.) UEFI - Unified Extensible Firmware Interface 2. Existing Interfaces. 2.1 "disk-label" Package The "disk-label" package is defined in the Open Firmware core specification [1], with additional specification for supported boot block file formats in [2] and [3]. The current OpenBoot implementation for Sun machines supports the "Sun Label". The Sun label exists in logical block address (lba) 0, and defines up to 8 partitions, known as partitions 'a' - 'h', where 'a' is the first partition, 'b' the second partition, and so on. 2.1.1 "load" method Currently, the disk-label package's "load" method reads blocks 1 - 15 from within the booted partition into memory. The implementation supports the following file types as defined in [2] and [3]. The following file formats are currently supported: a) a.out as defined in [2]. b) 32-bit ELF header. [3] c) 64-bit ELF header. [3] d) FCode, if the first block starts with a valid FCode start byte and FCode header. e) Forth source, if the first block starts with the characters "\ ". Note that the entries (a) - (c) above are specific to implementations compliant with [2] and [3]. Other implementations might have their own ISA and platform specific bindings that might define a different set of supported file formats. 2.1.2. Compatibility All changes must be compatible with the interfaces defined in the previous sections. All changes must continue to support the Sun label. 3. GPT Label The GPT label effectively supports an unlimited number of partitions. The GPT partition table entries use 64-bit fields for starting LBAs and the length of each partition. Each GPT partition table entry contains a PartitionTypeGUID and a UniquePartitionGUID. The GUID field formats are defined by the specification. The PartitionTypeGUID uniquely identifies the filesystem type and the UniquePartitionGUID uniquely identifies a specific partition. 4. EFI System Partition The UEFI Specification also defines a "System Partition", in Section 12.2. The system partition has a unique PartitionTypeGUID and is basically a FAT32 (or FAT12 or FAT16 for removable media) partition with long filename support. The UEFI specification defines an extensible directory structure that may be used to store drivers, EFI applications, etc. 5. Proposal. This proposal modifies the definition of the "disk-label" package to add support for GPT labeled disks. The proposal also adds support for the FAT file system in order to locate "OS boot programs" in the EFI System Partition if a boot block for a given partition is not found in blocks 1 - 15 within the booted partition. 5.1. "disk-label" package "open" method changes open ( -- okay? ) M Additional requirements for the the disk-label's package "open" method: The following requirements have lower precedence than existing requirements for this method. Open Arguments: A comma separated list of zero or more of the following: [partition-identifier] [list] [nolabel] Where, partition-identifier, if present, must be the first argument and must be one of the forms described below. list is the literal string "list" list displays the partition table on the current output-device. The output format is implementation specific. Example Usage: ok " disk1:list" open-dev ?dup if close-dev then nolabel is the literal string "nolabel" nolabel is mutually exclusive with all other arguments and allows a client program to open the entire (raw) disk. Any disk label is ignored. If the disk has a GPT label, the partition-identifier shall be one of the following forms: 'a' - 'z': GPT Partition Table Array entry 0 - 25, respectively. A single letter in the range 'a' - 'z'. Input is case insensitive. Open the partition number named in the arguments, where 'a' is the first partition table entry (partition number 0), 'b' is the second partition table entry, ... and 'z' is the 26th partition table entry. If the partition exists and is valid, return TRUE, otherwise return FALSE. The canonical form is a single lower case letter in the range 'a' - 'z'. Example: disk:a : GPT Partition Table Array Entry A decimal number starting at 0. Leading zeroes are ignored. Open the partition table entry given by the decimal number in the first argument, where 0 is the first partition table entry, 1 is the second partition table entry, ... If the partition exists and is valid, return TRUE, otherwise return FALSE. The canonical form is a single letter in the range 'a' - 'z' if the opened partition is the first through 26th partition in the partition table entry array, where the letter 'a' represents the first entry in the partition table entry array, 'b' the second entry in the partition table entry array ... and 'z', the 26th entry in the partition table entry array, or a decimal number with leading zeros omitted if the partition is the 27th or higher entry in the partition table entry array. Note that the partion table entries are numbered starting at zero, thus the 27th entries canonical form is the decimal number 26. In other words disk:a and disk:0 refer to the same partition. Examples: disk:10 disk:0 {UniquePartitionGUID}: A UniquePartitionGUID as defined in [4] enclosed in braces using the format defined in section 5.1.1. Search the GPT Partition Table Entry Array for a partition matching the given UniquePartitionGUID. If a valid matching entry is found, that partition is opened and return TRUE. Otherwise, return FALSE. The canonical form is a single letter in the range 'a' - 'z' if the opened partition is the first through 26th partition in the partition table entry array, where the letter 'a' represents the first entry in the partition table entry array, 'b' the second entry in the partition table entry array ... and 'z', the 26th entry in the partition table entry array, or a decimal number with leading zeros omitted if the partition is the 27th or higher entry in the partition table entry array. Note that the partion table entries are numbered starting at zero, thus the 27th entries canonical form is the decimal number 26. In other words disk:a and disk:0 refer to the same partition. If the partition argument is omitted, the default partition is the first partition and the canonical form is 'a'. Note: The canonical forms described above are published in the /chosen node "bootpath" property. Note: This specification permits opening any GPT partition, however, booted client programs may limit the number of partitions they support. 5.1.1. GUID text format. This section defines the GUID text format accepted and generated by the firmware. A GUID is a series of hex values and dashes enclosed in braces, in the following form: {llllllll-mmmm-hhhh-cccc-nnnnnnnnnnnn} where: '{', '}' and '-' are the literal ASCII characters '{', '}' and '-', respectively. llllllll is the hex/ASCII representation of the time-low field. mmmm is the hex/ASCII representation of the time-mid field hhhh is the hex/ASCII representation of the time-hi and version field. cccc is the hex/ASCII representation of the clock sequence field. nnnnnnnnnnnn is the hex/ASCII representation of the node field. where all fields are as defined in [4], Appendix A. Leading zeros in each field shall not be omitted. Example: disk:{c12a7328-f81f-11d2-ba4b-00a0c93ec93b} All input fields are case-insensitive. All GUID text strings generated by the firmware for output or for generating filenames use lower case characters 'a'-'f' for hex/ASCII conversion. 5.2 "disk-label" package "load" method changes The current definition of the "load" method in [1] is: load ( addr -- len ) M This specification modifies the "disk-label" packages "load" method to return the value 0 if the method fails to find a loadable "boot block" or len, if the "load" method succeeds. Additional requirements to the "disk-label" package "load" method: If the disk contains a GPT label { If the partition size is > 1 block { Load block number 1 from the open partition, and check for one of the valid program types described in section 2.1.1 of this document (or as modified for other ISA and platform specific bindings.) If a valid boot block is found, load blocks 1 - 15 of of the partition (or less, if the partition contains less than 16 blocks) from the device into memory starting at addr, and return len, the size of the loaded program. } If the implementation includes optional support for an EFI System Partition reader (FAT32, for example) { Search for a GPT partition table entry with the PartitionTypeGUID for EFI System Partition equal to: c12a7328-f81f-11d2-ba4b-00a0c93ec93b If EFI System Partition found { Attempt to open the partition as a FAT32, FAT16 or FAT12 file system, if fail, exit this procedure and return the value 0. Attempt to locate a file in the following directories in the following order: /OF/LIB/FS/BOOT//{UniquePartitionGUID} /OF/LIB/FS/BOOT/{UniqueParitionGUID} /OF/LIB/FS/BOOT//{PartitionTypeGUID} /OF/LIB/FS/BOOT/{PartitionTypeGUID} Where is "sparc" for SPARC-based machines compliant with [2]. Where UniquePartitonGUID is the UniquePartitonGUID value from the originally opened partition (the partition that was open at the time the "load" method was invoked) in the form defined in section 5.1.1, using lower case hex/ASCII characters. Where PartitionTypeGUID is the PartitionTypeGUID value from the originally opened partition (the partition that was open at the time the "load" method was invoked) in the form defined in section 5.1.1, using lower case hex/ASCII characters. NB: The filename includes the surrounding braces. If the file named above can be located, load the named file into memory at addr and return the size of the program in len. } } } No loadable program could be found, thus the load method returns the value 0. 5.2.2. Properties An implementation of the "disk-label" package compliant with this specification shall publish the following property in the /packages/disk-label package: "gpt" S Standard property name to indicate that the package supports booting from GPT-labeled media. prop-encoded-array: Property contains no data. prop-encoded-array is NULL. Created as with: 0 0 " gpt" property Implementation Notes: The client program can check if the system supports booting booting from GPT-labeled disks if the "gpt" property exists in the "/packages/disk-label" node. If the property does not exist, the firmware on this system does not support booting from GPT-labeled disks. This property must be created even if the disk-label package was not used during boot. An implementation that includes optional support for the EFI System Partition reader shall publish the following property in the /packages/disk-label package: "efi-system-partition" Standard property name to indicate that the package supports the EFI System Partition reader. prop-encoded-array: Property contains no data. prop-encoded-array is NULL. Created as with: 0 0 " efi-system-partition" property 5.3. User Interface An implementation compliant with this specification that includes the Administrative Group user interface as defined in the core specification [1] shall implement the user interface methods defined in the following sections. 5.3.1. show-partitions show-partitions ( "device-specifier" -- ) Display the partition table for the specified device. Parse device-specifier delimited by end of line. Properly append the option string "list" to the device-specifier allowing other optional option strings to be present in device-specifier. Perform the equivalent of: open-dev ?dup if close-dev then with the modified device-specifier including the "list" option as as an argument. If a partition identifier is present in device-specifier, the information for that partition is displayed. If no partition identifier is present, the information for all partitions is displayed. The output format is implementation specific. The results are undefined if device-specifier's open method is not implemented by the "disk-label" package. See also: "list" open method argument in section 5.1.