All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: u-boot@lists.denx.de
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [PATCH v2 2/8] doc: Add gpt command documentation
Date: Wed, 23 Aug 2023 10:47:38 -0600	[thread overview]
Message-ID: <20230823164755.2874792-3-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20230823164755.2874792-1-JPEWhacker@gmail.com>

Adds initial documentation for the gpt command

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 doc/usage/cmd/gpt.rst | 139 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 doc/usage/cmd/gpt.rst

diff --git a/doc/usage/cmd/gpt.rst b/doc/usage/cmd/gpt.rst
new file mode 100644
index 0000000000..ea2cf73a60
--- /dev/null
+++ b/doc/usage/cmd/gpt.rst
@@ -0,0 +1,139 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+gpt command
+===========
+
+Synopsis
+--------
+
+::
+
+    gpt repair <interface> <device no>
+    gpt write <interface> <device no> <partition string>
+    gpt verify <interface> <device no> <partition string>
+    gpt setenv <interface> <device no> <partition name>
+    gpt enumerate <interface> <device no>
+    gpt guid <interface> <device no> [<varname>]
+    gpt read <interface> <device no> [<varname>]
+    gpt swap <interface> <dev> <name1> <name2>
+    gpt rename <interface> <dev> <part> <name>
+
+Description
+-----------
+
+The gpt command lets users read, create, modify, or verify the GPT (GUID
+Partition Table) partition layout. 
+
+The syntax of the text description of the partition list is similar to
+the one used by the 'mbr' command.
+
+The partition list may start with a set of parameters for the whole disk:
+
+* uuid_disk (the UUID of the disk)
+
+Following the disk parameters, partitions are specified separated by a ';'.
+Supported partition parameters are:
+
+* name (required)
+* start (required, partition start offset in bytes)
+* size (in bytes or '-' to expand it to the whole free area)
+* bootable (boolean flag)
+* uuid (partition UUID, optional if CONFIG_RANDOM_UUID=y is enabled)
+* type (partition type GUID, requires CONFIG_PARTITION_TYPE_GUID=y)
+
+Here is an example how to create a 6 partitions, some of the predefined sizes:
+
+::
+
+    => setenv gpt_parts 'uuid_disk=bec9fc2a-86c1-483d-8a0e-0109732277d7;
+        name=boot,start=4M,size=128M,bootable,type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7,
+        name=rootfs,size=3072M,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;
+        name=system-data,size=512M,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;
+        name=[ext],size=-,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;
+        name=user,size=-,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;
+        name=modules,size=100M,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;
+        name=ramdisk,size=8M,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
+    => gpt write mmc 0 $gpt_parts
+
+
+If 'uuid' is not specified, but CONFIG_RANDOM_UUID is enabled, a random UUID
+will be generated for the partition
+
+The 'gpt verify' command returns 0 if the layout matches the one on the storage
+device or 1 if not. To check if the layout on the MMC #0 storage device
+matches the provided text description one has to issue following command:
+
+::
+
+    => gpt verify mmc 0 $gpt_parts
+
+The verify sub-command is especially useful in the system update scripts:
+
+::
+
+    => if gpt verify mmc 0 $gpt_parts; then
+         echo GPT layout needs to be updated
+         ...
+       fi
+
+The 'gpt write' command returns 0 on success write or 1 on failure.
+
+The 'gpt setenv' command will set a series of environment variables with
+information about a particular partition. The variables are:
+
+* gpt_partition_addr (the starting offset of the partition, in hexadecimal blocks)
+* gpt_partition_size (the size of the partition, in hexadecimal blocks)
+* gpt_partition_name (the name of the partition)
+* gpt_partition_entry (the partition number in the table, e.g. 1, 2, 3, etc.)
+
+To get the information about the partition named 'rootfs', issue the following
+command:
+
+::
+    => gpt setenv mmc 0 rootfs
+    => echo ${gpt_partition_addr}
+    2000
+    => echo ${gpt_partition_size}
+    14a000
+    => echo ${gpt_partition_name}
+    rootfs
+    => echo ${gpt_partition_entry}
+    2
+
+The 'gpt enumerate' command will set the variable 'gpt_partition_list' with the
+list of partition names on the device. For example:
+
+::
+    => gpt enumerate
+    => echo gpt_partition_list
+    boot rootfs system-data [ext] user modules ramdisk
+
+The 'gpt guid' command will report the GUID of a disk. If 'varname' is
+specified, the command will set the variable to the GUID, otherwise it will be
+printed out. For example:
+
+::
+    => gpt guid mmc 0
+    bec9fc2a-86c1-483d-8a0e-0109732277d7
+    => gpt guid mmc gpt_disk_uuid
+    => echo ${gpt_disk_uuid}
+    bec9fc2a-86c1-483d-8a0e-0109732277d7
+
+The 'gpt read' command will print out the current state of the GPT partition
+table. If 'varname' is specified, the variable will be filled with a partition
+string as described above that is suitable for passing to other 'gpt' commands.
+If omitted, a human readable description is printed out.
+CONFIG_CMD_GPT_RENAME=y is required.
+
+The 'gpt swap' command changes the names of all partitions that are named
+'name1' to be 'name2', and all partitions named 'name2' to be 'name1'.
+CONFIG_CMD_GPT_RENAME=y is required.
+
+The 'gpt rename' command renames all partitions named 'part' to be 'name1'.
+CONFIG_CMD_GPT_RENAME=y is required.
+
+Configuration
+-------------
+
+To use the 'gpt' command you must specify CONFIG_CMD_GPT=y. To enable 'gpt
+read', 'gpt swap' and 'gpt rename', you must specify CONFIG_CMD_GPT_RENAME=y.
-- 
2.33.0


  parent reply	other threads:[~2023-08-23 16:48 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 16:26 [PATCH 0/6] cmd: gpt: GPT manipulation improvements Joshua Watt
2023-08-15 16:26 ` [PATCH 1/6] cmd: gpt: Remove confusing help text Joshua Watt
2023-08-18 14:23   ` Tom Rini
2023-08-23 23:57   ` Simon Glass
2023-08-15 16:26 ` [PATCH 2/6] cmd: gpt: Add command to set bootable flags Joshua Watt
2023-08-15 18:39   ` Simon Glass
2023-08-15 16:26 ` [PATCH 3/6] cmd: gpt: Add gpt_partition_bootable variable Joshua Watt
2023-08-15 16:26 ` [PATCH 4/6] cmd: gpt: Preserve type GUID if enabled Joshua Watt
2023-08-15 16:26 ` [PATCH 5/6] cmd: gpt: Preserve bootable flag Joshua Watt
2023-08-15 16:27 ` [PATCH 6/6] cmd: gpt: Add command to swap partition order Joshua Watt
2023-08-23 23:57   ` Simon Glass
2023-08-23 16:47 ` [PATCH v2 0/8] cmd: gpt: GPT manipulation improvements Joshua Watt
2023-08-23 16:47   ` [PATCH v2 1/8] cmd: gpt: Remove confusing help text Joshua Watt
2023-08-23 18:15     ` Tom Rini
2023-08-23 16:47   ` Joshua Watt [this message]
2023-08-23 18:15     ` [PATCH v2 2/8] doc: Add gpt command documentation Tom Rini
2023-08-23 23:57     ` Simon Glass
2023-08-23 16:47   ` [PATCH v2 3/8] tests: gpt: Remove test order dependency Joshua Watt
2023-08-23 23:57     ` Simon Glass
2023-08-24  3:29       ` Joshua Watt
2023-08-23 16:47   ` [PATCH v2 4/8] cmd: gpt: Add gpt_partition_bootable variable Joshua Watt
2023-08-23 23:57     ` Simon Glass
2023-08-23 16:47   ` [PATCH v2 5/8] cmd: gpt: Add command to set bootable flags Joshua Watt
2023-08-23 23:57     ` Simon Glass
2023-08-23 16:47   ` [PATCH v2 6/8] cmd: gpt: Preserve type GUID if enabled Joshua Watt
2023-08-23 23:57     ` Simon Glass
2023-08-23 16:47   ` [PATCH v2 7/8] cmd: gpt: Preserve bootable flag Joshua Watt
2023-08-23 23:57     ` Simon Glass
2023-08-23 16:47   ` [PATCH v2 8/8] cmd: gpt: Add command to swap partition order Joshua Watt
2023-08-25 19:38   ` [PATCH v3 0/8] cmd: gpt: GPT manipulation improvements Joshua Watt
2023-08-25 19:38     ` [PATCH v3 1/8] cmd: gpt: Remove confusing help text Joshua Watt
2023-08-25 19:38     ` [PATCH v3 2/8] doc: Add gpt command documentation Joshua Watt
2023-08-25 23:53       ` Simon Glass
2023-08-28 21:52         ` Joshua Watt
2023-08-26  1:57       ` Heinrich Schuchardt
2023-08-28 19:29         ` Joshua Watt
2023-08-28 20:01           ` Heinrich Schuchardt
2023-08-28 21:01             ` Joshua Watt
2023-08-25 19:38     ` [PATCH v3 3/8] tests: gpt: Remove test order dependency Joshua Watt
2023-08-25 19:38     ` [PATCH v3 4/8] cmd: gpt: Add gpt_partition_bootable variable Joshua Watt
2023-08-25 23:53       ` Simon Glass
2023-08-25 19:38     ` [PATCH v3 5/8] cmd: gpt: Add command to set bootable flags Joshua Watt
2023-08-25 19:38     ` [PATCH v3 6/8] cmd: gpt: Preserve type GUID if enabled Joshua Watt
2023-08-25 23:53       ` Simon Glass
2023-08-26  0:37       ` Heinrich Schuchardt
2023-08-25 19:38     ` [PATCH v3 7/8] cmd: gpt: Preserve bootable flag Joshua Watt
2023-08-25 19:38     ` [PATCH v3 8/8] cmd: gpt: Add command to swap partition order Joshua Watt
2023-08-25 23:53       ` Simon Glass
2023-08-26  1:00       ` Heinrich Schuchardt
2023-08-28 21:56     ` [PATCH v4 0/8] cmd: gpt: GPT manipulation improvements Joshua Watt
2023-08-28 21:56       ` [PATCH v4 1/8] cmd: gpt: Remove confusing help text Joshua Watt
2023-08-28 22:05         ` Heinrich Schuchardt
2023-08-28 21:56       ` [PATCH v4 2/8] doc: Add gpt command documentation Joshua Watt
2023-08-28 22:45         ` Heinrich Schuchardt
2023-08-28 22:59           ` Heinrich Schuchardt
2023-08-29 13:22             ` Joshua Watt
2023-08-28 21:56       ` [PATCH v4 3/8] tests: gpt: Remove test order dependency Joshua Watt
2023-08-28 21:56       ` [PATCH v4 4/8] cmd: gpt: Add gpt_partition_bootable variable Joshua Watt
2023-08-28 21:56       ` [PATCH v4 5/8] cmd: gpt: Add command to set bootable flags Joshua Watt
2023-08-28 22:54         ` Heinrich Schuchardt
2023-08-29 13:24           ` Joshua Watt
2023-08-28 21:56       ` [PATCH v4 6/8] cmd: gpt: Preserve type GUID if enabled Joshua Watt
2023-08-28 21:56       ` [PATCH v4 7/8] cmd: gpt: Preserve bootable flag Joshua Watt
2023-08-28 21:56       ` [PATCH v4 8/8] cmd: gpt: Add command to swap partition order Joshua Watt
2023-08-31 16:51       ` [PATCH v5 0/8] cmd: gpt: GPT manipulation improvements Joshua Watt
2023-08-31 16:51         ` [PATCH v5 1/8] cmd: gpt: Remove confusing help text Joshua Watt
2023-08-31 16:51         ` [PATCH v5 2/8] doc: Add gpt command documentation Joshua Watt
2023-08-31 16:51         ` [PATCH v5 3/8] tests: gpt: Remove test order dependency Joshua Watt
2023-09-12 15:17           ` Tom Rini
2023-08-31 16:51         ` [PATCH v5 4/8] cmd: gpt: Add gpt_partition_bootable variable Joshua Watt
2023-08-31 16:51         ` [PATCH v5 5/8] cmd: gpt: Add command to set bootable flags Joshua Watt
2023-08-31 16:51         ` [PATCH v5 6/8] cmd: gpt: Preserve type GUID if enabled Joshua Watt
2023-08-31 16:51         ` [PATCH v5 7/8] cmd: gpt: Preserve bootable flag Joshua Watt
2023-08-31 16:51         ` [PATCH v5 8/8] cmd: gpt: Add command to swap partition order Joshua Watt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230823164755.2874792-3-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.