aboutsummaryrefslogtreecommitdiff
path: root/boot
AgeCommit message (Collapse)AuthorFilesLines
2022-10-30video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEOSimon Glass1-1/+1
Now that all the old code is gone, rename this option. Driver model migration is now complete. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30video: Drop use of the lcd header fileSimon Glass1-1/+0
This file is being removed so drop remaining references to it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-26mkimage: fit: Fix signing of configs with external dataSean Anderson1-4/+4
Just like we exclude data-size, data-position, and data-offset from fit_config_check_sig, we must exclude them while signing as well. While we're at it, use the FIT_DATA_* defines for fit_config_check_sig as welll. Fixes: 8edecd3110e ("fit: Fix verification of images with external data") Fixes: c522949a29d ("rsa: sig: fix config signature check for fit with padding") Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-20Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxiTom Rini1-2/+2
Beside some rather unexciting sync of the DTs from the kernel tree, and some Kconfig cleanup, there are some improvements for the ARMv5 Allwinner family, to support boards with the F1C200s (64MB DRAM) better. We will get actual board support as soon as the DTs have passed the Linux review process. There is also support for the X96 Mate TV Box, featuring the H616 SoC and a full 4GB of DRAM. Also we found the secret to enable SPI booting on the H616 (pin PC5 must be pulled to GND), so the SPI boot support patch is now good to go. Passed the gitlab CI, plus briefly tested on Pine64-LTS, LicheePi Nano, X96 Mate and OrangePi Zero.
2022-10-19sunxi: Kconfig: introduce SUNXI_MINIMUM_DRAM_MBAndre Przywara1-2/+2
Traditionally we assumed that every Allwinner board would come with at least 256 MB of DRAM, and set our DRAM layout accordingly. This affected both the default load addresses, but also U-Boot's own address expectations (like being loaded at 160 MB). Some SoCs come with co-packaged DRAM, but only provide 32 or 64MB. So far we special-cased those *chips*, as there was only one chip per DRAM size. However new chips force us to take a more general approach. Introduce a Kconfig symbol, which provides the minimum DRAM size of the board. If nothing else is specified, we use 256 MB, and default to smaller values for those co-packaged SoCs. Then select the different DRAM maps according to this new symbol, so that different SoCs with the same DRAM size can share those definitions. Inspired by an idea from Icenowy. This is just refactoring: compiled for all boards before and after this patch: the binaries were identical. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2022-10-17vbe: Add fixups for a basic set of OS requestsSimon Glass2-1/+234
As a starting point, add support for providing random data, if requested by the OS. Also add ASLR, as a placeholder for now. Signed-off-by: Simon Glass <sjg@chromium.org> (fixed up to use uclass_first_device_err() instead)
2022-10-17boot: Tidy up logging and naming in vbe_simpleSimon Glass1-7/+9
Make sure the log_msg_ret() values are unique so that the log trace is unambiguous with LOG_ERROR_RETURN. Also avoid reusing the 'node' variable for two different nodes in bootmeth_vbe_simple_ft_fixup(), since this is confusing. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-17boot: Pass the correct FDT to the EVT_FT_FIXUP eventSimon Glass1-6/+9
Now that we support multiple device trees with the ofnode interface, we can pass the correct FDT to this event. This allows the 'working' FDT to be fixed up, as expected, so long as OFNODE_MULTI_TREE is enabled. Also make sure we don't try to do this with livetree, which does not support fixups yet. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-17boot: Correct handling of addresses in boot_relocate_fdt()Simon Glass1-11/+11
This code uses casts between addresses and pointers, so does not work with sandbox. Update it so we can allow sandbox to do device tree fixups. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-17bootm: Change incorrect 'unsupported' errorSimon Glass1-1/+1
At present when bootm fails, it says: subcommand not supported and then prints help for the bootm command. This is not very useful, since generally the error is related to something else, such as fixups failing. It is quite confusing to see this in a test run. Change the error and show the error code. We could update the OS functions to return -ENOSYS when they do not support the bootm subcommand. But this involves some thought since this is arch-specific code and proper errno error codes are not always returned. Also, with the code as is, all required subcommands are of course supported - a problem would only come if someone added a new one or removed support for one from an existing OS. Therefore it seems better to leave that sort of effort for when our bootm tests are improved. Note: v1 of this patch generated a discussion[1] about printing error strings automatically using printf(). That is outside the scope of this patch but will be dealt with separately. [1] https://patchwork.ozlabs.org/project/uboot/patch/20220909151801.336551-3-sjg@chromium.org/ Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-17bootstd: Fix listing boot devicesMichal Suchanek1-2/+2
bootdev_list() uses uclass_*_device_err() to iterate devices. However, the only value _err adds is returning an error when the device pointer is null, and that's checked anyway. Also there is some intent to report errors, and that's what uclass_*_device_check() is for, use it. Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-11boot: image-pre-load: Check environment for location of signature infoSteven Lawrance1-1/+6
Setting an alternative signature info node in "pre_load_sig_info_path" allows verification of an image using the bootm pre-load mechanism with a different key, e.g.: setenv pre_load_sig_info_path "/alt/sig" ; bootm preload [addr] Signed-off-by: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-11image-pre-load: Move macros/definitions to image.hSteven Lawrance1-43/+0
Putting these definitions in a header will allow signatures to be validated independently of bootm. Signed-off-by: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-11cmd: pxe: add alias devicetree-overlay for fdtoverlaysEdoardo Tomelleri1-0/+2
This adds keyword devicetree-overlay as an alias for fdtoverlays in extlinux (sysboot) and pxe to better follow the Boot Loader Specification [1], improves documentation around them by adding an example for both fdtoverlays and devicetree-overlay and the environment variable required for this feature. The link for the spec is updated to the current one. [1] https://systemd.io/BOOT_LOADER_SPECIFICATION/ Signed-off-by: Edoardo Tomelleri <e.tomell@gmail.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-09-29dm: core: Split ofnode_path_root() into two functionsSimon Glass1-1/+1
This function turns out to be a little confusing since it looks up a path and also registers the tree. Split it into two, one that gets the root node and one that looks up a path, so the purpose is clear. Registering the tree will happen in a function to be added in a later patch, called oftree_from_fdt(). Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29event: Pass the images to EVT_FT_FIXUPSimon Glass1-0/+1
Pass the boot images along as well, in case the fixups need to look at them. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29treewide: Drop image_header_t typedefSimon Glass7-28/+29
This is not needed and we should avoid typedefs. Use the struct instead and rename it to indicate that it really is a legacy struct. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29treewide: Drop image_info_t typedefSimon Glass1-1/+1
This is not needed and we should avoid typedefs. Use the struct instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29treewide: Drop bootm_headers_t typedefSimon Glass5-40/+40
This is not needed and we should avoid typedefs. Use the struct instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-24boot: Call flush() before bootingPali Rohár1-0/+1
In a lot of cases kernel resets UART HW. To ensure that U-Boot messages printed before booting the kernel are not lost, call new U-Boot console flush() function. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-19Merge branch 'master' into nextTom Rini6-22/+55
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-09-18cyclic: Use schedule() instead of WATCHDOG_RESET()Stefan Roese2-2/+2
Globally replace all occurances of WATCHDOG_RESET() with schedule(), which handles the HW_WATCHDOG functionality and the cyclic infrastructure. Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2022-09-14image: Drop some other #ifdefs in image-board.cWIP/2022-09-14-refactor-ramdisk-code-againSimon Glass1-31/+36
Remove all but a few that are difficult, relying on legacy CONFIG options or optional global_data fields. Drop the duplicate function name in the comment for boot_get_cmdline(). Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-14image: Correct indentation in select_ramdisk()Simon Glass1-71/+69
Finish off the refactoring by correcting the indent levels. Note that this does not include any functional changes. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-14image: Drop remaining FIT #ifdefSimon Glass1-8/+9
Drop the last one of these, by using a done_select variable to control whether to fall back to using 'select' as a hex value. Note that the indentation is not adjusted, to make this easier to review. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-14image: Drop another #ifdef for FITSimon Glass1-2/+3
Drop the prenultimate one of these from select_ramdisk(). Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-14image: Drop one #ifdef for FITSimon Glass1-19/+20
Drop the #ifdef from near the end of select_ramdisk(). Move some variables to the top of the function to make this work. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-14image: Drop #ifdefs for LEGACY_IMAGE_FORMATSimon Glass1-17/+14
Use if() instead of the #ifdef in select_ramdisk(). Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-14image: Track when ramdisk processing is completedSimon Glass1-14/+22
The current switch default is tricky since it relies on #ifdefs to work. Use a bool instead. Also fix the comment on @select, since it has a dual purpose. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-14image: Fix up ANDROID_BOOT_IMAGE ramdisk codeSimon Glass1-5/+12
Convert this to an if(), fix the cast from an address to a pointer and make sure that any error is returned correctly. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-07image: fit: Add some helpers for getting dataSean Anderson1-0/+37
Several different firmware users have repetitive code to extract the firmware data from a FIT. Add some helper functions to reduce the amount of repetition. fit_conf_get_prop_node (eventually) calls fdt_check_node_offset_, so we can avoid an explicit if. In general, this version avoids printing on error because the callers are typically library functions, and because the FIT code generally has (debug) prints of its own. One difference in these helpers is that they use fit_image_get_data_and_size instead of fit_image_get_data, as the former handles external data correctly. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-08-31bootm: Fix upper bound of FDT overlap checksPali Rohár1-2/+2
FTD blob can be put immediately after the OS image. So use strict inequality for start address check. Fixes: fbde7589ce30 ("common: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image") Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-31image-fit: don't set compression if it can't be readDaniel Golle2-6/+3
fit_image_get_comp() should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller of fit_image_get_comp() should be used. As a result the warning message WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-31bootm: fix typo imape_comp -> image_compDaniel Golle1-4/+4
Change variable name 'imape_comp' to the supposedly intended name 'image_comp'. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-26Rename disto_[pxe_]getfile to distro_[pxe_]getfileDario Binacchi2-6/+6
Replace 'disto' with 'distro' since they are all functions about distro booting. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2022-08-26boot: simplify bootmeth_vbe_simple_ft_fixup()Heinrich Schuchardt1-4/+3
Don't assign a value to a variable if it is not used afterwards. Move variables to the code fragment where they are used. Addresses-Coverity: CID 356243 ("Code maintainability issues (UNUSED_VALUE)") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-26boot: fix vbe_find_first_device()Heinrich Schuchardt1-1/+1
uclass_find_first_device() may return NULL if no device for the uclass exists. Handle this case gracefully. Addresses-Coverity: CID 356244 ("Null pointer dereferences (FORWARD_NULL)") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-12Convert CONFIG_SYS_FDT_PAD to KconfigTom Rini1-4/+0
This converts the following to Kconfig: CONFIG_SYS_FDT_PAD Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-12vbe: Support VBE simpleSimon Glass3-0/+328
Add support for VBE simple, which permits firmware update of a single image stored in MMC or another block device. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12vbe: Add initial support for VBESimon Glass3-0/+131
Create a new bootmeth for VBE along with a library to handle finding the VBE methods. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12event: Add an event for device tree fixupsSimon Glass1-0/+11
At present there is a confusing array of functions that handle the device tree fix-ups needed for booting an OS. We should be able to switch to using events to clean this up. As a first step, create a new event type and call it from the standard place. Note that this event uses the ofnode interface only, since this can support live tree which is more efficient when making lots of updates. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Drop the system bootdevSimon Glass3-73/+1
This was a work-around for the fact that global bootmeths such as EFI bootmgr and VBE don't use a particular bootdev, or at least select it themselves so that we don't need to scan all bootdevs when using that bootmeth. Drop the system bootdev entirely. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Always create the EFI bootmgr bootmethSimon Glass1-6/+1
Now that we can separate this out from the normal bootmeths, update the code to create it always. We cannot rely on the device tree to create this, since the EFI project is quite opposed to having anything in the device tree that helps U-Boot with its processing. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Allow scanning for global bootmeths separatelySimon Glass2-23/+58
Typically we want to find and use global bootmeths first, since they have the best idea of how the system should boot. We then use normal bootmeths as a fallback. Add the logic for this, putting global bootmeths at the end of the ordering. We can then easily scan the global bootmeths first, then drop them from the list for subsequent bootdev-centric scans. This changes the ordering of global bootmeths, so update the bootflow_system() accordingly. Drop the comment from bootmeth_setup_iter_order() since this is an exported function and it should be in the header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Support bootflows with global bootmethsSimon Glass1-8/+50
Add support for handling this concept in bootflows. Update the 'bootflow' command to allow only the normal bootmeths to be used. This alllows skipping EFI bootmgr and VBE, for example. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Allow the bootdev to be optional in bootflowsSimon Glass2-3/+7
With global bootmeths we want to scan without a bootdev. Update the logic to allow this. Change the bootflow command to show the bootdev only when valid. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Allow EFI bootmgr to support an invalid bootflowSimon Glass1-6/+26
For most testing we don't want this bootmeth to actually do anything. For the one test where we do, add a test hook to obtain the correct behaviour. This will allow us to bind the device always, rather than just doing it for this test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Allow bootmeths to be marked as globalSimon Glass3-1/+23
The current way of handling things like EFI bootmgr is a bit odd, since that bootmeth handles selection of the bootdev itself. VBE needs to work the same way, so we should support it properly. Add a flag that indicates that the bootmeth is global, rather than being invoked on each bootdev. Provide a helper to read a bootflow from the bootmeth. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Tidy up var naming in bootdev_setup_iter_order()Simon Glass1-4/+4
Avoid using 'count' to mean either a count or an error, since this is confusing. In fact, the called function never return 0, since that is an error. Use 'ret' instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Provide a bootmeth method to obtain state infoSimon Glass2-0/+24
Some bootmeths can provide information about what is available to boot. For example, VBE simple provides access to the firmware state. Add a new method for this, along with a sandbox test. Signed-off-by: Simon Glass <sjg@chromium.org>