Commit Graph

98595 Commits

Author SHA1 Message Date
Simon Glass
f8e55a7a2d CI: Allow selecting particular tests for CI
Normally the job itself controls which tests are run, by providing an
optional test spec and using the -k option.

It is sometimes useful to run a subset of tests on CI. Add a new
TEST_SPEC variable to control this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-03 00:38:15 +12:00
Simon Glass
d62dfb382c CI: Allow more control over which jobs run
Provide some additional variables which can be used to deselect whole
stages, or select a particular test.py build.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-03 00:15:05 +12:00
Simon Glass
575bfca9f1 CI: Drop the unnecessary rule in SJG_LAB
The rules are enough to handle the results logic. Drop the redundant
checks at the start of the bash script.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-03 00:14:07 +12:00
Simon Glass
11136d25a0 CI: Rename world build and testsuites stages
We use 'testsuites' for the test suites and 'world build' for the world
build. This is inconsistent. Use 'test_suites' and 'word_build' instead,
to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-03 00:14:06 +12:00
Simon Glass
25cf278d2c Revert "tools: fit_image: Add the loadable property to configs"
This is not correct when building a kernel FIT, since it adds a second
loadable in addition to the kernel.

There may in fact be a bug in SPL FIT, in which case that should be
fixed, rather than adding an invalid loadable to the FIT.

This reverts commit cabde449b9.

Series-to: concept
Series-cc: heinrich
Cover-letter:
mkimage: Start to tidy up mkimage and friends
The current mkimage code is a bit messy:

- the main() function is very long
- two similarly named structs are used throughout: the first
  (struct image_tool_params) is not actually just parameters, the second
  (struct image_type_params) is confusingly similar
- quite a bit of FIT processing happens right at the start of main(),
  which can be hard to follow
- the program calls exit() from many different places

This series renames the main structures, avoiding using the common
'params' word. It breaks up part of main() into separate functions and
starts the process of exiting in one place.

It also reverts a patch which causes an invalid 'loadables' property to
be added with '-f auto'.

More remains to be done, but this is a start.
END
2025-08-01 16:01:23 +12:00
Simon Glass
b7881d1cbf mkimage: Move the list-or-process code into a function
For listing an image, or processing an existing FIT, an initial code
path is used, then the program exits.

Move this into its own function so it is clear that this is an
early-return path.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:43:31 +12:00
Simon Glass
359baec777 mkimage: Split out file-opening into its own function
Add a new open_image() function to handle the initial opening of the
output file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
f684570439 mkimage: Split out initial checking and processing
The run_mkimage() function is long and complicated. Make a start by
moving some initial checks out into their own check_params() function.
Also move the FIT-processing into a new process_fit() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
332f75cf57 mkimage: Update copy_file() et al to return a value always
Rather than exiting in copy_file() and copy_datafile(), return an exit
code. The caller is  then responsible for returning it, so update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
9623245e33 mkimage: Update verify_image() to return a value always
Rather than exiting in this function, return an exit code. The caller is
then responsible for returning it, so update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
998e3e5acc mkimage: Update process_args() to return a value always
Rather than exiting in this function, return an exit code. The caller
already handles this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
9de1e71056 mkimage: Drop the global for struct imgtool
Use a local variable for this state information.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
47344cc5de mkimage: Update run_mkimage() to take an imgtool parameter
Pass this pointer in rather than using the global.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
8d551597d9 mkimage: Update copy_file() etc. to take an imgtool parameter
Pass this pointer in rather than using the global. Update
copy_data_file() too since it calls copy_file()

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
ef4f07231d mkimage: Update verify_image() to take an imgtool parameter
Pass this pointer in rather than using the global.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
801da28362 mkimage: Update process_args() to take an imgtool parameter
Pass this pointer in rather than using the global.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
0ebd1b0e5c mkimage: Update add_content() to take an imgtool parameter
Pass this pointer in rather than using the global.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:50 +12:00
Simon Glass
348ebaf45e mkimage: Pass struct imgtool out from main()
Update usage(), process_args() and run_mkimage() to pass the image-tool
info around, so we can eventually drop the global.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:49 +12:00
Simon Glass
1a9f81779e mkimage: Use a consistent parameter for struct imgtool *
Use the same 'itl' (for image-tool) whenever this parameter is passed
around. This makes it easier to recognise. Move away from using the word
'parameters', since it contains essentially all of the info about the
tool, not just parameters. Use 'info' instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:20:42 +12:00
Simon Glass
8855e0de5c mkimage: Return struct image_tool_params to struct imgtool
The existing name is confusing since it includes state as well as
parameters. In fact it includes nearly everything known about the tool
while it is running. Rename the struct to imgtool to reflect this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:05:12 +12:00
Simon Glass
fe1300387b mkimage: Rename struct image_type_params to imgtool_funcs
The current name is quite confusing. Mostly this struct holds function
pointers, not parameters. Rename it to imgtool_funcs, so that is has the
same prefix as imgtool (introduced in the next patch) and it is clear
that it provides functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-01 13:05:11 +12:00
Simon Glass
7d7f6811ea mkimage: Update usage() to return a value
Rather than exiting in this function, return an exit code. The caller is
then responsible for returning it, so update all the callers to return
the value.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-31 13:05:10 +12:00
Simon Glass
fbf1140223 mkimage: Return the exist code from run_mkimage()
Rather than exiting in the middle of the function, return the exit code
to main() so it can return it, in turn.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-31 13:03:20 +12:00
Simon Glass
0dc00d67f5 mkimage: Move code from main() to a new function
Create a new run_mkimage() function which will hold the top-level logic
for mkimage.

