[U-Boot] [PATCH v4 0/5] add support for GPT partition name manipulation

alison at peloton-tech.com alison at peloton-tech.com
Sun Jun 4 22:11:16 UTC 2017


From: Alison Chaiken <alison at peloton-tech.com>

One way for userspace and the bootloader to exchange information about
dynamic image selection is via the storage device partition table, as
described at

https://source.android.com/devices/tech/ota/ab_updates

The scheme described there relies on setting partitions' "boot" flag.
When no partition on a device is bootable since the kernel and U-Boot
are stored elsewhere, the name field in the GPT partition table offers
another logical place to store information.  These patches allow users
to easily modify GPT partition names via bootscripts that can select
different images based on a boot-failure counter, or when userspace
installs a software update.

These patches have been tested in the u-boot sandbox and (re)tested on
a TI DRA7xx-based SOM with U-Boot 2015.07.

Significant changes since v3:
-- Testing in sandbox showed error in NULL termination of UUID string
   in cmd/gpt.c.  That problem is fixed in
   0001-GPT-read-partition-table-from-device-into-a-data-str.patch.
-- Patch 3 "GPT: fix error in partitions string doc" now only treats
   the topic in the commit title, as the part dealing with the
   proposed 'flip' feature is moved to that patch.
-- Two new commits come from testing in the sandbox (of which I was
   previously unaware).   One fixes an error in README.sandbox, and
   one adds a few comments about sandbox testing to README.gpt.

Significant changes since v2:
-- Got rid of the need to allocate memory for the GUID string in
   do_gpt();
-- Fixed the problems with string NULL termination in
   allocate_disk_part();
-- Removed duplicate definition of MAX_SEARCH_PARTITIONS from
   disk/part.c and increased the value in include/part.h to 64;
-- Improved the commit message for "rename GPT partitions to detect
   boot failure" to better describe the version of the patch I
   submitted;
-- Fixed numerous small problems with function return values.

Significant changes since v1:
-- Put the gpt_flip() function and auxiliary ones inside a new
   CONFIG_CMD_GPT_FLIP option that depends on CMD_GPT.
-- Replace intentional overwriting of name and type string arrays with
   memset() instead.
-- Move part.h changes earlier in the patchset.
-- Add a few lines to README.gpt about the new gpt subcommands.

Added a few simple patches to do the following:
-- Replace remaining occurrences of '37' with UUID_STR_LEN+1;
-- Introduce new macros to get rid of the similar '32';
-- fix a smaller error in doc/README.gpt.

There are also some fixups of whitespace and formatting errors (plus
usual inevitable addition of new ones).

To do in future:
-- Add support for preserving the type flag for partitions. The u-boot
   version on which this patchset is based did not have this feature,
   and it's easy to add, but I need to figure how to test it first.

-- Add tests for the new gpt commands to the sandbox.

Alison Chaiken (5):
  GPT: read partition table from device into a data structure
  rename GPT partitions to detect boot failure
  GPT: fix error in partitions string doc
  sandbox: README: fix partition command invocation
  cmd gpt: test in sandbox

 board/sandbox/README.sandbox |   2 +-
 cmd/Kconfig                  |   7 +
 cmd/gpt.c                    | 298 +++++++++++++++++++++++++++++++++++++++++++
 doc/README.gpt               |  31 ++++-
 include/part.h               |   7 +
 5 files changed, 340 insertions(+), 5 deletions(-)

-- 
2.1.4



More information about the U-Boot mailing list