summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* bootm: add initial FIT supportwork/fit-supportJan Luebbe2016-01-158-3/+720
| | | | | | | | | | | | | | | 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-153-7/+37
| | | | | | | | | 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>
* crypto: add RSA supportSascha Hauer2016-01-155-0/+483
| | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: add digest_alloc_by_algo()Sascha Hauer2016-01-158-1/+74
| | | | | | | | | | | In barebox the function digest_alloc() allocates a digest based on a string. When a subsystem already uses an integer value to identify a digest it makes no sense to create a string and pass it to digest_alloc(), where it is parsed again. This patch adds the possibility to get a digest by an enum. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Initialize bootm_data defaults in single placeSascha Hauer2016-01-154-38/+20
| | | | | | | | 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-151-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-153-79/+83
| | | | | | | 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-159-7/+33
| | | | | | | 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>
* ARM: bootm: Use kernel handler to start barebox imageSascha Hauer2016-01-151-29/+1
| | | | | | | | barebox can be called with the kernel calling convention, so we can reuse the handler instead of creating a barebox specific handler. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: use names instead of numbers for image partsSascha Hauer2016-01-152-19/+30
| | | | | | | | | 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-153-1/+21
| | | | | | | | 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-151-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>
* ARM: zImage: add missing free() in appended device tree codeSascha Hauer2016-01-151-0/+1
| | | | | | oftree must be freed when the tree is successfully unflattened. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx233-olinuxino: Fix mx23_power_init() argumentsFabio Estevam2016-01-121-1/+1
| | | | | | | | | | | | | Commit 4d70da6 ("ARM: MXS: power-init: Add parameters to mx28_power_init()") causes imx233-olinuxino to not boot anymore. imx233-olinuxino is commonly powered from external input supply, so adjust the mx23_power_init() arguments to reflect that. Reported-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Tested-by: Peter Mamonov <pmamonov@gmail.com> 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/socfpga'Sascha Hauer2016-01-112-5/+7
|\
| * socfpga: Allow setting partition xloader boots from for mmcTrent Piepho2015-12-142-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The xloader boots the 2nd stage barebox from socfpga_barebox_part when using NOR. But when using MMC it boots from a hardcoded "disk0.1". Add the mmc device name to the partition description and use it for mmc booting. Add an extern declaration of socfpga_barebox_part to the socfpga header so that a board can change it to use a different partition. Initialize socfpga_barebox_part to the default value instead of NULL to avoid the NULL check later. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/rtc'Sascha Hauer2016-01-1113-9/+472
|\ \
| * | commands/hwclock: Check return value of rtc_read_time()Andrey Smirnov2016-01-071-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | It is possible for rtc_read_time() to fill struct rtc_time it returns with invalid values, so we have to check for its return value before using returned time. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | rtc-lib: Check tm_wday for validity in rtc_valid_tm()Andrey Smirnov2016-01-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RTC drivers rely on rtc_valid_tm() in order to make sure that no bogus values from uninitialized HW registers get passed to the uppper layers. A somewhat contrived way to reproduce this problem with DS1307 RTC would be to do the following: > i2c_write -b <bus> -a <addr> -r 3 0x00 > hwclock Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | rtc: ds1307: Fix a memory leakAndrey Smirnov2016-01-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Several failure paths would result in control being transfered to 'exit' label, so instead of just returning error codes in those cases we also need to free the memory allocated for 'ds1307' Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | rtc: ds1307: Add code to support ds1337/1341Andrey Smirnov2016-01-071-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | Port DS1337 specific bits from corresponding Linux driver and add small changes needed for DS1341. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | rtc: Add Abracon driverSascha Hauer2016-01-073-0/+130
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the Abracon ab-rtcmc-32.768khz-eoz9-s3 RTC. The driver can probably support other Abracon RTCs aswell, but this hasn't been verified. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | hwclock: Allow to set hwclock from sntpSascha Hauer2016-01-071-1/+26
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | net: Add SNTP supportSascha Hauer2016-01-074-0/+184
| | | | | | | | | | | | | | | | | | | | | | | | This adds support for retrieving the time via Simple Network Time Protocol (SNTP). No fancy features are supported, only plainly getting the current time. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | rtc: Fill in weekdays before setting timeSascha Hauer2016-01-071-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | Some rtcs store the weekday. Make sure it's filled in correctly before passinf the time to the driver. This is easily done by converting it to seconds-since-epoch and back to struct rtc_time. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | rtc: Check time for validity before passing it to the rtc driverSascha Hauer2016-01-071-0/+3
| | | | | | | | | | | | | | | | | | So that rtc drivers do not get invalid times. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | hwclock command: forward return value of rtc_set_timeSascha Hauer2016-01-071-2/+1
| | | | | | | | | | | | | | | | | | rtc_set_time can fail, forward the error to the user. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | hwclock command: use format like the Linux tool doesSascha Hauer2016-01-073-3/+21
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1129-66/+2689
|\ \
| * | Documentation: Document pstore/RAMOOPSMarkus Pargmann2015-12-111-0/+76
| | | | | | | | | | | | | | | | | | | | | Add some documentation about behaviour and setup of pstore/RAMOOPS. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: Add pstore filesystemMarkus Pargmann2015-12-1012-0/+1650
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | arm: Add RAMOOPS memory areaMarkus Pargmann2015-12-102-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RAMOOPS is a driver that uses a reserved static memory region to store the data from the last panic or boot. This helps to debug crashes at the next boot while preserving the boot messages. To guarantee a memory area that is not altered by barebox or the kernel, this area is located at the end of the RAM right after barebox and before the STACK. This ensures that changing barebox sizes do not interfere with RAMOOPS. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | arm: start: Add visible sdram region for barebox board dataMarkus Pargmann2015-12-101-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | This helps to understand and find problems with the memory layout of barebox. It adds another entry for the board data that barebox allocated. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | arm: Clarify memory layout calculationMarkus Pargmann2015-12-104-65/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The memory calculations used are all hardcoded into three different files, start-pbl.c, uncompress.c and start.c. To make this more readable and reliable, this patch gathers these information in barebox-arm.h with static inline functions for the calculation of the memory offsets. This patch also adds proper handling of different barebox/board data sizes. Currently only 1MB+Alignment of RAM is reserved for Barebox and board data. This could be too small for bigger devicetrees and barebox. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | lib: Import reed solomon code from kernelMarkus Pargmann2015-12-107-0/+807
| | | | | | | | | | | | | | | | | | | | | | | | reed solomon code is used by RAMOOPS to check and fix data stored in volatile memory. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | vsprintf: Add scnprintf from kernelMarkus Pargmann2015-12-102-0/+25
| | | | | | | | | | | | | | | Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | printk: Add missing include/declarationMarkus Pargmann2015-12-101-0/+3
| | | | | | | | | | | | | | | | | | | | | There are functions or structs used that do need these. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | log2: Add missing __rounddown_pow_of_two()Markus Pargmann2015-12-101-0/+9
| | | | | | | | | | | | | | | Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | arm: boards: karo-tx6x remove definition of DIV_ROUND_UPMarkus Pargmann2015-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | DIV_ROUND_UP is defined in include/linux/kernel.h. Use that instead. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/net'Sascha Hauer2016-01-113-90/+67
|\ \ \
| * | | net: resolv: Make argument constSascha Hauer2015-12-142-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | resolv() is not allowed to change the hostname argument, make it const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | net: dhcp: make unmodified variable constSascha Hauer2015-12-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 'str' in dhcp_set_string_options is never modified, so make it const. With this we no longer have to cast away the const returned from getenv. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | net: dhcp: simplify dhcp_options_processSascha Hauer2015-12-141-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dhcp_options_handle returns the index into the dhcp_options array. This is only to be able in the caller to print a debug message when the index returned from dhcp_options_handle is out of bounds. Simplify this by printing the debug message in dhcp_options_handle and not in the caller. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | net: dhcp: unify options and paramsSascha Hauer2015-12-141-77/+57
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | The dhcp code distinguishes between options and params. If sent to the server they are params, if received from the server they are options. Unify them all to be options. If it has a handle_param callback it's a param, if it has a handle callback it's an option. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/mtd'Sascha Hauer2016-01-113-2/+173
|\ \ \
| * | | mtd: gpmi: Add erased page bitflip correctionMarkus Pargmann2016-01-041-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hardware ECC does not work for erased pages. However as soon as something that is not 0xff is found in the page, hardware ECC assumes this is valid data and produces an uncorrectable error ECC status. We can use that to check for bitflips in erased pages and fix them if the number of flipped bits is below the ecc_strength. We need to move the memcpy above the for loop to be able to access the buffer directly. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: nand: Add erased page bitflip check helper functionsMarkus Pargmann2016-01-042-0/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the bitflip check helper functions from the kernel. They are used to check for bitflips in erased pages and correct them in the buffer so that UBI can work with it. Unfortunately most nand controllers do not have ECC for erased pages and don't do this on their own. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/misc'Sascha Hauer2016-01-1128-210/+354
|\ \ \ \
| * | | | usb: chipidea-imx: check return value of regulator_get()David Jander2016-01-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The VBUS regulator is optional for the chipidea-imx glue, so it must be checked if regulator_get provided a valid regulator handle before trying to enable the regulator. Signed-off-by: David Jander <david@protonic.nl> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>