For the few cases where there is a 'return', use that as the exit code
of the problem, preserving existing behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-31 13:03:20 +12:00
Simon Glass
8ba24652d9 mkimage: Move copy_file() higher in the file
It is confusing to have the main program in the moddle of the mkimage.c
file. Move copy_file() higher, so that main() is at the bottom.

Drop the now-unnecessary forward declaration.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-31 13:03:20 +12:00
Simon Glass
816236b75e Merge branch 'loadc' into 'master'
pxe: Support an automatic localboot

See merge request u-boot/u-boot!139
2025-07-30 03:44:44 +00:00
Simon Glass
7a37413818 pxe_utils: Support the SAY command
This shows a message for the user. Implement it to keep the user
informed.

Series-to: u-boot
pxe: Support an automatic localboot
It seems that extlinux expects that boards know how to boot a local OS
from attached media. U-Boot currently assumes that boards define a
"localcmd" environment variable to support this. None does.

Provide an automatic means to find a kernel and ramdisk, using common
filenames. This addresses booting on MAAS, at least.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-07-30 15:01:52 +12:00
Simon Glass
de881bfad7 pxe_utils: Support a backup for localboot
The current localboot implementation assumes that a 'localcmd'
environment variable is provided, with the instructions to follow. This
may not be included, so provide a fallback in that case.

Add a test image and test as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 15:00:59 +12:00
Simon Glass
6657f739a3 pxe_utils: Allow the FDT to be missing
The devicetree file may not be provided, so avoid a failure in that
case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-07-30 14:59:40 +12:00
Simon Glass
80b4557092 test: bootflow: Avoid a confusing error condition
The prep_mmc_bootdev() function replaces bootstd's bootdev_order with
its own static version, then returns it.

From then on std->bootdev_order cannot be freed, since it was not
allocated.

So long as the test passes, all is well. But if a test fails, the test
system will try to free std->bootdev_order and this will fail.

Adjust prep_mmc_bootdev() to allocate the boot_dev order, instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 14:59:33 +12:00
Simon Glass
110c2cdd45 text: Rename setup_bootflow_image()
The name of this is fairly vague. Use 'extlinux' so that it is clear
that it relates to that format.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 14:59:25 +12:00
Simon Glass
723729afdc Merge branch 'hein2' into 'master'
scripts: Always use the RNG device with QEMU

See merge request u-boot/u-boot!138
2025-07-30 02:32:19 +00:00
Simon Glass
3cf8c74bb7 scripts: Always use the RNG device with QEMU
There is no harm in always having this device enabled, thus reducing the
number of script arguments. Enable RNG always.

Series-to: concept
Series-version: 2
Series-changes: 2
- Use /dev/urandom instead, dropping the now-unnecessary arguments

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-07-30 13:42:18 +12:00
Simon Glass
e40682dca3 Merge branch 'loadb' into 'master'
test: Create a better helper for filesystems

See merge request u-boot/u-boot!137
2025-07-30 01:41:45 +00:00
Simon Glass
7188be8a76 test: Convert test_ut_dm_init() to use FsHelper
Use the helper here, for consistency.

Series-to: concept, heinrich
Cover-letter:
test: Create a better helper for filesystems
This series includes a few new helpers which make it easier to create
filesystems and disk images for testing.

