summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
...
| * filetype: add STM32 image typeAhmad Fatoum2019-07-151-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Both STM32MP BootROM and TF-A first stage expect subsequent bootloader stages to feature a specific 256-byte long STM32 file header. Add detection of the header to file_detect_type(). While there's only one version of the header so far, identify the new header as v1 anyway, so new versions can be unambiguously added. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mtd-gpmi-nand'Sascha Hauer2019-08-151-4/+11
|\ \
| * | mtd: nand-mxs: change API between NAND driver and fcb codeSascha Hauer2019-08-061-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The imx-bbu-nand-fcb update handler code calls into the NAND driver to get the ecc strength and bad block marker position. Change the API so that only a single function is necessary and not three functions. Also in future the ecc strength will be configurable via device tree. This means static parameters like page size / oob size are no longer enough to calculate the ecc strength and so we store a pointer to our mtd_info struct in a static global variable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/mtd'Sascha Hauer2019-08-153-22/+47
|\ \ \
| * | | ubiformat: Fix wrong error testsSascha Hauer2019-07-161-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several tests in ubiformat test for a positive error code where a negative error code is returned from the called functions. This is because the original code used tested against errno which is a positive value. One place still tests against errno, but the test should be against the return value from the last function call. Fix that aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | ubiformat: handle write errors correctlySascha Hauer2019-07-161-9/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a barebox adoption of mtd-utils commit d9cbf6a ("ubiformat: handle write errors correctly"): | ubiformat: handle write errors correctly | | This issue was reported and analyzed by | Anton Olofsson <anol.martinsson@gmail.com>: | | when ubiformat encounters a write error while flashing the UBI image (which may | come from a file of from stdout), it correctly marks the faulty eraseblock as | bad and skips it. However, it also incorrectly drops the data buffer which was | supposed to be written, and reads next block of data. | | This patch fixes this issue - in case of a write error, we preserve the current | data and write it to the next eraseblock, instead of dropping it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: peb: Do not mark as bad in mtd_peb_torture()Sascha Hauer2019-07-163-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both the Kernel and mtd-utils have peb torture functions and both do not mark the block as bad automatically. Instead, the caller must mark the block as bad when -EIO is returned from the torture function. Do the same in barebox. This is necessary as the UBI code otherwise may mark a block as bad twice: Once indirectly in mtd_peb_torture() and then directly afterwards. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | ubiformat: improve generation of UBI image sequenceSascha Hauer2019-07-151-2/+4
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UBI ec_hdr has an image_seq field. During attaching UBI expects that its value is the same for all eraseblocks. The value should be changed with every ubiformat and is used to detect half written images. In barebox we use a pseudo random number generated with rand() for this value. The ubiformat command calls srand(get_time_ns()) to initialize the pseudo random numbber generator. This is done in the option parser, so when ubiformat() is called directly (from fastboot for example) the pseudo random number generator is not initialized and we get the same values after every barebox restart. This patch moves the pseudo random number generator initialization to the place where the numbers are generated. Also use random32() rather than rand() to generate 32bit values rather than 15bit values (0 - RAND_MAX). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / | console: return number of characters written in fops_writeSascha Hauer2019-08-051-1/+1
|/ / | | | | | | | | | | | | | | struct cdev_operations write() callback is supposed to return the number of characters written. Do this instead of returning 0 for the console device files. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/stm32'Sascha Hauer2019-07-121-0/+1
|\ \
| * | reset_source: add new Brownout reset (BOR) sourceAhmad Fatoum2019-06-131-0/+1
| |/ | | | | | | | | | | | | | | | | The STM32MP1 can report brown out as reason for a reset, which doesn't fit into existing reasons. Thus add a new one to the enumeration. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/pstore'Sascha Hauer2019-07-121-0/+4
|\ \
| * | pstore: Only capture log messagesSascha Hauer2019-07-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this pstore only captures barebox log messages printed with pr_* and dev_*, but no longer anything printed with printf and friends. When capturing the barebox output with pstore only the log messages are of interest, but not the ones printed with printf and certainly not the things typed interactively on the command line. These are logged currently because we register pstore as a barebox console. Instead, hook into pr_puts which only outputs the barebox log messages. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | blspec: invalidate only necessary bootm variablesRouven Czerwinski2019-07-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of removing all global bootm variables, remove only the ones which will be set by the blspec entries. This allows setting the bootm.tee variable to load OP-TEE for blspec entries or setting the image load address. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | startup: Factor out the autoboot counter to separate functionSascha Hauer2019-07-031-46/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | The autoboot countdown is part of the init function. This patch factors out this code to a separate function to allow boards to call it at a different time. Also boards can set the autoboot state manually in case they have its own idea how to interrupt the autoboot process. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | startup: Create boot related variables where they are usedSascha Hauer2019-07-032-14/+14
| | | | | | | | | | | | | | | | | | | | | global.boot.default, global.linux.bootargs.base and global.user are used in the boot code, so create them there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | startup: Create global.linux.bootargs.dyn.* variables where they are neededSascha Hauer2019-07-032-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | global.linux.bootargs.dyn.* variables are exclusively used in boot scripts, so create them right before executing a script. This moves the corresponding code from the unrelated startup code to the place where the variables are used. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | startup: remove unused editcmd variableSascha Hauer2019-07-031-3/+0
| | | | | | | | | | | | | | | | | | Nobody uses global.editcmd, so remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | add CONFIG_PBL_BREAK optionOleksij Rempel2019-06-271-0/+8
| |/ |/| | | | | | | | | | | | | With this option barebox will be build with breakpoint instruction in early pbl stage. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | 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>