Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
| 3 | part command |
Heinrich Schuchardt | b214e88 | 2023-10-28 11:59:32 +0200 | [diff] [blame^] | 4 | ============ |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 5 | |
| 6 | Synopis |
| 7 | ------- |
| 8 | |
| 9 | :: |
| 10 | |
| 11 | part uuid <interface> <dev>:<part> [varname] |
| 12 | part list <interface> <dev> [flags] [varname] |
| 13 | part start <interface> <dev> <part> <varname> |
| 14 | part size <interface> <dev> <part> <varname> |
| 15 | part number <interface> <dev> <part> <varname> |
Simon Glass | 125194e | 2023-07-15 21:38:47 -0600 | [diff] [blame] | 16 | part set <interface> <dev> <part> <type> |
Enric Balletbo i Serra | 22e7f1d | 2023-01-10 17:19:34 +0100 | [diff] [blame] | 17 | part type <interface> <dev>:<part> [varname] |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 18 | part types |
| 19 | |
| 20 | Description |
| 21 | ----------- |
| 22 | |
| 23 | The `part` command is used to manage disk partition related commands. |
| 24 | |
| 25 | The 'part uuid' command prints or sets an environment variable to partition UUID |
| 26 | |
| 27 | interface |
| 28 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 29 | dev |
| 30 | device number |
| 31 | part |
| 32 | partition number |
| 33 | varname |
| 34 | an optional environment variable to store the current partition UUID value into. |
| 35 | |
| 36 | The 'part list' command prints or sets an environment variable to the list of partitions |
| 37 | |
| 38 | interface |
| 39 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 40 | dev |
| 41 | device number |
| 42 | part |
| 43 | partition number |
| 44 | flags |
| 45 | -bootable |
| 46 | lists only bootable partitions |
| 47 | varname |
| 48 | an optional environment variable to store the list of partitions value into. |
| 49 | |
| 50 | The 'part start' commnad sets an environment variable to the start of the partition (in blocks), |
| 51 | part can be either partition number or partition name. |
| 52 | |
| 53 | interface |
| 54 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 55 | dev |
| 56 | device number |
| 57 | part |
| 58 | partition number |
| 59 | varname |
| 60 | a variable to store the current start of the partition value into. |
| 61 | |
| 62 | The 'part size' command sets an environment variable to the size of the partition (in blocks), |
| 63 | part can be either partition number or partition name. |
| 64 | |
| 65 | interface |
| 66 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 67 | dev |
| 68 | device number |
| 69 | part |
| 70 | partition number |
| 71 | varname |
| 72 | a variable to store the current size of the partition value into. |
| 73 | |
| 74 | The 'part number' command sets an environment variable to the partition number using the partition name, |
| 75 | part must be specified as partition name. |
| 76 | |
| 77 | interface |
| 78 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 79 | dev |
| 80 | device number |
| 81 | part |
| 82 | partition number |
| 83 | varname |
| 84 | a variable to store the current partition number value into |
| 85 | |
Simon Glass | 125194e | 2023-07-15 21:38:47 -0600 | [diff] [blame] | 86 | The 'part set' command sets the type of a partition. This is useful when |
| 87 | autodetection fails or does not do the correct thing: |
| 88 | |
| 89 | interface |
| 90 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 91 | dev |
| 92 | device number |
| 93 | part |
| 94 | partition number |
| 95 | type |
| 96 | partition type to use (see 'part types') to check available types |
| 97 | |
Enric Balletbo i Serra | 22e7f1d | 2023-01-10 17:19:34 +0100 | [diff] [blame] | 98 | The 'part type' command prints or sets an environment variable to the partition type UUID. |
| 99 | |
| 100 | interface |
| 101 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 102 | dev |
| 103 | device number |
| 104 | part |
| 105 | partition number |
| 106 | varname |
| 107 | a variable to store the current partition type UUID value into |
| 108 | |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 109 | The 'part types' command list supported partition table types. |
| 110 | |
| 111 | Examples |
| 112 | -------- |
| 113 | |
| 114 | :: |
| 115 | |
| 116 | => host bind 0 ./test_gpt_disk_image.bin |
| 117 | => part uuid host 0:1 |
| 118 | 24156b69-3378-497f-bb3e-b982223de528 |
| 119 | => part uuid host 0:1 varname |
| 120 | => env print varname |
| 121 | varname=24156b69-3378-497f-bb3e-b982223de528 |
| 122 | => |
| 123 | => part list host 0 |
| 124 | |
| 125 | Partition Map for HOST device 0 -- Partition Type: EFI |
| 126 | |
| 127 | Part Start LBA End LBA Name |
| 128 | Attributes |
| 129 | Type GUID |
| 130 | Partition GUID |
| 131 | 1 0x00000800 0x00000fff "second" |
| 132 | attrs: 0x0000000000000000 |
| 133 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 134 | (data) |
| 135 | guid: 24156b69-3378-497f-bb3e-b982223de528 |
| 136 | 2 0x00001000 0x00001bff "first" |
| 137 | attrs: 0x0000000000000000 |
| 138 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 139 | (data) |
| 140 | guid: 5272ee44-29ab-4d46-af6c-4b45ac67d3b7 |
| 141 | => |
| 142 | => part start host 0 2 varname |
| 143 | => env print varname |
| 144 | varname=1000 |
| 145 | => |
| 146 | => part size host 0 2 varname |
| 147 | => env print varname |
| 148 | varname=c00 |
| 149 | => |
| 150 | => part number host 0 2 varname |
| 151 | => env print varname |
| 152 | varname=0x2 |
| 153 | => |
Enric Balletbo i Serra | 22e7f1d | 2023-01-10 17:19:34 +0100 | [diff] [blame] | 154 | => part type host 0:1 |
| 155 | ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 156 | => part type host 0:1 varname |
| 157 | => env print varname |
| 158 | varname=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 159 | => |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 160 | => part types |
| 161 | Supported partition tables: EFI, AMIGA, DOS, ISO, MAC |
| 162 | |
Simon Glass | 125194e | 2023-07-15 21:38:47 -0600 | [diff] [blame] | 163 | This shows looking at a device with multiple partition tables:: |
| 164 | |
| 165 | => virtio scan |
| 166 | => part list virtio 0 |
| 167 | |
| 168 | Partition Map for VirtIO device 0 -- Partition Type: EFI |
| 169 | |
| 170 | Part Start LBA End LBA Name |
| 171 | Attributes |
| 172 | Type GUID |
| 173 | Partition GUID |
| 174 | 1 0x00000040 0x0092b093 "ISO9660" |
| 175 | attrs: 0x1000000000000001 |
| 176 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 177 | guid: a0891d7e-b930-4513-94d8-f629dbd637b2 |
| 178 | 2 0x0092b094 0x0092d7e7 "Appended2" |
| 179 | attrs: 0x0000000000000000 |
| 180 | type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b |
| 181 | guid: a0891d7e-b930-4513-94db-f629dbd637b2 |
| 182 | 3 0x0092d7e8 0x0092da3f "Gap1" |
| 183 | attrs: 0x1000000000000001 |
| 184 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 185 | guid: a0891d7e-b930-4513-94da-f629dbd637b2 |
| 186 | => ls virtio 0:3 |
| 187 | => part types |
| 188 | Supported partition tables: EFI, DOS, ISO |
| 189 | => part set virtio 0 dos |
| 190 | |
| 191 | Partition Map for VirtIO device 0 -- Partition Type: DOS |
| 192 | |
| 193 | Part Start Sector Num Sectors UUID Type |
| 194 | 1 1 9624191 00000000-01 ee |
| 195 | => part set virtio 0 iso |
| 196 | |
| 197 | Partition Map for VirtIO device 0 -- Partition Type: ISO |
| 198 | |
| 199 | Part Start Sect x Size Type |
| 200 | 1 3020 4 512 U-Boot |
| 201 | 2 9613460 10068 512 U-Boot |
| 202 | => part set virtio 0 efi |
| 203 | |
| 204 | Partition Map for VirtIO device 0 -- Partition Type: EFI |
| 205 | |
| 206 | Part Start LBA End LBA Name |
| 207 | Attributes |
| 208 | Type GUID |
| 209 | Partition GUID |
| 210 | 1 0x00000040 0x0092b093 "ISO9660" |
| 211 | attrs: 0x1000000000000001 |
| 212 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 213 | guid: a0891d7e-b930-4513-94d8-f629dbd637b2 |
| 214 | 2 0x0092b094 0x0092d7e7 "Appended2" |
| 215 | attrs: 0x0000000000000000 |
| 216 | type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b |
| 217 | guid: a0891d7e-b930-4513-94db-f629dbd637b2 |
| 218 | 3 0x0092d7e8 0x0092da3f "Gap1" |
| 219 | attrs: 0x1000000000000001 |
| 220 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 221 | guid: a0891d7e-b930-4513-94da-f629dbd637b2 |
| 222 | => |
| 223 | |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 224 | Return value |
| 225 | ------------ |
| 226 | |
| 227 | The return value $? is set to 0 (true) if the command succededd. If an |
| 228 | error occurs, the return value $? is set to 1 (false). |