The current approach requires the caller to create a temporary
directory, put files in there, then call the helper. It has poor support
for building disks containing multiple partitions.

This new helper works by creating a temporary directory which the caller
can use, then creating the filesystem and cleaning up.

Most of U-Boot is moved over to use these new helpers, but two EFI tests
are left alone, since they don't currently pass:

   - test_efi_eficonfig() has a 'return' in it, so doesn't run
   - TestEfiCapsuleFirmwareFit is skipped due to a failure at the start

These can be moved over later when they are working.

This series also includes a few quirks to the VBE tests.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 12:18:27 +12:00
Simon Glass
00cdb3abc5 test: Convert setup_efi_image() to use FsHelper
Simplify this test-setup code by using the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 12:18:18 +12:00
Simon Glass
2cc670ad29 test: Convert setup_bootflow_image() to use FsHelper
Simplify this test-setup code by using the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 12:18:18 +12:00
Simon Glass
525c6301eb test: Convert setup_bootmenu_image() to use FsHelper
Simplify this test-setup code by using the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 12:18:18 +12:00
Simon Glass
3b3671157a test: Convert test_efi_bootmgr to use FsHelper
Simplify this test by using the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 12:18:18 +12:00
Simon Glass
88733e540e test: Add a helper class to create disk images
Provide a way to create disk images which consist of multiple filesystem
images.

Provide an option to use the current directory for images, instead of
persistent-data directory. This makes it easy for C tests to locate the
image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 12:18:17 +12:00
Simon Glass
3586e6f158 test: Convert test_xxd to use FsHelper
Simplify this test by using the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-29 07:06:45 +12:00
Simon Glass
e9f9e8123e test: Convert test_cat to use FsHelper
Simplify this test by using the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-29 07:06:45 +12:00
Simon Glass
6ffb1ab8e7 test: Convert fs_helper to use a class
It is somewhat inconvenient that callers to mk_fs() must create their
own temporary directory. Convert it to a class so this can be handled
automatically, using a context manager.

Rather than specifying the file size in bytes, use MB since it is rare
to need a smaller file.

Update mk_fs() to use this new class.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-29 07:06:45 +12:00
Simon Glass
e90e4e8c72 test: fs_helper: Drop the size_gran argument
Nothing uses this argument, so make it a constant for now.

Also fix a pylint warning when checking for vfat/exfat.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-29 07:06:45 +12:00
Simon Glass
fa9639f4d2 test: Update comment for fs_helper.setup_image()
This function actually allows creating two partitions now, so update its
comment to match that.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-29 07:06:45 +12:00
Simon Glass
86f4833465 vbe: Enable testing OS requests on vanilla sandbox
Rather than using the flattree build, run the OS-request tests on the
main sandbox build.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-29 07:06:45 +12:00
Simon Glass
dee24f9071 vbe: Remove 'simple' from vbe_abrec
It is confusing to use the word 'simple' within the ABrec driver. Rename
a few identifiers to fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-29 07:06:45 +12:00
Simon Glass
95dbfe82e0 Merge branch 'loada' into 'master'
doc: Flesh out the documentation for bootm

See merge request u-boot/u-boot!136
2025-07-28 19:00:23 +00:00
Simon Glass
8a971f9265 test: Add a test for loading a second FIT
Check that we can read a FIT containing a devicetree, then boot with a
second FIT.

This requires a few more FIT parameters and commands to be configurable.

Series-to: concept
Series-cc: heinrich
Cover-letter:
Support FITs with load-only configs
FIT is growing a new feature where a load-only configuration can be used
to obtain and set up a devicetree prior to loading the OS.

This series implements this feature in U-Boot.

Some refactoring is necessary to permit this, on top of a previous
series. Also the FIT tests have the annoying property that they all run
at once, so this series also adjusts these.

Further work will integrate this properly into a bootmeth, etc.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-28 13:06:51 +12:00
Simon Glass
aec5fbeee8 boot: Support bootm restart
Normally bootm proceeds sequentially through the various states, from
'start' to 'go'.

In some cases we want to load the devicetree from one FIT and the kernel
and ramdisk from another. This requires two bootm commands.

Of course it is possible to just do a second 'bootm start' to load the
kernel. But that removes all record of the devicetree from the
boot_images information, so it is then not provided to the OS.

Add a 'restart' subcommand which allows more images to be loaded,
without erasing those already loaded.
2025-07-28 13:06:51 +12:00