summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* startup: Add missing newline to notice messageHEADmasterJules Maselbas40 hours1-1/+1
| | | | | Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/watchdog'Sascha Hauer9 days1-0/+4
|\
| * startup: inhibit watchdogs on non-interactive autoboot abortAhmad Fatoum2020-06-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | nv.autoboot=abort has been added as development aid to have barebox stop at the shell prompt automatically. It makes sense to inhibit all watchdogs in this mode, so the user can later use the shell in peace. This also applies to fastboot aborting the shell prompt. If this happens, watchdog will be automatically inhibited as well. Behavior on user aborting the shell prompt via keypad or uart input remains unchanged for backwards-compatibility. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/tlsf'Sascha Hauer9 days3-157/+262
|\ \
| * | tlsf: Update to v3.1Sascha Hauer2020-06-163-157/+262
| |/ | | | | | | | | | | | | | | This updates the tlsf implementation to v3.1. This is taken from commit deff9ab509341f264addbd3c8ada533678591905 in https://github.com/mattconte/tlsf.git. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/ratp'Sascha Hauer9 days1-49/+49
|\ \
| * | ratp: Straighten ratp deregistrationSascha Hauer2020-06-161-49/+49
| |/ | | | | | | | | | | | | | | | | | | | | | | | | There are some bugs in the error path when ratp initialization fails half way through. Reusing the global ratp context which might be half initialized makes the code hard to follow and hard to fix, so the strategy is changed to always allocating a fresh ratp context and returning -EBUSY when one exists already. We store in the context what has been done in the initialization path and add a ratp_unregister() which uses this information to tear down everything that has been initialized. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/module'Sascha Hauer9 days2-23/+52
|\ \
| * | module: Implement HAVE_MOD_ARCH_SPECIFICDavid Dgien2020-07-012-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement HAVE_MOD_ARCH_SPECIFIC Kconfig and module_frob_arch_sections() function prototype from Linux module subsystem. module_frob_arch_sections() should be implemented by any architecture that selects HAVE_MOD_ARCH_SPECIFIC, and is called from load_module() Signed-off-by: David Dgien <dgienda125@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | module: Fix module command registrationDavid Dgien2020-07-011-14/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 1e4a948673d7 ("command: Use array of pointers to commands") updated the command linker sections to contain an array of pointers to the command structs, rather than the command structs themselves. However, the load_module function was not updated to account for the change to the linker section, so fix that here. Additionally, commit 22bdecc9c591 ("lds: Move start/end address variables into defines") moved the _start and _end symbols out of the linker script and into the section macro defines, causing them to show up in the module symbol table as well, so we take can advantage of those to find the array of pointers. Fixes: 1e4a948673d7 ("command: Use array of pointers to commands") Signed-off-by: David Dgien <dgienda125@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | module: Fix adding module to list after layoutDavid Dgien2020-07-011-9/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | During load_module(), the 'this_module' section is relocated, but the pointer to the module struct isn't updated to account account for the move. Do so before adding the module to the module_list. As a side effect of properly pointing to the relocated module struct, we no longer need to manually search for and fixup the init_module symbol, so remove that code. Signed-off-by: David Dgien <dgienda125@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer9 days4-21/+27
|\ \
| * | sandbox: add libc memory allocatorAhmad Fatoum2020-07-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While we typically want to reuse as much barebox functionality as possible in sandbox, using system malloc(3) instead can be very useful when using external memory integrity tools. This is even useful for AddressSanitizer, because the reports resulting from the memory poisoning API are less detailed than the built-in support for the libc malloc(3). Note that a barebox "heap" is still allocated upfront. It's only used for request_sdram_region now though. Whatever is allocated by means of malloc and memalign will be ina disjunct heap. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | treewide: make use of PTR_ERR_OR_ZEROUwe Kleine-König2020-06-262-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PTR_ERR_OR_ZERO is designed to replace boiler plate like: if (IS_ERR(x)) return PTR_ERR(x); return 0; Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | startup: Fix do_autoboot_countdown() running multiple timesSascha Hauer2020-06-261-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The comment above do_autoboot_countdown() states: "This function can be called multiple times, it is executed only the first time.". Since 1973892533 ("startup: don't clobber original autoboot state") This is no longer the case. Bring back the old and documented behaviour. Fixes: 1973892533 ("startup: don't clobber original autoboot state") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | startup: register autoboot vars in initcallSascha Hauer2020-06-261-12/+14
| |/ | | | | | | | | | | | | | | | | globalvars should be registered early so that code modifying them also updates the backing store pointer. Move registering of global.autoboot_abort_key, global.autoboot_timeout and global.autoboot to an initcall. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/kvx'Sascha Hauer9 days2-2/+1
|\ \
| * | common: Kconfig: remove MIPS dependency for ELFClement Leger2020-07-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | There is no reason anymore to limit the use of elf on mips since there is no elf specific support needed in architectures. Drop the MIPS dependency. Signed-off-by: Clement Leger <cleger@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: bootm: allow building with an undefined IH_ARCHClement Leger2020-07-011-1/+1
| |/ | | | | | | | | | | | | | | | | Some architectures might not want to support uImage. To do so, allow IH_ARCH to be let undefined which will make it possible to compile boot support. Signed-off-by: Clement Leger <cleger@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx'Sascha Hauer9 days1-0/+8
|\ \
| * | arm: imx: add initial imx8mp supportOleksij Rempel2020-07-141-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | This adds base support for the i.MX8MP SoC. Not much to do here as this SoC is quite similar to the i.MX8M. This adds: - Kconfig symbols - bootsource detection - register base address defines - iomux defines Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
* | Merge branch 'for-next/fastboot'Sascha Hauer9 days2-84/+30
|\ \
| * | fastboot: Drop support for downloading to bufferSascha Hauer2020-06-182-82/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The option to download to a buffer instead of a file was introduced because in some workloads it is required to have a contiguous image in memory. With recent changes now ramfs can provide such a buffer via memmap API even when it downloaded the data to a file. This makes the explicit download to buffer option unnecessary, so remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fastboot: Use make_temp() to create temporary fileSascha Hauer2020-06-121-2/+3
| |/ | | | | | | | | | | make_temp() was created for this purpose, so use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/elf'Sascha Hauer9 days3-36/+236
|\ \
| * | common: bootm: add support for elf file loadingClement Leger2020-06-152-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will allows elf loader to directly have an elf file available. Thus filetype_elf bootm handlers will be able to use standard bootm functions and data. Signed-off-by: Clement Leger <cleger@kalray.eu> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: elf: add elf_open, elf_close and elf_loadClement Leger2020-06-151-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | In order to integrate elf loading into bootm command, split elf opening from elf loading. Signed-off-by: Clement Leger <cleger@kalray.eu> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: elf: load elf directly from fileClement Leger2020-06-151-35/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, elf file must be loaded into a buffer and then passed to elf_load_image. This requires to copy the whole elf file before booting it. This commit allows to pass the filename directly and will allocate data only for the elf header (elf header + program headers). This will then be used to load the elf data from the file without copying it in an intermediate buffer. Elf segments are first parsed into a list and are then loaded from the file in a second time. Signed-off-by: Clement Leger <cleger@kalray.eu> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: elf: check number of elf program headersClement Leger2020-06-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | An elf file without program headers should not be loaded. Add a check for such cases. Signed-off-by: Clement Leger <cleger@kalray.eu> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: elf: use calloc instead of xzallocClement Leger2020-06-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | This failure can be handled grecefully, use standard calloc. Signed-off-by: Clement Leger <cleger@kalray.eu> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: elf: fix warning on 32 bits architecturesClement Leger2020-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When pointers are 32 bits wide and we cast a potentially 64 bits value in it, the compiler will yield an error. Cast that value first into a phys_addr_t to match the architecture pointer size and then in a void *. Signed-off-by: Clement Leger <cleger@kalray.eu> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: elf: add computation of elf boundariesClement Leger2020-06-151-0/+7
| |/ | | | | | | | | | | | | | | | | | | In order to correctly load an initrd or a device tree after an elf file, we need to know its boundaries. This commit adds support for that and allow the bootm implementations to use it for memory loading. Signed-off-by: Clement Leger <cleger@kalray.eu> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: fat: extend for in-PBL supportAhmad Fatoum2020-07-111-1/+2
|/ | | | | | | | | | | The AT91 BootROM loads a boot.bin file from the first FAT partition into SRAM, when booting from MMC. To avoid the need for two barebox configurations for each of the bootloader stages, add PBL support for reading from FAT. This way each stage need only have a different PBL entry point. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ratp'Sascha Hauer2020-06-111-1/+16
|\
| * ratp: Remove unnecessary poller_call()Sascha Hauer2020-05-201-1/+0
| | | | | | | | | | | | | | poller_call() is called by is_timeout(), no need to do this again in a timeout loop. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ratp: Test if console exists before using itSascha Hauer2020-05-201-0/+16
| | | | | | | | | | | | | | | | Consoles can be unregistered, this happens for example when barebox implements the barebox serial USB gadget. Before using the console we have to explicitly test if the pointer is still valid each time. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2020-06-112-1/+15
|\ \
| * | password: Fix warning with empty default passwordDavid Dgien2020-06-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_PASSWORD_DEFAULT is unset, the default_passwd buffer is set to the empty string. The read_default_passwd() function wants to read at least two characters from that buffer, causing GCC to generate an array bounds warning: barebox/common/password.c: In function 'login': barebox/common/password.c:173:5: warning: array subscript [1, 2147483647] is outside array bounds of 'const char[1]' [-Warray-bounds] In file included from barebox/common/password.c:30: include/generated/passwd.h:1:19: note: while referencing 'default_passwd' Add an ARRAY_SIZE check to default_passwd so that the loop is optimized away and the warning is no longer generated. Since the read_default_passwd() function is only called when default_passwd is not the empty string, this is not a functional change. Signed-off-by: David Dgien <dgienda125@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | password: don't export read_default_passwd()Uwe Kleine-König2020-06-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This function is used only in common/password.c itself, so it doesn't need to be exported. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | blspec: Allow the "options" key to be given multiple timesRobert Karszniewicz2020-06-031-0/+12
| |/ | | | | | | | | | | | | | | | | The Boot Loader Spec says: "This key is optional and may appear more than once in which case all specified parameters are used in the order they are listed." Signed-off-by: Robert Karszniewicz <r.karszniewicz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/kbuild'Sascha Hauer2020-06-111-0/+1
|\ \
| * | 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>
* | fastboot: Use unique tempfile nameSascha Hauer2020-05-201-9/+12
| | | | | | | | | | | | | | | | With fastboot over ethernet we now can have two instances of fastboot running in parallel. Make sure that both instances use a different temporary file to store data so that they do not influence each other. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fastboot: don't close fd 0 when downloading to ramDaniel Glöckner2020-05-201-1/+2
| | | | | | | | | | | | | | | | | | When downloading to a buffer, download_fd is never assigned a valid file descriptor. We should therefore avoid calling close on the value found in that variable. Signed-off-by: Daniel Glöckner <dg@emlix.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fastboot: split generic code from USB gadgetEdmund Henniges2020-05-203-0/+998
| | | | | | | | | | | | | | | | | | | | | | | | | | The fastboot specification describes other protocols beyond USB. Allow these to reuse the generic parts of the existing fastboot code when they are implemented. Most of the changes in common/fastboot.c are due to the renaming of struct f_fastboot *f_fb to struct fastboot *fb. Signed-off-by: Edmund Henniges <eh@emlix.com> Signed-off-by: Daniel Glöckner <dg@emlix.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | poller: Add a poller commandSascha Hauer2020-05-201-0/+71
| | | | | | | | | | | | | | The poller command allows to print which pollers are registered and also how many times we can run the registered pollers in one second. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | poller: Give pollers a nameSascha Hauer2020-05-203-5/+7
|/ | | | | | It helps debugging when pollers have a name, so give them one. 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
|\ \