Compare commits

...

35 Commits
loadd ... loadf

Author SHA1 Message Date
Simon Glass
d587b852ff test: Allow use of FsHelper without a config
This class is used by the build-efi/qemu scripts, so allow it to work
outside the context of a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 13:51:53 -06:00
Simon Glass
05840f9593 Merge branch 'revert-24fc4467' into 'master'
Revert "Merge branch 'loadg' into 'master'"

See merge request u-boot/u-boot!142
2025-08-02 19:50:43 +00:00
Simon Glass
684fc8c4d7 Revert "Merge branch 'loadg' into 'master'"
This reverts merge request !141
2025-08-02 19:50:30 +00:00
Simon Glass
24fc4467ea Merge branch 'loadg' into 'master'
test: Allow use of FsHelper without a config

See merge request u-boot/u-boot!141
2025-08-02 19:48:34 +00:00
Simon Glass
c583c5376a boot: Add documentation for the VBE-OS bootmeth
Add some information about this new bootmeth, including how to enable it
and how it works.

Cover-letter:
boot: Enhance VBE to support a separate devicetree FIT
It is sometimes desirable to have the devicetrees packaged with firware,
or in a different FIT from the OS. This series adds support for this,
including a test.

The new bootmeth can automatically locate a state file and use that to
decide what images to use when booting. The OS must update the file
before rebooting, if a different selection is required.

For now there is no logic to deal with boot failures.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:31:55 -06:00
Simon Glass
3c2f152a9b boot: test: Add a test for the VBE OS flow
Create two new images (vbe0 and vbe1) containing the two types of VBE-OS
setups: with and without an OEM FIT. Put this in a new img/ subdirectory
since the test_ut.py file is getting quite large.

Most of the test is in C, with just the image-setup done in Python.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:31:52 -06:00
Simon Glass
74a49fcd3d boot: Add support for VBE for the OS
When booting an OS it is useful to be able to read devicetrees provided
by the OEM, from a separate FIT to the OS.

Add a new method which supports this, along with the usual A/B/recovery
flows, using a state file on the boot device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:35 -06:00
Simon Glass
5efe688884 boot: Add comments for struct pxe_label
Some members are not commented. Add the missing comments and tidy up the
style a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:35 -06:00
Simon Glass
87c3760161 boot: Support restarting a bootm sequence from PXE
If a load-only FIT has already provided a devicetree, PXE boot may need
to restart the bootm sequence, rather than starting an entirely new one,
so that the devicetree is preserved and used for booting.

Add support for this by adding a new field in the context and updating
extlinux_boot() to receive the value as a new parameter.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:35 -06:00
Simon Glass
43b35c9a2c boot: Use provided filename with bootmeth_alloc_other()
Rather than using bflow->fname, which assumes that it is the same as the
passed-in filename, use the passed in filename. This can be different in
some cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:35 -06:00
Simon Glass
50e2c42569 boot: pxe: Add a token for FIT
It is not obvious that PXE supports FIT, but it does, by detecting
whether an image is a FIT or not.

In many cases a FIT is more convenient than using separate files for
the kernel, initrd and devicetree.

Really we should promote FIT as an important format, rather than
silentily dealing with it if detected.

Add a new 'fit' token which indicates that a FIT is being used.

When the 'fit' token is used, the expectation is that the devicetree
is within the FIT, but this is not required, for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:35 -06:00
Simon Glass
f9c9f2b8ee boot: Remove blank lines in pxe_parse
This file has quite a few more blank lines than is usual in the U-Boot
code base. Remove them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:35 -06:00
Simon Glass
4c423e6711 boot: Move PXE-parsing logic out to a separate file
The pxe_utils.c file is quite large and has a mix of parsing and booting
code. Split out the parsing into a new 'pxe_parse.c' file.

Add function prototypes for parse_pxefile_top() and label_destroy(), the
two functions used by pxe_utils.c

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:34 -06:00
Simon Glass
70fa14e7fa test: Drop double removal of the FS image on failure
We already have a cleanup function which removes the filesystem, so drop
the unnecessary try...except for this. It results in an error on the
error path, as we try to remove the filesystem twice.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:34 -06:00
Simon Glass
37632e0ff4 test: Allow inspection of input filesystems
At present a temporary directory is used to hold the files before
placing them in the filesystem. Use a suitably named directory inside
the persistent-data directory, so that it is easy to take a look at what
was produced.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:34 -06:00
Simon Glass
73aeba7470 mkimage: Set the timestamp with -f auto
When creating a FIT, ensure that a timestamp is added, even if there is
no OS image present.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:34 -06:00
Simon Glass
12ad621926 mkimage: Support a load-only FIT
Support creation of a load-only FIT (where there is no OS), with a new
--load-only option. Allow FITs to be created without an OS image.

Update the auto-generated FIT description to make this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:34 -06:00
Simon Glass
0c6a7180dd mkimage: Add compatible strings to configuration node
When using '-f auto', mkimage automatically creates a FIT given the
images. For devicetree files, FIT expects that the compatible string
from each is copied to its corresponding configuration node.

Implement this in mkimage, so far only for uncompressed devicetrees.

