Commit Graph

98903 Commits

Author SHA1 Message Date
Simon Glass
083a355fa2 Merge branch 'loado2' into 'master'
smbios: Refactor the smbios command and parser

See merge request u-boot/u-boot!155
2025-08-19 21:28:37 +00:00
Simon Glass
12f3fc10fd smbios: Add support for showing table types 16 and 19
In some cases it is useful to find out the location of physical memory,
e.g. so that the memory@ nodes can be correctly set up in the
devicetree. Add support for parsing this information from the SMBIOS
tables.

Series-to: concept
Series-cc: heinrich
Series-version: 2
Cover-letter:
smbios: Refactor the smbios command and parser
The 'smbios' command has its own code for parsing SMBIOS tables. There
in also lib/smbios-parser.c which parses tables, although only
version 2.

This series moved parsing to lib/ and rationalises the code a little. It
also adds support for a few more tables.

Finally, a hook is added so operation from coreboot can be tested on
ellesmere.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 14:00:19 -06:00
Simon Glass
a68c0625aa smbios: coreboot: Update smbios_get_header() to use smbios_info
Use the smbios_info struct in this function, so it can deal with any
version of SMBIOS table.

Also update smbios_update_version_full() to work the same way.

Drop find_next_header() which is now unused.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 14:00:19 -06:00
Simon Glass
8de843271f smbios: Pass smbios_info to smbios_next_table()
At present smbios_next_table() does not support SMBIOS v2 tables. Pass
in the info struct so that it can check for the end of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 14:00:19 -06:00
Simon Glass
40453163c8 smbios: Create a function to locate the tables
The code in the smbios command is a nice implementation of finding the
tables. It supports both SMBIOS2 and SMBIOS3, which smbios-parser.c does
not.

Move this code over to the library, creating a struct to hold the
result.

Series-changes: 2
- Fix the return values on error

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 14:00:17 -06:00
Simon Glass
0ee25282d8 smbios: Move some parsing code to smbios-parser.c
The 'smbios' command has some parsing code, as does the SMBIOS parser
in the lib/ directory. Start to unify these by moving over a few
functions.

Require CONFIG_SMBIOS_PARSER to be enabled when using the command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 13:56:05 -06:00
Simon Glass
843c10a93e smbios: Rename smbios_header()
This function has the same name as the struct, which is confusing.
Rename it to smbios_get_header() and update the function comment a
little.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 13:56:05 -06:00
Simon Glass
aaf1ab294c smbios: x86: Enable command by default
If SMBIOS is enabled on x86, enable the 'smbios' command by default,
so that the tables can be examined.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 13:56:05 -06:00
Simon Glass
6f8274ed68 coreboot: Increase the cyclic limit
This fails in CI sometimes, so increase the limit to 50ms:

 cyclic_run() cyclic function video_init took too long: 20725us vs 5000us max

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 13:56:05 -06:00
Simon Glass
878b4a0842 hooks: Add ellesmere riscv64_spl board
Add a symlink for this board to the travis-ci board.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 13:56:05 -06:00
Simon Glass
b7fe69a08f hooks: ellesmere: Add a coreboot board
Add a coreboot board which can run under QEMU on ellesmere.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-18 13:56:05 -06:00
Simon Glass
711a77d573 Merge branch 'makeb' into 'master'
test: Split up the image-creation code

See merge request u-boot/u-boot!154
2025-08-17 22:22:35 +00:00
Simon Glass
b351843588 test: Move localboot image-creation to its own file
Move setup_localboot_image() to a new module

Series-to: concept
Cover-letter:
test: Split up the image-creation code
This series moves the image-creation code into separate files so it is
easier to find and maintain.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
91d376de6e test: Move the configuration-editor setup to its own file
Move setup_cedit_file() to its own module.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
8270d6d201 test: Move EFI image-creation to its own file
Move setup_efi_image() to its own module.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
b20c043f8b test: Move Android image-creation to its own file
Move setup_android_image() function to its own module.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
c1d531e19c test: Move ChromeOS image-creation to its own file
Move setup_cros_image() to its own module. This function creates disk
images with a ChromiumOS partition layout.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
6543dc4540 test: Move Armbian image-creation to its own file
Move setup_bootmenu_image() to its own module. This function creates an
image styled on Armbian 22.08 Jammy with a boot menu.

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
0d29222435 test: Move Ubuntu image-creation to its own file
Move setup_ubuntu_image() to its own module.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
b3596d6474 test: Move Fedora image-creation to its own file
Move setup_fedora_image() to its own module.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
ceb47ebdd4 test: Create a common file for image utilities
Move mkdir_cond(), copy_partition(), and setup_extlinux_image() to a
common module which can be used by the rest of the image-creation code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:32:25 -06:00
Simon Glass
dfa072fd07 test: Move image creation to test/py/img
Rather than having this code mixed with the tests, it seems better to
put it up one level. Move the directory and tidy up references.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 15:32:25 -06:00
Simon Glass
244f7436ce Merge branch 'maked' into 'master'
sandbox: Fix memory corruption around 1MB

