summaryrefslogtreecommitdiffstats
path: root/common/bbu.c
Commit message (Collapse)AuthorAgeFilesLines
* bbu: In bbu_register_std_file_update detect device before accessing itSascha Hauer2019-05-101-0/+2
| | | | | | | The device the standard file update handler writes to may not be present before detecting it, so as a first step detect it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: bbu_register_std_file_update should take const char*Sascha Hauer2019-05-101-1/+1
| | | | | | String arguments to bbu_register_std_file_update should be const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: Simplify bbu_find_handler_by_device()Andrey Smirnov2018-10-081-9/+5
| | | | | | | | | Simplify bbu_find_handler_by_device() by making use of devpath_to_name() as well as some basic recursion to avoid coding the same loop twice. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: Add "handler" parameter to barebox_update()Andrey Smirnov2018-10-081-10/+1
| | | | | | | | | | | | Add "handler" parameter to barebox_update() and remove the code that was respondible for header lookup before. With this change finding appropriate handler is caller's responsibility, which makes it possible to implement custom handler lookup/existence check, chache it, and then re-use it without calling handler_find_by_* functions for the second time. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: Expose bbu_find_handler_by_*() functionsAndrey Smirnov2018-10-081-19/+5
| | | | | | | | | | | | Expose bbu_find_handler_by_device() and bbu_find_handler_by_name() as public functions and convert the only user of barebox_update_handler_exists() to use the former function instead. With this done, barebox_update_handler_exists() is no longer used anywhere in the code and can be removed. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: Report update failures explicitlyAndrey Smirnov2018-08-311-6/+6
| | | | | | | | | Change the code of barebox_update() to explicitly log that update failed instead of failing silently (unless update was interrupted) and relying on user checking the return code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: Remove logical negation in barebox_update_handler_exists()Andrey Smirnov2018-08-311-1/+1
| | | | | | | | | Returning !bbu_find_handler() from barebox_update_handler_exists() would return the opposite result from what the name of that funciton implies. Drop the "!" to make it behave as expected. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imd: Make all pointers into image constSascha Hauer2018-01-301-2/+2
| | | | | | | The IMD code should be readonly and never modify any pointers. Make all pointers const so that const pointers can be passed in to IMD. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: Add function to iterate over registered handlersSascha Hauer2017-09-271-0/+15
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: Search for cdev names aswellSascha Hauer2017-03-101-0/+9
| | | | | | | | In bbu_find_handler_by_device() search for cdev names aswell since some update handlers are registered with their cdev name and not the full path. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: parameters are inverted in error messageRenaud Barbier2016-08-181-2/+2
| | | | | | | | | The error message warning the user that the image is too big for the device has its parameters in the wrong order. Swap the two parameters so that the output makes sense. Signed-off-by: Renaud Barbier <renaud.barbier@ge.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx-bbu-nand-fcb'Sascha Hauer2016-04-081-1/+11
|\
| * bbu: Allow to refresh/repair imagesSascha Hauer2016-04-081-1/+11
| | | | | | | | | | | | | | | | | | | | Some SoCs allow to store multiple boot images on a device in order to improve robustness. This adds a -r option to barebox_update to indicate we do not want to make an update but instead repair/refresh an existing image. Handlers which want to support this feature must set the BBU_HANDLER_CAN_REFRESH flag during registration. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bbu: print and evaluate image MetadataSascha Hauer2016-04-061-0/+78
|/ | | | | | | | | | | With imd we can store metadata in barebox images. Let's use this information to further verify that the image that is to be flashed is the correct one. This patch extracts the device tree compatible from the image and compares it with the one from the currently running barebox. If it doesn't match the update is aborted with a warning. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/bbu'Sascha Hauer2016-03-111-1/+33
|\
| * bbu: Add function to check if an update handler existsMarkus Pargmann2016-02-181-0/+14
| | | | | | | | | | | | | | | | This adds a function to check for the existence of an update handler based on the supplied bbu_data. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * bbu: Add barebox_update search by deviceMarkus Pargmann2016-02-181-1/+19
| | | | | | | | | | | | | | | | | | bbu_data includes a devicefile information. Add the possibility to make an update based on the given devicefile. This is in addition to the normal search for a barebox update handler by its name. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bbu: use correct printf format specifier for size_tLucas Stach2016-03-041-1/+1
|/ | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: Add a standard file-to-device-copy handlerSascha Hauer2015-07-011-0/+113
| | | | | | | | The most standard update handler will simply copy a file to a device. This can be shared across several users, so add a standard handler for this operation. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: make bbu confirm a bit more verboseLucas Stach2015-03-041-1/+3
| | | | | | | It is a lot more user friendly if we give a bit more feedback. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* barebox update: fix finding default handlerSascha Hauer2012-12-031-5/+8
| | | | | | | It was not possible to register another handler when already a default handler is registered. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add in-system barebox update infrastructureSascha Hauer2012-10-171-0/+150
Currently in-system update means to write an arbitrary file to an arbitrary device. There is no sanity check if the flashed image is of the right type or will fit onto the device. Furthermore some SoCs need a special preparation step for their images before flashing them. This adds a barebox in-system update infrastructure. Boards can register update handlers which know how to make the board bootable. The available handlers can be listed to be able to select one, different force levels give the user the chance to know it better. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>