aboutsummaryrefslogtreecommitdiff
path: root/test/py/tests/test_efi_capsule
AgeCommit message (Collapse)Author
2024-07-18Merge patch series "finish using .dtso for overlay source files"Tom Rini
Rasmus Villemoes <rasmus.villemoes@prevas.dk> says: This is a followup to the patches that landed in 2024.01 and nearly made sure that source files for producing .dtbo files use the .dtso extension. In the same release, a few new .dts files snuck in, and there was also some test code involving .dtbo -> .dtbo.S -> .dtbo.o I didn't really know how to handle at the time. This should finish the job, bring us in sync with linux (at least in this respect), and drop the .dts -> .dtbo build rule.
2024-07-18test/py: efi_capsule: rename device tree overlay source to .dtsoRasmus Villemoes
Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo. Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources, and eventually eliminating all .dts -> .dtbo instances. This also matches the documentation update done in commit 4fb7e570d6b. Cc: Masahisa Kojima <kojima.masahisa@socionext.com> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2024-07-14test: test for ignore OsIndicationsIlias Apalodimas
The tests we currently have expect the firmware update to fail when OsIndications is not set properly. However, we have a Kconfig flag that explicitly ignores that variable. Adjust the tests accordingly Signed-off-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>
2023-08-29test: capsule: Remove logic to add public key ESLSughosh Ganu
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>
2023-08-29test: capsule: Generate EFI capsules through binmanSughosh Ganu
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>
2023-07-20test: avoid function name 'setup'Heinrich Schuchardt
pytest 7.3.2 treats the function name 'setup' as a fixture [1]. This leads to errors like: TypeError: setup() missing 2 required positional arguments: 'disk_img' and 'osindications' Rename setup() to capsule_setup(). [1] How to run tests written for nose https://docs.pytest.org/en/7.3.x/how-to/nose.html Fixes: 482ef90aeb4c ("test: efi_capsule: refactor efi_capsule test") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-06-12Merge tag 'xilinx-for-v2023.10-rc1' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-microblaze into next Xilinx changes for v2023.10-rc1 global: - Use proper U-Boot project name Fix sparse warnings in zynqmp-clk, zynqmp handoff, board cmd: - Cover incorrect 0 length entries Versal NET: - Add bootmode logic - Support SPP production version - Add loadpdi command ZynqMP: - Clear pmufw node command ID handling - Change power domain behavior around zynqmp_pmufw_node() - Fix zynqmp cmd return values and pmufw command - Fix R5 tcm init and modes mmc: - Sync Versal NET emmc DT binding pcie: - Add support for ZynqMP PCIe root port video: - Add support for ZynqMP DP tools: - Fix debug message in relocate-rela
2023-06-12global: Use proper project name U-BootMichal Simek
Use proper project name in comments, Kconfig, readmes. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/0dbdf0432405c1c38ffca55703b6737a48219e79.1684307818.git.michal.simek@amd.com
2023-06-08test/py: efi_capsule: test for FMP versioningMasahisa Kojima
This test covers the FMP versioning for both raw and FIT image, and both signed and non-signed capsule update. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-06-08test: efi_capsule: refactor efi_capsule testMasahisa Kojima
Current efi capsule python tests have much code duplication. This commit creates the common function in test/py/tests/test_efi_capsule/capsule_common.py, aim to reduce the code size and improve maintainability. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-05-04test: fix pydoc issues for EFI testsHeinrich Schuchardt
Fix issues reported by pydocstyle. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-04-21test: fix pylint warning for capsule testsHeinrich Schuchardt
Fix pylint warnings like: * Class inherits from object * Missing module description * Missing class description * First line of comment blank * Superfluous imports Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-10-31test: dm: Add test cases for FWU Metadata uclassSughosh Ganu
Add test cases for accessing the FWU Metadata on the sandbox platform. The sandbox platform also uses the metadata access driver for GPT partitioned block devices. The FWU feature will be tested on the sandbox64 variant with a raw capsule. Remove the FIT capsule testing from sandbox64 defconfig -- the FIT capsule test will be run on the sandbox_flattree variant. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-07-18efi: test/py: repair authenticated capsules testsVincent Stehlé
The UEFI console initialisation has been modified by commit 68edbed454b8 ("efi_loader: initialize console size late"). A corresponding workaround is now necessary for the automated tests, as added to some of the tests already by commit e05bd68ed5fc ("test: work around for EFI terminal size probing"). Add the same workaround to the UEFI authenticated capsules tests to repair them. This can be tested with sandbox_defconfig, sandbox64_defconfig or sandbox_flattree_defconfig, plus CONFIG_EFI_CAPSULE_AUTHENTICATE=y. Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-06-19test: work around for EFI terminal size probingHeinrich Schuchardt
When the UEFI sub-system is initialized it sends an escape sequence to the serial console to determine the terminal size. This stops the run_command_list() function of the console emulation from recognizing the U-Boot command line prompt. Add a 'print -e' command as first command in the command list to work around this issue. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-06-04efi: test/py: authenticate fit capsulesVincent Stehlé
Add support for the authentication of UEFI capsules containing FIT images. The authentication code is moved out of the function handling raw images into a new function efi_firmware_capsule_authenticate(). The special case for the FMP header coming from edk2 tools is preserved. There is no functional change for capsules containing raw images. The python test for signed capsules with raw images is renamed with no functional change and a new test is added for signed capsules containing FIT images. This can be tested with sandbox64_defconfig or sandbox_flattree_defconfig, plus CONFIG_EFI_CAPSULE_AUTHENTICATE=y. Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
2022-06-04test/py: efi_capsule: repair image authentication testVincent Stehlé
Repair the python tests for authenticated EFI capsules, which can be run with sandbox_defconfig plus CONFIG_EFI_CAPSULE_AUTHENTICATE=y. - Account for the reset changes done by commit 3e6f81000672 ("efi_loader: test/py: Reset system after capsule update on disk"). - Fix the capsule GUID typo introduced by commit 2e9c3c6965ba ("test: capsule: Modify the capsule tests to use GUID values for sandbox"). Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
2022-05-03test: fix some pylint problems in test_capsule_firmware_raw.pyHeinrich Schuchardt
* improve doc-string formatting * remove unused imports Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-04-15test: capsule: Modify the capsule tests to use GUID values for sandboxSughosh Ganu
The current UEFI capsule updation code uses two GUID values, one for FIT images, and one for raw images across platforms. This logic is being changed to have GUID values per image, per platform. Change the tests for the capsule update code to reflect this change. The GUID values now used are the ones specific to the sandbox platform -- one for the u-boot image, and another for the u-boot environment image. Install the FMP instance for raw images on the sandbox variant for testing the capsule update code. Install the FMP instance for the FIT images on the sandbox64 and sandbox_flattree variant for testing capsule update for FIT images. This is being done by splitting the capsule update script for FIT and raw images. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2022-02-26efi_loader: test/py: Reset system after capsule update on diskMasami Hiramatsu
Add a cold reset soon after processing capsule update on disk. This is required in UEFI specification 2.9 Section 8.5.5 "Delivery of Capsules via file on Mass Storage device" as; In all cases that a capsule is identified for processing the system is restarted after capsule processing is completed. This also reports the result of each capsule update so that the user can notice that the capsule update has been succeeded or not from console log. Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-02-11test/py: efi_capsule: check the results in case of CAPSULE_AUTHENTICATEAKASHI Takahiro
Before the capsule authentication is supported, this test script works correctly, but with the feature enabled, most tests will fail due to unsigned capsules. So check the results depending on CAPSULE_AUTHENTICATE or not. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-02-11test/py: efi_capsule: add a test for "--guid" optionAKASHI Takahiro
This test scenario tests a new feature of mkeficapsule, "--guid" option, which allows us to specify FMP driver's guid explicitly at the command line. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-02-11test/py: efi_capsule: align with the syntax change of mkeficapsuleAKASHI Takahiro
Since the syntax of mkeficapsule was changed in the previous commit, we need to modify command line arguments in a pytest script. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-02-11test/py: efi_capsule: add image authentication testAKASHI Takahiro
Add a couple of test cases against capsule image authentication for capsule-on-disk, where only a signed capsule file with the verified signature will be applied to the system. Due to the difficulty of embedding a public key (esl file) in U-Boot binary during pytest setup time, all the keys/certificates are pre-created. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-07-24test/py: efi_capsule: align with efidebug syntax changesAKASHI Takahiro
After the commit c70f44817d46 ("efi_loader: simplify 'printenv -e'"), "-all" option is no longer necessary. Just remove them in the test script. Fixes: c70f44817d46 ("efi_loader: simplify 'printenv -e'") Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-04-24test/py: Fix efidebug related testsIlias Apalodimas
commit cbea241e935e("efidebug: add multiple device path instances on Boot####") slightly tweaked the efidebug syntax adding -b, -i and -s for the boot image, initrd and optional data. The pytests using this command were adapted as well. However I completely missed the last "" argument, which at the time indicated the optional data and needed conversion as well. This patch is adding the missing -s flag and the tests are back to normal. Fixes: cbea241e935e("efidebug: add multiple device path instances on Boot####") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviwed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-03-25test: test the ESRT creationJose Marinho
This commit slightly extends test_efi_capsule_fw3. In order to run the test the following must be added to sandbox_defconfig: +CONFIG_CMD_SF=y +CONFIG_CMD_MEMORY=y +CONFIG_CMD_FAT=y +CONFIG_DFU=y The ESRT is printed in the u-boot shell by calling efidebug esrt. The test ensures that, after the capsule is installed, the ESRT contains entries with the GUIDs: - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID; - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID; test invocation: sudo ./test/py/test.py --bd sandbox -k capsule_fw3 -l --build CC: Heinrich Schuchardt <xypron.glpk@gmx.de> CC: Sughosh Ganu <sughosh.ganu@linaro.org> CC: AKASHI Takahiro <takahiro.akashi@linaro.org> CC: Ilias Apalodimas <ilias.apalodimas@linaro.org> CC: Andre Przywara <andre.przywara@arm.com> CC: Alexander Graf <agraf@csgraf.de> CC: nd@arm.com Signed-off-by: Jose Marinho <jose.marinho@arm.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-03-25efidebug: add multiple device path instances on Boot####Ilias Apalodimas
The UEFI spec allows a packed array of UEFI device paths in the FilePathList[] of an EFI_LOAD_OPTION. The first file path must describe the loaded image but the rest are OS specific. Previous patches parse the device path and try to use the second member of the array as an initrd. So let's modify efidebug slightly and install the second file described in the command line as the initrd device path. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-03-07efi_loader: correct uboot_bin_env.its file formatHeinrich Schuchardt
Up to now the EFI capsule Python tests were always skipped. The reason is that mkimage fails with: uboot_bin_env.its:13.21-23.5: Warning (unit_address_vs_reg): /images/u-boot-bin@100000: node has a unit name, but no reg property uboot_bin_env.its:24.21-34.5: Warning (unit_address_vs_reg): /images/u-boot-env@150000: node has a unit name, but no reg property If a unit in a device-tree has an address, a reg property must be provided. But adding a reg property is not the solution here. Since 2017 unit addresses are disallowed for FIT, cf. common/image-fit.c:1624. So remove the unit addresses in uboot_bin_env.its. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-12-03test/py: efi_capsule: test for raw image capsuleAKASHI Takahiro
The test can run on sandbox build and it attempts to execute a firmware update via a capsule-on-disk, using a raw image capsule, CONFIG_EFI_CAPSULE_RAW. To run this test successfully, you need configure U-Boot specifically; See test_capsule_firmware.py for requirements, and hence it won't run on Travis CI, at least, for now. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-12-03test/py: efi_capsule: test for FIT image capsuleAKASHI Takahiro
The test can run on sandbox build and it attempts to execute a firmware update via a capsule-on-disk, using a FIT image capsule, CONFIG_EFI_CAPSULE_FIT. To run this test successfully, you need configure U-Boot specifically; See test_capsule_firmware.py for requirements, and hence it won't run on Travis CI, at least, for now. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>