Commit graph

347 commits

Author SHA1 Message Date
Marek Vasut
ba377a6c2c image: Remove unused NEEDS_MANUAL_RELOC code bits
The last user of the NEEDS_MANUAL_RELOC has been removed in commit
26af162ac8 ("arch: m68k: Implement relocation")
Remove now unused NEEDS_MANUAL_RELOC code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-09-14 10:42:24 -04:00
Marek Vasut
446d664303 boot: Remove unused NEEDS_MANUAL_RELOC code bits
The last user of the NEEDS_MANUAL_RELOC has been removed in commit
26af162ac8 ("arch: m68k: Implement relocation")
Remove now unused NEEDS_MANUAL_RELOC code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-09-14 10:42:24 -04:00
Tom Rini
ddec4cae62 Prepare v2023.10-rc4
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmT17FsACgkQFHw5/5Y0
 tywn0gwAlRs5NZ4ierzvDiLQEvYgV6E+lLccwyf8mMfJVHicrrW/ckxqJGS2mrLz
 IoA0pO1oF/HFfR/0pgx9Pb2kuIK1tkCeVNYW6t9EDbEJzrbfdvykBcSB4wgKYpgB
 ZgCga0jsPNM951Y3a3TElNEet4pVTZrDLu0E2UR6zNzr5hpKnfoQTZRfBI1MyCq4
 w4/Eo2wAnnaV1lcobg9LzM6uyDnETxWyTI7DIJYSqkEgT0WcF6zrdW55MaXtrPo5
 RZ4q5MTJQwqnTV5awsmgEt8PSC+XQcPHMPrVCwoOZAdru+5zO3AWpbqq1q6K+y9U
 FEsaJ6HGn5BdITgmIK/lb8oTekfOkDPFF3WuFp5bZ6L0A63ANu/MMWHELyyt5+0z
 TlnU94PVxiLnPMzZtfBPWRQ3jIU5qltJaoW0pKwsoa7P8iUd1WZgYyN+G9WPgwFr
 XUemGRNkgnWfRoxcKGbaYDSB0Llp6m/zqPlGfhlt0ZKXc6igLu3/egRh7/8zLR0i
 y9uBKG45
 =s9vZ
 -----END PGP SIGNATURE-----

Merge tag 'v2023.10-rc4' into next

Prepare v2023.10-rc4
2023-09-04 10:51:58 -04:00
Simon Glass
6c4cad7438 event: Rename EVENT_SPY to EVENT_SPY_FULL
The new name makes it clearer that this is for a full spy, with access to
the context and the event data.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-31 13:16:54 -04:00
Simon Glass
5986d46f8e bootstd: Adjust the default bootmeth order
The existing distro scripts check extlinux and scripts before EFI. Adjust
the default ordering to do the same, to avoid breaking existing flows.

Add some documentation, mentioning that this order will likely change in
future.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Da Xue <da@libre.computer>
2023-08-28 15:59:22 -04:00
Peter Robinson
d167062c48 boot: Fix reference to bootmenu doc
The Kconfig references a readme file that's moved and
converted to rst so update the reference.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-28 15:59:22 -04:00
Simon Glass
71f634b822 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>
2023-08-26 10:07:32 -04:00
Simon Glass
831405f41d bootstd: Support bootmeths which can scan any partition
Some bootmeths support scanning a partition without a filesystem on it.
Add a flag to support this.

This will allow the ChromiumOS bootmeth to find kernel partition, which
are stored in a special format, without a filesystem.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 17:55:19 -04:00
Simon Glass
b2b7e6c181 part: Add an accessor for struct disk_partition sys_ind
This field is only present when a CONFIG is set. To avoid annoying #ifdefs
in the source code, add an accessor. Update the only usage.

Note that the accessor is optional. It can be omitted if it is known that
the option is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 17:55:18 -04:00
Simon Glass
cfc402db39 expo: cedit: Support reading settings from CMOS RAM
Add a command to read edit settings from CMOS RAM, using the cedit
definition to indicate which registers and bits are used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
eb6c71b562 expo: cedit: Support writing settings to CMOS RAM
Add a command to write cedit settings to CMOS RAM so that it can be
preserved across a reboot. This uses a simple bit-encoding, where each
field has a 'bit position' and a 'bit length' in the schema.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
bcf2b7202e expo: cedit: Support reading settings from environment vars
Add a command to read cedit settings from environment variables so that
they can be restored as part of the environment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
fc9c0e0771 expo: cedit: Support writing settings to environment vars
Add a command to write cedit settings to environment variables so that
they can be stored with 'saveenv'.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
472317cb12 expo: cedit: Support reading settings from a file
Add a command to read cedit settings from a devicetree file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
2dee81fe5f expo: cedit: Support writing settings to a file
Support writing settings from an expo into a file in FDT format. It
consists of a single node with a two properties for each sceneitem,
one with tag ID chosen by the user and another for its text value.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
6e648fa781 expo: Export scene_menuitem_find() for use in internal code
Make this function available to other expo code so we can use it to look
up a menu item.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
8d0f890a0b expo: Add a function to prepare a cedit
Split out the code which prepares the cedit for use, so we can call it
from a test.

