summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* startup: execute /env/bin/init as part of the initial shellIan Abbott2019-06-131-4/+5
| | | | | | | | | | | | | | | Commit 90df2a955e3c ("defaultenv: Convert init script to C") unintentionally changed the way the legacy "/env/bin/init" script is run, so that it runs in a sub-shell context, effectively changing `run_command("source /env/bin/init");` to `run_command("/env/bin/init");`. Therefore, any changes to shell environment variables made by the script are undone when the script exits. This patch reverts back to the old behavior. Fixes: 90df2a955e3c ("defaultenv: Convert init script to C") Cc: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: Do not overwrite global.linux.bootargs.consoleSascha Hauer2019-06-131-3/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubootenv'Sascha Hauer2019-06-111-0/+8
|\
| * filetype: Allow specifying cdev's filetype explicitlyAndrey Smirnov2019-06-071-0/+6
| | | | | | | | | | | | | | | | | | Allow specifying cdev's filetype explicitly to support the cases where the type of a cdev is known apriori, yet cannot be determined by reading the cdev's content. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * filetype: Add "U-Boot environmemnt variable data" filetypeAndrey Smirnov2019-06-071-0/+2
| | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-06-114-9/+13
|\ \
| * | remove CONFIG_DEBUG_INFOOleksij Rempel2019-06-071-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | The ELF file should have debug symbols, the binary should have no symbols any way. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | filetype: fix typoAntony Pavlov2019-06-071-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | libbb: Drop simple_itoa()Andrey Smirnov2019-05-281-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Hush is the only one user of simple_itoa() and the code there can be re-implemented using snprintf(). Change the code to get rid of simple_itoa(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: state: check lengthJan Remmet2019-05-231-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | if written_length is read from a partial written bucket it may be to big and xmalloc will panic barebox. Check if the value is sane. Make read_len unsigned to avoid negative values. Signed-off-by: Jan Remmet <j.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/imx'Sascha Hauer2019-06-111-7/+23
|\ \ \
| * | | imx-bbu-nand-fcb: exchange firmware slots when used firmware is refreshedSascha Hauer2019-05-231-0/+6
| | | | | | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | imx-bbu-nand-fcb: refresh unused firmware when it needs refreshSascha Hauer2019-05-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far we only refreshed the unused firmware when it differs from the used one, but we also have to refresh it when the pages need a cleanup (-EUCLEAN returned). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | imx-bbu-nand-fcb: return positive result when firmware needs cleanupSascha Hauer2019-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The caller of read_firmware() expects a positive return value when a firmware is readable but needs a cleanup, so return 1 instead of -EUCLEAN. Without this a firmware will never be refreshed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | imx-bbu-nand-fcb: make info messages in read_firmware_all() clearerSascha Hauer2019-05-231-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When talking about primary and secondary firmware also say in which slot they are. Also, when talking about the slot say if it's the primary or secondary firmware in that slot. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | imx-bbu-nand-fcb: always print info messages in read_firmware_all()Sascha Hauer2019-05-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | read_firmware_all() prints some info messages at the end. There's one case where we bail out early and no messages are printed. This is confusing, drop the return and always print messages. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | imx-bbu-nand-fcb: print primary/secondary firmware page numbersSascha Hauer2019-05-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When rewriting FCBs print information where the primary and where the secondary firmware will be. This allows to check consistency with earlier messages. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | imx-bbu-nand-fcb: print page numbers instead of block numbersSascha Hauer2019-05-231-2/+3
| | |/ | |/| | | | | | | | | | | | | | | | | | | The whole file uses NAND page numbers, so for clarity print the message about where the new firmware is written to with page numbers aswell. Also refer to the slot the firmware is written into. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/at91'Sascha Hauer2019-06-111-0/+21
|\ \ \
| * | | ARM: at91: debug_ll: make UART base address configurableAhmad Fatoum2019-05-271-0/+21
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is in line with other platforms such as i.MX, which allow specifying a debug port. As we can't use port indices because the UARTs aren't mapped consecutively, allow specifying a hex base at configuration time. A side effect of this patch is that sama5d4's HAVE_AT91_DBGU2 is now honored as well. Previously anything besides DBGU0 defaulted to DBGU1. Fixes: 06a0773ee31 ("ARM: at91: add sama5d4 soc support #2") Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Tested-by: Sam Ravnborg <sam@ravnborg.org> [afa: moved base address defaults to common/Kconfig] Signed-off-by: Ahmad Fatoum <afa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/arm'Sascha Hauer2019-06-112-0/+27
|\ \ \ | |/ / |/| |
| * | ARM: Initial OP-TEE supportSascha Hauer2019-06-072-0/+27
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds initial support for OP-TEE, see https://www.op-tee.org/ barebox starts in secure mode as usual. When booting a kernel the bootm code also loads the optee_os binary. Instead of jumping into the kernel barebox jumps into the optee_os binary and puts the kernel execution address into the lr register. OP-TEE then jumps into the kernel in nonsecure mode. The optee_os binary is passed with the -t option to bootm or with global.bootm.tee. Optionally OP-TEE can be compiled into barebox using the builtin firmware feature. Enable the Kconfig option and place or link your tee binary as optee.bin into the firmware directory. The amount of SDRAM which is kept free for OP-TEE is configurable. This patch was tested on a i.MX6 Nitrogen6x board. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / serdev: Do not call .receive_buf() callback recursivelyAndrey Smirnov2019-05-151-0/+6
|/ | | | | | | | | | | | Code implementing .receive_buf() callback can potentially call serdev_device_write(), which will call serdev_device_poller(). We need to make sure that such a call is a no-op in order to prevent corrupting shared data buffer as well as breaking .receive_buf callback that most likely does not expect that to happen. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Tested-by: Cory Tusar <cory.tusar@zii.aero> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-05-101-1/+1
|\
| * ddr_spd: Fix mod_ranks test张忠山2019-04-101-1/+1
| | | | | | | | | | | | | | ((x & 0x10) == 1) can never be true. Test for the bit at 0x10 instead. Signed-off-by: 张忠山 <zzs213@126.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/layerscape'Sascha Hauer2019-05-102-1/+10
|\ \
| * | 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>
| * | filetype: Detect Layerscape PBL imagesSascha Hauer2019-05-091-0/+7
| |/ | | | | | | | | | | | | The Layerscape SoCs have their own boot image format. Add filetype detection for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | defaultenv: Convert init script to CSascha Hauer2019-04-241-19/+169
| | | | | | | | | | | | | | | | | | | | | | It's hard to get more complicated things right in hush. This commit converts the /env/bin/init script to C code. With this we get a better error handling and better control what is being done. If /env/bin/init exists in the environment then it is still executed instead of the corresponding C code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | console_countdown: Add pattern listSascha Hauer2019-04-241-1/+18
| | | | | | | | | | | | | | This adds an optional string argument to console_countdown() which can hold a list of keys which also abort the countdown. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | console: forbid ctrlc during startupSascha Hauer2019-04-241-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When global.autoboot_abort_key is set to ctrl-c then the user is expected to press ctrl-c to get to the prompt. The user might press ctrl-c before the init script runs the "timeout" command. In this case the init script is aborted at arbitrary places which leads to inconsistent results depending on the place it is aborted. This patch introduces the global.console.ctrlc_allowed variable. When this variable is set to false ctrl-c is ignored entirely. The variable is set to false by default and changed to true in the init script. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Shell: Handle aborting loops betterSascha Hauer2019-04-243-6/+26
|/ | | | | | | | | | | | | | | | | | It's easy to get stuck in an infinite loop in the hush shell: while true; do sleep 1; done The 'sleep' command will check for ctrl-c with the ctrlc() function. This will abort the sleep command. Hush then checks for ctrl-c again in the loop. The ctrl-c in the buffer has already been eaten by the sleep command, so the loop will continue. With this patch we remember the presence of a ctrl-c character in a variable instead of checking for a new character each time. The variable must be resetted explicitly by calling ctrlc_handled() which will be called by the shell in the outer loop. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/warnings'Sascha Hauer2019-04-091-1/+1
|\
| * treewide: Make locally used functions staticSascha Hauer2019-03-181-1/+1
| | | | | | | | | | | | | | Many functions are only used locally but still are globally visible. Make these function static. Avoids warnings generated with -Wmissing-prototypes Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-04-091-2/+2
|\ \
| * | treewide: surround Kconfig file paths with double quotesMasahiro Yamada2019-03-211-2/+2
| |/ | | | | | | | | | | | | | | | | Based on Linux commit 8636a1f9677db4f883f29a072f401303acfc2edd This will be needed when you sync Kconfig with Linux 5.0 or later. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/lseek'Sascha Hauer2019-04-084-39/+34
|\ \
| * | state: Fix lseek error check in state_mtd_peb_write()Andrey Smirnov2019-03-111-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. While at it, make sure to populate return error code from 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: Fix lseek error check in state_mtd_peb_read()Andrey Smirnov2019-03-111-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. While at it, make sure to populate return error code from 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: Fix lseek error check in state_backend_bucket_direct_write()Andrey Smirnov2019-03-111-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. While at it, make sure to populate return error code from 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: Fix lseek error check in state_backend_bucket_direct_read()Andrey Smirnov2019-03-111-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. While at it, make sure to populate return error code from 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | uimage: Fix lseek error check in uimage_load_to_buf()Andrey Smirnov2019-03-111-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | uimage: Fix lseek error check in uimage_load()Andrey Smirnov2019-03-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. While at it, make sure to populate return error code from 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | uimage: Fix lseek error check in uimage_verify()Andrey Smirnov2019-03-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. While at it, make sure to populate return error code from 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: Always return enum filetype in file_name_detect_type_offset()Andrey Smirnov2019-03-111-2/+2
| |/ | | | | | | | | | | | | | | | | None of the callers of file_name_detect_type_offset() are prepared to deal with negative error code. Change the code to return filetype_unknown if open_and_lseek() fails. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/layerscape'Sascha Hauer2019-04-081-0/+8
|\ \
| * | ARM: Add basic Layerscape supportSascha Hauer2019-03-131-0/+8
| |/ | | | | | | | | | | | | | | | | | | This adds basic Layerscape support: - Makefile/Kconfig - Register maps - errata workarounds Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / common: extend BOOTM_FITIMAGE_SIGNATURE help textBastian Krause2019-03-181-1/+3
|/ | | | | | | This points out how to actually use BOOTM_FITIMAGE_SIGNATURE. Signed-off-by: Bastian Krause <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spd'Sascha Hauer2019-03-074-27/+183
|\