summaryrefslogtreecommitdiff
path: root/doc/usage/cmd/gpt.rst
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2023-08-31 10:51:41 -0600
committerTom Rini <trini@konsulko.com>2023-09-11 16:27:49 -0400
commit7cc1d87d7e1e64d7bb280ead94c55a51c4f3ee63 (patch)
treeb25b1f678e1a30d0ac3f8b02a8fb4c3791ba39d2 /doc/usage/cmd/gpt.rst
parent648140f77aff55d3bab072166a88ef179c474524 (diff)
downloadu-boot-7cc1d87d7e1e64d7bb280ead94c55a51c4f3ee63.tar.gz
u-boot-7cc1d87d7e1e64d7bb280ead94c55a51c4f3ee63.tar.bz2
u-boot-7cc1d87d7e1e64d7bb280ead94c55a51c4f3ee63.zip
cmd: gpt: Add command to swap partition order
Adds a command called "gpt transpose" which will swap the order two partition table entries in the GPT partition table (but leaves them pointing to the same locations on disk). This can be useful for swapping bootloaders in systems that use an A/B partitioning scheme where the bootrom is hard coded to look for the bootloader in a specific index in the GPT partition table. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'doc/usage/cmd/gpt.rst')
-rw-r--r--doc/usage/cmd/gpt.rst25
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/usage/cmd/gpt.rst b/doc/usage/cmd/gpt.rst
index 288dd365c0..f6115ecb0e 100644
--- a/doc/usage/cmd/gpt.rst
+++ b/doc/usage/cmd/gpt.rst
@@ -16,6 +16,7 @@ Synopsis
gpt set-bootable <interface> <dev> <partition list>
gpt setenv <interface> <dev> <partition name>
gpt swap <interface> <dev> <name1> <name2>
+ gpt transpose <interface> <dev> <part1> <part2>
gpt verify <interface> <dev> [<partition string>]
gpt write <interface> <dev> <partition string>
@@ -126,6 +127,13 @@ 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.
+gpt transpose
+~~~~~~~~~~~~~
+
+Swaps the order of two partition table entries with indexes 'part1' and 'part2'
+in the partition table, but otherwise leaves the actual partition data
+untouched.
+
gpt verify
~~~~~~~~~~
@@ -199,3 +207,20 @@ Get the GUID for a disk::
Set the bootable flag for the 'boot' partition and clear it for all others::
=> gpt set-bootable mmc 0 boot
+
+Swap the order of the 'boot' and 'rootfs' partition table entries::
+ => gpt setenv mmc 0 rootfs
+ => echo ${gpt_partition_entry}
+ 2
+ => gpt setenv mmc 0 boot
+ => echo ${gpt_partition_entry}
+ 1
+
+ => gpt transpose mmc 0 1 2
+
+ => gpt setenv mmc 0 rootfs
+ => echo ${gpt_partition_entry}
+ 1
+ => gpt setenv mmc 0 boot
+ => echo ${gpt_partition_entry}
+ 2