See merge request u-boot/u-boot!153
2025-08-17 21:14:40 +00:00
Simon Glass
0d523d8d55 sandbox: Abort if a partition memory map is detected
This can indicate that something is horribly wrong. It seems better to
abort, rather than just print a message which might not be noticed.

If the mapping does not map exactly, abort.

Series-to: concept
Cover-letter:
sandbox: Fix memory corruption around 1MB
After many hours of debugging, it turns out that the PCI EA driver is
mapping itself into RAM at 1MB. This happens to be where the kernel
ends up, with the vbe_abrec_os bootmeth. Since measurement is enabled,
bootm_measure() calls map_sysmem() on the kernel in order to measure it.

easurement takes place, although of course using the wrong data. Then,
through a strange sequence of events, which I have found very hard to
narrow down, the malloc() heap is corrupted.

This series provides a fix.

To repeat this problem:

  NO_LTO=1 ./test/py/test.py --bd sandbox --build -k
     "(ut or vbe) and not efi and not slow and not dm"

which dies when running vbe_test_abrec_oem_norun:

   ...
   => echo $?
   0
   => host bind 0 [...]/build-sandbox/persistent-data/vbe1.img
   => ut -f bootstd vbe_test_abrec_oem_norun
   Test: bootstd_setup_for_tests: bootstd_common.c
   common/dlmalloc.c:793: do_check_free_chunk:
      Assertion `next->prev_size == sz' failed.
   resetting ...

With this series, the above now passes.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 14:37:25 -06:00
Simon Glass
5ef5e6a8cc test: pci: Use the exact mapping size for PCI EA tests
Update the sizes to the expected size of the device's mapping in each
case, to avoid a warning in map_physmem() about a partial map.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 14:37:22 -06:00
Simon Glass
fbb05dc0d1 sandbox: Use the exact mapping size for PCI in pmc
Update the size to the expected size of the device's mapping, to avoid
a warning in map_physmem() about a partial map.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 14:37:22 -06:00
Simon Glass
9932bb407a sandbox: Move PCI EA space out of RAM
The address chosen for testing this feature is 1MB which is part of the
sandbox RAM. When devices access this, e.g. with map_sysmem(), the
memory is mapped to a PCI device. Any changes then apply to that device
and are not written to memory. Reads also come from the device.

It is not safe to use RAM space in this way.

A symptom that something is wrong is the log message:

   map_physmem: Warning: partial map at 100000, wanted 4, got 2000

Move the memory out of the way and document it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 21ebbafde8 ("test: dm: Add a test for PCI Enhanced Allocation")
2025-08-17 14:37:22 -06:00
Simon Glass
dcfec7fd37 sandbox: Swap the wanted and got messages in map_physmem()
The ordering is reversed. Fix it, to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 14:37:22 -06:00
Simon Glass
f85258951d Merge branch 'makea' into 'master'
test: Move towards using a fixture for test images

See merge request u-boot/u-boot!152
2025-08-17 12:49:58 +00:00
Simon Glass
a2b4596ccf test/py: Update test_ut_dm_init_bootstd() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Series-to: concept
Cover-letter:
test: Move towards using a fixture for test images
There are quite a few test images created by the test system. Most are
needed for bootstd tests.

At present these are created by a test, called test_ut_dm_init_bootstd()
which runs before the test_ut() tests.

This means that it is possible to create the images once, then iterate
on a test without the images being recreated each time.

While this is not a terrible approach, it does have some drawbacks:

- If an image is missing or corrupted for some reason, the test fails
- The relationship between the images and the tests is not obvious
- Images are often created even if the tests to be run do not need them

Overall, it seems worthwhile to explore moving to using a fixture for
the images.

Another problem is that 'make qcheck' and 'make pcheck' are not tested
in CI, so can break over time. The latter is a good way of seeing
whether each test is independent, e.g. not reliant on files created by
another test.

Overall this area of U-Boot could use some attention. This series makes
a very small start on this:

- Update test_fdt_add_pubkey() to work without test_vboot_base()
- Fix 'make qcheck' so that it passes
- Minor fixes to a few tests
- Pass separate fixtures to the image-setup functions instead of the
  overall ubman fixture
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:10:27 -06:00
Simon Glass
b667fd9e0c test/py: Update setup_vbe_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:10:26 -06:00
Simon Glass
eafa440c59 test/py: Update setup_localboot_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
71cd1eddea test/py: Update setup_cedit_file() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
9bec0b3fad test/py: Update setup_efi_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
6665d9fa38 test/py: Update setup_android_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
e6dde985e6 test/py: Update setup_cros_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
da2c60ff34 test/py: Update setup_ubuntu_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
f4b979eae4 test/py: Update setup_fedora_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
13c72bfea0 test/py: Update setup_extlinux_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
f03a3b2c37 test/py: Update setup_bootmenu_image() to avoid ubman
Pass in the two fixtures this function actually requires, rather than
ubman, which is a function-scoped fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
6f664d8445 test/py: Provide a run_and_log() function that uses log
The normal function requires a ubman but only uses it to find the log
fixture. This is a pain since the ubman is a function-level fixture.

Provide a version that takes a log directory, so that it can be called
from a session fixture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
06aed09ed0 test: Update test_fdt_add_pubkey() to create its own files
This test should create its own files rather than relying on those
created by test_vboot_base(). Copy the code in the test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
bddede757b test: Move create_rsa_pair() out of test_vboot_base()
At present test_fdt_add_pubkey() relies on the vboot test having already
run, since its makes use of the files that test produces.

This means that the tests cannot run in parallel (make pcheck).

As a first step to resolving this, move the required common code out to
a standalone function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
7e4bad3225 test: Correct implementation of Spawn() in ConsoleSandbox
Now that this base-class function is called, it can produce an error on
test failure, since it passes an empty list for the arguments.

Rename the reset() function to prepare_for_spawn() and use that instead.

See also: ca30385c61 ("Correct implementation of Spawn() in ConsoleBase")

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
69f4226ca5 test: Mark the sleep tests as slow
These tests do take quite a bit of time, so mark them as such.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
834d847610 test: vbe: Avoid using fdt_util to compile a devicetree
The VBE test uses fdt_util to compile a devicetree.

Other tests log the output of the dtc tool, which can be helpful when
a test fails.

For reasons which are unclear, using fdt_util means that the path to dtc
ends up being './scripts/dtc/dtc' when run from 'make qcheck'. This
causes a failure to set up the image required for the VBE test.

Update the test to use the normal run_and_log() method instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-17 06:02:16 -06:00
Simon Glass
a32b0df1f7 test: vbe: Free the bootflow after use
The bootflow contains fields which are connected to the struct. It
should be freed when it is finished with.

It isn't exactly clear why this fixes the problem, which shows up as:

   => ut -f bootstd vbe_test_abrec_oem_norun
   Test: bootstd_setup_for_tests: bootstd_common.c
   common/dlmalloc.c:793: do_check_free_chunk:
     Assertion `next->prev_size == sz' failed.

