]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
15 months agoevent.h: Documented some newly added portions better
Tom Rini [Mon, 4 Sep 2023 15:19:50 +0000 (11:19 -0400)]
event.h: Documented some newly added portions better

After the merge of v2023.10-rc4 to next include/event.h needs to be
fully documented in order for documentation builds to complete.  Rewords
two of the event_t descriptions to be docbook style and better match the
rest of this enum.  Fix two typos (flag->flags) in other comments.

Signed-off-by: Tom Rini <trini@konsulko.com>
15 months agoMerge tag 'v2023.10-rc4' into next
Tom Rini [Mon, 4 Sep 2023 14:51:58 +0000 (10:51 -0400)]
Merge tag 'v2023.10-rc4' into next

Prepare v2023.10-rc4

15 months agoPrepare v2023.10-rc4
Tom Rini [Mon, 4 Sep 2023 14:39:43 +0000 (10:39 -0400)]
Prepare v2023.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
15 months agoMerge tag 'rpi-2023.10' of https://source.denx.de/u-boot/custodians/u-boot-raspberrypi
Tom Rini [Mon, 4 Sep 2023 14:07:48 +0000 (10:07 -0400)]
Merge tag 'rpi-2023.10' of https://source.denx.de/u-boot/custodians/u-boot-raspberrypi

Updates for RPi for 2023.10:

- rpi: Disable DISTRO_DEFAULTS
- arm: rpi: Switch to standard boot
- arm: rpi: Switch to a text environment

15 months agoarm: rpi: Switch to a text environment
Simon Glass [Thu, 27 Jul 2023 21:54:30 +0000 (15:54 -0600)]
arm: rpi: Switch to a text environment

Use the new environment format so we can drop most of the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agorpi: Disable DISTRO_DEFAULTS
Simon Glass [Thu, 27 Jul 2023 21:54:29 +0000 (15:54 -0600)]
rpi: Disable DISTRO_DEFAULTS

Disable this option to reclaim some space, since bootstd requires less
functionality to operate (e.g. hush parser).

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoarm: rpi: Switch to standard boot
Simon Glass [Thu, 27 Jul 2023 21:54:28 +0000 (15:54 -0600)]
arm: rpi: Switch to standard boot

Drop use of the distro scripts and use standard boot instead.

We don't need to specify the mmc devices individually, since they are
used in order from 0 to 2, and standard boot uses that order anyway.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoMerge tag 'doc-2023-10-rc4-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 2 Sep 2023 13:08:54 +0000 (09:08 -0400)]
Merge tag 'doc-2023-10-rc4-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request doc-2023-10-rc4-2

* Man-page for gpt command
* Fix long text help of gpt command
* Add events to HTML documentation
* Update Toradex documentation

15 months agoMerge tag 'doc-next' of https://source.denx.de/u-boot/custodians/u-boot-efi into...
Tom Rini [Sat, 2 Sep 2023 13:08:34 +0000 (09:08 -0400)]
Merge tag 'doc-next' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request doc-next

* Update TI am64x documentation

15 months agodoc: Add gpt command documentation
Joshua Watt [Thu, 31 Aug 2023 16:51:35 +0000 (10:51 -0600)]
doc: Add gpt command documentation

Adds initial documentation for the gpt command

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
15 months agocmd: gpt: Remove confusing help text
Joshua Watt [Thu, 31 Aug 2023 16:51:34 +0000 (10:51 -0600)]
cmd: gpt: Remove confusing help text

This help text appears to be a fragment of the text shown when
CONFIG_CMD_GPT_RENAME is enabled, but is confusing so remove it.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
15 months agodoc: board: ti: am64x: Fix build step numbering
Nishanth Menon [Tue, 22 Aug 2023 16:41:03 +0000 (11:41 -0500)]
doc: board: ti: am64x: Fix build step numbering

Fix up build step numbering.

Fixes: 4bf49bade124 ("doc: board: ti: am64: Add boot flow diagram")
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
15 months agodoc: board: ti: am64x: provide image alt text
Nishanth Menon [Tue, 22 Aug 2023 16:40:58 +0000 (11:40 -0500)]
doc: board: ti: am64x: provide image alt text

Provide alternative text for image.

Fixes: 4bf49bade124 ("doc: board: ti: am64: Add boot flow diagram")
Reported-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
15 months agodoc: board: toradex: verdin-am62: document update u-boot wrapper
Marcel Ziswiler [Mon, 28 Aug 2023 22:01:54 +0000 (00:01 +0200)]
doc: board: toradex: verdin-am62: document update u-boot wrapper

Now with the update U-Boot wrappers having been sorted out, document
their usage.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
15 months agodoc: board: toradex: minor documentation update
Marcel Ziswiler [Mon, 28 Aug 2023 22:01:53 +0000 (00:01 +0200)]
doc: board: toradex: minor documentation update

- Update SPDX-License-Identifier from obsolete GPL-2.0+ to
  GPL-2.0-or-later.
- Add links to product websites of SoM and carrier board where missing.
- Add information about update U-Boot wrapper where missing.
- Add sectionauthor where missing.
- Update information about imx-seco from version 3.7.4 to 3.8.1.
- Various minor grammatic and spelling fixes.
- Improve whitespace by adding or removing new lines.
- Change from code-block for output to just Output::.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
15 months agovideo: fix typo in video_sync_all documentation
Heinrich Schuchardt [Mon, 28 Aug 2023 20:40:47 +0000 (22:40 +0200)]
video: fix typo in video_sync_all documentation

%s/there/their/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodoc: add events.h to documentation
Heinrich Schuchardt [Mon, 28 Aug 2023 19:13:33 +0000 (21:13 +0200)]
doc: add events.h to documentation

Add the events.h include to the API documentation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodm: event: document all events
Heinrich Schuchardt [Mon, 28 Aug 2023 19:13:32 +0000 (21:13 +0200)]
dm: event: document all events

