summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* 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>
| * | imd: fix memory leakUlrich Ölmann2019-10-141-6/+14
| | | | | | | | | | | | | | | | | | | | | Each invocation of 'imd' ate up to 1MB of RAM. Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: drop unused code and declarations for non-existing functionsUwe Kleine-König2019-10-141-7/+0
| |/ | | | | | | | | | | | | | | | | state_get_name() is not used and so can be removed. state_backend_dtb_file() and state_backend_raw_file() were dropped in c999b507da98 ("state: Refactor state framework"). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/machine-id'Sascha Hauer2019-10-174-0/+107
|\ \
| * | bootm: allow providing machine id to KernelBastian Krause2019-09-301-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default systemd generates a machine id on first boot and tries to persist it (see `man machine-id`). When the root file system is read-only systemd cannot persist the machine id. In case multiple redundant slots are used the machine id will vary. When not handled explicitly the machine id will also change during system updates. It is possible to pass a machine id to the kernel which will be used by systemd (systemd.machine_id=). If global.bootm.provide_machine_id (or nv.bootm.provide_machine_id) is true then provide the machine id from global.machine_id as systemd.machine_id= parameter to the Kernel. Note that global.machine_id must be set, either by the machine_id_set_bootarg late init call or by setting it manually with nv.machine_id if necessary. Signed-off-by: Bastian Krause <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: machine_id: introduce machine id generationBastian Krause2019-09-303-0/+88
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds functionality to pass device-specific information that will be hashed to generate a persistent unique machine id. It is then available as global.machine_id. It can be overwritten with nv.machine_id if necessary. Passing the machine id to the kernel is done in a separate patch. Note: if multiple sources provide hashable device-specific information (via machine_id_set_hashable()) the information provided by the last call prior to the late initcall set_machine_id() is used to generate the machine id from. Thus when updating barebox the machine id might change. Signed-off-by: Bastian Krause <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/layerscape'Sascha Hauer2019-10-171-0/+2
|\ \
| * | filetype: support fastboot barebox_update with layerscape imageAhmad Fatoum2019-09-181-0/+2
| |/ | | | | | | | | | | | | | | | | | | We do not yet support USB on the Layerscape platforms, but when we do, it's imaginable that we would want to export barebox_update targets over Fastboot. Prepare for this by adding the layerscape images to those that filetype_is_barebox_image returns true for. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx'Sascha Hauer2019-10-171-1/+8
|\ \
| * | imx-bbu-nand-fcb: Mark block as bad when erasing it failsSascha Hauer2019-09-251-1/+8
| |/ | | | | | | | | | | | | | | When a block cannot be erased it must be marked as bad. Previously we accidently ignored the erase failure and the the code just wrote the firmware into that block which resulted in boot failure. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: at91: add basic sama5d2 supportAhmad Fatoum2019-10-141-0/+1
| | | | | | | | | | | | | | | | Add hardware description, chip identification and clock changes to support the sama5d2 SoC. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: at91: build for all SoCs when AT91_MULTI_BOARDS is selectedAhmad Fatoum2019-10-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the addition of 15afd9d25 ("ARM: at91: Add initial support for the EVB-KSZ9477 eval board"), we now have two multi-image capable boards supported, but users still have to choose a specific SoC, so they can't be selected at the same time. Fix this, by restricting the menu to the non-multi-image configurations, i.e. CONFIG_ARCH_* symbols become specific to non-multi-image. The multi-image configurations on the other hand directly select the CONFIG_SOC_* symbol they require. Existing CONFIG_ARCH_* usage is adjusted to align with the new usage. Eventually, we would want to have a at91_multi_defconfig along with this, but for now leave existing configs as is. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fix compile error when set CONFIG_CONSOLE_SIMPLE=yDU HUANPENG2019-10-141-0/+12
|/ | | | | Signed-off-by: DU HUANPENG <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>