summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* imd: Add function to read parametersSascha Hauer2016-04-011-0/+31
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imd: export functionsSascha Hauer2016-04-011-3/+27
| | | | | | | To make the image metadata API usable for external users export some functions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imd: rename imd_search_validate to imd_getSascha Hauer2016-04-011-13/+11
| | | | | | | The name is more suitable for what the function does. Also let the function return a pointer to the imd data found in the buffer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imd: string returned from imd_string_data should be constSascha Hauer2016-04-011-6/+10
| | | | | | | imd_string_data() returns the original data, so the string should be const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imd: use struct imd_header * as argumentSascha Hauer2016-03-291-15/+16
| | | | | | | | imd_concat_strings() and imd_string_data() are easier to handle when they take a struct imd_header * instead of a struct imd_entry_string *. Change this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2016-03-111-6/+2
|\
| * imx-bbu-nand-fcb: Remove double write of first fcbSascha Hauer2016-03-041-4/+0
| | | | | | | | | | | | | | The first FCB page was written twice. One time is enough, drop the second write. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * imx-bbu-nand-fcb: optimize check for bad block loopSascha Hauer2016-03-041-2/+2
| | | | | | | | | | | | | | | | The argument passed to dbbt_data_create() contains the number of blocks, not the last block. This means we can exit the loop with '<' instead of '<=' Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2016-03-112-0/+37
|\ \
| * | common: oftree: Add function to register set status fixupTeresa Remmet2016-03-011-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | Added a function to register a fixup to enable or disable device tree nodes. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | Print error message if of_state_fixup() failsHarald Welte2016-02-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If of_state_fixup() fails for some reason, boot/bootm will fail, too However, it is completely unclear where the error has happened, and to the user it rather seems like the kernel device tree loaded from some file was broken/corrupt, not that in fact some fixup routine was failing. Adding a meaningful error message can help debugging significantly. Signed-off-by: Harald Welte <laforge@gnumonks.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/doc'Sascha Hauer2016-03-111-15/+1
|\ \ \
| * | | ratp: remove unused ratp_close commandRobert Schwebel2016-02-101-15/+1
| | |/ | |/| | | | | | | | | | | | | | | | This is a leftover from development, remove. Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/bbu'Sascha Hauer2016-03-112-1/+46
|\ \ \
| * | | fastboot: Add a ARM Barebox filetype handlerMarkus Pargmann2016-03-111-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will automatically call barebox_update for the transfered file if it is an ARM Barebox image and the destination file is defined by some update handler. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | 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>
* | | | ratp: use proper defines for BAREBOX_CMDLucas Stach2016-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Lucas Stach <dev@lynxeye.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>
* | | | bootm: Fix booting uImagesSascha Hauer2016-02-251-6/+12
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes: 0a37e22d (bootm: use names instead of numbers for image parts) This commit switches to strings for the image numbers for better FIT image support (which uses names instead of numbers). These strings may be NULL when no image number is given. They are used uninitialzed in several places. Introduce a wrapper function to convert the string into a number. Check for NULL here in which case we return 0 which is the correct value. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | bootm: Free allocated fdt buffer in error pathHarald Welte2016-02-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | It seems like there is a memory leak in an error path of bootm_open_oftree_uimage() where the memory allocated for the fdt is not released again. Signed-off-by: Harald Welte <laforge@gnumonks.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | bootm: parse initrd and oftree into correct struct membersLucas Stach2016-02-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The code parsing the oftree and initrd file names is clearly wrong, leading to bootm not loading oftree or initrd files any more. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | bootm: restore load DT message for plain oftree filesLucas Stach2016-02-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This message was dropped when reorganizing the DT loading code, and it's really confusing to miss this. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | blspec: ignore lines beginning with '#'Sascha Hauer2016-02-111-0/+3
| | | | | | | | | | | | | | | | | | According to the bootloader spec these should be treated as comments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | blspec: Do not crash on config files without newline on last lineSascha Hauer2016-02-111-1/+1
| |/ |/| | | | | | | | | | | When the last line in a config file has no newline then 'next' is NULL on the the loop iteration. Check that before derefencing 'next'. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ratp-console: select CRC16 and POLLER, depend on CONSOLE_FULLLucas Stach2016-02-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | RATP console selects RATP, which in turn selects CRC16, but those chains don't work in Kconfig, so select CRC16 also from the console option. Also fix build errors by depending on CONSOLE_FULL and selecting POLLER. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: Fix resource_size_t format specifierSascha Hauer2016-02-111-2/+2
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ratp'Sascha Hauer2016-02-084-3/+545
|\
| * barebox remote controlSascha Hauer2016-01-184-3/+545
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the ability to control barebox over serial lines. The regular console is designed for human input and is unsuitable for controlling barebox from scripts since characters can be lost on both ends, the data stream contains escape sequences and the prompt cannot be easily matched upon. This approach is based on the RATP protocol. RATP packages start with a binary 0x01 which does not occur in normal console data. Whenever a 0x01 character is detected in the console barebox goes into RATP mode. The RATP packets contain a simple structure with a command/respone type and data for that type. Currently defined types are: BB_RATP_TYPE_COMMAND (host->barebox): Execute a command in the shell BB_RATP_TYPE_COMMAND_RETURN (barebox->host) Sends return value of the command back to the host, also means barebox is ready for the next command BB_RATP_TYPE_CONSOLEMSG (barebox->host) Console message from barebox Planned but not yet implemented are: BB_RATP_TYPE_PING (host->barebox) BB_RATP_TYPE_PONG (barebox->host) For testing purposes BB_RATP_TYPE_GETENV (host->barebox) BB_RATP_TYPE_GETENV_RETURN (barebox->host) Get values of environment variables Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Tested-by: Andrey Smirnov <andrew.smirnov@gmail.com>
* | Merge branch 'for-next/misc'Sascha Hauer2016-02-083-25/+24
|\ \
| * | Convert users of PRINTF_CONVERSION_RESOURCE to %paSascha Hauer2016-01-152-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | printf now supports printing resource_size_t directly, convert all users of the previously used PRINTF_CONVERSION_RESOURCE over to %pa. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | hush: fix indentationSascha Hauer2016-01-111-17/+17
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/input'Sascha Hauer2016-02-081-4/+22
|\ \ \
| * | | poller: Fix async pollerSascha Hauer2016-01-131-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The async poller does not work as expected since it can happen that the async poller is removed from the list of pollers while we are iterating over the list. Even list_for_each_entry_safe does not help here since we may remove the next list element, but list_for_each_entry_safe only allows to remove the current list element. Rework the async poller so that it is registered with the poller framework on registration and then is only marked as active with poller_call_async(). This way we do not have to do list manipulations while running the pollers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | bootm: Add option to force booting signed imagesSascha Hauer2016-01-261-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With CONFIG_BOOTM_FORCE_SIGNED_IMAGES the bootm code will refuse to boot unsigned images. Since currently FIT is the only image type which supports signing, this means with this option we enforce using FIT images. All additionally passed in device trees and initrds will be ignored, so that only the ones from the FIT image can be used. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
* | | | bootm: add initial FIT supportJan Luebbe2016-01-264-3/+644
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implementation is inspired by U-Boot's FIT support. Instead of using libfdt (which does not exist in barebox), configuration signatures are verified by using a simplified DT parser based on barebox's own code. Currently, only signed configurations with hashed images are supported, as the other variants are less useful for verified boot. Compatible FIT images can be created using U-Boot's mkimage tool. Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | bootm: make verifying/hashing configurableSascha Hauer2016-01-261-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So long struct bootm_data.verify is a bool which enables CRC checking (hashing). Extend this to a enum and add support for signature checking in the same option. This also adds the corresponding globalvar and a -s option to bootm. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | bootm: Initialize bootm_data defaults in single placeSascha Hauer2016-01-261-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both the bootm and the boot code initialize the struct bootm_data with defaults from the bootm global variables. Create a common function for doing this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | bootm: move oftree code togetherSascha Hauer2016-01-261-107/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The device tree code is distributed in several places in the bootm code. Move it all together in bootm_load_devicetree(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | bootm: move initrd code togetherSascha Hauer2016-01-261-76/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The initrd code is distributed in several places in the bootm code. Move it all together in bootm_load_initrd(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | bootm: Push dryrun to handlersSascha Hauer2016-01-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We can make the dryrun option more useful by calling into the handlers. With this we can detect more cases that can go wrong during boot. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | bootm: use names instead of numbers for image partsSascha Hauer2016-01-221-16/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The uImage format uses numbers for to identify the different parts of a image, but the FIT image format uses names. To better integrate the FIT image format into bootm always use names and convert them to numbers when necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | bootm: introduce bootm_get_os_sizeSascha Hauer2016-01-221-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ARM do_bootm_linux is not only called with uImages but also with raw images, so we can't use uimage_get_size() here. Introduce bootm_get_os_size() which handles the different image types. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | bootm: Do not call uimage_close twiceSascha Hauer2016-01-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | uimage_close() is called on bootm cleanup, so do not close it in the failure path in bootm_open_os_uimage(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | state: hmac: fix error message that algo is displayedMarc Kleine-Budde2016-01-181-4/+4
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | This patch moves the error message about missing crypto support so that the used crypto algo is printed. Without this patch the algo is always shown as a NULL pointer. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | hush: Initialize struct p_contextSascha Hauer2016-01-111-3/+3
|/ / | | | | | | | | | | | | The hush context must be initialized before it is used. Add initialization where necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/rtc'Sascha Hauer2016-01-111-0/+18
|\ \
| * | hwclock command: use format like the Linux tool doesSascha Hauer2016-01-071-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Print three-letter abbreviations of the days and months. With a fixup by Andrey Smirnov: | common/date.c: Fix off-by-one error | | As per http://pubs.opengroup.org/onlinepubs/007908775/xsh/time.h.html | 'tm_wday' is zero indexed with zero representing Sunday, this is also | corroborated by the code in rtc_time_to_tm() which used 4 to represent | Thursday. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/pstore'Sascha Hauer2016-01-111-0/+5
|\ \ \
| * | | fs: Add pstore filesystemMarkus Pargmann2015-12-101-0/+5
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pstore is a persistent storage filesystem used for RAMOOPS. It is used to store console logs, panics, ftrace and other information in case of a crash/panic/oops/reboot. pstore is implemented for barebox as a read-only filesystem at the moment. It may be extended later on. The idea is to provide a way to extract essential data from the last running kernel. Most of the code is copied from the kernel. However this is only a lightweight implementation without real write support yet. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>