Provide Sphinx documentation for all events.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agoMerge branch '2023-08-31-replace-more-init-hooks-with-events' into next
Tom Rini [Thu, 31 Aug 2023 19:10:42 +0000 (15:10 -0400)]
Merge branch '2023-08-31-replace-more-init-hooks-with-events' into next

To quote the author:
This series replaces some more of the init hooks in board_f.c and
board_r.c with events. Notably it converts last_state_init() over.

It also provides a 'simple' event spy, which takes no arguments. It
turns out that this is quite a common case, so it is worth optimising
for this, to reduce code size, before events become too commonly used.

Finally, it introduces a way of emitting an event in an initcall,
instead of calling a function. This is likely to be used at least as
often as the functions, as we convert more of these initcalls.

As part of this, the initcall code is brought back into a C file. Somehow
the compiler has changed or something else, so that this does not confer
any benefits now.

For boards with EVENT enabled, this unfortunately results in small
growth, e.g. for firefly:

   aarch64: (for 1/1 boards) all +114.0 data +16.0 rodata +22.0 text +76.0
       arm: (for 1/1 boards) all +82.0 rodata +18.0 text +64.0

For boards without EVENT enabled the growth is smaller, e.g. nokia_rx51:

       arm: (for 1/1 boards) all +32.0 data +8.0 rodata -8.0 text +32.0

I cannot find a good way to avoid the latter, other than macro magic
with an embedded comma (to completely remove an event entry), which
seems nasty.

15 months agoevent: Use an event to replace last_stage_init()
Simon Glass [Tue, 22 Aug 2023 03:17:01 +0000 (21:17 -0600)]
event: Use an event to replace last_stage_init()

Add a new event which handles this function. Convert existing use of
the function to use the new event instead.

Make sure that EVENT is enabled by affected boards, by selecting it from
the LAST_STAGE_INIT option. For x86, enable it by default since all boards
need it.

For controlcenterdc, inline the get_tpm() function and make sure the event
is not built in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agofreescale: Drop call to init_func_vid() in the init sequence
Simon Glass [Tue, 22 Aug 2023 03:17:00 +0000 (21:17 -0600)]
freescale: Drop call to init_func_vid() in the init sequence

Use the misc_init_f event instead, which is designed for this purpose.

All boards with CONFIG_VID already enable CONFIG_EVENT.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agox86: Convert arch_fsp_init() to use events
Simon Glass [Tue, 22 Aug 2023 03:16:59 +0000 (21:16 -0600)]
x86: Convert arch_fsp_init() to use events

Convert this to use events instead of calling a function directly in the
init sequence.

Rename it to arch_fsp_init_f() to distinguish it from the one that happens
after relocation.

For FSPv2 nothing needs to be done here, so drop the empty function.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoevent: Update documentation for simple spy
Simon Glass [Tue, 22 Aug 2023 03:16:58 +0000 (21:16 -0600)]
event: Update documentation for simple spy

Now that we have two types of spy, mention this in the documentation. Put
the simple spy first, since it seems to be the common case.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoevent: Rename EVENT_SPY to EVENT_SPY_FULL
Simon Glass [Tue, 22 Aug 2023 03:16:57 +0000 (21:16 -0600)]
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>
15 months agoevent: Convert existing spy records to simple
Simon Glass [Tue, 22 Aug 2023 03:16:56 +0000 (21:16 -0600)]
event: Convert existing spy records to simple

Very few of the existing event-spy records use the arguments they are
passed. Update them to use a simple spy instead, to simplify the code.

Where an adaptor function is currently used, remove it where possible.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoinitcall: Support manual relocation
Simon Glass [Tue, 22 Aug 2023 03:16:55 +0000 (21:16 -0600)]
initcall: Support manual relocation

Move the manual-relocation code to the initcall file. Make sure to avoid
manually relocating event types. Only true function pointers should be
relocated.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoinitcall: Support emitting events
Simon Glass [Tue, 22 Aug 2023 03:16:54 +0000 (21:16 -0600)]
initcall: Support emitting events

At present the initcall list consists of a list of function pointers. Over
time the initcall lists will likely change to mostly emitting events,
since most of the calls are board- or arch-specific.

As a first step, allow an initcall to be an event type instead of a
function pointer. Add the required macro and update initcall_run_list() to
emit an event in that case, or ignore it if events are not enabled.

The bottom 8 bits of the function pointer are used to hold the event type,
with the rest being all ones. This should avoid any collision, since
initcalls should not be above 0xffffff00 in memory.

Convert misc_init_f over to use this mechanism.

Add comments to the initcall header file while we are here. Also fix up
the trace test to handle the change.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoevent: Export event_type_name()
Simon Glass [Tue, 22 Aug 2023 03:16:53 +0000 (21:16 -0600)]
event: Export event_type_name()

Export this function so it can be used with initcall debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoinitcall: Adjust the failure message and return value
Simon Glass [Tue, 22 Aug 2023 03:16:52 +0000 (21:16 -0600)]
initcall: Adjust the failure message and return value

Move the failure message outside the loop, so it is easier to follow the
code. Avoid swallowing the error code - just pass it along.

Drop the initcall-list address from the output. This is confusing since
we show two addresses. Really it is only the function address which is
useful, since it can be looked up in the map, e.g. with:

   grep -A1 -B1 serial_init u-boot.map

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoinitcall: Adjust the loop logic
Simon Glass [Tue, 22 Aug 2023 03:16:51 +0000 (21:16 -0600)]
initcall: Adjust the loop logic

Use a variable to hold the function, so we don't need to repeat the
pointer access each time. Rename the init pointer to 'ptr' since we only
refer to it in the for() statement now.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoinitcall: Factor out reloc_off calculation
Simon Glass [Tue, 22 Aug 2023 03:16:50 +0000 (21:16 -0600)]
initcall: Factor out reloc_off calculation

