summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* 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
|\
| * bootsource: add JTAG bootsourceLucas Stach2019-11-111-0/+1
| | | | | | | | | | | | | | | | Some SoCs are able to detect if they are booted from JTAG. Add the enum value to be able to represent this as a valid bootsource. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/randfixes'Sascha Hauer2019-12-103-12/+2
|\ \
| * | ARM: PBL break is not available on ARMv4Lucas Stach2019-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ARMv4 does not support the bkpt mnemonic. Rather than trying to work around this, just disable this feature for ARMv4. On Tegra the PBL runs on the ARM720T co-processor, so we also need to disable the option for this SoC architecture. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: provide stubs for ctrlc_* functionsLucas Stach2019-12-021-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | Currently the stubs are only provided for CONFIG_CONSOLE_SIMPLE, but they are also needed for CONSOLE_NONE. Move them to the header. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ratp: add more build dependenciesLucas Stach2019-12-021-0/+1
| | | | | | | | | | | | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | efi: fix off-by-one in mem_malloc_init(..., end)Ahmad Fatoum2019-12-091-1/+1
|/ / | | | | | | | | | | | | | | | | | | The second (end) parameter of mem_malloc_init() denotes the last address in the malloc region, so we need to subtract one from the current value to arrive at the correct end. So far this went not noticed, because iomem doesn't yet display barebox malloc memory region. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / filetype: mvebu: Fix kwbimage v1 detectionSascha Hauer2019-11-151-10/+12
|/ | | | | | | | | | | The kwbimage detection calculates a checksum over the first 31 bytes of the image. This is correct for the v0 image format, but for the v1 image format the checksum in the image also covers the extenstion headers. These might not be completely present in the initial buffer provided to file_detect_type(), so just drop the checksum calculation for v1 images. Fixes: bf8b6d46db ("kwbimage_v0: add support to detect and boot a mvebu v0 image") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/watchdog'Sascha Hauer2019-11-072-2/+2
|\
| * watchdog: export API to configure watchdogs by nameAhmad Fatoum2019-10-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | So far watchdog users could only configure the watchdog with the highest priority. In preparation for having the wd command configure a watchdog by name, extend watchdog_set_timeout with a struct watchdog *parameter and export functions to query default watchdog and to find watchdog by name. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * efi: efi-image: don't mask x86 interrupts on bootAhmad Fatoum2019-10-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 55da0cf1 ("efi: add support for initrd loading") introduced support for the Linux v3.6+ handover protocol[1]. As part of this change a x86 cli (Clear Interrupt Flag) instruction was introduced just prior to the jump into the kernel's EFI handover protocol entry point. While the normal Linux x86 boot protocols require that interrupts are masked on entry, this doesn't apply to the EFI stub, because the EFI stub itself is the one implementing the boot protocol and as such masks the interrupts itself[2]. EFI watchdogs may, and often are, implemented using a timer interrupt. Dropping the cli will allow monitoring the boot of the kernel up to it calling ExitBootServices. In absence of a hardware watchdog, this is the only watchdog available to users with EFI 1.0+, so it seems prudent to not make it even more useless. [1]: https://www.kernel.org/doc/Documentation/x86/boot.txt [2]: Linux v5.4-rc4, arch/x86/boot/compressed/eboot.c Cc: Michael Olbrich <mol@pengutronix.de> Fixes: 55da0cf1 ("efi: add support for initrd loading") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-11-072-5/+5
|\ \
| * | common: state: improve kconfig help textRoland Hieber2019-10-231-3/+3
| | | | | | | | | | | | | | | | | | Cc: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | partition: include partuuid string in debug stringAhmad Fatoum2019-10-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | When debugging partitions detected by barebox, knowing the partuuid can be useful. Include it in the dev_dbg output. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/efi'Sascha Hauer2019-11-073-2/+5
|\ \ \ | |_|/ |/| |
| * | efi: silence warning about un-prototyped assembly-called functionsAhmad Fatoum2019-10-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Both _relocate and efi_main are only called from assembly, but -Wmissing-prototypes doesn't know that and warns about them. Pre-declare prototypes to silence the warnings. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | efi: retire efi_compare_guid in favor of efi_guidcmpAhmad Fatoum2019-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both functions wrap the same memcmp except that one uses pointers to GUIDs and the other passes the GUIDs by value. The function is static inline, so it doesn't really matter which one we keep. We'll drop efi_compare_guid because it's been used once only in the code base so far. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | efi: Fix typo in description stringAhmad Fatoum2019-10-181-1/+1
| |/ | | | | | | | | | | | | s/Conosle/Console/ Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / console_simple: fix linking error when ARCH_HAS_CTRLC enabledDU HUANPENG2019-10-181-5/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | this error happens in sandbox with simple console, sandbox has ARCH_HAS_CTRLC enabled by default $ make sandbox_defconfig $ make menuconfig (select CONFIG_SHELL_SIMPLE) $ make LD barebox common/built-in.o: In function `__pr_memory_display': /home/du/source/barebox/common/memory_display.c:117: undefined reference to `ctrlc' common/built-in.o: In function `run_init': /home/du/source/barebox/common/startup.c:317: undefined reference to `console_ctrlc_allow' common/built-in.o: In function `parse_stream_outer': /home/du/source/barebox/common/hush.c:1742: undefined reference to `ctrlc' common/built-in.o: In function `run_list_real': /home/du/source/barebox/common/hush.c:895: undefined reference to `ctrlc' common/built-in.o: In function `run_shell': /home/du/source/barebox/common/hush.c:1940: undefined reference to `ctrlc_handled' Signed-off-by: DU HUANPENG <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rsa'Sascha Hauer2019-10-172-17/+24
|\
| * fit-image: Use compiled-in keysSascha Hauer2019-10-151-11/+16
| | | | | | | | | | | | | | | | The compiled-in keys can be retrieved with rsa_get_key(). Try to use them first before falling back to looking up the keys in the device tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * rsa: let rsa_of_read_key() return a fully allocated keySascha Hauer2019-10-151-4/+6
| | | | | | | | | | | | | | | | | | | | Until now rsa_of_read_key() took a pointer to a key and filled the struct rsa_public_key members with allocated values. So far we have never freed these values. Change rsa_of_read_key() to always return a fully allocated key and provide rsa_key_free() to free it. Let the FIT image code free the key after usage. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * command: Use array of pointers to commandsSascha Hauer2019-10-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to store the commands as a linker array. One problem with this is that on X86_64 for unknown reasons the linker uses a different struct alignment than the compiler, so when we use the linker to compose the array and the compiler to iterate over it we have to play tricks with manually adjusting the alignment. The other problem is that we declare the commands as const (and also put it in .rodata), but in fact we do not treat it as const: we put the commands onto a list which modifies the struct list_head list member of struct command. With this patch we no longer put the command themselves into an array, but instead create an array of pointers to the commands. This inherently solves the second issue as well. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/of-overlay'Sascha Hauer2019-10-172-0/+96
|\ \
| * | blspec: load firmware if specified in dt overlayMichael Tretter2019-09-161-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | If a device tree overlay referenced by the blspec depends on firmware, try to load the firmware from the default Linux firmware search path /lib/firmware in the about to be started rootfs. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | firmware: add function to find firmware by devicetree nodeMichael Tretter2019-09-161-0/+18
| | | | | | | | | | | | | | | | | | | | | Allows to get the firmware manager using a phandle from the devicetree. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | blspec: add support for devicetree overlaysMichael Tretter2019-09-161-0/+61
| |/ | | | | | | | | | | | | | | | | | | | | Read the devicetree-overlay property from the blspec entry and register the overlays when booting the blspec entry. Do not fail the boot if an overlay cannot be loaded, because if Linux fails to boot without an overlay, the base device tree is broken. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-10-177-19/+30
|\ \
| * \ Merge branch 'imx_gpt_file_header_fix' of ↵Sascha Hauer2019-10-141-1/+1
| |\ \ | | | | | | | | | | | | https://github.com/KLSMartin/barebox into for-next/misc
| | * | common/partitions/efi: fix gpt detectionLeif Middelschulte2019-10-141-1/+1
| | |/ | | | | | | | | | | | | | | | | | | On some boards (such as i.MX) the buffer might contain both: A barebox image *and* a GPT partition table. Thus, irrelevant filetypes should be ignored.
| * | common: state: fix backward compatibilityUlrich Ölmann2019-10-141-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts [1] as it annihilated its counterpart of commit [2]. [1] 5033b4f58f71 ("common: state: harmonize code with dt-utils") [2] 480cde1b2283 ("state: keep backward compatibility") Fixes: 5033b4f58f71 ("common: state: harmonize code with dt-utils") Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: backend_bucket_circular: fix double free()Ulrich Ölmann2019-10-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ports the following dt-utils commit (as the actual code that is changed is removed by the preprocesser when compiling barebox this patch is only of cosmetic nature to keep both code bases in sync): | commit 634317cc91202304c1477a6d738d7c7691b80419 | Author: Kim Christensen <kch@skov.dk> | Date: Wed Sep 18 16:48:23 2019 +0200 | | state: backend_bucket_circular: fix double free() | | The function state_mtd_peb_read() is only a user of buf and not its owner, | hence it may not deallocate it. | | Signed-off-by: Kim Christensen <kch@skov.dk> | Reviewed-by: Ulrich Ölmann <u.oelmann@pengutronix.de> | Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: backend_bucket_circular: harmonize code with dt-utilsUlrich Ölmann2019-10-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Comparing barebox' commit [1] with dt-utils' commit [2] it is obvious that adjusting the return value has been forgotten in barebox - fix that. (As the actual code that is changed is removed by the preprocesser when compiling barebox this patch is only of cosmetic nature to keep both code bases in sync). [1] 9d6d91931afb ("state: Remove -EUCLEAN check from userspace tool") [2] 791a2404116d ("state: Remove -EUCLEAN check from userspace tool") Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | console: disallow opening for writing when no write method definedAhmad Fatoum2019-10-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some consoles, like the input console (usually /dev/cs0), don't feature a puts or putc callback. Trying to echo out of them would thus crash: barebox@Embest MarS Board i.MX6Dual:/ echo -a /dev/cs0 prefetch abort pc : [<00000004>] lr : [<4fd05071>] WARNING: [<...>] (fops_write+0xd/0x10) WARNING: [<...>] (devfs_write+0x21/0x2a) WARNING: [<...>] (__write+0xcb/0xf0) WARNING: [<...>] (write+0x2d/0x68) WARNING: [<...>] (dputc+0x31/0x34) WARNING: [<...>] (do_echo+0xcb/0x144) Fix this by only allowing open(.., O_WRONLY) or open(..., O_RDWR) when puts is defined. Consoles defining putc are covered by this as well as those have putc-calling __console_puts assigned as their puts when they are registered. Now echo -a /dev/cs0 would yield: open: Operation not permitted Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | blspec: skip entries that are not blspec entriesMichael Tretter2019-10-141-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The list of boot entries can contain items that are not blspec entries. For example, the bootchooser also adds an item to this list. Therefore, blspec cannot unconditionally interpret entries as blspec entries. The error is reproduced by listing the boot entries with the bootchooser and a rootfs with blspec entries, e.g.: boot -l bootchooser /mnt/nfs Check if a bootentry is a blspec entry by testing if the boot function is blspec_boot. Reported-by: Thomas Hämmerle <Thomas.Haemmerle@wolfvision.net> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>