summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* kconfig: add 'option modules' to allow tristate options to become mMasahiro Yamada2020-05-201-0/+1
| | | | | | | | | | | | | | | | | | Since commit 18895514dc5e ("kconfig: update to v3.18-rc6"), tristate symbols cannot become 'm'. In old days of Linux, CONFIG_MODULES was the special option hard-coded in Kconfig. The current Kconfig does not know which option is it. You need to specify 'option modules' to teach Kconfig that it is the module support switch. Add 'option modules' to revive the module builds. Fixes: 18895514dc5e ("kconfig: update to v3.18-rc6") Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mxs'Sascha Hauer2020-05-141-0/+4
|\
| * filetype: Add filetype for i.MX23/28 SD card imagesSascha Hauer2020-05-061-0/+4
| | | | | | | | | | | | | | Add a filetype for i.MX23/28 SD card images so that they can be detected. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2020-05-1439-120/+46
|\ \
| * | common.h: move and rename lregion_overlap()Masahiro Yamada2020-05-051-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lregion_overlap() is only used by common/startup.c There is no need to define it in include/common.h While I was here, I also renamed it to region_overlap(), and got rid of the 'inline' keyword. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: imd: handle error in imd_write_crc32Steffen Trumtrar2020-05-051-1/+6
| | | | | | | | | | | | | | | | | | | | | Don't just ignore the return value of write_file. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | treewide: remove references to CREDITSUwe Kleine-König2020-04-2738-112/+0
| | | | | | | | | | | | | | | | | | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: bootm: Enforce CONFIG_BOOTM_FORCE_SIGNED_IMAGES for TEE binsAlbert Schwarzkopf2020-04-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, unsigned TEE binaries can be booted. This patch ensures that CONFIG_BOOTM_FORCE_SIGNED_IMAGES is also enforced for TEE binaries. Signed-off-by: Albert Schwarzkopf <a.schwarzkopf@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | startup: add $global.autoboot to make behavior configurableAhmad Fatoum2020-04-271-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already have a global_autoboot_state variable that controls barebox init behavior on startup: * ABORT abort and fall into shell * MENU display boot menu * BOOT boot immediately, only abortable via ctrl+c during init * COUNTDOWN regular boot after count down Exporting this as a device parameter allows us to support some different boot scenarios: * COUNTDOWN is the default * ABORT boot always while debugging * display MENU by default (e.g. for graphical boots) * BOOT while ignoring external code calling console_countdown_abort() Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | startup: don't clobber original autoboot stateAhmad Fatoum2020-04-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | do_autoboot_countdown changes autoboot state if the user presses m for menu or ctrl+c to abort during count down. This is an internal detail and doesn't need to be reflected in the state of the global variable. This will improve UX when exporting the variable in the follow-up commit, because on a regular boot it $autoboot will expand to countdown instead of abort/boot/menu dependent on prior user input. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | startup: rename AUTOBOOT_UNKNOWN to more descriptive AUTOBOOT_COUNTDOWNAhmad Fatoum2020-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | If we export the autoboot state variable for customization, having unknown as default is not so helpful. Rename it to what actually happens (abortable countdown). Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | Add magicvar description for autoboot variablesSascha Hauer2020-04-271-0/+8
| |/ | | | | | | | | | | | | global.autoboot_abort_key and global.autoboot_timeout lack a magicvar description. Add one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/kconfig'Sascha Hauer2020-05-141-3/+0
|\ \
| * | treewide: Kconfig: remove some unused symbolsAhmad Fatoum2020-04-291-3/+0
| |/ | | | | | | | | | | | | | | All these symbols are defined, but unused anywhere in the barebox tree. Remove them. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/kbuild'Sascha Hauer2020-05-143-5/+3
|\ \
| * | kbuild: sync filechk rule with Linux 5.7-rc2Masahiro Yamada2020-05-041-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'filechk' in the latest Linux works more simply, reliably. - Do not show CHK every time - Delete the *.tmp file when the filechk_$(1) fails - Do not open the first prerequisite. This is unneeded in most cases. I deleted pointeless dependency on Makefile. Also delete the meaningless assignment to 'targets' because filechk does not generate .cmd file. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | image: support 'powerpc' for mkimage architectureMasahiro Yamada2020-05-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the -A option of mkimage is determined based on $(SRCARCH). I want to rename arch/ppc/ to arch/powerpc/. Support 'powerpc' for the -A option of mkimage beforehand, otherwise the barebox.uimage build would be broken. common/image.c in U-Boot supports both 'powerpc' and 'ppc' for the name of IH_ARCH_PPC. Let's do likewise in barebox. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | kbuild: make DEFCONFIG_LIST workMasahiro Yamada2020-04-271-2/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of the Kconfig commands (except defconfig and all*config) read the .config file as a base set of CONFIG options. When it does not exist, the files in DEFCONFIG_LIST are searched in this order and loaded if found. This is not working for barebox because ARCH_DEFCONFIG is not set by anyone, nor arch/$(ARCH)/defconfig exists. Fix this. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: add COMPILE_TEST prompts for some off-by-default optionsAhmad Fatoum2020-05-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | Some Kconfig options we have are promptless and off-by-default and instead can only be enabled by being selected from platform options. For some of those that aren't compile testable, add a new COMPILE_TEST-only prompt. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: introduce COMPILE_TEST option for build-testingAhmad Fatoum2020-05-081-0/+13
|/ | | | | | | | | | | | | | Compile-time analysis may help us catch latent bugs in barebox. For this to be most effective, we need an easy way to compile as much of barebox as possible. Giving all driver options prompts would do this, but at the cost of making user experience worse, by asking them about drivers for HW that's clearly not relevant to the platform they selected. Do as Linux does and provide a default-off COMPILE_TEST option, which we can use to make extra drivers selectable. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-04-1619-36/+40
|\
| * common: fix typos found with codespellYegor Yefremov2020-03-2318-36/+36
| | | | | | | | | | Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * common: oftree: trim leading spaces from bootargsClement Leger2020-03-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | When barebox concatenates all dynamic bootargs string for linux, if they are empty, the resulting string might be composed of only spaces. Currently, there is no check for such string and it leads to overwriting bootargs in the device tree by an empty string. To avoid this behavior, use skip_spaces to trim leading spaces and then check if the string is empty. If so, simply returns and don't patch device tree bootargs. Signed-off-by: Clement Leger <cleger@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/arm'Sascha Hauer2020-04-161-3/+18
|\ \
| * | ARM: bootm: Add some printfs when request_sdram_region() failsSascha Hauer2020-03-251-3/+18
| |/ | | | | | | | | | | | | request_sdram_region() can fail in which case it's interesting which region we tried to request. Add some printfs for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / imd: Use %zu for printing size_tSascha Hauer2020-04-011-1/+1
|/ | | | | | To avoid compiler warnings Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/stm32'Sascha Hauer2020-03-181-3/+3
|\
| * reset_source: introduce reset_source_to_stringAhmad Fatoum2020-02-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a few places where driver code prints reset_source_name() to console after setting the reset source. This working is probe order dependent, because reset_source_name() prints the highest priority reset_source so far, which doesn't necessarily have to be the one that was just computed. Implement reset_source_to_string, so drivers can be migrated to use it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2020-03-182-4/+5
|\ \
| * | state: treat state with all-invalid buckets as dirtyAhmad Fatoum2020-03-091-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The state.dirty flag controls whether state_save will actually persist state. It is cleared when we successfully load or save state and set on writing a state parameter. When the state however becomes corrupt during barebox runtime and state.dirty == 0, reinitializing the state to defaults is quite cumbersome: 1. We reset twice. After the first reset, the dirty flag is reset and before the second, state_save will reinitialize to defaults 2. We write any state variable and then run the state -s command Both workarounds are quite obscure, improve the user experience by having state -l set the dirty flag when it fails, so a subsequent state -s may persist the default values to state. Steps to reproduce: barebox$ state -l state: Using bucket 0@0x00000000 barebox$ memcpy -s /dev/zero -d /dev/eeprom0.state 0 0 0x400 barebox$ state -s barebox$ state -l ERROR: state: No meta data header found ERROR: state: No meta data header found ERROR: state: No meta data header found ERROR: state: Failed to find any valid state copy in any bucket ERROR: state: Failed to read state with format raw, -2 state: No such file or directory Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: backend_storage: deal gracefully with runtime bucket corruptionAhmad Fatoum2020-03-091-0/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Corrupting an already selected bucket and then reading it again will crash barebox when it attempts the refresh: barebox$ state -l barebox$ mw -d /dev/eeprom0.state 0 0x42 barebox$ state -l ERROR: state: No meta data header found state: Using bucket 1@0x00000040 unable to handle NULL pointer dereference at address 0x00000000 pc : [<4fe4f1ea>] lr : [<4fe0bcb1>] sp : 4ffefd5c ip : 00000000 fp : 2ff68f04 r10: 4ffefdc8 r9 : 4b434d63 r8 : 30155f50 r7 : 00000024 r6 : 2ff68b60 r5 : 2ff68e90 r4 : 00000000 r3 : 00000024 r2 : 00000024 r1 : 30155f50 r0 : 00000000 Flags: Nzcv IRQs off FIQs off Mode SVC_32 WARNING: [<4fe4f1ea>] (memcmp+0x14/0x1a) from [<4fe0bcb1>] (bucket_refresh.isra.0+0x4d/0x78) WARNING: [<4fe0bcb1>] (bucket_refresh.isra.0+0x4d/0x78) from [<4fe0be1d>] (state_storage_read+0xd1/0x104) WARNING: [<4fe0be1d>] (state_storage_read+0xd1/0x104) from [<4fe0a5bd>] (state_do_load+0x1d/0x78) WARNING: [<4fe0a5bd>] (state_do_load+0x1d/0x78) from [<4fe04137>] (execute_command+0x23/0x4c) The memcmp called here is an optimization to skip I/O if the used bucket and the one to be refreshed compare equal. Unfortunately, if the now corrupt bucket was previously the used one, bucket->len will hold the old value and we'll run into a NULL pointer dereference. While this is quite inconvenient, it appears it doesn't affect correctness: after the reset, the corrupt bucket will be refreshed as expected. Improve upon this by setting the length to zero when we are NULLing the buffer. The zero length of the corrupted bucket will then compare unequal to used_bucket->len in bucket_refresh() and ensure we will always refresh the buffer if it becomes corrupted without an intermittent reset. Fixes: 238008b4bd8f ("state: Drop cache bucket") Cc: Enrico Jörns <ejo@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/block'Sascha Hauer2020-03-181-2/+23
|\ \ | |/ |/|
| * Revert "block: Adjust cache sizes"Ahmad Fatoum2020-03-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On 12/13/19 2:12 PM, Sascha Hauer wrote: > On Tue, Dec 10, 2019 at 03:44:52PM +0100, Hubert Feurstein wrote: >> With v2015.06.0 the indicated progress of the copy command is very >> smooth. Calling "cp -v /dev/zero /dev/mmc3.root" takes about 80 >> seconds for 256MB. But with v2019.12.0 the progress is very bumpy and >> the copy takes about 280 seconds. >> >> I've tracked this down to this commit which destroys the performance: >> "block: Adjust cache sizes" (b6fef20c1215c6ef0004f6af4a9c4b77af51dc43) > > We could just revert this patch. I can't find any workload that gets > faster with b6fef20c1215. It's rather the other way round. Do this by reverting commit b6fef20c1215c6ef0004f6af4a9c4b77af51dc43. Reported-by: Hubert Feurstein <h.feurstein@gmail.com> Suggested-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * block: Implement discard_rangeSascha Hauer2020-02-141-0/+21
| | | | | | | | | | | | | | | | This implements the discard_range hook. When a range of data is discarded then we do not have to read it from the device and can pass a zeroed buffer instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/parameter'Sascha Hauer2020-02-183-23/+23
|\ \
| * | globalvar: Allow NULL pointers to be returned by dev_add_param()Christian Eggers2020-01-271-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following commit will change the return value of dev_add_param() from -ENOSYS to NULL if CONFIG_PARAMETER is disabled. After that, building without CONFIG_PARAMETER will return a NULL pointer to __nvvar_add() instead of an error. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: remove param member from state_uint32, state_enum32, state_macChristian Eggers2020-01-272-11/+8
| | | | | | | | | | | | | | | | | | | | | After adding the parameter, the pointer isn't required anymore. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: remove param member from struct state_stringChristian Eggers2020-01-272-4/+4
| |/ | | | | | | | | | | | | After adding the parameter, the pointer isn't required anymore. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/optee'Sascha Hauer2020-02-183-21/+58
|\ \
| * | ARM: add optee early loading functionRouven Czerwinski2020-01-302-21/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a OP-TEE early loading function which expects a pointer to a valid tee binary and the device tree. OP-TEE will then be started and barebox will continue to run in normal mode. The function start_optee_early should be used in a boards lowlevel.c file. Ensure that barebox has been relocated and a proper c environment has been setup beforehand. Depending on the OP-TEE configuration, the fdt will be modified. If the internal barebox device tree is passed, OP-TEE will overwrite barebox PBL memory during this modification. Copy the fdt to a save memory location beforehand to avoid a corruption of barebox PBL memory. This also moves the OP-TEE Kconfig symbols into a separate menu. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | optee: move optee_verify_header() to commonRouven Czerwinski2020-01-282-0/+24
| |/ | | | | | | | | | | | | | | Subsequent patches will use this to verify the header in the PBL, move it to common to make it potentially available for both. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2020-02-181-3/+3
|\ \
| * | common: make CONFIG_BAREBOX_UPDATE visibleChristian Eggers2020-01-271-3/+3
| |/ | | | | | | | | | | | | | | | | The barebox update infrastructure is also useful without CONFIG_CMD_BAREBOX_UPDATE (e.g. from a own barebox_main() with CONFIG_SHELL_NONE). Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: bbu: add support for imd checksumSteffen Trumtrar2020-02-101-0/+4
| | | | | | | | | | | | | | | | | | Add support for verifying an image by use of the imd checksum. If the checksum that is saved in the image and the one that is calculated over the image differ, barebox_update aborts. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | imd: add support for checksum generation/verificationSteffen Trumtrar2020-02-103-1/+153
| | | | | | | | | | | | | | | | | | | | Add a new imd type "checksum". This type consists of the CRC32 checksum of the whole barebox image minus the checksum itself. The checksum can be written to the imd field with the bareboximd host-tool. It can be verified with said tool or with "imd" on the target. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | imd: replace magicvalue with sizeof(struct)Steffen Trumtrar2020-01-281-3/+3
|/ | | | | | | Instead of using "8" as the size of an imd_header, use the sizeof operator. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/zynq'Sascha Hauer2020-01-151-0/+4
|\
| * filetype: add Zynq image typeLucas Stach2019-12-111-0/+4
| | | | | | | | | | | | | | | | Use the 2 invariant words (width detection and image identification) from the Zynq image header to detect the filetype. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Allow usage of default environment without environment file storageAlbert Schwarzkopf2019-12-116-197/+239
|/ | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the default environment is only used when the barebox environment on the persistent store is not valid or when ENVFS_FLAGS_FORCE_BUILT_IN is set in the super block. However, ENVFS_FLAGS_FORCE_BUILT_IN can be cleared and the environmnet variables in the persistent store will be used again. This may not be desirable. This patch allows building CONFIG_DEFAULT_ENVIRONMENT independent of CONFIG_ENV_HANDLING. This can be useful if you never want to load or write values from the persistent store and you only need to read environment variables from your default environment. If CONFIG_ENV_HANDLING is not set, a message will be printed to the user indicating that changes to non-volatile variables won't be persisted. Move envfs functions that are needed when CONFIG_DEFAULT_ENVIRONMENT and/or CONFIG_ENV_HANDLING is set to a new file common/envfs-core.c. Signed-off-by: Albert Schwarzkopf <a.schwarzkopf@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/zynq'Sascha Hauer2019-12-101-0/+1
|\