Move this into a function and do it once, not each time around the loop.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoRevert "initcall: Move to inline function"
Simon Glass [Tue, 22 Aug 2023 03:16:49 +0000 (21:16 -0600)]
Revert "initcall: Move to inline function"

Somehow I do not see any inlining with initcalls now. I was sure I saw
it when this commit went in, but now it seems to make things worse.

This reverts commit 47870afab92fca6e672c03d0dea802a55e200675.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoevent: Support a simple spy record
Simon Glass [Tue, 22 Aug 2023 03:16:48 +0000 (21:16 -0600)]
event: Support a simple spy record

The current event spy is always passed the event context and the event.
The context is always NULL for a static spy. The event is not often used.

Introduce a 'simple' spy which takes no arguments. This allows us to drop
the adaptation code that many of these spy records use.

Update the event script to find these in the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoMerge branch '2023-08-30-assorted-code-improvements' into next
Tom Rini [Thu, 31 Aug 2023 16:23:36 +0000 (12:23 -0400)]
Merge branch '2023-08-30-assorted-code-improvements' into next

- pcie-bcmstb improvements, nvmxip improvements, fix a corner case in
  the serial uclass, send error messages to stderr in host tools, fwu
  library CI state fixup, turn some setexpr diagnostic messages to debug

15 months agosetexpr: Silence some diagnostic messages
Łukasz Stelmach [Thu, 24 Aug 2023 06:10:25 +0000 (08:10 +0200)]
setexpr: Silence some diagnostic messages

Neither successful match nor lack thereof should be considered an
extraordinary situation. Thus, neither require printing a message.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agoconfigs: sandbox: Enable NVMXIP QSPI driver
Marek Vasut [Wed, 23 Aug 2023 00:18:21 +0000 (02:18 +0200)]
configs: sandbox: Enable NVMXIP QSPI driver

Enable NVMXIP QSPI driver on sandbox, since it is already enabled
on sandbox64.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
15 months agodrivers/mtd/nvmxip: Move sandbox_set_enable_memio() to test
Marek Vasut [Wed, 23 Aug 2023 00:18:20 +0000 (02:18 +0200)]
drivers/mtd/nvmxip: Move sandbox_set_enable_memio() to test

The sandbox_set_enable_memio() should only ever be set during
sandbox testing, not within driver itself, move it back to test/ .

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
15 months agodrivers/mtd/nvmxip: Print phys_addr_t without warnings on both 32bit and 64bit systems
Marek Vasut [Wed, 23 Aug 2023 00:18:19 +0000 (02:18 +0200)]
drivers/mtd/nvmxip: Print phys_addr_t without warnings on both 32bit and 64bit systems

Cast the address such that it can be printed without warnings
on both 32bit and 64bit systems. This really should use some
better print formatter, but for the lack of it, do it this way.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
15 months agodrivers/mtd/nvmxip: Rework the read accessor to support 32bit systems
Marek Vasut [Wed, 23 Aug 2023 00:18:18 +0000 (02:18 +0200)]
drivers/mtd/nvmxip: Rework the read accessor to support 32bit systems

Get rid of nvmxip_mmio_rawread() and just implement the readl()/readq()
reader loop within nvmxip_blk_read(). Cast the destination buffer as
needed and increment the read by either 4 or 8 bytes depending on if
this is systemd with 32bit or 64bit physical address.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
15 months agodrivers/mtd/nvmxip: Trigger post bind as probe on driver level
Marek Vasut [Wed, 23 Aug 2023 00:18:17 +0000 (02:18 +0200)]
drivers/mtd/nvmxip: Trigger post bind as probe on driver level

Perform all the block device creation only once, after the driver itself
successfully bound. Do not do this in uclass post bind, as this might be
triggered multiple times. For example the ut_dm_host test triggers this
and triggers a memory leak that way, since there are now multiple block
devices created using the blk_create_devicef() .

To retain the old probe-on-boot behavior, set DM_FLAG_PROBE_AFTER_BIND
flag in uclass post_bind callback, so the driver model would probe the
driver at the right time.

Rename the function as well, to match similar functions in
other block-related subsystems, like the mmc one.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
15 months agofwu: Initialize global fwu library state during CI test
Marek Vasut [Wed, 23 Aug 2023 00:16:52 +0000 (02:16 +0200)]
fwu: Initialize global fwu library state during CI test

The current CI test worked by sheer luck, the g_dev global pointer
in the fwu library was never initialized and the test equally well
failed on sandbox64. Trigger the main loop in sandbox tests too to
initialize that global state, and move the sandbox specific exit
from fwu_boottime_checks after g_dev is initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agoserial-uclass: reset gd->cur_serial_dev to NULL if serial not found
Maksim Kiselev [Fri, 18 Aug 2023 09:34:30 +0000 (12:34 +0300)]
serial-uclass: reset gd->cur_serial_dev to NULL if serial not found

Reset gd->cur_serial_dev pointer to avoid calling non-relocated code
from relocated code if a serial driver is not found and
CONFIG_REQUIRE_SERIAL_CONSOLE is disabled.

Here is detailed explanation of what this patch is trying to fix.

U-boot calls the serial_find_console_or_panic() function twice.
The first console setup occurs before U-boot relocation in
the serial_init(). This stage uses simple FDT parsing and
assigns gd->cur_serial_dev to a "serial" device that lives in
non-relocated code too.

The second console setup after U-boot relocation(from serial_initialize())
may use full live DT (if OF_LIVE enabled) probe sequence with buses,
clocks, resets, etc... And if the console setup fails at this step,
than we should be caught by panic_str("No serial driver found").

