aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-04-25nds32: Remove the architectureWIP/25Apr2022Tom Rini89-5659/+15
As removal of nds32 has been ack'd for the Linux kernel, remove support here as well. Cc: Rick Chen <rick@andestech.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Rick Chen <rick@andestech.com>
2022-04-25Merge branch '2022-04-25-initial-implementation-of-stdboot'Tom Rini86-110/+7188
To quote the author: The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting. It introduces the following concepts: - bootdev - a device which can hold a distro - bootmeth - a method to scan a bootdev to find bootflows (owned by U-Boot) - bootflow - a description of how to boot (owned by the distro) This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot. With this we can boot on a Raspberry Pi 3 with just one command: bootflow scan -lb which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this. With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only. ... The design is described in these two documents: https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
2022-04-25Merge branch '2022-04-23-binman-updates'Tom Rini13-15/+440
- Assorted binman updates, and add Alper as a maintainer, after talking with Simon.
2022-04-25binman: don't import deprecated distutils packageCI/2022-04-23-binman-updatesHeinrich Schuchardt1-7/+0
'make tests' fails on Ubuntu 22.04 with: binman: ./tools/binman/binman:12: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.sysconfig import get_python_lib ./tools/binman/binman:12: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead from distutils.sysconfig import get_python_lib <unittest.result.TestResult run=428 errors=0 failures=4> AssertionError: 0 != 468 As we don't use Ubuntu 16.04 for our CI anymore drop the import. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-04-25MAINTAINERS: Add Alper as a binman maintainerAlper Nebi Yasak1-0/+1
I ended up learning most of binman internals while trying to add a few features to it, and I recently started reviewing binman series that would not affect me personally. I'll keep working on it and try to do more reviews. Add myself as a maintainer for binman. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Acked-by: Tom Rini <trini@konsulko.com>
2022-04-25binman: Refuse to replace sections for nowAlper Nebi Yasak3-0/+35
Binman interfaces allow attempts to replace any entry in the image with arbitrary data. When trying to replace sections, the changes in the section entry's data are not propagated to its child entries. This, combined with how sections rebuild their contents from its children, eventually causes the replaced contents to be silently overwritten by rebuilt contents equivalent to the original data. Add a simple test for replacing a section that is currently failing due to this behaviour, and mark it as an expected failure. Also, raise an error when replacing a section instead of silently pretending it was replaced. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-25binman: Test replacing non-section entries in FIT subsectionsAlper Nebi Yasak1-0/+38
A previous patch fixes binman to correctly extract FIT subentries. This makes it easier to test replacing these entries as we can write tests using an existing helper function that relies on extracting the replaced entry. Add tests that replace leaf entries in FIT subsections with data of various sizes. Replacing the subsections or the whole FIT section does not work yet due to the section contents being re-built from unreplaced subentries' data. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-25binman: Create FIT subentries in the FIT section, not its parentAlper Nebi Yasak3-1/+110
When reading images from a file, each entry's data is read from its parent section as specified in the Entry.Create() call that created it. The FIT entry type has been creating its subentries under its parent (their grandparent), as creating them under the FIT entry resulted in an error until FIT was converted into a proper section. FIT subentries have their offsets relative to the FIT section, and reading those offsets in the parent section results in wrong data. The subentries rightfully belong under the FIT entries, so create them there. Add tests checking that we can extract the correct data for a FIT entry and its subentries. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-25binman: Remove '/images/' fragment from FIT subentry pathsAlper Nebi Yasak2-5/+15
Binman FIT entry nodes describe their subentries in an 'images' subnode, same as how they would be written for the mkimage executable. The entry type initially manually managed its subentries keyed by their node paths relative to its base node. It was later converted to a proper section while still keeping the same keys for subentries. These subentry keys of sections are used as path fragments, so they must not contain the path separator character '/'. Otherwise, they won't be addressable by binman extract/replace commands. Change these keys from the '/images/foo' forms to the subentry node names. Extend the simple FIT tests to check for this. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-04-25binman: Don't reset offset/size if image doesn't allow repackingAlper Nebi Yasak2-1/+22
When an image has the 'allow-repack' property, binman includes the original offset and size properties from the image description in the fdtmap. These are later used as the packing constraints when replacing entries in an image, so other unconstrained entries can be freely positioned. Replacing an entry in an image without 'allow-repack' (and therefore the original offsets) follows the same logic and results in entries being merely concatenated. Instead, skip resetting the calculated offsets and sizes to the missing originals for these images so that every entry is constrained to its existing offset/size. Add tests that replace an entry with smaller or equal-sized data, in an image that doesn't allow repacking. Attempting to do so with bigger-size data is already an error that is already being tested. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-25binman: Collect bintools for images when replacing entriesAlper Nebi Yasak4-0/+115
Binman entries can use other executables to compute their data, usually in their ObtainContents() methods. Subclasses of Entry_section would use bintools in their BuildSectionData() method instead, which is called from several places including their Pack(). These binary tools are resolved correctly while building an image from a device-tree description so that they can be used from these methods. However, this is not being done when replacing entries in an image, which can result in an error as the Pack() methods attempt to use them. Collect and resolve entries' bintools also when replacing entries to fix Pack() errors. Add a way to mock bintool usage in the testing entry type and tests that check bintools are being resolved for such an entry. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-25binman: Fix unique names having '/.' for images read from filesAlper Nebi Yasak4-1/+104
Binman can embed a copy of the image description into the images it builds as a fdtmap entry, but it omits the /binman/<image-name> prefix from the node paths while doing so. When reading an already-built image file, entries are reconstructed using this fdtmap and their associated nodes still lack that prefix. Some entries like fit and vblock create intermediate files whose names are based on an entry unique name. This name is constructed from their node's path by concatenating the parents with dots up to the binman node, e.g. /binman/image/foo/bar becomes 'image.foo.bar'. However, we don't have this /binman/image prefix when replacing entries in such an image. The /foo/bar entry we read when doing so erroneously has the unique name of '/.foo.bar', causing permission errors when the entry attempts to create files based on that. Fix the unique-name generation by stopping at the '/' node like how it stops at the binman node. As the unique names are used as filenames, add tests that check if they're safe to use as filenames. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: doc: Add documentationWIP/2022-04-25-initial-implementation-of-stdbootSimon Glass11-0/+1376
Add documentation for this feature, including the commands and full devicetree bindings. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Provide a default commandSimon Glass1-1/+16
We would like to use bootstd by default when EFI boot manager is not enabled. But so far bootstd does not support all the of distro-boot fetures. So for now, add an option to select this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add setup for the bootflow testsSimon Glass2-0/+103
We need to create a disk image with a partition table and a DOS-format filesystem containing a few files. Provide a fallback binary for CI since it does not seem able to detect the loopback partitions. Add this to a dm_init test so that it happens when needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add tests for bootstd including all uclassesSimon Glass13-2/+845
Add a set of combined tests for the bootdev, bootflow and bootmeth commands, along with associated functionality. Expand the sandbox console-recording limit so that these can work. These tests rely on a filesystem script which is not yet added to the Python tests. It is included here as a shell script. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: usb: Add a bootdev driverSimon Glass3-0/+76
Add a bootdev driver for USB host. It can use the distro boot mechanism to locate a file, or any other available bootmeth. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add an implementation of script bootSimon Glass3-0/+151
Add a bootmeth driver which handles distro boot from a disk via a U-Boot script, so we can boot a bootflow using this commonly used mechanism. This is required by Armbian, for example. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: sandbox: Add a hostfs bootdevSimon Glass6-0/+70
It is helpful to be able to try out bootstd on sandbox, using host files. This is easier than using a block device, which must have a filesystem, partition table, etc. Add a new driver which provides this feature. For now it is not used in tests, but it is likely to be useful. Add notes in the devicetree also, but don't disturb the tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add a sandbox bootmeth driverSimon Glass3-0/+77
Add a bootmeth driver for sandbox, used for testing. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add an implementation of EFI bootmgrSimon Glass2-0/+89
Add a bootmeth driver which handles EFI boot manager, using EFI_LOADER. In effect, this provides the same functionality as the 'bootefi bootmgr' command and shares the same code. But the interface into it is via a bootmeth, so it does not require any special scripts, etc. For now this requires the 'bootefi' command be enabled. Future work may tidy this up so that it can be used without CONFIG_CMDLINE being enabled. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add a system bootdev for strange boot methodsSimon Glass3-1/+73
Some boot methods don't act on a single bootdev but instead do their own thing. An example is EFI bootmgr which scan various devices using its own logic. Add a bootdev to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add an implementation of EFI bootSimon Glass3-0/+210
Add a bootmeth driver which handles EFI boot, using EFI_LOADER. In effect, this provides the same functionality as the 'bootefi' command and shares the same code. But the interface into it is via a bootmeth, so it does not require any special scripts, etc. For now this requires the 'bootefi' command be enabled. Future work may tidy this up so that it can be used without CONFIG_CMDLINE being enabled. There was much discussion about whether this is needed, but it seems that it is, at least for now. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add an implementation of distro PXE bootSimon Glass3-0/+197
Add a bootmeth driver which handles distro boot from a network device, so we can boot a bootflow using this commonly used mechanism. In effect, this provides the same functionality as the 'pxe' command and shares the same code. But the interface into it is via a bootmeth. For now this requires the 'pxe' command be enabled. Future work may tidy this up so that it can be used without CONFIG_CMDLINE being enabled. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: ethernet: Add a bootdev driverSimon Glass5-0/+120
Add a bootdev driver for Ethernet. It can use the PXE boot mechanism to locate a file, added later. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: mmc: Add a bootdev driverSimon Glass5-1/+102
Add a bootdev driver for MMC. It mostly just calls the bootdev helper function. Add a function to obtain the block device for an MMC controller. Fix up the comment for mmc_get_blk_desc() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add an implementation of distro bootSimon Glass5-1/+186
Add a bootmeth driver which handles distro boot from a disk, so we can boot a bootflow using this commonly used mechanism. In effect, this provides the same functionality as the 'sysboot' command and shares the same code. But the interface into it is via a bootmeth. For now this requires the 'pxe' command be enabled. Future work may tidy this up so that it can be used without CONFIG_CMDLINE being enabled. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add a bootmeth commandSimon Glass3-0/+125
Add a 'bootmeth' command to handle listing and ordering of boot methods. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add a bootflow commandSimon Glass3-0/+423
Add a 'bootflow' command to handle listing and selection of bootflow. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add a bootdev commandSimon Glass6-0/+134
Add a 'bootdev' command to handle listing and selection of bootdevs. Disable standard boot for a few boards which otherwise run out of space. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add support for bootflowsSimon Glass6-3/+475
Add support for bootflows, including maintaining a list of them and iterating to find them. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add the bootmeth uclass and helpersSimon Glass7-2/+605
A bootmeth is a method of locating an operating system. For now, just add the uclass itself. Drivers for particular bootmeths are added later. If no bootmeths devices are included in the devicetree, create them automatically. This avoids the need for boilerplate in the devicetree files. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add the bootdev uclassSimon Glass6-1/+928
A 'bootdev' is a device which can be used to boot an operating system. It is a child of the media device (e.g. MMC) which handles reading files from that device, such as a bootflow file. Add a uclass for bootdev and the various helpers needed to make it work. Also add a binding file, empty for now. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add the bootstd uclass and core implementationSimon Glass9-0/+302
The 'bootstd' device provides the central information about U-Boot standard boot. Add a uclass for bootstd and the various helpers needed to make it work. Also add a binding file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add the concept of a bootflowSimon Glass2-0/+265
A bootflow encapsulates the process used to boot an operating system. It typically has a control file (such as extlinux.conf) and information about which 'bootdev' it came from. Add the header file for this first, since it is needed by all other files. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25fs: Add a function to set the filesystem typeSimon Glass2-0/+16
When sandbox is used with hostfs we won't have a block device, but still must set up the filesystem type before any filesystem operation, such as loading a file. Add a function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: blk: Add a function to return the device typeSimon Glass2-0/+15
Use the uclass name to get the device type for a block device. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25test: dm: Restart USB before assuming it is stoppedSimon Glass1-0/+6
Update the blk test to stop USB first, in case another test has started it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25test: fastboot: Avoid using mmc1Simon Glass1-2/+2
The bootflow tests need to use an MMC with an associated backing file containing a filesystem. Update the fastboot tests to cope with this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: core: Allow finding a uclass device by partial nameSimon Glass4-4/+42
In some cases two devices are related and the only way to tell is to check that the names partially patch. Add a way to check this without needing to create a new string for the comparison. Fix the comment for device_find_child_by_namelen() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: core: Rename and fix uclass_get_by_name_len()Simon Glass3-6/+9
It seems that namelen is more common in U-Boot. Rename this function to fit in better. Also fix a bug where it breaks the operation of uclass_get_by_name() and add a test. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reported-by: Tim Harvey <tharvey@gateworks.com>
2022-04-25lib: Add a way to find the postiion of a trailing numberSimon Glass3-3/+42
At present it is not possible to find out which part of the string is the number part and which is before it. Add a new variant which provides this feature, so we can separate the two in the caller. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25lib: Fix a few bugs in trailing_strtoln()Simon Glass3-5/+11
At present this has a minor bug in that it reads the byte before the start of the string, if it is empty. Also it doesn't handle a non-numeric prefix which is only one character long. Fix these bugs with a reworked implementation. Add a test for the second case. The first one is hard to test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25lib: Correct comment formatting to avoid sphinx problemsSimon Glass1-46/+46
Tweak a few comments to kep sphinx happy, in case we want to include this file one day. Also fix the 'exxamine' typo. Patch-notes: This uses: sed -i 's/@param \(\S*\)\s*/@\1: /' include/vsprintf.h to convert the @param to the new format. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25test: Add tests for trailing_strtol()Simon Glass2-2/+21
This function currently has no tests. Add some. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25lib: Move string tests to the string moduleSimon Glass2-40/+40
A few string tests were added to the print module by mistake. Move them. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-24cmd: part: add explicit dependency on PARTITIONSWIP/24Apr2022AKASHI Takahiro2-1/+1
This is a follow-up patch for my "disk: don't compile in partition support for spl/tpl if not really necessary". "part" command is useful only if, at least, one of partition table types is selected. So it should have a dependency on PARTITIONS which is now automatically selected if one of partition table types is enabled. With this change, *_defconfig which explicitly selects CMD_PART but has no partition table types enabled should also be fixed. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2022-04-23Merge tag 'efi-2022-07-rc1-3' of ↵WIP/23Apr2022Tom Rini25-168/+789
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-07-rc1-3 Documentation: * Document image size parameter of bootefi command UEFI: * avoid building partition support in SPL/TPL where not required * improve integration of EFI subsystem and driver model * restore ability to boot arbitrary blob
2022-04-23efi_loader: disk: use udevice instead of blk_descAKASHI Takahiro1-6/+16
In most of all cases, we can avoid using blk_desc which is expected to be private to udevice(UCLASS_BLK), that is, the data should not be manipulated outside the device driver unless really needed. Now efi_disk's internally use dev_read/write() interfaces if CONFIG_PARTITIONS is enabled. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-23dm: disk: add read/write interfaces with udeviceAKASHI Takahiro2-0/+101
In include/blk.h, Simon suggested: ===> /* * These functions should take struct udevice instead of struct blk_desc, * but this is convenient for migration to driver model. Add a 'd' prefix * to the function operations, so that blk_read(), etc. can be reserved for * functions with the correct arguments. */ unsigned long blk_dread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, void *buffer); unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, const void *buffer); unsigned long blk_derase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt); <=== So new interfaces are provided with this patch. They are expected to be used everywhere in U-Boot at the end. The exceptions are block device drivers, partition drivers and efi_disk which should know details of blk_desc structure. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>