X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=doc%2FREADME.gpt;h=ec0156d8aa9b8073555bbe00f5836f4e0883fe1c;hb=79cbecb81ba8ed05ca890587f6eead0555c90293;hp=a9c58b4c9662166ae79555c16f6414513326666a;hpb=7528cf5f016b5b8b8b12b373f6f31a10bf89233d;p=karo-tx-uboot.git diff --git a/doc/README.gpt b/doc/README.gpt index a9c58b4c96..ec0156d8aa 100644 --- a/doc/README.gpt +++ b/doc/README.gpt @@ -4,24 +4,7 @@ # Lukasz Majewski # # -# See file CREDITS for list of people who contributed to this -# project. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA - +# SPDX-License-Identifier: GPL-2.0+ Glossary: ======== @@ -38,7 +21,6 @@ Introduction: This document describes the GPT partition table format and usage of the gpt command in u-boot. - UUID introduction: ==================== @@ -84,17 +66,16 @@ GPT brief explanation: |Partition n | | | ---------------------------------------------------------- - LBA -34 |Entry 1|Entry 2| Entry 3| Entry 4| Secondary - -------------------------------------------------- (bkp) - LBA -33 |Entries 5 - 128 | GPT + LBA -34 |Entry 1|Entry 2| Entry 3| Entry 4| Backup + -------------------------------------------------- GPT + LBA -33 |Entries 5 - 128 | | | | | LBA -2 | | -------------------------------------------------- - LBA -1 |Secondary GPT Header | + LBA -1 |Backup GPT Header | ---------------------------------------------------------- - For a legacy reasons, GPT's LBA 0 sector has a MBR structure. It is called "protective MBR". Its first partition entry ID has 0xEE value, and disk software, which is not @@ -105,7 +86,7 @@ It is possible to define 128 linearly placed partition entries. "LBA -1" means the last addressable block (in the mmc subsystem: "dev_desc->lba - 1") -Primary/Secondary GPT header: +Primary/Backup GPT header: ---------------------------- Offset Size Description @@ -130,12 +111,11 @@ Offset Size Description TOTAL: 512 B - IMPORTANT: GPT headers and partition entries are protected by CRC32 (the POSIX CRC32). -Primary GPT header and Secondary GPT header have swapped values of "Current LBA" +Primary GPT header and Backup GPT header have swapped values of "Current LBA" and "Backup LBA" and therefore different CRC32 check-sum. CRC32 for GPT headers (field "CRC of header") are calculated up till @@ -145,16 +125,15 @@ CRC32 for partition entries (field "CRC32 of partition array") is calculated for the whole array entry ( Number_of_partition_entries * sizeof(partition_entry_size (usually 128))) -Observe, how Secondary GPT is placed in the memory. It is NOT a mirror reflect +Observe, how Backup GPT is placed in the memory. It is NOT a mirror reflect of the Primary. - Partition Entry Format: ---------------------- Offset Size Description - 0 16 B Partition type GUID - 16 16 B Unique partition GUID + 0 16 B Partition type GUID (Big Endian) + 16 16 B Unique partition GUID in (Big Endian) 32 8 B First LBA (Little Endian) 40 8 B Last LBA (inclusive) 48 8 B Attribute flags [+] @@ -166,7 +145,6 @@ of the Primary. Bit 62 - Hidden Bit 63 - Not mount - Creating GPT partitions in U-Boot: ============== @@ -182,20 +160,31 @@ To restore GUID partition table one needs to: Fields 'name', 'size' and 'uuid' are mandatory for every partition. The field 'start' is optional. + option: CONFIG_RANDOM_UUID + If any partition "UUID" no exists then it is randomly generated. + 2. Define 'CONFIG_EFI_PARTITION' and 'CONFIG_CMD_GPT' 2. From u-boot prompt type: gpt write mmc 0 $partitions - Useful info: ============ -Two programs, namely: 'fdisk' and 'parted' are recommended to work with GPT -recovery. Parted is able to handle GUID partitions. Unfortunately the 'fdisk' -hasn't got such ability. +Two programs, namely: 'gdisk' and 'parted' are recommended to work with GPT +recovery. Both are able to handle GUID partitions. Please, pay attention at -l switch for parted. "uuid" program is recommended to generate UUID string. Moreover it can decode (-d switch) passed in UUID string. It can be used to generate partitions UUID passed to u-boot environment variables. +If optional CONFIG_RANDOM_UUID is defined then for any partition which environment +uuid is unset, uuid is randomly generated and stored in correspond environment +variable. + +note: +Each string block of UUID generated by program "uuid" is in big endian and it is +also stored in big endian in disk GPT. +Partitions layout can be printed by typing "mmc part". Note that each partition +GUID has different byte order than UUID generated before, this is because first +three blocks of GUID string are in Little Endian.