But... If we disable CONFIG_REQUIRE_SERIAL_CONSOLE, than we
return from serial_init() with gd->cur_serial_dev pointing
to the "old"(non-relocated) serial device.

And if this area, where "old" serial device is placed, is changed
(e.g. Linux kernel may be relocated at this address), than we will get
an unexpected crash on the next call of printf().

Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
15 months agotools: image-host: print error messages to stderr
Oleksandr Suvorov [Thu, 17 Aug 2023 15:36:10 +0000 (18:36 +0300)]
tools: image-host: print error messages to stderr

The make by default cuts off the stdout output from external tools,
so all error messages from the image-host are not shown in a make
output. Besides that, it is a common approach to use stderr stream
for error messages.
Use stderr for all error messages in image-host.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agopci: pcie-brcmstb: do not rely on CLKREQ# signal
Sam Edwards [Wed, 16 Aug 2023 22:27:53 +0000 (15:27 -0700)]
pci: pcie-brcmstb: do not rely on CLKREQ# signal

When the Broadcom STB PCIe controller is initialized, it must be set
into one of three CLKREQ# modes: "none"/"aspm"/"l1ss". The Linux driver,
through today, hard-codes "aspm" since the vast majority of boards using
this driver have a fixed PCIe bus with the CLKREQ# signal wired up.

The Raspberry Pi CM4, however, can be connected to a plethora of PCIe
devices, some of which do not connect the CLKREQ# line (they just leave
it floating). So "aspm" mode is no longer appropriate in all cases. In
Linux, there is a proposed patchset [1] to determine the proper mode.
This doesn't really make sense in U-Boot's case, so we just change the
assumption from "aspm" to "none" (which is always safe).

This patch DOES resolve a real-world crash that occurs when U-Boot is
running on a Raspberry Pi CM4 installed in slot 3 of a Turing Pi 2
cluster board.

[1]: https://lore.kernel.org/all/20230428223500.23337-1-jim2101024@gmail.com/

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
15 months agopci: pcie-brcmstb: bring over some robustness improvements from Linux
Sam Edwards [Mon, 14 Aug 2023 22:34:13 +0000 (16:34 -0600)]
pci: pcie-brcmstb: bring over some robustness improvements from Linux

Since the initial U-Boot driver was ported here from Linux, the latter
has had a few changes for robustness/stability. This patch brings over
two of them:
- Do not attempt to access the configuration space of a PCIe device if
  the link has gone down, as that will result in an asynchronous SError
  interrupt which will crash U-Boot.
- Wait for the recommended 100ms after PERST# is deasserted.

I sent this patch while debugging a crash involving PCIe, but these
are unrelated improvements. I do not believe that this patch fixes any
real-world bug.

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
15 months agoMerge tag 'u-boot-at91-2023.10-a' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 30 Aug 2023 13:32:10 +0000 (09:32 -0400)]
Merge tag 'u-boot-at91-2023.10-a' of https://source.denx.de/u-boot/custodians/u-boot-at91 into next

First set of u-boot-at91 features for the 2023.10 cycle:

This feature set includes a new board sama5d29 Curiosity, and various
fixes and alignments for sam9x60 and sam9x60 curiosity board.

16 months agoMerge branch '2023-08-29-integrate-efi-capsule-update-better-in-to-u-boot-buildflow...
Tom Rini [Tue, 29 Aug 2023 20:58:42 +0000 (16:58 -0400)]
Merge branch '2023-08-29-integrate-efi-capsule-update-better-in-to-u-boot-buildflow' into next

To quote the author:
This patchset aims to bring two capsule related tasks under the U-Boot
build flow.

The first task is related to generation of capsules. The capsules can be
generated as part of U-Boot build, and this is being achieved through
binman, by adding a capsule entry type. The capsules can be generated by
specifying the capsule parameters as properties under the capsule entry
node.

The other task is the embedding of the public key into the platform's
DTB. The public key is in the form of an EFI Signature List(ESL) file
and is used for capsule authentication. This is being achieved by adding
the signature node containing the capsule public key in the platform's
DTB.

Corresponding changes have also been made to the test setup of the EFI
capsule update feature. The ESL public key file was embedded into the
sandbox platform's test.dtb as part of the test setup, post U-Boot
build. This is now no longer needed as the embedding of the ESL happens
as part of the build.

Secondly, the capsules needed for testing the EFI capsule update feature
were being generated through the invocation of the mkeficapsule tool.
This setup has also been changed to introduce generation of these
capsules through binman.

The document has been updated to reflect the above changes.

16 months agodoc: capsule: Document the new mechanism to embed ESL file into dtb
Sughosh Ganu [Tue, 22 Aug 2023 17:40:08 +0000 (23:10 +0530)]
doc: capsule: Document the new mechanism to embed ESL file into dtb

Update the document to specify how the EFI Signature List(ESL) file
can be embedded into the platform's dtb as part of the U-Boot build.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agotest: capsule: Remove logic to add public key ESL
Sughosh Ganu [Tue, 22 Aug 2023 17:40:07 +0000 (23:10 +0530)]
test: capsule: Remove logic to add public key ESL

The public key EFI Signature List(ESL) needed for capsule
authentication is now embedded into the platform's DTB as part of the
build. Remove the superfluous logic from the test setup.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
16 months agosandbox: capsule: Add path to the public key ESL file
Sughosh Ganu [Tue, 22 Aug 2023 17:40:06 +0000 (23:10 +0530)]
sandbox: capsule: Add path to the public key ESL file

Add the path to the public key EFI Signature List(ESL) file for the
sandbox variants which enable capsule authentication. This ESL file
gets embedded into the platform's device-tree as part of the build.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
16 months agoscripts/Makefile.lib: Embed capsule public key in platform's dtb
Sughosh Ganu [Tue, 22 Aug 2023 17:40:05 +0000 (23:10 +0530)]
scripts/Makefile.lib: Embed capsule public key in platform's dtb

