barebox/Documentation/user/updating.rst
Sascha Hauer 97e81f2d78 Add support for metadata in barebox images
It's often useful to get some information about a barebox image
before starting or flashing it. This patch introduces barebox
Image MetaData (IMD). When enabled a barebox image will contain
a list of tags containing the desired information. We have tags
for:

- the barebox release (2014.07.0-00160-g035de50-dirty)
- the build timestamp (#741 Mon Jul 28 15:08:54 CEST 2014)
- the board model the image is intended for
- the device tree toplevel compatible property

Also there is an additional generic key-value store which stores
parameters for which no dedicated tag exists. In this patch it
is used for the memory size an image supports.

Since there is no fixed offset in a barebox image which can be
used for storing the information, the metadata is stored somewhere
in the image and found by iterating over the image. This works
for most image types, but obviously not for SoC images which are
encoded or encrypted in some way.

There is a 'imd' tool compiled from the same sources for barebox,
for the compile host and for the target, so the metadata information
is available whereever needed.

For device tree boards the model and of_compatible tags are automatically
generated.

Example output of the imd tool for a Phytec phyFLEX image:

build: #889 Wed Jul 30 16:08:54 CEST 2014
release: 2014.07.0-00167-g6b2070d-dirty
parameter: memsize=1024
of_compatible: phytec,imx6x-pbab01 phytec,imx6dl-pfla02 fsl,imx6dl
model: Phytec phyFLEX-i.MX6 Duallite Carrier-Board

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-08-07 06:13:52 +02:00

33 lines
1.2 KiB
ReStructuredText

.. _update:
Updating barebox
================
Updating barebox is potentially a dangerous task. When the update fails,
the board may not start anymore and must be recovered. barebox has a special
command to make updating barebox easier and safer: :ref:`command_barebox_update`.
A board can register an update handler to the update command. The handler can
do additional checks before trying an update, e.g. it's possible
to check whether the new image actually is a barebox image.
Updating barebox can be as easy as::
barebox_update /path/to/new/barebox.img
Multiple handlers can be registered to the update mechanism. Usually the device
barebox has been started from is registered as default (marked with a ``*``)::
barebox:/ barebox_update -l
registered update handlers:
* mmc -> /dev/mmc1
spinor -> /dev/m25p0
:ref:`command_barebox_update` requires board support, so it may not be
available for your board. It is recommended to implement it, but you can also
update barebox manually using :ref:`command_erase` and :ref:`command_cp`
commands. The exact commands are board specific.
**NOTE** barebox images can be enriched with metadata which can be used to check
if a given image is suitable for updating barebox, see :ref:`imd`.