Sean Anderson | 21e8476 | 2021-02-05 09:39:02 -0500 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | .. _partitions: |
| 3 | |
| 4 | Partitions |
| 5 | ========== |
| 6 | |
| 7 | Synopsis |
| 8 | -------- |
| 9 | |
| 10 | :: |
| 11 | |
| 12 | <command> <interface> [devnum][.hwpartnum][:partnum|#partname] |
| 13 | |
| 14 | Description |
| 15 | ----------- |
| 16 | |
| 17 | Many U-Boot commands allow specifying partitions (or whole disks) using a |
| 18 | generic syntax. |
| 19 | |
| 20 | interface |
| 21 | The interface used to access the partition's device, like ``mmc`` or |
| 22 | ``scsi``. For a full list of supported interfaces, consult the |
Simon Glass | fada3f9 | 2022-09-17 09:00:09 -0600 | [diff] [blame] | 23 | ``uclass_idname_str`` array in ``drivers/block/blk-uclass.c`` |
Sean Anderson | 21e8476 | 2021-02-05 09:39:02 -0500 | [diff] [blame] | 24 | |
| 25 | devnum |
| 26 | The device number. This defaults to 0. |
| 27 | |
| 28 | hwpartnum |
| 29 | The hardware partition number. All devices have at least one hardware |
| 30 | partition. On most devices, hardware partition 0 specifies the whole |
| 31 | device. On eMMC devices, hardware partition 0 is the user partition, |
| 32 | hardware partitions 1 and 2 are the boot partitions, hardware partition |
| 33 | 3 is the RPMB partition, and further partitions are general-purpose |
| 34 | user-created partitions. The default hardware partition number is 0. |
| 35 | |
| 36 | partnum |
| 37 | The partition number, starting from 1. The partition number 0 specifies |
| 38 | that the whole device is to be used as one "partition." |
| 39 | |
| 40 | partname |
| 41 | The partition name. This is the partition label for GPT partitions. For |
| 42 | MBR partitions, the following syntax is used:: |
| 43 | |
| 44 | <devtype><devletter><partnum> |
| 45 | |
| 46 | devtype |
Heinrich Schuchardt | d02a76c7 | 2024-03-29 13:01:00 +0100 | [diff] [blame] | 47 | The devtype field is set in dependence of the device class: |
| 48 | |
| 49 | ======= =============== |
| 50 | devtype device class |
| 51 | ======= =============== |
| 52 | hd IDE or SATA |
| 53 | sd SCSI |
| 54 | usbd USB |
| 55 | mmcsd eMMC or SD-card |
| 56 | xx others |
| 57 | ======= =============== |
| 58 | |
| 59 | See the ``part_set_generic_name`` function in ``disk/part.c`` |
| 60 | for the complete list. |
Sean Anderson | 21e8476 | 2021-02-05 09:39:02 -0500 | [diff] [blame] | 61 | |
| 62 | devletter |
| 63 | The device number as an offset from ``a``. For example, device |
| 64 | number 2 would have a device letter of ``c``. |
| 65 | |
| 66 | partnum |
| 67 | The partition number. This is the same as above. |
| 68 | |
| 69 | If neither ``partname`` nor ``partnum`` is specified and there is a partition |
| 70 | table, then partition 1 is used. If there is no partition table, then the whole |
| 71 | device is used as one "partition." If none of ``devnum``, ``hwpartnum``, |
| 72 | ``partnum``, or ``partname`` is specified, or only ``-`` is specified, then |
| 73 | ``devnum`` defaults to the value of the ``bootdevice`` environmental variable. |
| 74 | |
| 75 | Examples |
| 76 | -------- |
| 77 | |
| 78 | List the root directory contents on MMC device 2, hardware partition 1, |
| 79 | and partition number 3:: |
| 80 | |
| 81 | ls mmc 2.1:3 / |
| 82 | |
| 83 | Load ``/kernel.itb`` to address ``0x80000000`` from SCSI device 0, hardware partition |
| 84 | 0, and the partition labeled ``boot``:: |
| 85 | |
| 86 | load scsi #boot 0x80000000 /kernel.itb |
| 87 | |
| 88 | Print the partition UUID of the SATA device ``$bootdevice``, hardware partition |
| 89 | 0, and partition number 0:: |
| 90 | |
| 91 | part uuid sata - |