This requires a few more fields in struct content_info, so take this
opportunity to comment it properly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:34 -06:00
Simon Glass
1049284b49 mkimage: Remove an unused argument from fdt_property_file()
This function does not actually use the 'name' argument. Drop it and use
FIT_DATA_PROP instead, to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:34 -06:00
Simon Glass
eec742ca39 sandbox: Enable FIT best-match
Enable this feature so that it can be tested on sandbox.

Update the vboot FDT to avoid having it match on conf-1 instead of
conf-1

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:29:33 -06:00
Simon Glass
20851c1330 boot: Show compatible strings with FIT information
The compatible strings used by each configuration comprise useful
information about how the system will boot. Show these after the current
configuration-node information.

Swap the order of the desc argument in its caller, fit_image_print()
since it is easier to read.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:22:11 -06:00
Simon Glass
e05844907d boot: Add a constant for the FIT-configuration compatible
This property is part of the configuration node, so add a constant for
it, instead of open-coding the value. This allows easy searching for
places in U-Boot where the configuration node's compatible string is
used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:22:11 -06:00
Simon Glass
f5f480a507 boot: Show messages when using FIT best-match
This matching happens silently at present, which can lead one to wonder
if U-Boot has been built without the feature. Add a few basic messages.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:22:11 -06:00
Simon Glass
3fa1f83c09 boot: Use a common index in fit_conf_print
Rather than using two variables for the stringlist index, use one.
Simplify the i == 0 expression.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:22:11 -06:00
Simon Glass
ebcbcdef0a boot: Tidy up fit_get_desc()
This should return a constant pointer, since modifying the description
within a devicetree node is not allowed. Also there is no need to set
the return value unless there is actually a description.

Update the function and move the docs to the header file while we are
here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:22:11 -06:00
Simon Glass
15b071fa5d sandbox: Increase the number of bootstage records
When running boot tests involving FIT, 30 is not enough. Increase the
limit to 50.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:22:11 -06:00
Simon Glass
a6599d4145 test: Rename test_vboot() to test_vboot_base()
At present it isn't easy to run just the base vboot tests. Rename it to
make this easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:22:11 -06:00
Simon Glass
fdcc591414 Correct implementation of Spawn() in ConsoleBase
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:21:34 -06:00
Simon Glass
a18a6252fb test: Allow use of FsHelper without a config
This class is used by the build-efi/qemu scripts, so allow it to work
outside the context of a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 08:20:21 -06:00
Simon Glass
abf6c576b8 Merge branch 'loade' into 'master'
CI: Enhance control of which jobs run

See merge request u-boot/u-boot!140
2025-08-02 12:42:35 +00:00
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
4 changed files with 71 additions and 29 deletions

View File