Add a log category while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
040b04685e expo: Split out cedit into its own header
Before adding more functions to this interface, create a new header for
the configuration editor.

Fix up the expo header guard while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
431b21fd40 expo: Refactor menu_build() to return the object created
The caller reads the ID but menu_build() does this again. Add the ID as
a parameter to avoid this. Return the object created so that the caller
can adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
f2eb6ad50a expo: Provide a way to iterate through all scene objects
For some operations it is necessary to process all objects in an expo.
Provide an iterator to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
633b3dc755 expo: Make scene_obj_find() take a const scene
This does not change the scene, so mark the pointer const.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Tom Rini
7e6e40c572 Prepare v2023.10-rc3
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmTjxwsACgkQFHw5/5Y0
 tyz4TAwAtVgllQGPVNIVDaEBdG93htm1DoZPc4EMZ4L5rf0nT0yJPeOhRCGygYY+
 zYL1ueleBZtpJhYOuHGetSns0B/M5Wx7gu1eGHNGrMNHH7zCV5Ynjjee2IaqKgbU
 tdSSc8XQpJ3PJY6rhJ6qZ7pO/EcUlQEdqplEUGFmA4JObx43j1+bmqyGTJA57vEw
 rrr+tyUVlr+Wv4lqlX/YJWzAB6IoSMUStv34M2lmiZvZoTYHezvIqBK33GrQ4Cwl
 hQ8nP7ymBXdA5GoMFBpfaBCA7aX3esx4yYN3JIRNRjNmnITJHYs0G8oIh8R5iNnJ
 psroU7GRPu3MmXfOnHlRfA/v0mo8xQGc2RQHyZUGXuApTI8+SFK/4WJPBny/IYse
 ggcVCHoI57dx1+j4+JHYhh61bMR1JUwARs4/UU4dKT3MRZM8Gb99OvbXO3+switZ
 R0YHSnDP///MTC7/MzbOPWzsJiTn9gkZd8nFVTXoncrVI8F3OtCc89G4HBruBSj7
 ptfylxqH
 =VlzD
 -----END PGP SIGNATURE-----

Merge tag 'v2023.10-rc3' into next