The EFI capsule authentication logic in u-boot expects the public key
in the form of an EFI Signature List(ESL) to be provided as part of
the platform's dtb. Currently, the embedding of the ESL file into the
dtb needs to be done manually.

Add a target for generating a dtsi file which contains the signature
node with the ESL file included as a property under the signature
node. Include the dtsi file in the dtb. This brings the embedding of
the ESL in the dtb into the U-Boot build flow.

The path to the ESL file is specified through the
CONFIG_EFI_CAPSULE_ESL_FILE symbol.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoscripts/Makefile.lib: Add dtsi include files as deps for building DTB
Sughosh Ganu [Tue, 22 Aug 2023 17:40:04 +0000 (23:10 +0530)]
scripts/Makefile.lib: Add dtsi include files as deps for building DTB

At the time of building the DTB, some dtsi files can be selected for
inclusion. Have these dtsi files as dependencies for the DTB
target. This also ensures generation or updating the dtsi files if
need be.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
16 months agoscripts/Makefile.lib: Collate all dtsi files for inclusion
Sughosh Ganu [Tue, 22 Aug 2023 17:40:03 +0000 (23:10 +0530)]
scripts/Makefile.lib: Collate all dtsi files for inclusion

At the time of building a device-tree file, all the *u-boot.dtsi files
are looked for, in a particular order, and the first file found is
included. Then, the list of files specified in the
CONFIG_DEVICE_TREE_INCLUDES symbol are included.

Combine these files that are to be included into a variable, and then
include all these files in one go.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agosandbox: trace: Increase trace buffer size
Sughosh Ganu [Tue, 22 Aug 2023 17:40:02 +0000 (23:10 +0530)]
sandbox: trace: Increase trace buffer size

When running the trace test on the sandbox platform, the current size
of 16MiB is no longer large enough for capturing the entire trace
history, and results in truncation. Use a size of 32MiB for the trace
buffer on the sandbox platform while running the trace test.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agodoc: Add documentation to highlight capsule generation related updates
Sughosh Ganu [Tue, 22 Aug 2023 17:40:01 +0000 (23:10 +0530)]
doc: Add documentation to highlight capsule generation related updates

The EFI capsules can now be generated as part of U-Boot build, through
binman. Highlight these changes in the documentation.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
16 months agotest: capsule: Generate EFI capsules through binman
Sughosh Ganu [Tue, 22 Aug 2023 17:40:00 +0000 (23:10 +0530)]
test: capsule: Generate EFI capsules through binman

Support has been added for generating the EFI capsules through
binman. Make changes in the EFI capsule update testing feature to
generate capsules through binman.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
16 months agobinman: capsule: Add support for generating EFI capsules
Sughosh Ganu [Tue, 22 Aug 2023 17:39:59 +0000 (23:09 +0530)]
binman: capsule: Add support for generating EFI capsules

Add support in binman for generating EFI capsules. The capsule
parameters can be specified through the capsule binman entry. Also add
test cases in binman for testing capsule generation.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agobtool: mkeficapsule: Add a bintool for EFI capsule generation
Sughosh Ganu [Tue, 22 Aug 2023 17:39:58 +0000 (23:09 +0530)]
btool: mkeficapsule: Add a bintool for EFI capsule generation

Add a bintool for generating EFI capsules. This calls the mkeficapsule
tool which generates the capsules.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agosandbox: capsule: Enable EFI capsule module on sandbox variants
Sughosh Ganu [Tue, 22 Aug 2023 17:39:57 +0000 (23:09 +0530)]
sandbox: capsule: Enable EFI capsule module on sandbox variants

Enable the EFI capsule update code on all sandbox variants. This was
already enabled on the sandbox, sandbox64 and sandbox_flattree
variants. The rest of the variants also have the EFI capsule update
module  enabled now. With this commit, the mkeficapsule tool also gets
enabled on all variants.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agosandbox: capsule: Add keys and certificates needed for capsule update testing
Sughosh Ganu [Tue, 22 Aug 2023 17:39:56 +0000 (23:09 +0530)]
sandbox: capsule: Add keys and certificates needed for capsule update testing

Add the private keys and public key certificates which are to be used
for capsule authentication while testing the EFI capsule update
functionality. There are two pairs of private and public keys, good
and bad. The good key pair will be used for signing capsules, whilst
the bad key pair is to be used as malicious keys for testing
authentication failure cases. The capsule_pub_key_good.crt is also
converted to an EFI Signature List(ESL) file, SIGNER.esl, which is
embedded in the platform's device-tree for capsule authentication.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agonuvoton: npcm845-evb: Add a newline at the end of file
Sughosh Ganu [Tue, 22 Aug 2023 17:39:55 +0000 (23:09 +0530)]
nuvoton: npcm845-evb: Add a newline at the end of file

Add a newline at the end of the dts, without which the build fails
when including a dtsi file.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agobinman: bintool: Build a tool from a list of commands
Sughosh Ganu [Tue, 22 Aug 2023 17:39:54 +0000 (23:09 +0530)]
binman: bintool: Build a tool from a list of commands

Add support to build a tool from source with a list of commands. This
is useful when a tool can be built with multiple commands instead of a
single command.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoARM: dts: at91: sam9x60-curiosity: Sync gpio button from Linux
Alexander Dahl [Wed, 23 Aug 2023 13:58:56 +0000 (15:58 +0200)]
ARM: dts: at91: sam9x60-curiosity: Sync gpio button from Linux

Copied as is from Linux Kernel release v6.4.
(dts file is still the same in Linux v6.5-rc7 but was moved to vendor
sub-directories with v6.5-rc1.)

