aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2024-07-11test/py/tests/test_fpga.py: Correct check for legacy image format supportTom Rini
The build option to support images of type 'IMAGE_FORMAT_LEGACY' is CONFIG_LEGACY_IMAGE_FORMAT so update the pytest to check for the correct option. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-07-04test/py/tests: Update some network dependenciesTom Rini
On tests which require "tftpboot" we need to depend not on cmd_net but rather cmd_tftpboot. And on tests which require cmd_pxe we do not need to also depend on cmd_net as this should be handled already via Kconfig logic. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-07-04test: Check help outputSimon Glass
The current test doesn't check anything about the output. If a bug results in junk before the output, this is not currently detected. Add a check for the first line being the one expected. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-04test: Decode exceptions only with sandboxSimon Glass
When a real board fails we don't want to decode the exception. Reserve that behaviour for sandbox. Also avoid raising a new exception on failure - just re-raise the existing one. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-04test: dm: Show failing driver nameSimon Glass
When a driver is not registered properly it is not clear which one it is. Adjust test_dm_compat() to show this. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-04log: Allow tests to pass with CONFIG_LOGF_FUNC_PAD setSimon Glass
This setting pads out the function names. Adjust the test to handle this, since some boards use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-04test: Make bootstd init run only on sandboxSimon Glass
Tests for standard boot need disks to be set up, which can only be done on sandbox, since adjusting disks on real hardware is not currently supported. Mark the init function as sandbox-only. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-04initcall: Correct use of relocation offsetSimon Glass
The relocation offset can change in some initcall sequences. Handle this and make sure it is used for all debugging statements in init_run_list() Update the trace test to match. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-07-04trace: Update test to tolerate different trace-cmd versionSimon Glass
Some versions of trace-cmd (or some machines?) show one less dot in the CPU list. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03global_data.h: drop write-only field dm_root_fRasmus Villemoes
The dm_root_f field seems to be entirely write-only and hence redundant, unless 'git grep' fails to find some access generated via preprocessor token concatenation or similar. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03acpi: set creator_revision in acpi_fill_headerHeinrich Schuchardt
We should have a single place where we write the default value to the creator revision field. If we ever will have any table created by another tool, we can overwrite the value afterwards. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-06-28Merge patch series "automatically add /chosen/kaslr-seed and deduplicate code"Tom Rini
Tim Harvey <tharvey@gateworks.com> says: This series will automatically add /chosen/kaslr-seed to the dt if DM_RNG is enabled during the boot process. If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to randomize the virtual address at which the kernel image is loaded, it expects entropy to be provided by the bootloader by populating /chosen/kaslr-seed with a 64-bit value from source of entropy at boot. If we have DM_RNG enabled populate this value automatically when fdt_chosen is called. We skip this if ARMV8_SEC_FIRMWARE_SUPPORT is enabled as its implementation uses a different source of entropy that is not yet implemented as DM_RNG. We also skip this if MEASURED_BOOT is enabled as in that case any modifications to the dt will cause measured boot to fail (although there are many other places the dt is altered). As this fdt node is added elsewhere create a library function and use it to deduplicate code. We will provide a parameter to overwrite the node if present. For our automatic injection, we will use the first rng device and not overwrite if already present with a non-zero value (which may have been populated by an earlier boot stage). This way if a board specific ft_board_setup() function wants to customize this behavior it can call fdt_kaslrseed with a rng device index of its choosing and set overwrite true. Note that the kalsrseed command (CMD_KASLRSEED) is likely pointless now but left in place in case boot scripts exist that rely on this command existing and returning success. An informational message is printed to alert users of this command that it is likely no longer needed. Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for randomization and completely ignores the kaslr-seed for its own randomness needs (i.e the randomization of the physical placement of the kernel). It gets weeded out from the DTB that gets handed over via efi_install_fdt() as it would also mess up the measured boot DTB TPM measurements as well.
2024-06-28test: cmd: fdt: fix chosen test for DM_RNGTim Harvey
Now that kaslr-seed is automatically added to the chosen node if DM_RNG is enabled, adjust the test to expect this. Take care not to expect kaslr-seed for CONFIG_MEASURED_BOOT and CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT as we do not add it for those. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Cc: Michal Simek <michal.simek@amd.com> Cc: Andy Yan <andy.yan@rock-chips.com> Cc: Akash Gajjar <gajjar04akash@gmail.com> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Simon Glass <sjg@chromium.org> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Devarsh Thakkar <devarsht@ti.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com> Cc: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Chris Morgan <macromorgan@hotmail.com>
2024-06-24Merge tag 'v2024.07-rc5' into nextTom Rini
Prepare v2024.07-rc5
2024-06-16cyclic: make clients embed a struct cyclic_info in their own data structureRasmus Villemoes
There are of course not a whole lot of examples in-tree yet, but before they appear, let's make this API change: Instead of separately allocating a 'struct cyclic_info', make the users embed such an instance in their own structure, and make the convention that the callback simply receives the 'struct cyclic_info *', from which the clients can get their own data using the container_of() macro. This has a number of advantages. First, it means cyclic_register() simply cannot fail, simplifying the code. The necessary storage will simply be allocated automatically when the client's own structure is allocated (often via uclass_priv_auto or similar). Second, code for which CONFIG_CYCLIC is just an option can more easily be written without #ifdefs, if we just provide an empty struct cyclic_info {}. For example, the nested CONFIG_IS_ENABLED()s in https://lore.kernel.org/u-boot/20240316201416.211480-1-marek.vasut+renesas@mailbox.org/ are mostly due to the existence of the 'struct cyclic_info *' member being guarded by #ifdef CONFIG_CYCLIC. And we do probably want to avoid the extra memory overhead of that member when !CONFIG_CYCLIC. But that is automatic if, instead of a 'struct cyclic_info *', one simply embeds a 'struct cyclic_info', which will have size 0 when !CONFIG_CYCLIC. Also, the no-op cyclic_register() function can just unconditionally be called, and the compiler will see that (1) the callback is referenced, so not emit a warning for a maybe-unused function and (2) see that it can actually never be reached, so not emit any code for it. Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2024-06-13test/py: net_boot: Add test cases for net bootLove Kumar
Add tests for booting image using tftpboot/pxe boot commands, tftpboot boot case loads the FIT image into DDR and boots using bootm command whereas pxe boot cases downloads the pxe configuration file from the TFTP server and interprets it to boot the images mentioned in the pxe configurations file. This test relies on boardenv_* containing configuration values including the parameter 'pattern'. tftpboot/pxe boot cases boots the Linux till the boot log pattern value is matched. For example, if the parameter 'pattern' is defined as 'login:', it will boot till login prompt. Signed-off-by: Love Kumar <love.kumar@amd.com> Tested-by: Tom Rini <trini@konsulko.com>
2024-06-13test/py: Add support to enable check for bad patternLove Kumar
Executing a u-boot command may raise an error or extra bad pattern, beyond the default bad patterns. Providing a way to enable the console output error check in test. For example, description for OS boot test: import re check_type = 'kernel_boot_error' check_pattern = re.compile('ERROR -2: can't get kernel image!') with u_boot_console.enable_check(check_type, check_pattern): u_boot_console.run_command('<boot command>') Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-06-10doc/sphinx, test/py: Update requests module to 2.32.2Tom Rini
The issue described in https://github.com/psf/requests/pull/6655 has been assigned as a security issue. While unlikely to be exploited in our usage, update to the current release to fix it. Furthermore, upstream has now moved on to v2.23.2 as the release to use which has all of the issues resolved. Reported-by: GitHub dependabot Signed-off-by: Tom Rini <trini@konsulko.com>
2024-06-10efi_loader: Fix EFI_VARIABLE_APPEND_WRITE hash checkWeizhao Ouyang
According to UEFI v2.10 spec section 8.2.6, if a caller invokes the SetVariables() service, it will produce a digest from hash(VariableName, VendorGuid, Attributes, TimeStamp, DataNew_variable_content), then the firmware that implements the SetVariable() service will compare the digest with the result of applying the signer’s public key to the signature. For EFI variable append write, efitools sign-efi-sig-list has an option "-a" to add EFI_VARIABLE_APPEND_WRITE attr, and u-boot will drop this attribute in efi_set_variable_int(). So if a caller uses "sign-efi-sig-list -a" to create the authenticated variable, this append write will fail in the u-boot due to "hash check failed". This patch resumes writing the EFI_VARIABLE_APPEND_WRITE attr to ensure that the hash check is correct. And also update the "test_efi_secboot" test case to compliance with the change. Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
2024-06-04Merge tag 'v2024.07-rc4' into nextTom Rini
Prepare v2024.070-rc4
2024-05-27tpm-v2: allow algorithm name to be configured for pcr_read and pcr_extendTim Harvey
For pcr_read and pcr_extend commands allow the digest algorithm to be specified by an additional argument. If not specified it will default to SHA256 for backwards compatibility. Additionally update test_tpm2.py for the changes in output in pcr_read which now shows the algo and algo length in the output. A follow-on to this could be to extend all PCR banks with the detected algo when the <digest_algo> argument is 'auto'. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-05-24Merge patch series "FWU: Add support for FWU metadata version 2"Tom Rini
Sughosh Ganu <sughosh.ganu@linaro.org> says: The following patch series adds support for version 2 of the FWU metadata. The version 2 metadata structure is defined in the latest revision of the FWU specification [1]. The earlier versions of these patches were migrating to a version 2 only support in U-Boot, similar to TF-A. However, based on feedback from ST [2], this series has been updated to support both versions. A platform would still be needed to enable one of the two versions of metadata through a config symbol. TF-A has code which reads the FWU metadata and boots the platform from the active partition. TF-A has decided to migrate the FWU code to a version 2 only support. These changes have been merged in upstream TF-A. These changes have been tested on the ST DK2 board, which uses the GPT based partitioning scheme. Both V1 and V2 metadata versions have been tested on the DK2 board. These changes need to be tested on platforms with MTD partitioned storage devices.
2024-05-24test: fwu: make changes to the FWU metadata access testSughosh Ganu
Make changes to the FWU metadata access tests corresponding to the changes in the FWU metadata access code. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Tested-by: Michal Simek <michal.simek@amd.com>
2024-05-22include: Move snprintf to stdio.hRaymond Mao
Move snprintf to stdio.h since it is needed by exteranl libraries. Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-08test/py: Make the number of SPL banners seen a variableTom Rini
Currently we have the option to tell the console code that we should ignore the SPL banner. We also have an option to say that we can see it a second time, and ignore it. However, some platforms such as TI AM64x will have us see the SPL banner three times. Rather than add an "spl3_skipped" option, rework the code. By default we expect to see the banner once, but boards can specify seeing it as many times as they expect to. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-06test: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from all "test/" files and when needed add missing include files directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-05rng: Introduce SPL_DM_RNGMarek Vasut
Add SPL variant of DM_RNG so that the DM_RNG can be disabled in SPL if necessary. This may be necessary due to e.g. size constraints of the SPL. Signed-off-by: Marek Vasut <marex@denx.de>
2024-05-01efi_loader: improve error handling in try_load_entry()Heinrich Schuchardt
The image is not unloaded if a security violation occurs. If efi_set_load_options() fails, we do not free the memory allocated for the optional data. We do not unload the image. * Unload the image if a security violation occurs. * Free load_options if efi_set_load_options() fails. * Unload the image if efi_set_load_options() fails. Fixes: 53f6a5aa8626 ("efi_loader: Replace config option for initrd loading") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-18test: py: add optee_rpmb testsIgor Opaniuk
Add read/write tests for optee_rpmb cmd. Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-17test: typo currenHeinrich Schuchardt
Fix typos in test_eficonfig.py: %s/curren/current/ Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
2024-04-12disk: simplify print_part_header()Heinrich Schuchardt
Using uclass_get_name() reduces the code size. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-04-12test: remove unused import from pkg_resourcesHeinrich Schuchardt
load_entry_point is not used. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-04-08boot: correct finding the default EFI binaryHeinrich Schuchardt
* The sandbox must not use an arbitrary file name bootsbox.efi but the file name matching the host architecture to properly boot the respective file. We already have an include which provides a macro with the name of the EFI binary. Use it. * The path to the EFI binary should be absolute. * The path and the file name must be capitalized to conform to the UEFI specification. This is important when reading from case sensitive file systems. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-08boot: correct the default sequence of boot methodsHeinrich Schuchardt
The default sequence of boot methods is determined by alphabetical sorting during linkage. * efi_mgr must run before efi to be UEFI compliant * pxe should run as last resort Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-08sandbox: capsule: binman: generate some capsules as part of buildSughosh Ganu
Currently, all the capsules for the sandbox platform are generated at the time of running the capsule tests. To showcase generation of capsules through binman, generate all raw(non FIT payload) capsules needed for the sandbox platform as part of the build. This acts as an illustrative example for generating capsules as part of a platform's build. Make corresponding change in the capsule test's configuration to get these capsules from the build directory. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2024-03-27acpi: rename aslc_id, aslc_revisionHeinrich Schuchardt
The fields Creator ID and Creator Revision contain information about the tool that created an ACPI table. This may be the ASL compiler for some tables but it is not for others. Naming these fields aslc_id and aslc_revision is misleading. It is usual to see diverse values of Creator ID. On a laptop I saw these: 'AMD ', 'INTL, 'MSFT', 'PTEC'. Obviously not all relate to the Intel ASL compiler. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-03-20test: dm: add button_cmd testCaleb Connolly
Add a test for the button_cmd feature. This validates that commands can be mapped to two buttons, that the correct command runs based on which button is pressed, that only 1 command is run, and that no command runs if button_cmd_0_name is wrong or unset. Additionally, fix a potential uninitialised variable use caught by these tests, the btn variable in get_button_cmd() is assumed to be null if button_get_by_label() fails, but it's actually used uninitialised in that case. CONFIG_BUTTON is now enabled automatically and was removed when running save_defconfig. Fixes: e761035b6423 ("boot: add support for button commands") Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-03-19test/py: reset: Add a test for reset commandLove Kumar
Add a test for reset commands which performs resetting of CPU, It does COLD reset by default and WARM reset with -w option. Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-03-19test/py: saveenv: Add a test for saveenv commandLove Kumar
Add test case for saveenv command in non-JTAG bootmode which saves the u-boot environment variables in persistent storage. Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-03-04bootstd: fix build error when CONFIG_MMC is disabledDan Carpenter
This code assumes that CONFIG_MMC and it causes a build error when the config is disabled. aarch64-linux-gnu-ld.bfd: test/boot/bootstd_common.o: in function `bootstd_test_check_mmc_hunter': test/boot/bootstd_common.c:83:(.text.bootstd_test_check_mmc_hunter+0x70): undefined reference to `_u_boot_list_2_bootdev_hunter_2_mmc_bootdev_hunter' Fixes: 66e3dce78750 ("bootstd: Allow hunting for a bootdev by label") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
2024-03-04bootflow: Fix build error when BOOTMETH_CROS is disabledDan Carpenter
The bootflow testing assumes that BOOTMETH_CROS is enabled but it might not be which leads to a build error. aarch64-linux-gnu-ld.bfd: test/boot/bootflow.o: in function `prep_mmc_bootdev': test/boot/bootflow.c:549:(.text.prep_mmc_bootdev+0x1c8): undefined reference to `_u_boot_list_2_driver_2_bootmeth_cros' Fixes: d08db02d2d3d ("bootstd: Add a test for bootmeth_cros") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
2024-03-02cmd: setexpr: fix no matching string in gsub return empty valueMassimiliano Minella
In gsub, when the destination string is empty, the string 't' is provided and the regular expression doesn't match, then the final result is an empty string. Example: => echo ${foo} => setenv foo => setexpr foo gsub e a bar => echo ${foo} => The variable ${foo} should contain "bar" and the lack of match shouldn't be considered an error. This patch fixes the erroneous behavior by removing the return statement and breaking out of the loop in case of lack of match. Also add a test for the no match case. Signed-off-by: Massimiliano Minella <massimiliano.minella@se.com>
2024-03-02test: cmd: mbr: Fix Smatch static checker warningAlexander Gendin
This patch fixes Smatch static checker warning: test/cmd/mbr.c:243 mbr_test_run() warn: sizeof(NUMBER)? Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Alexander Gendin <agendin@matrox.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2024-03-01test/py: net: Add dhcp abort testLove Kumar
Abort the dhcp request in the middle by pressing ctrl + c on u-boot prompt and validate the abort status. Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-02-29Merge patch series "Handoff bloblist from previous boot stage"Tom Rini
Raymond Mao <raymond.mao@linaro.org> says: This patch set adds/adapts a few bloblist APIs and implements Arm arch custom function to retrieve the bloblist (aka. Transfer List) from previous loader via boot arguments when BLOBLIST option is enabled and all boot arguments are compliant to the register conventions defined in the Firmware Handoff spec v0.9. If an arch wishes to have different behaviors for loading bloblist from the previous boot stage, it is required to implement the custom function xferlist_from_boot_arg().
2024-02-29bloblist: refactor of bloblist_reloc()Raymond Mao
The current bloblist pointer and size can be retrieved from global data, so we don't need to pass them from the function arguments. This change also help to remove all external access of gd->bloblist outside of bloblist module. Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-02-29bloblist: check bloblist with specified buffer sizeRaymond Mao
Instead of expecting the bloblist total size to be the same as the pre-allocated buffer size, practically we are more interested in whether the pre-allocated buffer size is bigger than the bloblist total size. Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-02-15avb: move SPDX license identifiers to the first lineIgor Opaniuk
Move SPDX license identifiers to the first line, so it conforms to license placement rule [1]: Placement: The SPDX license identifier in kernel files shall be added at the first possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX identifier goes into the second line. [1] https://www.kernel.org/doc/Documentation/process/license-rules.rst Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com> Link: https://lore.kernel.org/r/20240209192045.3961832-3-igor.opaniuk@foundries.io Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-01-29clk: Remove rfreeSean Anderson
Nothing uses this function. Remove it. Since clk_free no longer does anything, just stub it out. Signed-off-by: Sean Anderson <seanga2@gmail.com> Link: https://lore.kernel.org/r/20231216193843.2463779-2-seanga2@gmail.com