1.10. 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: barebox_update - update barebox to persistent media. 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:
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
barebox_update - update barebox to persistent media 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 erase - erase flash memory and cp - copy files 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 Image MetaData (IMD).
1.10.1. Repairing existing boot images¶
Some SoCs allow to store multiple boot images on a device in order to improve robustness. When an update handler supports it the handler can repair and/or refresh an image from this redundant information. This is done with the ‘-r’ option to barebox_update - update barebox to persistent media.