Button works out of the box now if the following config options are
enabled: CONFIG_BUTTON, CONFIG_BUTTON_GPIO, CONFIG_CMD_BUTTON,
CONFIG_DM_GPIO.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
16 months agoboard: sam9x60-curiosity: Let LED subsystem init leds if enabled
Alexander Dahl [Wed, 23 Aug 2023 13:58:55 +0000 (15:58 +0200)]
board: sam9x60-curiosity: Let LED subsystem init leds if enabled

If CONFIG_LED and CONFIG_LED_GPIO are enabled, it is not necessary to
initialize the RGB LED on the board by manually setting hardcoded GPIOs
anymore.  Everything is well defined in dts and can be used like on
boards of other vendors.

Keep the old behaviour as fallback, though.

With all this in place enabling CONFIG_CMD_LED gives us a working 'led'
command on the U-Boot shell.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
16 months agoARM: dts: at91: sam9x60-curiosity: Sync LED nodes from Linux
Alexander Dahl [Wed, 23 Aug 2023 13:58:54 +0000 (15:58 +0200)]
ARM: dts: at91: sam9x60-curiosity: Sync LED nodes from Linux

Copied as is from Linux Kernel release v6.4.

(dts file is still the same in Linux v6.5-rc7 but was moved to vendor
sub-directories with v6.5-rc1.)

Signed-off-by: Alexander Dahl <ada@thorsis.com>
16 months agoconfigs: at91: sam9x60: Switch to new reset driver
Alexander Dahl [Wed, 23 Aug 2023 13:58:53 +0000 (15:58 +0200)]
configs: at91: sam9x60: Switch to new reset driver