Prepare v2023.10-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
2023-08-21 17:32:17 -04:00
Bin Meng
6072703dc9 bootmeth: efi: Make distro_efi_boot() static
As it is only called in bootmeth_efi.c

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-08-15 18:21:17 +02:00
Simon Glass
daffb0be2c 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>
2023-08-11 07:33:40 -06:00
Simon Glass
c279224ea6 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>
2023-08-11 07:33:38 -06:00
Simon Glass
598dea978d 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>
2023-08-10 18:34:54 -06:00
Simon Glass
074503c40a 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>
2023-08-10 18:34:54 -06:00
Simon Glass
f861b1ee70 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>
2023-08-10 18:34:54 -06:00
Simon Glass
76bd6844dc bootstd: Add private bootmeth data to the bootflow
Some bootmeths need to store their own information related to the
bootflow, in addition to the generic information in struct bootflow.
Add a pointer for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-10 18:34:54 -06:00
Simon Glass
1d4bbdf3e4 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>
2023-08-10 18:34:54 -06:00
Simon Glass
b7ed5386a4 bootstd: cros: Add docs for the kernel layout
Provide brief documentation about the ChromiumOS kernel layout.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-10 18:34:54 -06:00
Simon Glass
1a0810924a 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>
2023-08-10 18:34:54 -06:00
Simon Glass
c5dca50bbb 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>
2023-08-10 18:34:54 -06:00
Simon Glass
3257835e56 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>
2023-08-10 18:34:54 -06:00
Simon Glass
4cfe4510f1 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>
2023-08-10 18:34:54 -06:00
Simon Glass
de30aa9a2f 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>
2023-08-10 18:34:54 -06:00
Simon Glass
5a8589ebd6 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>
2023-08-10 18:34:54 -06:00
Simon Glass
defa33ad29 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>
2023-08-10 18:34:54 -06:00
Simon Glass
3500ae13c6 bootstd: Add some more debugging in the bootdev uclass
Add some more output to make it easier to see what is going wrong when
a bootdev hunter fails.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-08-09 23:31:11 +08:00
Simon Glass
d7d78576bb bootstd: Rename bootdev_setup_sibling_blk()
This name is a little confusing since it suggests that it sets up the
sibling block device. In fact it sets up a bootdev for it. Rename the
function to make this clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-08-09 23:31:11 +08:00
Tom Rini
a077ac13d0 Kconfigs: Correct default of "0" on hex type entries
It is not a parse error to have a default value of "0" for a "hex" type
entry, instead of "0x0".  However, "0" and "0x0" are not treated the
same even by the tools themselves. Correct this by changing the default
value from "0" to "0x0" for all hex type questions that had the
incorrect default. Fix one instance (in two configs) of a default of "0"
being used on a hex question to be "0x0". Remove the cases where a
defconfig had set a value of "0x0" to be used as the default had been
"0".

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-09 09:21:42 -04:00
Ilya Lukin
1a549c8961 crc32: Drop duplicates crc header includes
Fixes: 3db7110857 ("crc32: Use the crc.h header for crc functions")
Signed-off-by: Ilya Lukin <4.shket@gmail.com>
2023-08-08 17:41:52 -04:00
Dan Carpenter
d864bd0e21 expo: allocate correct amount of memory
This should be allocating the memory for "item" instead of "menu".
The item struct is 48 bytes instead of 96 (assuming a 64bit system)
so this saves a little memory.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-08 17:41:52 -04:00
Dan Carpenter
bb34bc0c96 cmd: pxe_utils: add some missing tabs
These lines are supposed to be indented one more tab.  Otherwise it's
confusing to read.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2023-08-08 17:41:52 -04:00
Simon Glass
11158aef89 bootstd: Init the size before reading extlinux file
The implementation in extlinux_pxe_getfile() does not pass a valid size
to bootmeth_read_file(), so this can fail if the uninited value happens to
be too small.

Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-03 15:30:54 -04:00
Simon Glass
2984d21a28 bootstd: Init the size before reading the devicetree
The implementation in distro_efi_try_bootflow_files() does not pass a
valid size to bootmeth_common_read_file(), so this can fail if the
uninted value happens to be too small.

Fix this.

This was reported by someone but I cannot now find the email.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-03 15:30:54 -04:00
Simon Glass
6a8c2f9781 bootstd: Avoid allocating memory for the EFI file
The current bootflow-iteration algorithm reads the bootflow file into
an allocated memory buffer so it can be examined. This works well in
most cases.

However, while the common case is that the first bootflow is immediately
booted, it is also possible just to scan for available bootflows, perhaps
selecting one to boot later.

Even with the common case, EFI bootflows can be quite large. It doesn't
make sense to read it into an allocated buffer when we have kernel_addr_t
providing a suitable address for it. Even if we do have plenty of malloc()
space available, it is a violation of U-Boot's lazy-init principle to
read the bootflow before it is needed.

So overall it seems better to make a change.

Adjust the logic to read just the size of the EFI file at first. Later,
when the bootflow is booted, read the rest of the file into the designated
kernel buffer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Da Xue <da@libre.computer>
Reported-by: Vincent Stehlé <vincent.stehle@arm.com>
2023-08-03 15:30:54 -04:00
Simon Glass
146242cc99 bootstd: Use a function to detect network in EFI bootmeth
This checks for a network-based bootflow in two places, one of which is
less than ideal. Move the correct test into a function and use it in both
places.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-03 15:30:54 -04:00
Simon Glass
0c0c82b517 bootflow: Export setup_fs()
This function is used in some bootmeth implementations. Export it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-03 15:30:53 -04:00
Heinrich Schuchardt
ca9d9263e5 boot: fix bootdev_list()
uclass_get_device_by_name() is meant to return 0 or a negative error code.
simple_itoa() cannot handle negative numbers.

This leads to output like:

    => bootdev list -p

    Seq  Probed  Status  Uclass    Name
    ---  ------  ------  --------  ------------------
      c   [   ]  18446744073709551614  spi_flash spi.bin@0.bootdev

Convert the status to a positive number. Now we get

    Seq  Probed  Status  Uclass    Name
    ---  ------  ------  --------  ------------------
      c   [   ]       2  spi_flash spi.bin@0.bootdev

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-08-02 12:05:57 -06:00