Commit Graph

23 Commits

Author SHA1 Message Date
Farhan Ali 653cd92d66 cmd: gpt: Add option to write GPT partitions to environment variable
This change would enhance the existing 'gpt read' command to allow
(optionally) writing of the read GPT partitions to an environment
variable in the UBOOT partitions layout format. This would allow users
to easily change the overall partition settings by editing said variable
and then using the variable in the 'gpt write' and 'gpt verify' commands.

Signed-off-by: Farhan Ali <farhan.ali@broadcom.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Corneliu Doban <cdoban@broadcom.com>
Cc: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-04 12:52:46 -04:00
Rasmus Villemoes 214cc199b4 doc/README.gpt: reflow partition type GUID table
The previous patch made the table look bad. Fix it, and leave some
space for a future element being a bit longer than the current
maximum.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2021-01-16 14:49:09 -05:00
Rasmus Villemoes c0364ce1c6 doc/README.gpt: define partition type GUID for U-Boot environment
When setting aside a GPT partition for holding the U-Boot environment,
having a partition type GUID [1] indicating "Linux filesystem" (as
most tools default to) is somewhat misleading - and there's no other
well-known type GUID that is better suited. So to have a canonical
value to put into the type field, define

    3de21764-95bd-54bd-a5c3-4abe786f38a8

to mean a partition holding a U-Boot environment.

This is a v5 namespace-name GUID [2], generated [3] from a namespace
of "25cbcde0-8642-47c6-a298-1a3a57cd256b" and name "U-Boot
environment".

Should future type GUIDs be defined in the context of U-Boot, it's
sensible to use that same namespace GUID.

[1] https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
[2] https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based)
[3] https://www.uuidtools.com/v5

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2021-01-16 14:49:09 -05:00
Keerthy 5917d0b877 doc: arch: sandbox: Replace all the instances of README.sandbox
commit 49116e6d23 ("doc: arch: Convert README.sandbox to reST")
Moves README.sandbox to doc/arch.
Replace all the existing instances to point to the right documentation
file.

Signed-off-by: Keerthy <j-keerthy@ti.com>
2019-07-29 09:32:09 -04:00
Tom Rini 83d290c56f SPDX: Convert all of our single license tags to Linux Kernel style
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents.  There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07 09:34:12 -04:00
Alison Chaiken 2105f34843 doc: remove duplicate text in README.gpt
Signed-off-by: Alison Chaiken <alison@she-devel.com>
2017-09-07 10:44:34 -04:00
Alison Chaiken 203f9b48ad GPT: provide commands to selectively rename partitions
This patch provides support in u-boot for renaming GPT
partitions.  The renaming is accomplished via new 'gpt swap'
and 'gpt rename' commands.

The 'swap' mode returns an error if no matching partition names
are found, or if the number of partitions with one name does not equal
the number with the second name.   The 'rename' variant always
succeeds as long as a partition with the provided number exists.

Rewriting the partition table has the side-effect that all partitions
end up with "msftdata" flag set.  The reason is that partition type
PARTITION_BASIC_DATA_GUID is hard-coded in the gpt_fill_pte()
function.  This does not appear to cause any harm.

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
2017-08-04 20:35:27 -04:00
Alison Chaiken 73d6d18b71 GPT: add accessor function for disk GUID
In order to read the GPT, modify the partition name strings, and then
write out a new GPT, the disk GUID is needed.  While there is an
existing accessor for the partition UUIDs, there is none yet for the
disk GUID.

Changes since v6: none.

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
2017-08-04 09:56:04 -04:00
Alison Chaiken 52791db74f cmd gpt: test in sandbox
Make minor changes to README.gpt and sandbox_defconfig to support
testing of the gpt command's functionality in the sandbox.

Changes since v6: none.

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
2017-08-04 09:56:02 -04:00
Alison Chaiken 0a24238625 GPT: fix error in partitions string doc
The existing partitions-list parsing in cmd/gpt.c passes a value
from gpt_default() to set_gpt_info() that README.gpt suggests
should begin with 'partitions='.  Partition-list strings should
in fact begin with 'uuid_disk', as otherwise the call from
set_gpt_info() to extract_val() to find 'uuid_disk' will fail.
Change README.gpt accordingly.

Changes since v6: none.

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
2017-08-04 09:55:30 -04:00
Alison Chaiken 564cf25d5b cmd gpt: test in sandbox
Make minor changes to README.gpt and sandbox_defconfig to support
testing of the gpt command's functionality in the sandbox.

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
2017-07-11 10:08:19 -06:00
Robert P. J. Day 62a3b7dd08 Various, unrelated tree-wide typo fixes.
Fix a number of typos, including:

     * "compatble" -> "compatible"
     * "eanbeld" -> "enabled"
     * "envrionment" -> "environment"
     * "FTD" -> "FDT" (for "flattened device tree")
     * "ommitted" -> "omitted"
     * "overriden" -> "overridden"
     * "partiton" -> "partition"
     * "propogate" -> "propagate"
     * "resourse" -> "resource"
     * "rest in piece" -> "rest in peace"
     * "suport" -> "support"
     * "varible" -> "variable"

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
2016-07-16 09:43:12 -04:00
Patrick Delaunay cfdaf4caa2 part:efi: add bootable parameter in gpt command
The optional parameter bootable is added in gpt command to set the
partition attribute flag "Legacy BIOS bootable"

