aboutsummaryrefslogtreecommitdiff
path: root/boot/bootmeth_cros.c
Commit message (Collapse)AuthorAgeFilesLines
* bootstd: cros: Correct condition for read methodSimon Glass2023-11-011-4/+4
| | | | | | | This has a typo which makes the method inoperable. Correct it so that 'bootflow read' works correctly for ChromeOS. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Allow detection of any kernel partitionSimon Glass2023-08-261-18/+30
| | | | | | | | | | | | | | | | | The existing ChromiumOS bootmeth only supports reading a single kernel partition, either 2 or 4. In fact there are normally two options available. Use the GUID to detect kernel partitions, with the BOOTMETHF_ANY_PART flag, so that bootstd does not require a valid filesystem before calling the bootmeth. Tidy up and improve the logging while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> [trini: Add missing select of PARTITION_TYPE_GUID] Signed-off-by: Tom Rini <trini@konsulko.com>
* bootstd: cros: Add ARM supportSimon Glass2023-08-111-6/+10
| | | | | | | | Support booting ChromiumOS on ARM devices using FIT. Add an entry into the boot implementation which does not require a command line. This can be expanded over time as the bootm code is refactored. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Add a command to read all files for a bootflowSimon Glass2023-08-111-1/+21
| | | | | | | | | | Some bootflows (such as EFI and ChromiumOS) delay reading the kernel until it is needed to boot. This saves time when scanning and avoids needing to allocate memory for something that may never be used. To permit reading of these files, add a new 'bootflow read' command. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Split up reading info and kernelSimon Glass2023-08-101-73/+23
| | | | | | | Use the two new functions to separate reading of the ChromiumOS info from the partition from actually reading the kernel and booting it. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Add a function to read a kernelSimon Glass2023-08-101-0/+39
| | | | | | | | | | | | The code to read the ChromiumOS information from the partition is currently all in one function. Create a new function which reads the kernel, assuming that the metadata has been parsed. For now this function is not used. Future work will plumb it in. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Add a function to read info from partitionSimon Glass2023-08-101-0/+121
| | | | | | | | | | | | | The code to read the ChromiumOS information from the partition is currently all in one function. It reads the entire kernel, which is unnecessary unless it is to be booted. Create a new function which reads just the minimum required data from the disk, then obtains what it needs from there. For now this function is not used. Future work will plumb it in. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Add private info for ChromiumOSSimon Glass2023-08-101-13/+42
| | | | | | | | Create a new private structure to hold information gleaned from the disk. This will allow separation between reading of the bootflow information and (later) reading the whole kernel. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Add docs for the kernel layoutSimon Glass2023-08-101-0/+29
| | | | | | Provide brief documentation about the ChromiumOS kernel layout. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Move common zimage functions to bootm.hSimon Glass2023-08-101-3/+1
| | | | | | | | | | | We want to avoid using #ifdefs around header files and in the code. It makes sense to collect the various functions used for loading images into a single header which can be included by all architectures. The best place for this is the arch-neutral bootm.h header, so use that. Move some zimage functions into this bootm.h header. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Simplify setup and cmdline expressionsSimon Glass2023-08-101-10/+10
| | | | | | | | | | | | | | Create a common base from which the other parts are offset and make all of the offsets related to that. This makes the code a little easier to read. Use X86_ prefixes for the two values which are x86-specific. Drop OFFSET_BASE since it is available in a header field. Drop the unnecessary 'start' variable too. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Decode some kernel preamble fieldsSimon Glass2023-08-101-17/+37
| | | | | | | | | Decode the kernel start and size using the structures provided. This accesses the same data, just in a cleaner way. Add some logging for some of the fields in the kernel preamble. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Support a kernel on either partitionSimon Glass2023-08-101-7/+14
| | | | | | | | | | ChromiumOS allows a kernel to be on either partition 2 or 4. Add support for scanning both and using the first one we find with a suitable signature. Record the partition which is used. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Bring in some ChromiumOS structuresSimon Glass2023-08-101-2/+4
| | | | | | | | | | | | | | | Add a header file with structures for booting ChromiumOS, taken from the vboot tree. Using these makes it easier to understand the code. Note that the code style has not been updated for U-Boot, with use of uint64_t, __attribute__((packed)) and one comment-style nit. This should make it easier to keep the code in sync. It was taken from commit: 5b8596ce ("2sha256_arm: Fix data abort issue") Update the CHROMEOS string to use the defined values. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Move partition reading into a functionSimon Glass2023-08-101-16/+50
| | | | | | | Move the code which reads a partition into its own function. Add a constant for the number of bytes to 'probe' at the start of the partition. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: cros: Correct reporting of I/O errorsSimon Glass2023-08-101-2/+2
| | | | | | Return -EIO when the read failed, rather than the number of blocks read. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstd: Add a simple bootmeth for ChromiumOSSimon Glass2023-07-171-0/+212
It is possible to boot x86-based ChromeOS machines by parsing a table and locating the kernel and command line. Add a bootmeth for this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>