summaryrefslogtreecommitdiff
path: root/common
Commit message (Collapse)AuthorAgeLines
* image: Combine image_sig_algo with image_sign_infoAndrew Duda2016-11-21-26/+31
| | | | | | | | | | | | | | | Remove the need to explicitly add SHA/RSA pairings. Invalid SHA/RSA pairings will still fail on verify operations when the hash length is longer than the key length. Follow the same naming scheme "checksum,crytpo" without explicitly defining the string. Indirectly adds support for "sha1,rsa4096" signing/verification. Signed-off-by: Andrew Duda <aduda@meraki.com> Signed-off-by: aduda <aduda@meraki.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* image: Add crypto_algo struct for RSA infoAndrew Duda2016-11-21-23/+23
| | | | | | | | | | Cut down on the repetition of algorithm information by defining separate checksum and crypto structs. image_sig_algos are now simply pairs of unique checksum and crypto algos. Signed-off-by: Andrew Duda <aduda@meraki.com> Signed-off-by: aduda <aduda@meraki.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* rsa: Verify RSA padding programaticallyAndrew Duda2016-11-21-3/+6
| | | | | | | | | | | | | | | | | | | Padding verification was done against static SHA/RSA pair arrays which take up a lot of static memory, are mostly 0xff, and cannot be reused for additional SHA/RSA pairings. The padding can be easily computed according to PKCS#1v2.1 as: EM = 0x00 || 0x01 || PS || 0x00 || T where PS is (emLen - tLen - 3) octets of 0xff and T is DER encoding of the hash. Store DER prefix in checksum_algo and create rsa_verify_padding function to handle verification of a message for any SHA/RSA pairing. Signed-off-by: Andrew Duda <aduda@meraki.com> Signed-off-by: aduda <aduda@meraki.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* ext4: Allow reading files with non-zero offset, clamp read lenStefan Brüns2016-11-21-4/+4
| | | | | | | | Support was already implemented, but not hooked up. This fixes several fails in the test cases. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Stephen Warren <swarren@wwwdotorg.org>
* spl: Convert CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR to KconfigSemen Protsenko2016-11-18-2/+29
| | | | | | Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> [trini: Fix sniper and kc1 migration] Signed-off-by: Tom Rini <trini@konsulko.com>
* image: Protect against overflow in unknown_msg()Simon Glass2016-11-05-2/+4
| | | | | | | | | | Coverity complains that this can overflow. If we later increase the size of one of the strings in the table, it could happen. Adjust the code to protect against this. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 150964)
* cmd: dfu: Add error handling for board_usb_initMichal Simek2016-11-03-1/+5
| | | | | | board_usb_init() can failed and error should be handled properly. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* Merge branch 'master' of git://www.denx.de/git/u-boot-imxTom Rini2016-10-28-0/+5
|\ | | | | | | | | | | | | | | Signed-off-by: Tom Rini <trini@konsulko.com> Conflicts: common/Kconfig configs/dms-ba16_defconfig
| * config: Move CONFIG_DEFAULT_FDT_FILE to defconfigsJagan Teki2016-10-26-0/+5
| | | | | | | | | | | | | | | | | | | | - Add DEFAULT_FDT_FILE kconfig entry - Move CONFIG_DEFAULT_FDT_FILE from include/configs to defconfigs Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Cc: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
* | Convert CONFIG_SYS_STDIO_DEREGISTER to KconfigSimon Glass2016-10-23-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | This converts the following to Kconfig: CONFIG_SYS_STDIO_DEREGISTER This option should never be enabled in SPL, so use CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) when checking the option. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Re-sync] Signed-off-by: Tom Rini <trini@konsulko.com>
* | Convert CONFIG_SYS_CONSOLE_INFO_QUIET to KconfigSimon Glass2016-10-23-0/+8
| | | | | | | | | | | | | | | | | | This converts the following to Kconfig: CONFIG_SYS_CONSOLE_INFO_QUIET Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Make this default n, re-run the migration] Signed-off-by: Tom Rini <trini@konsulko.com>
* | Convert CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE to KconfigSimon Glass2016-10-23-0/+9
| | | | | | | | | | | | | | | | This converts the following to Kconfig: CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | Convert CONFIG_SYS_CONSOLE_ENV_OVERWRITE to KconfigSimon Glass2016-10-23-0/+9
| | | | | | | | | | | | | | | | This converts the following to Kconfig: CONFIG_SYS_CONSOLE_ENV_OVERWRITE Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | Convert CONFIG_SYS_CONSOLE_IS_IN_ENV and CONFIG_CONSOLE_MUX to KconfigSimon Glass2016-10-23-0/+21
| | | | | | | | | | | | | | | | | | | | This converts the following to Kconfig: CONFIG_SYS_CONSOLE_IS_IN_ENV CONFIG_CONSOLE_MUX Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Re-order, re-migrate] Signed-off-by: Tom Rini <trini@konsulko.com>
* | Convert CONSOLE_PRE_CONSOLE_BUFFER options to KconfigSimon Glass2016-10-23-3/+45
| | | | | | | | | | | | | | Move these option to Kconfig and tidy up existing uses. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagan Teki <jteki@openedev.com>
* | Convert SILENT_CONSOLE options to KconfigSimon Glass2016-10-23-2/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | Move these option to Kconfig and tidy up existing uses. The Power PC boards don't have a suitable common element: the common header files don't appear to line up with the Kconfig files as far as I can tell. This results in a lot of defconfig changes. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagan Teki <jteki@openedev.com> [trini: Re-migrate, update common/console.c logic] Signed-off-by: Tom Rini <trini@konsulko.com>
* | watchdog: Fix Watchdog Reset while in U-Boot PromptAndreas J. Reichel2016-10-17-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hardware: CM-FX6 Module from Compulab This patch fixes unwanted watchdog resets while the user enters a command at the U-Boot prompt. As found on the CM-FX6 board from Compulab, when having enabled the watchdog, a missing WATCHDOG_RESET call in common/console.c causes this and alike boards to reset when the watchdog's timeout has elapsed while waiting at the U-Boot prompt. Despite the user could press several keys within the watchdog timeout limit, the while loop in cli_readline.c, line 261, does only call WATCHDOG_RESET if first == 1, which gets set to 0 in the 1st loop iteration. This leads to a watchdog timeout no matter if the user presses keys or not. Although, this affects other boards as well as it touches common/console.c, the macro WATCHDOG_RESET expands to {} if watchdog support isn't configured. Hence, there's no harm caused and no need to surround it by #ifdef in this case. * Symptom: U-Boot resets after watchdog times out when in commandline prompt and watchdog is enabled. * Reasoning: When U-Boot shows the commandline prompt, the following function call stack is executed while waiting for a keypress: common/main.c: main_loop => common/cli.c: cli_loop() => common/cli_hush.c: parse_file_outer => parse_stream_outer => parse_stream => b_getch(i) => i->get(i) => file_get => get_user_input => cmdedit_read_input => uboot_cli_readline => common/cli_readline.c: cli_readline => cli_readline_into_buffer => cread_line => getcmd_getch (== getc) => common/console.c: fgetc => console_tstc common/console.c: (with CONFIG_CONSOLE_MUX is set) - in console_tstc line 181: If dev->tstc(dev) returns 0, the global tstcdev variable doesn't get set. This is the case if no character is in the serial buffer. - in fgetc(int file), line 297: Program flow keeps looping because tstcdev does not get set. Therefore WATCHDOG_RESET is not called, as mx_serial_tstc from drivers/serial/serial_mxc.c does not call it. * Solution: Add WATCHDOG_RESET into the loop of console_tstc. Note: Macro expands to {} if not configured, so no #ifdef is needed. * Comment: Signed-off-by: Christian Storm <christian.storm@tngtech.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Andreas J. Reichel <Andreas.Reichel@tngtech.com> Acked-by: Simon Glass <sjg@chromium.org>
* spl: move SYS_OS_BASE to KconfigHeiko Schocher2016-10-15-0/+10
| | | | | | | | | Move SYS_OS_BASE to Kconfig and cleanup existing uses. Signed-off-by: Heiko Schocher <hs@denx.de> [trini: Also migrate a4m2k] Signed-off-by: Tom Rini <trini@konsulko.com>
* spl: move SPL_OS_BOOT to KconfigHeiko Schocher2016-10-14-0/+8
| | | | | | | Move SPL_OS_BOOT to Kconfig and cleanup existing uses. Signed-off-by: Heiko Schocher <hs@denx.de>
* libfdt: Sync fdt_for_each_subnode() with upstreamSimon Glass2016-10-13-5/+5
| | | | | | | | | | | The signature for this macro has changed. Bring in the upstream version and adjust U-Boot's usages to suit. Signed-off-by: Simon Glass <sjg@chromium.org> Update to drivers/power/pmic/palmas.c: Signed-off-by: Keerthy <j-keerthy@ti.com> Change-Id: I6cc9021339bfe686f9df21d61a1095ca2b3776e8
* libfdt: Bring in upstream stringlist functionsSimon Glass2016-10-13-21/+17
| | | | | | | | | | | | | | These have now landed upstream. The naming is different and in one case the function signature has changed. Update the code to match. This applies the following upstream commits by Thierry Reding <treding@nvidia.com> : 604e61e fdt: Add functions to retrieve strings 8702bd1 fdt: Add a function to get the index of a string 2218387 fdt: Add a function to count strings Signed-off-by: Simon Glass <sjg@chromium.org>
* cmd/fdt: add possibilty to have 'extrasize' on fdt resizeHannes Schmelzer2016-10-13-2/+3
| | | | | | | | | | | | | | | | | | | Sometimes devicetree nodes and or properties are added out of the u-boot console, maybe through some script or manual interaction. The devicetree as loaded or embedded is quite small, so the devicetree has to be resized to take up those new nodes/properties. In original the devicetree was only extended by effective 4 * add_mem_rsv. With this commit we can add an argument to the "fdt resize" command, which takes the extrasize to be added. Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at> Acked-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-x86Tom Rini2016-10-12-7/+83
|\
| * board_f: Drop the extra fdtdec_prepare_fdt()Simon Glass2016-10-11-3/+0
| | | | | | | | | | | | | | | | This is already called earlier, from fdtdec_setup(), so drop this unnecessary call from the init sequence. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * dm: stdio: Allow lazy probing of video devicesSimon Glass2016-10-11-4/+83
| | | | | | | | | | | | | | | | | | | | | | | | At present all video devices are probed on start-up. It would be better to probe a device only when it is needed. This can happen if it is referenced in the stdout environment variable, for example. Add support for this by searching for a suitable device when needed, probing it, and finding the stdio device it creates. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* | common: Add DISPLAY_BOARDINFOLokesh Vutla2016-10-12-0/+8
| | | | | | | | | | | | | | | | Create a Kconfig entry for DISPLAY_BOARDINFO and make it be the default in certain architectures. Migrate all config files. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Tom Rini <trini@konsulko.com>
* | common/Kconfig: Add DISPLAY_CPUINFOLokesh Vutla2016-10-12-0/+8
|/ | | | | | | | Create a Kconfig entry for DISPLAY_CPUINFO and make it be the default in certain architectures. Migrate all config files. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Tom Rini <trini@konsulko.com>
* Merge branch 'master' of git://www.denx.de/git/u-boot-imxTom Rini2016-10-08-0/+1
|\
| * tools: mkimage: add support for Vybrid image formatAlbert ARIBAUD \(3ADEV\)2016-10-06-0/+1
| | | | | | | | | | | | | | This format can be flashed directly at address 0 of the NAND FLASH, as it contains all necessary headers. Signed-off-by: Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
* | spl: saveenv: adding saveenv support in SPLB, Ravi2016-10-08-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default saveenv option is not supported for SPL. This patch enable the support for save environment variable for SPL build. Enable save environment support in SPL after setenv. By default the saveenv option is not provided in SPL, but some boards need this support in 'Falcon' boot, where SPL need to boot from different images based on environment variable set by OS. For example OS may set "reboot_image" environment variable to "recovery" inorder to boot recovery image by SPL. The SPL read "reboot_image" and act accordingly and change the reboot_image to default mode using setenv and save the environemnt. Signed-off-by: Ravi Babu <ravibabu@ti.com> Reviewed-by: Simon Glass <sig@chromium.org> change in v1: - dropped SUPPORT, use CONFIG_SPL_SAVEENV - updates the comments in mmc_private.h
* | common/console.c: ensure GD_FLG_SILENT is set or clearedChris Packham2016-10-07-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_SILENT_CONSOLE is defined and the default environment has silent=1 it is not possible for a user to make the console un-silent if the environment is not available when console_init_f() is called (for example because the environment is in SPI). Add a new helper function console_update_silent() and call it from both console_init_f() and console_init_r(). Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | Various, accumulated typos collected from around the tree.Robert P. J. Day2016-10-06-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix various misspellings of: * deprecated * partition * preceding,preceded * preparation * its versus it's * export * existing * scenario * redundant * remaining * value * architecture Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Reviewed-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Stefan Roese <sr@denx.de>
* | spl: Make spl_boot_list a local variableSimon Glass2016-10-06-12/+12
| | | | | | | | | | | | | | | | | | | | | | There is no need for this to be in the BSS region. By moving it we can delay use of BSS in SPL. This is useful for machines where the BSS region is not in writeable space. On 64-bit x86, SPL runs from SPI flash and it is easier to eliminate BSS use than link SPL to run with BSS at a particular cache-as-RAM (CAR) address. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Update spl_load_simple_fit() to take an spl_image paramSimon Glass2016-10-06-10/+11
| | | | | | | | | | | | | | Upda the SPL FIT code to use the spl_image parameter. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Update fat functions to take an spl_image parameterSimon Glass2016-10-06-20/+29
| | | | | | | | | | | | | | Update the fat loader to avoid using the spl_image global variable. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Update ext functions to take an spl_image parameterSimon Glass2016-10-06-11/+14
| | | | | | | | | | | | | | Update the ext loader to avoid using the spl_image global variable. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Pass spl_image as a parameter to load_image() methodsSimon Glass2016-10-06-75/+98
| | | | | | | | | | | | | | | | | | Rather than having a global variable, pass the spl_image as a parameter. This avoids BSS use, and makes it clearer what the function is actually doing. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_board_load_image() to use linker listSimon Glass2016-10-06-11/+2
| | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Update existing users. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_net_load_image() to use linker listSimon Glass2016-10-06-14/+25
| | | | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. We need two variants - one for BOOT_DEVICE_CPGMAC and one for BOOT_DEVICE_USBETH. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_spi_load_image() to use linker listSimon Glass2016-10-06-5/+3
| | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Also set up the sunxi function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: spi: Move the generic SPI loader into common/splSimon Glass2016-10-06-0/+124
| | | | | | | | | | | | | | | | | | | | | | All the other SPL loaders are in this directory, so move the SPI one in there too. There are two board-specific SPI loaders (fsl and sunxi). These remain in the drivers/mtd/spi directory, since they do not contain generic code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_sata_load_image() to use linker listSimon Glass2016-10-06-5/+2
| | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_usb_load_image() to use linker listSimon Glass2016-10-06-4/+2
| | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_ymodem_load_image() to use linker listSimon Glass2016-10-06-5/+2
| | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_nor_load_image() to use linker listSimon Glass2016-10-06-5/+2
| | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_onenand_load_image() to use linker listSimon Glass2016-10-06-5/+3
| | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_nand_load_image() to use linker listSimon Glass2016-10-06-5/+3
| | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_ubi_load_image() to use linker listSimon Glass2016-10-06-6/+3
| | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_mmc_load_image() to use linker listSimon Glass2016-10-06-7/+5
| | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | spl: Convert spl_ram_load_image() to use linker listSimon Glass2016-10-06-9/+9
| | | | | | | | | | | | | | | | | | | | Add a linker list declaration for this method and remove the explicit switch() code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> [trini: Include updating the DFU case] Signed-off-by: Tom Rini <trini@konsulko.com>