Since commit 61040097a9d1 ("reset: at91: Add reset driver for basic
assert/deassert operations") the compatible "microchip,sam9x60-rstc" for
the sam9x60 reset controller in sam9x60.dtsi is not handled by
CONFIG_SYSRESET_AT91 anymore, but by CONFIG_RESET_AT91 now.  This
resulted in the following error message, when trying to reset from
U-Boot shell:

    U-Boot> reset
    resetting ...
    System reset not supported on this platform
    ### ERROR ### Please RESET the board ###

Fixed by enabling the new driver in the relevant defconfigs.  Tested on
sam9x60-curiosity board.  Defconfigs for sam9x60ek adapted in the same
way, but without testing.  These should be all sam9x60 boards affected
in U-Boot here.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
16 months agoconfigs: at91: sam9x60_curiosity: Sync both defconfig variants
Alexander Dahl [Wed, 23 Aug 2023 13:58:52 +0000 (15:58 +0200)]
configs: at91: sam9x60_curiosity: Sync both defconfig variants

The board has two SD card slots and we have two defconfigs for booting
from either the first (micro SD) named 'sam9x60_curiosity_mmc_defconfig'
or the second (full size SD) named 'sam9x60_curiosity_mmc1_defconfig'.
For comparable Microchip boards (sama5d27-som1-ek, sama5d29-curiosity,
sama7g5ek) with two card slots the defconfigs only differ in BOOTARGS,
BOOTCOMMAND, and ENV_FAT_DEVICE_AND_PART and the same should be the case
for sam9x60_curiosity.

Here the 'mmc1' config has more options enabled to support the raw NAND
flash populated on the board, so the 'mmc' config (for mmc0) was adapted
by enabling additional options, instead of removing options from mmc1.

The 'mem=128M' argument can be dropped from kernel command line, because
it is redundant to memory node in dts in both Linux and U-Boot:

        memory@20000000 {
                reg = <0x20000000 0x8000000>;
        };

Signed-off-by: Alexander Dahl <ada@thorsis.com>
16 months agoMerge branch '2023-08-28-assorted-important-fixes'
Tom Rini [Tue, 29 Aug 2023 14:06:08 +0000 (10:06 -0400)]
Merge branch '2023-08-28-assorted-important-fixes'

- A few platform-specific config/dts updates to fix issues, drop a
  temporary change in binman, update the MAINTAINERS file to remove
  Wolfgang Denk, fix a typo, fix a corner case with bootstd, update
  Azure to not timeout so easily, and fix a case where we would omit
  some files in SPL.

16 months agoRevert "arm: imx: mx7: Move CONFIG_OPTEE_TZDRAM_SIZE from lib/optee"
Ricardo Salveti [Fri, 25 Aug 2023 13:47:11 +0000 (16:47 +0300)]
Revert "arm: imx: mx7: Move CONFIG_OPTEE_TZDRAM_SIZE from lib/optee"

This reverts commit c5b68ef8af3c2f515c1f5b8d63a69359a85d753b.

CONFIG_OPTEE_TZDRAM_SIZE is used by imx6-based SoCs as well. Move the
option back.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
16 months agoRevert "binman: Add a temporary hack for duplicate phandles"
Simon Glass [Thu, 24 Aug 2023 01:18:02 +0000 (19:18 -0600)]
Revert "binman: Add a temporary hack for duplicate phandles"

The affected boards have been fixed, so drop this hack.

This reverts commit 288ae53cb73605500b7fc01e5919753c878466be.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Tim Harvey <tharvey@gateworks.com>
16 months agoimx: Drop unneeded phandle in FIT template
Simon Glass [Thu, 24 Aug 2023 01:18:01 +0000 (19:18 -0600)]
imx: Drop unneeded phandle in FIT template

Adding a phandle to a template node is not allowed, since when the node is
instantiated multiple times, we end up with duplicate phandles.

Drop this invalid constructs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Tim Harvey <tharvey@gateworks.com>
16 months agoMAINTAINERS: remove Wolfgang Denk
Heinrich Schuchardt [Wed, 23 Aug 2023 22:12:47 +0000 (00:12 +0200)]
MAINTAINERS: remove Wolfgang Denk

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agospl: crypto: fix including SHA* object files in SPL
Oleksandr Suvorov [Wed, 23 Aug 2023 14:56:27 +0000 (17:56 +0300)]
spl: crypto: fix including SHA* object files in SPL

If one of SHA* algorithms is disabled in u-boot, its code is not
included in SPL even if a given SHA* option is enabled in SPL. Fix
this.

Fixes: 603d15a572d ("spl: cypto: Bring back SPL_ versions of SHA")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Tom Rini <trini@konsulko.com>
16 months agoAzure: Set the timeout for jobs to the maximum
Tom Rini [Sun, 20 Aug 2023 17:31:26 +0000 (13:31 -0400)]
Azure: Set the timeout for jobs to the maximum

As per current Azure Pipelines documentation we qualify for 3600 minutes
per job, if specified, as the timeout. The default unspecified timeout
is 60 minutes. Rework things to specify 0 as the timeout (and so maximum
allowed) so that we don't have failures due to running slightly past 60
minutes total.

Link: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#timeouts
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoconfigs: set CONFIG_LMB_MAX_REGIONS=64 for MT7988 boards
Daniel Golle [Mon, 21 Aug 2023 19:38:23 +0000 (20:38 +0100)]
configs: set CONFIG_LMB_MAX_REGIONS=64 for MT7988 boards

Similar to MT7981 and MT7986 also MT7988 can have a high number of
reserved-memory regions used by the various hardware offloading
subsystems.

Raise CONFIG_LMB_MAX_REGIONS to 64 to avoid errors when trying to boot
Linux with more then 6 reserved regions:

ERROR: reserving fdt memory region failed (addr=4f700000 size=240000 flags=4)
ERROR: reserving fdt memory region failed (addr=15194000 size=1000 flags=4)
ERROR: reserving fdt memory region failed (addr=15294000 size=1000 flags=4)
ERROR: reserving fdt memory region failed (addr=15394000 size=1000 flags=4)
ERROR: Failed to allocate 0xb161 bytes below 0x80000000.
device tree - allocation error

Fixes: bc4adc97cfb ("board: mediatek: add MT7988 reference boards")
Reported-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
16 months agoconfigs: Enable CONFIG_DM_SCSI in am57xx_hs_evm_usb
Andrew Davis [Mon, 21 Aug 2023 13:59:10 +0000 (08:59 -0500)]
configs: Enable CONFIG_DM_SCSI in am57xx_hs_evm_usb

This should have already been enabled but was missed when converting the
base platform defconfig, fix this here.

Fixes: 3c5aa6caccab ("configs: Enable CONFIG_BLK in am57xx_evm and am57xx_hs_evm")
Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agobootstd: Adjust the default bootmeth order
Simon Glass [Sat, 19 Aug 2023 22:49:35 +0000 (16:49 -0600)]
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>
16 months agoarm: dts: mediatek: convert gmac link mode to 2500base-x for r3
Frank Wunderlich [Thu, 3 Aug 2023 16:52:58 +0000 (18:52 +0200)]
arm: dts: mediatek: convert gmac link mode to 2500base-x for r3

Ethernet on Bananapi-r3 is broken after

commit bd70f3cea353 ("net: mediatek: add support for SGMII 1Gbps auto-negotiation mode")

because changes from this commit were not applied to bpi-r3 devicetree too:

commit aef54ea16cac ("arm: dts: medaitek: convert gmac link mode to 2500base-x")

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Weijie Gao <weijie.gao@mediatek.com>
16 months agoboot: Fix reference to bootmenu doc
Peter Robinson [Fri, 18 Aug 2023 14:54:10 +0000 (15:54 +0100)]
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>
16 months agoMerge tag 'efi-2023-10-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 27 Aug 2023 15:04:02 +0000 (11:04 -0400)]
Merge tag 'efi-2023-10-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2023-10-rc4

Documentation:

* describe TPL/VPL/SPL boot
* Add support for sphinx-prompt and convert TI K3 to use it
* board: sdm845: Explicitly add boot.img flashing command

EFI:

* remove handle from events when deleting it

Others:

* fix gpt sub-commands setenv and enumerate
* add a parameter check in hash_calculate()

16 months agoefi_loader: delete handle from events when a protocol is uninstalled
Ilias Apalodimas [Thu, 24 Aug 2023 14:21:09 +0000 (17:21 +0300)]
efi_loader: delete handle from events when a protocol is uninstalled

When a notification event is registered for a protocol the handle of the
protocol is added in our event notification list.  When all the protocols
of the handle are uninstalled we delete the handle but we do not remove
it from the event notification list.

Clean up the protocol removal functions and add a wrapper which
- Removes the to-be deleted handle from any lists it participates
- Remove the handle if no more protocols are present

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agodoc: describe TPL/VPL/SPL boot
Heinrich Schuchardt [Wed, 23 Aug 2023 21:49:55 +0000 (23:49 +0200)]
doc: describe TPL/VPL/SPL boot

This is a stub describing how TPL, VPL, and SPL load the next boot stages
on a detail level for users.

For sure we will need a few patches on top to catch the whole complexity.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>
16 months agodoc: board: ti: k3: Convert to sphinx-prompt
Nishanth Menon [Thu, 24 Aug 2023 15:40:36 +0000 (10:40 -0500)]
doc: board: ti: k3: Convert to sphinx-prompt

Sphinx-prompt provides a handy scheme to provide documentation that
renders nicely and yet provides a scheme to copy paste for users without
having to hand-edit the copied text as is the result of code-block

[1] https://lore.kernel.org/all/87fs48rgto.fsf@baylibre.com/
Reported-by: Simon Glass <sjg@chromium.org>
Suggested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agodoc: sphinx: Add sphinx-prompt
Nishanth Menon [Thu, 24 Aug 2023 15:40:35 +0000 (10:40 -0500)]
doc: sphinx: Add sphinx-prompt

Sphinx-prompt[1] helps bring-in '.. prompt::' option that allows a
better rendered documentation, yet be able to copy paste without
picking up the prompt from rendered documentation.

[1] https://lore.kernel.org/all/87fs48rgto.fsf@baylibre.com/
Suggested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agodoc: board: sdm845: Explicitly add boot.img flashing command
Sumit Garg [Thu, 24 Aug 2023 12:44:20 +0000 (18:14 +0530)]
doc: board: sdm845: Explicitly add boot.img flashing command

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Use code-block. Fix length of two heading underlines.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agocmd: let gpt_partition_entry be hexadecimal
Heinrich Schuchardt [Sat, 26 Aug 2023 01:53:43 +0000 (03:53 +0200)]
cmd: let gpt_partition_entry be hexadecimal

In commands like 'ls mmc 0:f' the partition number is hexadecimal.

In command 'gpt setenv' variable gpt_partition_entry needs to be set
to a hexadecimal value to allow its use as a parameter in a
subsequent command.

Fixes: 57f8cf1b9aea ("cmd: fix gpt enumerate")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fix gpt enumerate
Heinrich Schuchardt [Sat, 26 Aug 2023 01:53:42 +0000 (03:53 +0200)]
cmd: fix gpt enumerate

Do not assume that partitions are numbered continuously starting at 1.

Only a single partition table type can exist on a block device. If we found
a GPT partition table, we must not re-enumerate with the MBR partition
driver which would find the protective partition.

Fixes: 12fc1f3bb223 ("cmd: gpt: add eMMC and GPT support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fix gpt setenv
Heinrich Schuchardt [Sat, 26 Aug 2023 01:53:41 +0000 (03:53 +0200)]
cmd: fix gpt setenv

Do not assume that partitions are continuously numbered starting at 1.

Having a partition table with a single partition 63 is valid.

Fixes: 12fc1f3bb223 ("cmd: gpt: add eMMC and GPT support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agolib: parameter check in hash_calculate
Heinrich Schuchardt [Tue, 22 Aug 2023 09:10:20 +0000 (11:10 +0200)]
lib: parameter check in hash_calculate

If hash_calculate is invoked with region_count = 0, it will try to hash
INT_MAX regions. We should check this parameter.

* Avoid a comparison with different signedness.
* Check that region_count is at least 1.
* Avoid a superfluous assignment.

Fixes: b37b46f042cc ("rsa: Use checksum algorithms from struct hash_algo")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoMerge branch '2023-08-26-bootstd-chromeos-impreovements-and-move-to-gcc-13.2' into...
Tom Rini [Sat, 26 Aug 2023 15:25:08 +0000 (11:25 -0400)]
Merge branch '2023-08-26-bootstd-chromeos-impreovements-and-move-to-gcc-13.2' into next

First, update CI to using gcc-13.2 from 13.1, and rebuild the CI
containers.  This is needed because the second part adds utilities for
tests and provides, to quote the author:

This updates the ChromiumOS bootmeth to detect multiple kernel
partitions on a disk.

It also includes minor code improvements to the partition drivers,
including accessors for the optional fields.

This series also includes some other related tweaks in testing.

16 months agoCI: Move to latest Ubuntu "Jammy" tag
Tom Rini [Fri, 25 Aug 2023 17:21:27 +0000 (13:21 -0400)]
CI: Move to latest Ubuntu "Jammy" tag

Move to the latest "Jammy" tag from Ubuntu.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoCI: Update to gcc-13.2.0
Tom Rini [Fri, 25 Aug 2023 17:21:26 +0000 (13:21 -0400)]
CI: Update to gcc-13.2.0

The latest kernel.org toolchains for gcc are now 13.2.0, so upgrade to
that.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoCI: Add ChromiumOS utilities
Simon Glass [Thu, 24 Aug 2023 19:55:46 +0000 (13:55 -0600)]
CI: Add ChromiumOS utilities

We need cgpt and futility for building test images. Add them.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobootstd: cros: Allow detection of any kernel partition
Simon Glass [Thu, 24 Aug 2023 19:55:45 +0000 (13:55 -0600)]
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>
16 months agouuid: Add ChromiumOS partition types
Simon Glass [Thu, 24 Aug 2023 19:55:44 +0000 (13:55 -0600)]
uuid: Add ChromiumOS partition types

Add some GUIDs for ChromiumOS so we can detect the partitions.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobootstd: Support bootmeths which can scan any partition
Simon Glass [Thu, 24 Aug 2023 19:55:43 +0000 (13:55 -0600)]
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>
16 months agopart: Add a fallback for part_get_bootable()
Simon Glass [Thu, 24 Aug 2023 19:55:42 +0000 (13:55 -0600)]
part: Add a fallback for part_get_bootable()

This function can be called when partition support is disabled. Add a
static inline to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobootstd: Add a test for bootmeth_cros
Simon Glass [Thu, 24 Aug 2023 19:55:41 +0000 (13:55 -0600)]
bootstd: Add a test for bootmeth_cros

The ChromiumOS bootmeth has no tests at present. Before adding more
features. add a basic test.

This creates a disk which can be scanned by the bootmeth, so make sure
things work. It is quite rudimentary, since the kernel is faked, the root
disk is missing and there is no cmdline stored.

Enable the bootmeth for snow so it can build the unit test.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobootstd: test: Allow binding and using any mmc device
Simon Glass [Thu, 24 Aug 2023 19:55:40 +0000 (13:55 -0600)]
bootstd: test: Allow binding and using any mmc device

We currently use mmc4 for tests. Update the function which sets this up
so that it can handle any device.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobootflow: Show an empty filename when there is none
Simon Glass [Thu, 24 Aug 2023 19:55:39 +0000 (13:55 -0600)]
bootflow: Show an empty filename when there is none

At present 'bootflow list' shows <NULL> for the filename when it is not
present. Show an empty string instead, since that is more user-friendly.

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