This flag is used in extlinux and so in with distro to select
the boot partition where is located the configuration file
(please check out doc/README.distro for details).

With this parameter, U-Boot can be used to create the boot partition
needed for device using distro.

example of use:

setenv partitions "name=u-boot,size=60MiB;name=boot,size=60Mib,bootable;\
                   name=rootfs,size=0"

> gpt write mmc 0 $partitions

> part list mmc 0

Partition Map for MMC device 0  --   Partition Type: EFI

Part	Start LBA	End LBA		Name
	Attributes
	Type GUID
	Partition GUID
  1	0x00000022	0x0001e021	"u-boot"
	attrs:	0x0000000000000000
	type:	ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
	guid:	cceb0b18-39cb-d547-9db7-03b405fa77d4
  2	0x0001e022	0x0003c021	"boot"
	attrs:	0x0000000000000004
	type:	ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
	guid:	d4981a2b-0478-544e-9607-7fd3c651068d
  3	0x0003c022	0x003a9fde	"rootfs"
	attrs:	0x0000000000000000
	type:	ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
	guid:	6d6c9a36-e919-264d-a9ee-bd00379686c7

> part list mmc 0 -bootable devplist

> printenv devplist

devplist=2

Then the distro scripts will search extlinux in partition 2
and not in the first partition.

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>
2015-11-23 11:01:52 -05:00
Lukasz Majewski dd445879f7 gpt: doc: README: Update README entry for gpt verify extension
./doc/README.gpt entry has been updated to explain usage of "gpt verify"
command.

Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
Reviewed-by: Tom Rini <trini@konsulko.com>
2015-11-23 10:56:09 -05:00
Patrick Delaunay bcb41dcaef uuid: add selection by string for known partition type GUID
short strings can be used in type parameter of gpt command
to replace the guid string for the types known by u-boot

      partitions = name=boot,size=0x6bc00,type=data; \
                   name=root,size=0x7538ba00,type=linux;
      gpt write mmc 0 $partitions

and they are also used to display the type of partition
in "part list" command

  Partition Map for MMC device 0  --   Partition Type: EFI

  Part	Start LBA	End LBA		Name
	Attributes
	Type GUID
	Partition GUID
    1	0x00000022	0x0000037f	"boot"
	attrs:	0x0000000000000000
	type:	ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
	type:	data
	guid:	d117f98e-6f2c-d04b-a5b2-331a19f91cb2
    2	0x00000380	0x003a9fdc	"root"
	attrs:	0x0000000000000000
	type:	0fc63daf-8483-4772-8e79-3d69d8477de4
	type:	linux
	guid:	25718777-d0ad-7443-9e60-02cb591c9737

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>
2015-11-12 15:58:58 -05:00
Patrick Delaunay 7561b258a1 gpt: add optional parameter type in gpt command
code under flag CONFIG_PARTITION_TYPE_GUID
add parameter "type" to select partition type guid

example of use with gpt command :

  partitions = uuid_disk=${uuid_gpt_disk}; \
      name=boot,size=0x6bc00,uuid=${uuid_gpt_boot}; \
      name=root,size=0x7538ba00,uuid=${uuid_gpt_root}, \
         type=0fc63daf-8483-4772-8e79-3d69d8477de4;

  gpt write mmc 0 $partitions

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>
2015-11-12 15:58:58 -05:00
Patrick Delaunay b38c108a98 part:efi: add GUID for linux file system data
Previously, Linux used the same GUID for the data partitions as Windows
(Basic data partition: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7).
This created problems when dual-booting Linux and Windows in UEFI-GPT
Setup, so a new GUID (Linux filesystem data:
0FC63DAF-8483-4772-8E79-3D69D8477DE4) was defined jointly by GPT fdisk
and GNU Parted developers.

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>
2015-11-12 15:58:57 -05:00
Rob Herring 0c7e8d1317 gpt: support random UUIDs without setting environment variables
Currently, an environment variable must be used to store the randomly
generated UUID for each partition. This is not necessary, so make storing
the UUID optional. Now passing uuid_disk and uuid are optional when random
UUIDs are enabled.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
2015-03-05 11:17:53 -05:00
Steve Rae ae95fad5af disk: part_efi: add support for the Backup GPT
Check the Backup GPT table if the Primary GPT table is invalid.
Renamed "Secondary GPT" to "Backup GPT" as per:
  UEFI Specification (Version 2.3.1, Errata A)

Signed-off-by: Steve Rae <srae@broadcom.com>
2014-05-12 15:20:05 -04:00
Przemyslaw Marczak 39206382de cmd:gpt: randomly generate each partition uuid if undefined
Changes:
- randomly generate partition uuid if any is undefined and CONFIG_RAND_UUID
  is defined
- print debug info about set/unset/generated uuid
- update doc/README.gpt

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Piotr Wilczek <p.wilczek@samsung.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
2014-04-02 16:36:06 -04:00
Wolfgang Denk 16641d52fc Coding Style cleanup: drop some excessive empty lines
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-10-14 16:06:54 -04:00
Wolfgang Denk 1a4596601f Add GPL-2.0+ SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:44:38 -04:00
Lukasz Majewski 36f2e8e0d1 gpt:doc: GPT (GUID Partition Table) documentation
Documentation of the GPT format.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-12-13 11:46:02 -07:00