@@ -6,6 +6,10 @@ include:
variables:
DEFAULT_TAG: ""
MIRROR_DOCKER: docker.io
TEST_SUITES: "1"
TEST_PY: "1"
TEST_SPEC: ""
WORLD_BUILD: "1"
LAB_ONLY: ""
SJG_LAB: ""
PLATFORM: linux/amd64,linux/arm64
@@ -23,10 +27,10 @@ default:
# We run some tests in different order, to catch some failures quicker.
stages:
- testsuites
- test_suites
- test.py
- sjg-lab
- world build
- world_build
- version_bump
- release
@@ -34,10 +38,15 @@ stages:
stage: test.py
retry: 2 # QEMU may be too slow, etc.
rules:
- if: $LAB_ONLY != "1"
when: always
- if: $LAB_ONLY == "1"
when: never
- if: $TEST_PY == "1"
when: always
- if: $TEST_PY == $CI_JOB_NAME
when: always
- if: $TEST_PY == $TEST_PY_BD
when: always
- when: never
before_script:
- git config --global --add safe.directory "${CI_PROJECT_DIR}"
# qemu_arm64_lwip_defconfig is the same as qemu_arm64 but with NET_LWIP enabled.
@@ -106,11 +115,17 @@ stages:
export bl1=/tmp/bl1.bin;
export PATH=/opt/Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3:${PATH};
fi
- if [[ -n "${TEST_SPEC}" ]]; then
SPEC="${TEST_SPEC}";
echo 'Using provided test spec ${TEST_SPEC}"';
else
SPEC="${TEST_PY_TEST_SPEC}";
fi
# "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
- export PATH=/opt/qemu/bin:test/hooks/bin:${PATH};
export PYTHONPATH=test/hooks/py/travis-ci;
./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_EXTRA}
${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
${SPEC:+"-k ${SPEC}"}
--build-dir "$UBOOT_TRAVIS_BUILD_DIR"
--junitxml=/tmp/${TEST_PY_BD}/results.xml
artifacts:
@@ -124,12 +139,13 @@ stages:
expire_in: 1 week
.world_build:
stage: world build
stage: world_build
rules:
- if: $LAB_ONLY != "1"
when: always
- if: $LAB_ONLY == "1"
when: never
- if: $WORLD_BUILD == "1"
when: always
- when: never
build all 32bit ARM platforms:
extends: .world_build
@@ -206,16 +222,17 @@ build all other platforms:
exit $ret;
fi;
.testsuites:
stage: testsuites
.test_suites:
stage: test_suites
rules:
- if: $LAB_ONLY != "1"
when: always
- if: $LAB_ONLY == "1"
when: never
- if: $TEST_SUITES == "1"
when: always
- when: never
check for new CONFIG symbols outside Kconfig:
extends: .testsuites
extends: .test_suites
script:
- git config --global --add safe.directory "${CI_PROJECT_DIR}"
# If grep succeeds and finds a match the test fails as we should
@@ -228,7 +245,7 @@ check for new CONFIG symbols outside Kconfig:
# build documentation
docs:
extends: .testsuites
extends: .test_suites
script:
- python3 -m venv /tmp/venvhtml
- . /tmp/venvhtml/bin/activate
@@ -238,13 +255,13 @@ docs:
# ensure all configs have MAINTAINERS entries
Check for configs without MAINTAINERS entry:
extends: .testsuites
extends: .test_suites
script:
- ./tools/buildman/buildman --maintainer-check
# Ensure host tools build
Build tools-only and envtools:
extends: .testsuites
extends: .test_suites
tags:
- single
script:
@@ -252,8 +269,8 @@ Build tools-only and envtools:
make mrproper;
make tools-only_config envtools -j$(nproc)
Run binman, buildman, dtoc, Kconfig and patman testsuites:
extends: .testsuites
Run binman, buildman, dtoc, Kconfig and patman test suites:
extends: .test_suites
script:
- git config --global user.name "GitLab CI Runner";
git config --global user.email trini@konsulko.com;
@@ -282,7 +299,7 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites:
# Check for any pylint regressions
Run pylint:
extends: .testsuites
extends: .test_suites
tags:
- single
script:
@@ -306,7 +323,7 @@ Run pylint:
# Check for pre-schema driver model tags
Check for pre-schema tags:
extends: .testsuites
extends: .test_suites
script:
- git config --global --add safe.directory "${CI_PROJECT_DIR}";
# If grep succeeds and finds a match the test fails as we should
@@ -315,7 +332,7 @@ Check for pre-schema tags:
# Check we can package the Python tools
Check packing of Python tools:
extends: .testsuites
extends: .test_suites
script:
- make pip
@@ -632,11 +649,6 @@ coreboot test.py:
# Environment:
# SRC - source tree
# OUT - output directory for builds
- if [[ -n ${SJG_LAB} ]]; then
if [[ "${SJG_LAB}" != "${ROLE}" && "${SJG_LAB}" != "1" ]]; then
exit 0;
fi;
fi
- export SRC="$(pwd)"
- export OUT="${SRC}/build/${ROLE}"
- export OUT_EXTRA="${SRC}/build/${ROLE}_extra"

View File

@@ -95,6 +95,34 @@ testing cycle to edit these pipelines in separate local commits to pair them
down to just the jobs you're interested in. These changes must be removed
prior to submission.
Available variables are:
TEST_SUITES
Set to 0 to disable the test_suites stage::
git push ci -o ci.variable=TEST_SUITES=0
TEST_PY
Set to 0 to disable the test.py stage, or set to the job name to run just
that job, or set to the board name to run all tests for that board:
For example::
git push ci -o ci.variable=TEST_PY=0
git push ci -o ci.variable=TEST_PY=sandbox
git push ci -o ci.variable=TEST_PY='sandbox with clang test.py'
WORLD_BUILD
Set to 0 to disable the world_build stage::
git push ci -o ci.variable=WORLD_BUILD=0
TEST_SPEC
Set to the test spec to use when running a test.py tests. This overrides
the spec provided by the job. For example::
git push ci -o ci.variable=TEST_SPEC=bootstd
Using the lab
-------------
@@ -113,7 +141,9 @@ To request that the lab runs::
git push ci -o ci.variable=SJG_LAB=1 <branch>
To request that *only* the lab runs::
To request that *only* the lab runs, you can set TEST_PY=0 and TEST_SUITES=0
and WORD_BUILD=0 as above. But as a shortcut you can use the LAB_ONLY
variables::
git push ci -o ci.variable=SJG_LAB=1 ci.variable=LAB_ONLY=1 <branch>

View File

@@ -63,7 +63,8 @@ class FsHelper:
# Use a default filename; the caller can adjust it
leaf = f'{prefix}.{fs_type}.img'
self.fs_img = os.path.join(config.persistent_data_dir, leaf)
self.fs_img = os.path.join(
config.persistent_data_dir if config else '', leaf)
# Some distributions do not add /sbin to the default PATH, where mkfs
# lives

View File

@@ -381,7 +381,6 @@ static void fit_write_configs(struct imgtool *itl, char *fdt)
typename = genimg_get_type_short_name(itl->fit_image_type);
snprintf(str, sizeof(str), "%s-1", typename);
fdt_property_string(fdt, typename, str);
fdt_property_string(fdt, FIT_LOADABLE_PROP, str);
if (itl->fit_ramdisk)
fdt_property_string(fdt, FIT_RAMDISK_PROP,