Fix it by adding a bootflow_free() at the end, which is good practice in
any case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 07f5b96985 ("boot: test: Add a test for the VBE OS flow")
2025-08-17 06:01:25 -06:00
Simon Glass
fdffab6ea9 test: Disable LTO with make qcheck
When LTO is used it seems to miss some line-number information, so the
event_dump.py tool does not fully work, thus causing test_event_dump to
fail.

Disable LTO to prevent this problem. It speeds up the build in any case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-16 16:14:11 -06:00
Simon Glass
a633c1d1d2 Merge branch 'loadn' into 'master'
efi: Support booting an OS with the EFI app on ARM

See merge request u-boot/u-boot!151
2025-08-14 19:09:00 +00:00
Simon Glass
67526ce699 CI: Provide a QEMU instance for efi-arm_app64
Add a new board which can run the EFI app and boot an OS.

Series-to: concept
Series-cc: heinrich
Series-version: 2
Cover-letter:
efi: Support booting an OS with the EFI app on ARM
The ARM EFI app does not successfully boot an OS at present. This series
includes patches to allow it to boot an OS via extlinux:

The main changes are:

- Call exit-boot-services before jumping to the OS
- Write the physical-memory info to the FDT
- Tidy up some Kconfig options
- Improve keyboard compatibility

Note that QEMU 8.2 does not boot Ubuntu 24.04 with this series[1]. The
kernel dies quite early with:

ERROR:target/arm/internals.h:767:regime_is_user: code should not be reached
Bail out! ERROR:target/arm/internals.h:767:regime_is_user: code should not be reached

QEMU 9.2 resolves this problem.

[1] https://lists.opensuse.org/archives/list/bugs@lists.opensuse.org/
    message/XVO4M4LDEFOORP5M4ZFINZDX36DWO3G5/
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-14 07:45:26 -06:00