History log of /u-boot/boot/bootmeth_cros.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>

# c4b646d4 27-Apr-2024 Tom Rini <trini@konsulko.com>

boot: Remove <common.h> and add needed includes

Remove <common.h> from all "boot/" files and when needed add
missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d2c485a0 03-Dec-2023 Simon Glass <sjg@chromium.org>

x86: zboot: Rename zboot_start() to zboot_run()

The term 'start' is used withint bootm and zboot to indicate the first
phase of booting an image.

Since zboot_start() does the whole boot, rename it to zboot_run() to
align with bootm_run() etc.

Fix a log message while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a831d113 24-Oct-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Correct condition for read method

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>

# 71f634b8 24-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Allow detection of any kernel partition

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>

# daffb0be 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add ARM support

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>

# c279224e 10-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a command to read all files for a bootflow

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>

# 598dea97 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Split up reading info and kernel

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>

# 074503c4 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add a function to read a kernel

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>

# f861b1ee 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add a function to read info from partition

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>

# 1d4bbdf3 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add private info for ChromiumOS

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>

# b7ed5386 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add docs for the kernel layout

Provide brief documentation about the ChromiumOS kernel layout.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a081092 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Move common zimage functions to bootm.h

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>

# c5dca50b 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Simplify setup and cmdline expressions

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>

# 3257835e 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Decode some kernel preamble fields

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>

# 4cfe4510 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Support a kernel on either partition

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>

# de30aa9a 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Bring in some ChromiumOS structures

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>

# 5a8589eb 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Move partition reading into a function

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>

# defa33ad 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Correct reporting of I/O errors

Return -EIO when the read failed, rather than the number of blocks read.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c88d67d0 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a simple bootmeth for ChromiumOS

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>

# c4b646d4 27-Apr-2024 Tom Rini <trini@konsulko.com>

boot: Remove <common.h> and add needed includes

Remove <common.h> from all "boot/" files and when needed add
missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d2c485a0 03-Dec-2023 Simon Glass <sjg@chromium.org>

x86: zboot: Rename zboot_start() to zboot_run()

The term 'start' is used withint bootm and zboot to indicate the first
phase of booting an image.

Since zboot_start() does the whole boot, rename it to zboot_run() to
align with bootm_run() etc.

Fix a log message while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a831d113 24-Oct-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Correct condition for read method

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>

# 71f634b8 24-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Allow detection of any kernel partition

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>

# daffb0be 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add ARM support

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>

# c279224e 10-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a command to read all files for a bootflow

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>

# 598dea97 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Split up reading info and kernel

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>

# 074503c4 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add a function to read a kernel

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>

# f861b1ee 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add a function to read info from partition

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>

# 1d4bbdf3 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add private info for ChromiumOS

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>

# b7ed5386 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add docs for the kernel layout

Provide brief documentation about the ChromiumOS kernel layout.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a081092 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Move common zimage functions to bootm.h

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>

# c5dca50b 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Simplify setup and cmdline expressions

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>

# 3257835e 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Decode some kernel preamble fields

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>

# 4cfe4510 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Support a kernel on either partition

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>

# de30aa9a 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Bring in some ChromiumOS structures

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>

# 5a8589eb 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Move partition reading into a function

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>

# defa33ad 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Correct reporting of I/O errors

Return -EIO when the read failed, rather than the number of blocks read.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c88d67d0 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a simple bootmeth for ChromiumOS

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>

# d2c485a0 03-Dec-2023 Simon Glass <sjg@chromium.org>

x86: zboot: Rename zboot_start() to zboot_run()

The term 'start' is used withint bootm and zboot to indicate the first
phase of booting an image.

Since zboot_start() does the whole boot, rename it to zboot_run() to
align with bootm_run() etc.

Fix a log message while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a831d113 24-Oct-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Correct condition for read method

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>

# 71f634b8 24-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Allow detection of any kernel partition

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>

# daffb0be 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add ARM support

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>

# c279224e 10-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a command to read all files for a bootflow

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>

# 598dea97 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Split up reading info and kernel

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>

# 074503c4 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add a function to read a kernel

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>

# f861b1ee 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add a function to read info from partition

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>

# 1d4bbdf3 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add private info for ChromiumOS

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>

# b7ed5386 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add docs for the kernel layout

Provide brief documentation about the ChromiumOS kernel layout.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a081092 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Move common zimage functions to bootm.h

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>

# c5dca50b 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Simplify setup and cmdline expressions

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>

# 3257835e 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Decode some kernel preamble fields

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>

# 4cfe4510 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Support a kernel on either partition

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>

# de30aa9a 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Bring in some ChromiumOS structures

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>

# 5a8589eb 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Move partition reading into a function

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>

# defa33ad 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Correct reporting of I/O errors

Return -EIO when the read failed, rather than the number of blocks read.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c88d67d0 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a simple bootmeth for ChromiumOS

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>

# a831d113 24-Oct-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Correct condition for read method

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>

# 71f634b8 24-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Allow detection of any kernel partition

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>

# daffb0be 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add ARM support

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>

# c279224e 10-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a command to read all files for a bootflow

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>

# 598dea97 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Split up reading info and kernel

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>

# 074503c4 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add a function to read a kernel

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>

# f861b1ee 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add a function to read info from partition

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>

# 1d4bbdf3 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add private info for ChromiumOS

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>

# b7ed5386 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add docs for the kernel layout

Provide brief documentation about the ChromiumOS kernel layout.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a081092 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Move common zimage functions to bootm.h

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>

# c5dca50b 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Simplify setup and cmdline expressions

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>

# 3257835e 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Decode some kernel preamble fields

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>

# 4cfe4510 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Support a kernel on either partition

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>

# de30aa9a 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Bring in some ChromiumOS structures

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>

# 5a8589eb 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Move partition reading into a function

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>

# defa33ad 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Correct reporting of I/O errors

Return -EIO when the read failed, rather than the number of blocks read.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c88d67d0 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a simple bootmeth for ChromiumOS

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>

# 71f634b8 24-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Allow detection of any kernel partition

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>

# daffb0be 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add ARM support

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>

# c279224e 10-Aug-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a command to read all files for a bootflow

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>

# 598dea97 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Split up reading info and kernel

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>

# 074503c4 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add a function to read a kernel

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>

# f861b1ee 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add a function to read info from partition

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>

# 1d4bbdf3 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add private info for ChromiumOS

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>

# b7ed5386 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Add docs for the kernel layout

Provide brief documentation about the ChromiumOS kernel layout.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a081092 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Move common zimage functions to bootm.h

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>

# c5dca50b 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Simplify setup and cmdline expressions

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>

# 3257835e 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Decode some kernel preamble fields

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>

# 4cfe4510 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Support a kernel on either partition

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>

# de30aa9a 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Bring in some ChromiumOS structures

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>

# 5a8589eb 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Move partition reading into a function

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>

# defa33ad 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: cros: Correct reporting of I/O errors

Return -EIO when the read failed, rather than the number of blocks read.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c88d67d0 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a simple bootmeth for ChromiumOS

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>

# c88d67d0 12-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Add a simple bootmeth for ChromiumOS

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>