forked from OERV-BSP/u-boot
Merge tag 'efi-2025-07-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull-request efi-2025-07-rc3 CI: * https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/26146 Documentation: * Improve the pytest documentation * u-boot-test-reset: mention power cycling * describe u-boot-test-release * correct link to QEMU * describe that RISC-V supports semihosting UEFI: * link libggc via PLATFORM_LIBGCC to EFI binaries * allow suppressing ANSI output in dtbdump.efi * test/py/test_efi_fit: test fdt and initrd # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmggj+IACgkQhO4vgnE3 # U0sjTBAAkWySSBNFoj12AyjO2h4kJecxiJJxyoMYTcsr3xdgV0WTPQFaWcSBqTsL # NgKq5KFNe+ywUdDIqU1VLOTcQf298hofRrcp5Gfhv+syZaRCorCSoSJI6ZveZ5Bi # 9N2pPvhEVrlFBF2XannJ5ilYtLAbiqIvVFmdLmFwRPbODv/gfEkSudSy0Za7t1tM # c7RoRegpXziY4Y1XPfr3MpXgKpUQkOPnvXKUwtHhL055X/1Ggg87dzPg1fiU+DiQ # AGAgvGD/KF/ym4aWQ3jWyji8Kxc5BLsurv083it7JAmL82wqNbU9j5cx3mS/f2Le # uL7YWv1GANbq+MoBC5O3nkB+yUtHSLylFC3KKFiehmKhc/JO+Uj3cJY/Q/25+lxs # aahG3C/5xgBTgM6YEqJfSqKYQVFsC2V/a7gWAFlX7OidYXm6oDBu4TeAHmAtBgcj # pz0AVCYMWyhKE+zb+4U2mlKEQ8bJpFdC2Q+pTMciGAM3YyztotJ1yoM4IndDrh4q # ScrIpXHSqWLlZfev+NnJDw1UKLWEJIMeXh0uzfpaT5M0cLEDeHTOSX9Fp3ZPj9Af # +T3nNWSXWlOW0wc6C5igj4p0UiGSbHMMPOa54f/D0gdl/UkPZ1YPBYVBa/eX1yBy # NlaJziLCmLqyWpYIVhaigKDtGWfgjoHGaABfyuSIj/HxmIHhD5w= # =NbGi # -----END PGP SIGNATURE----- # gpg: Signature made Sun 11 May 2025 05:54:10 AM CST # gpg: using RSA key 2BBC0A5EDDFF6ED2FAFF203E84EE2F827137534B # gpg: Can't check signature: No public key
This commit is contained in:
@@ -92,7 +92,7 @@ stages:
|
||||
set -e
|
||||
python3 -m venv /tmp/venvhtml
|
||||
. /tmp/venvhtml/bin/activate
|
||||
pip install -r doc/sphinx/requirements.txt
|
||||
pip install -r doc/sphinx/requirements.txt pytest
|
||||
make htmldocs KDOC_WERROR=1
|
||||
make infodocs
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ docs:
|
||||
script:
|
||||
- python3 -m venv /tmp/venvhtml
|
||||
- . /tmp/venvhtml/bin/activate
|
||||
- pip install -r doc/sphinx/requirements.txt
|
||||
- pip install -r doc/sphinx/requirements.txt pytest
|
||||
- make htmldocs KDOC_WERROR=1
|
||||
- make infodocs
|
||||
|
||||
|
||||
3
Makefile
3
Makefile
@@ -2448,7 +2448,8 @@ DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
|
||||
linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
|
||||
PHONY += $(DOC_TARGETS)
|
||||
$(DOC_TARGETS): scripts_basic FORCE
|
||||
$(Q)$(MAKE) $(build)=doc $@
|
||||
$(Q)PYTHONPATH=$(srctree)/test/py/tests:$(srctree)/test/py \
|
||||
$(MAKE) $(build)=doc $@
|
||||
|
||||
PHONY += checkstack ubootrelease ubootversion
|
||||
|
||||
|
||||
@@ -1263,7 +1263,7 @@ U_BOOT_CMD_COMPLETE(
|
||||
" \"-rt\": set runtime attribute\n"
|
||||
" \"-at\": set time-based authentication attribute\n"
|
||||
" \"-a\": append-write\n"
|
||||
" \"-i addr,size\": use <addr,size> as variable's value\n"
|
||||
" \"-i addr:size\": use <addr,size> as variable's value\n"
|
||||
" \"-v\": verbose message\n"
|
||||
" - delete UEFI variable 'name' if 'value' not specified\n"
|
||||
#endif
|
||||
|
||||
@@ -367,7 +367,7 @@ out:
|
||||
*
|
||||
* This function is for "env set -e" or "setenv -e" command:
|
||||
* => env set -e [-guid guid][-nv][-bs][-rt][-at][-a][-v]
|
||||
* [-i address,size] var, or
|
||||
* [-i address:size] var, or
|
||||
* var [value ...]
|
||||
* Encode values specified and set given UEFI variable.
|
||||
* If no value is specified, delete the variable.
|
||||
|
||||
@@ -47,7 +47,8 @@ needs_sphinx = '2.4.4'
|
||||
extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',
|
||||
'kfigure', 'sphinx.ext.ifconfig', # 'automarkup',
|
||||
'maintainers_include', 'sphinx.ext.autosectionlabel',
|
||||
'kernel_abi', 'kernel_feat', 'sphinx-prompt']
|
||||
'kernel_abi', 'kernel_feat', 'sphinx-prompt',
|
||||
'sphinx_reredirects', 'sphinx.ext.autodoc' ]
|
||||
|
||||
#
|
||||
# cdomain is badly broken in Sphinx 3+. Leaving it out generates *most*
|
||||
@@ -148,6 +149,11 @@ project = 'Das U-Boot'
|
||||
copyright = 'The U-Boot development community'
|
||||
author = 'The U-Boot development community'
|
||||
|
||||
# Pages we have moved after being heavily referenced externally
|
||||
redirects = {
|
||||
"develop/py_testing": "pytest/usage.html"
|
||||
}
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
QFW Bootmeth
|
||||
============
|
||||
|
||||
`QEMU <hhttps://www.qemu.org/>`_ is a system emulator which is able to boot
|
||||
`QEMU <https://www.qemu.org/>`_ is a system emulator which is able to boot
|
||||
Operating Systems. QEMU provides specific support for booting an OS image
|
||||
provided on the QEMU command line.
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ be built with mingw to run on Windows.
|
||||
Each of the pipelines is written in such as way as to be a "world build" style
|
||||
test and as such we try and build all possible platforms. In addition, for all
|
||||
platforms that support being run in QEMU we run them in QEMU and use our pytest
|
||||
suite. See :doc:`py_testing` for more information about those tests.
|
||||
suite. See :doc:`pytest/usage` for more information about those tests.
|
||||
|
||||
Azure Pipelines
|
||||
---------------
|
||||
|
||||
@@ -82,7 +82,7 @@ Testing
|
||||
:maxdepth: 1
|
||||
|
||||
testing
|
||||
py_testing
|
||||
pytest/index
|
||||
tests_writing
|
||||
tests_sandbox
|
||||
binman_tests
|
||||
|
||||
27
doc/develop/pytest/index.rst
Normal file
27
doc/develop/pytest/index.rst
Normal file
@@ -0,0 +1,27 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
pytest Framework within U-Boot
|
||||
==============================
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
usage
|
||||
|
||||
Individual tests
|
||||
----------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
test_000_version
|
||||
test_bind
|
||||
test_bootmenu
|
||||
test_bootstage
|
||||
test_button
|
||||
test_efi_loader
|
||||
test_net
|
||||
test_net_boot
|
||||
8
doc/develop/pytest/test_000_version.rst
Normal file
8
doc/develop/pytest/test_000_version.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
test_000_version
|
||||
================
|
||||
|
||||
.. automodule:: test_000_version
|
||||
:synopsis:
|
||||
:member-order: bysource
|
||||
:members:
|
||||
:undoc-members:
|
||||
8
doc/develop/pytest/test_bind.rst
Normal file
8
doc/develop/pytest/test_bind.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
test_bind
|
||||
=========
|
||||
|
||||
.. automodule:: test_bind
|
||||
:synopsis:
|
||||
:member-order: bysource
|
||||
:members:
|
||||
:undoc-members:
|
||||
8
doc/develop/pytest/test_bootmenu.rst
Normal file
8
doc/develop/pytest/test_bootmenu.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
test_bootmenu
|
||||
=============
|
||||
|
||||
.. automodule:: test_bootmenu
|
||||
:synopsis:
|
||||
:member-order: bysource
|
||||
:members:
|
||||
:undoc-members:
|
||||
8
doc/develop/pytest/test_bootstage.rst
Normal file
8
doc/develop/pytest/test_bootstage.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
test_bootstage
|
||||
==============
|
||||
|
||||
.. automodule:: test_bootstage
|
||||
:synopsis:
|
||||
:member-order: bysource
|
||||
:members:
|
||||
:undoc-members:
|
||||
8
doc/develop/pytest/test_button.rst
Normal file
8
doc/develop/pytest/test_button.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
test_button
|
||||
===========
|
||||
|
||||
.. automodule:: test_button
|
||||
:synopsis:
|
||||
:member-order: bysource
|
||||
:members:
|
||||
:undoc-members:
|
||||
8
doc/develop/pytest/test_efi_loader.rst
Normal file
8
doc/develop/pytest/test_efi_loader.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
test_efi_loader
|
||||
===============
|
||||
|
||||
.. automodule:: test_efi_loader
|
||||
:synopsis:
|
||||
:member-order: bysource
|
||||
:members:
|
||||
:undoc-members:
|
||||
8
doc/develop/pytest/test_net.rst
Normal file
8
doc/develop/pytest/test_net.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
test_net
|
||||
========
|
||||
|
||||
.. automodule:: test_net
|
||||
:synopsis:
|
||||
:member-order: bysource
|
||||
:members:
|
||||
:undoc-members:
|
||||
8
doc/develop/pytest/test_net_boot.rst
Normal file
8
doc/develop/pytest/test_net_boot.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
test_net_boot
|
||||
=============
|
||||
|
||||
.. automodule:: test_net_boot
|
||||
:synopsis:
|
||||
:member-order: bysource
|
||||
:members:
|
||||
:undoc-members:
|
||||
@@ -13,7 +13,7 @@ results. Advantages of this approach are:
|
||||
U-Boot; there can be no disconnect.
|
||||
- There is no need to write or embed test-related code into U-Boot itself.
|
||||
It is asserted that writing test-related code in Python is simpler and more
|
||||
flexible than writing it all in C. But see :doc:`tests_writing` for caveats
|
||||
flexible than writing it all in C. But see :doc:`../tests_writing` for caveats
|
||||
and more discussion / analysis.
|
||||
- It is reasonably simple to interact with U-Boot in this way.
|
||||
|
||||
@@ -377,7 +377,8 @@ this script again to restore U-Boot to an operational state before running the
|
||||
next test function.
|
||||
|
||||
This script will likely be implemented by communicating with some form of
|
||||
relay or electronic switch attached to the board's reset signal.
|
||||
relay or electronic switch attached to the board's reset signal. Power cycling
|
||||
is another option.
|
||||
|
||||
The semantics of this script require that when it is executed, U-Boot will
|
||||
start running from scratch. If the U-Boot binary to be tested has been written
|
||||
@@ -388,6 +389,13 @@ to download the U-Boot binary directly into RAM and execute it. This would
|
||||
avoid the need for `u-boot-test-flash` to actually write U-Boot to flash, thus
|
||||
saving wear on the flash chip(s).
|
||||
|
||||
u-boot-test-release
|
||||
'''''''''''''''''''
|
||||
|
||||
When all tests for the board have been executed, this script is called.
|
||||
|
||||
The board can be switched off now.
|
||||
|
||||
Examples
|
||||
''''''''
|
||||
|
||||
@@ -33,7 +33,7 @@ You can also run a selection tests in parallel with::
|
||||
make pcheck
|
||||
|
||||
All of the above use the test/run script with a paremeter to select which tests
|
||||
are run. See :doc:`py_testing` for more information.
|
||||
are run. See :doc:`pytest/usage` for more information.
|
||||
|
||||
|
||||
Sandbox
|
||||
@@ -69,7 +69,7 @@ build::
|
||||
|
||||
./test/py/test.py --bd sandbox_spl --build -k test_spl
|
||||
|
||||
See :doc:`py_testing` for more information about the pytest suite.
|
||||
See :doc:`pytest/usage` for more information about the pytest suite.
|
||||
|
||||
See :doc:`tests_sandbox` for how to run tests directly (not through pytest).
|
||||
|
||||
|
||||
@@ -376,5 +376,5 @@ An example SPL test is spl_test_load().
|
||||
Writing Python tests
|
||||
--------------------
|
||||
|
||||
See :doc:`py_testing` for brief notes how to write Python tests. You
|
||||
See :doc:`pytest/usage` for brief notes how to write Python tests. You
|
||||
should be able to use the existing tests in test/py/tests as examples.
|
||||
|
||||
@@ -15,6 +15,7 @@ six==1.16.0
|
||||
snowballstemmer==2.2.0
|
||||
Sphinx==8.1.3
|
||||
sphinx-prompt==1.9.0
|
||||
sphinx-reredirects==0.1.5
|
||||
sphinx-rtd-theme==3.0.1
|
||||
sphinxcontrib-applehelp==2.0.0
|
||||
sphinxcontrib-devhelp==2.0.0
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0+
|
||||
.. SPDX-License-Identifier: GPL-2.0-or-later
|
||||
.. Copyright 2014 Broadcom Corporation.
|
||||
|
||||
Semihosting
|
||||
===========
|
||||
|
||||
Semihosting is ARM's way of having a real or virtual target communicate
|
||||
with a host or host debugger for basic operations such as file I/O,
|
||||
console I/O, etc. Please see `Arm's semihosting documentation
|
||||
<https://developer.arm.com/documentation/100863/latest/>`_ for more
|
||||
information.
|
||||
Semihosting is a technique to let a real or virtual target communicate with a
|
||||
host or host debugger for basic operations such as file I/O, console I/O, etc.
|
||||
Originally introduced by ARM it has also been adopted for RISC-V. Please, see
|
||||
`Arm's semihosting documentation
|
||||
<https://developer.arm.com/documentation/dui0471/g/Semihosting>`_ and
|
||||
`RISC-V Semihosting
|
||||
<https://drive.google.com/file/d/1qu74D4_EmjGmc03qzfQ7Pf4g6m0fOtcD/view>`_
|
||||
for more information.
|
||||
|
||||
Platform Support
|
||||
----------------
|
||||
@@ -40,7 +43,7 @@ Foundation and Base fastmodel simulators.
|
||||
QEMU
|
||||
^^^^
|
||||
|
||||
Another ARM emulator which supports semihosting is `QEMU
|
||||
Another emulator which supports semihosting is `QEMU
|
||||
<https://www.qemu.org/>`_. To enable semihosting, enable
|
||||
``CONFIG_SERIAL_PROBE_ALL`` when configuring U-Boot, and use
|
||||
``-semihosting`` when invoking QEMU. Adding ``-nographic`` can also be
|
||||
@@ -53,8 +56,8 @@ running QEMU, refer to the :doc:`board documentation
|
||||
OpenOCD
|
||||
^^^^^^^
|
||||
|
||||
Any ARM platform can use semihosting with an attached debugger. One such
|
||||
debugger with good support for a variety of boards and JTAG adapters is
|
||||
Any ARM or RISC-V platform can use semihosting with an attached debugger. One
|
||||
such debugger with good support for a variety of boards and JTAG adapters is
|
||||
`OpenOCD <https://openocd.org/>`_. Semihosting is not enabled by default,
|
||||
so you will need to enable it::
|
||||
|
||||
|
||||
@@ -29,6 +29,18 @@ static struct efi_system_table *systable;
|
||||
static const efi_guid_t efi_dt_fixup_protocol_guid = EFI_DT_FIXUP_PROTOCOL_GUID;
|
||||
static const efi_guid_t efi_file_info_guid = EFI_FILE_INFO_GUID;
|
||||
static const efi_guid_t efi_system_partition_guid = PARTITION_SYSTEM_GUID;
|
||||
static bool nocolor;
|
||||
|
||||
/**
|
||||
* color() - set foreground color
|
||||
*
|
||||
* @color: foreground color
|
||||
*/
|
||||
static void color(u8 color)
|
||||
{
|
||||
if (!nocolor)
|
||||
cout->set_attribute(cout, color | EFI_BACKGROUND_BLACK);
|
||||
}
|
||||
|
||||
/**
|
||||
* print() - print string
|
||||
@@ -87,6 +99,17 @@ static void printx(unsigned char val)
|
||||
print_hex_digit(val & 0xf);
|
||||
}
|
||||
|
||||
/**
|
||||
* cls() - clear screen
|
||||
*/
|
||||
static void cls(void)
|
||||
{
|
||||
if (nocolor)
|
||||
print(u"\r\n");
|
||||
else
|
||||
cout->clear_screen(cout);
|
||||
}
|
||||
|
||||
/**
|
||||
* error() - print error string
|
||||
*
|
||||
@@ -94,9 +117,17 @@ static void printx(unsigned char val)
|
||||
*/
|
||||
static void error(u16 *string)
|
||||
{
|
||||
cout->set_attribute(cout, EFI_LIGHTRED | EFI_BACKGROUND_BLACK);
|
||||
color(EFI_LIGHTRED);
|
||||
print(string);
|
||||
cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK);
|
||||
color(EFI_LIGHTBLUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_drain_input() - drain console input
|
||||
*/
|
||||
static void efi_drain_input(void)
|
||||
{
|
||||
cin->reset(cin, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,8 +147,6 @@ static efi_status_t efi_input_yn(void)
|
||||
efi_uintn_t index;
|
||||
efi_status_t ret;
|
||||
|
||||
/* Drain the console input */
|
||||
ret = cin->reset(cin, true);
|
||||
for (;;) {
|
||||
ret = bs->wait_for_event(1, &cin->wait_for_key, &index);
|
||||
if (ret != EFI_SUCCESS)
|
||||
@@ -158,8 +187,6 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size)
|
||||
u16 outbuf[2] = u" ";
|
||||
efi_status_t ret;
|
||||
|
||||
/* Drain the console input */
|
||||
ret = cin->reset(cin, true);
|
||||
*buffer = 0;
|
||||
for (;;) {
|
||||
ret = bs->wait_for_event(1, &cin->wait_for_key, &index);
|
||||
@@ -262,6 +289,9 @@ static u16 *skip_whitespace(u16 *pos)
|
||||
*/
|
||||
static bool starts_with(u16 *string, u16 *keyword)
|
||||
{
|
||||
if (!string || !keyword)
|
||||
return false;
|
||||
|
||||
for (; *keyword; ++string, ++keyword) {
|
||||
if (*string != *keyword)
|
||||
return false;
|
||||
@@ -737,6 +767,7 @@ static efi_status_t do_dump(void)
|
||||
error(u"Missing end node\r\n");
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
print(u"\r\n");
|
||||
return EFI_SUCCESS;
|
||||
default:
|
||||
error(u"Invalid device tree token\r\n");
|
||||
@@ -748,6 +779,30 @@ static efi_status_t do_dump(void)
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_load_options() - get load options
|
||||
*
|
||||
* Return: load options or NULL
|
||||
*/
|
||||
static u16 *get_load_options(void)
|
||||
{
|
||||
efi_status_t ret;
|
||||
struct efi_loaded_image *loaded_image;
|
||||
|
||||
ret = bs->open_protocol(handle, &loaded_image_guid,
|
||||
(void **)&loaded_image, NULL, NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
error(u"Loaded image protocol not found\r\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!loaded_image->load_options_size || !loaded_image->load_options)
|
||||
return NULL;
|
||||
|
||||
return loaded_image->load_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_main() - entry point of the EFI application.
|
||||
*
|
||||
@@ -758,24 +813,31 @@ static efi_status_t do_dump(void)
|
||||
efi_status_t EFIAPI efi_main(efi_handle_t image_handle,
|
||||
struct efi_system_table *systab)
|
||||
{
|
||||
u16 *load_options;
|
||||
|
||||
handle = image_handle;
|
||||
systable = systab;
|
||||
cerr = systable->std_err;
|
||||
cout = systable->con_out;
|
||||
cin = systable->con_in;
|
||||
bs = systable->boottime;
|
||||
load_options = get_load_options();
|
||||
|
||||
cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK);
|
||||
cout->clear_screen(cout);
|
||||
cout->set_attribute(cout, EFI_WHITE | EFI_BACKGROUND_BLACK);
|
||||
if (starts_with(load_options, u"nocolor"))
|
||||
nocolor = true;
|
||||
|
||||
color(EFI_LIGHTBLUE);
|
||||
cls();
|
||||
color(EFI_WHITE);
|
||||
print(u"DTB Dump\r\n========\r\n\r\n");
|
||||
cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK);
|
||||
color(EFI_LIGHTBLUE);
|
||||
|
||||
for (;;) {
|
||||
u16 command[BUFFER_SIZE];
|
||||
u16 *pos;
|
||||
efi_uintn_t ret;
|
||||
|
||||
efi_drain_input();
|
||||
print(u"=> ");
|
||||
ret = efi_input(command, sizeof(command));
|
||||
if (ret == EFI_ABORTED)
|
||||
@@ -793,7 +855,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image_handle,
|
||||
do_help();
|
||||
}
|
||||
|
||||
cout->set_attribute(cout, EFI_LIGHTGRAY | EFI_BACKGROUND_BLACK);
|
||||
cout->clear_screen(cout);
|
||||
color(EFI_LIGHTGRAY);
|
||||
cls();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ KBUILD_EFILDFLAGS = -nostdlib -zexecstack -znocombreloc -znorelro
|
||||
KBUILD_EFILDFLAGS += $(call ld-option,--no-warn-rwx-segments)
|
||||
quiet_cmd_efi_ld = LD $@
|
||||
cmd_efi_ld = $(LD) $(KBUILD_EFILDFLAGS) -L $(srctree) -T $(EFI_LDS_PATH) \
|
||||
-shared -Bsymbolic -s $^ -o $@
|
||||
-shared -Bsymbolic -s $^ $(PLATFORM_LIBGCC) -o $@
|
||||
|
||||
EFI_LDS_PATH = arch/$(ARCH)/lib/$(EFI_LDS)
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
# Copyright (c) 2015 Stephen Warren
|
||||
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
|
||||
|
||||
# pytest runs tests the order of their module path, which is related to the
|
||||
# filename containing the test. This file is named such that it is sorted
|
||||
# first, simply as a very basic sanity check of the functionality of the U-Boot
|
||||
# command prompt.
|
||||
"""
|
||||
pytest runs tests the order of their module path, which is related to the
|
||||
filename containing the test. This file is named such that it is sorted
|
||||
first, simply as a very basic sanity check of the functionality of the U-Boot
|
||||
command prompt.
|
||||
"""
|
||||
|
||||
def test_version(ubman):
|
||||
"""Test that the "version" command prints the U-Boot version."""
|
||||
|
||||
@@ -7,6 +7,7 @@ import re
|
||||
import pytest
|
||||
|
||||
def in_tree(response, name, uclass, drv, depth, last_child):
|
||||
"""A helper function to confirm contents of the device tree """
|
||||
lines = [x.strip() for x in response.splitlines()]
|
||||
leaf = ''
|
||||
if depth != 0:
|
||||
@@ -28,7 +29,12 @@ def in_tree(response, name, uclass, drv, depth, last_child):
|
||||
@pytest.mark.boardspec('sandbox')
|
||||
@pytest.mark.buildconfigspec('cmd_bind')
|
||||
def test_bind_unbind_with_node(ubman):
|
||||
"""Test the bind and unbind commands of a node
|
||||
|
||||
Verify that the dm tree output contains some expected nodes, and then bind
|
||||
and unbind a USB via node device while verifying that the dm tree output
|
||||
matches the expected values at each step.
|
||||
"""
|
||||
tree = ubman.run_command('dm tree')
|
||||
assert in_tree(tree, 'bind-test', 'simple_bus', 'simple_bus', 0, True)
|
||||
assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False)
|
||||
@@ -106,6 +112,7 @@ def test_bind_unbind_with_node(ubman):
|
||||
assert response == ''
|
||||
|
||||
def get_next_line(tree, name):
|
||||
"""A helper function to strip content out of dm tree output"""
|
||||
treelines = [x.strip() for x in tree.splitlines() if x.strip()]
|
||||
child_line = ''
|
||||
for idx, line in enumerate(treelines):
|
||||
@@ -121,6 +128,11 @@ def get_next_line(tree, name):
|
||||
@pytest.mark.buildconfigspec('cmd_bind')
|
||||
@pytest.mark.singlethread
|
||||
def test_bind_unbind_with_uclass(ubman):
|
||||
"""Test the bind and unbind commands of a class
|
||||
|
||||
Bind and unbind the simple_bus class while verifying that the dm tree
|
||||
output matches the expected values at each step.
|
||||
"""
|
||||
#bind /bind-test
|
||||
response = ubman.run_command('bind /bind-test simple_bus')
|
||||
assert response == ''
|
||||
|
||||
@@ -8,9 +8,9 @@ import pytest
|
||||
def test_bootmenu(ubman):
|
||||
"""Test bootmenu
|
||||
|
||||
ubman -- U-Boot console
|
||||
Args:
|
||||
ubman: U-Boot console
|
||||
"""
|
||||
|
||||
with ubman.temporary_timeout(500):
|
||||
ubman.run_command('setenv bootmenu_default 1')
|
||||
ubman.run_command('setenv bootmenu_0 test 1=echo ok 1')
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# (C) Copyright 2023, Advanced Micro Devices, Inc.
|
||||
|
||||
import pytest
|
||||
|
||||
"""
|
||||
Test the bootstage command.
|
||||
|
||||
@@ -15,16 +13,32 @@ common/bootstage.c). Without this, bootstage stash and unstash tests will be
|
||||
automatically skipped.
|
||||
|
||||
For example:
|
||||
env__bootstage_cmd_file = {
|
||||
'addr': 0x200000,
|
||||
'size': 0x1000,
|
||||
'bootstage_magic_addr': 0xb00757a3,
|
||||
}
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
env__bootstage_cmd_file = {
|
||||
'addr': 0x200000,
|
||||
'size': 0x1000,
|
||||
'bootstage_magic_addr': 0xb00757a3,
|
||||
}
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
@pytest.mark.buildconfigspec('bootstage')
|
||||
@pytest.mark.buildconfigspec('cmd_bootstage')
|
||||
def test_bootstage_report(ubman):
|
||||
"""Test the bootstage report subcommand
|
||||
|
||||
This will run the 'bootstage report' subcommand and ensure that we are
|
||||
reporting:
|
||||
|
||||
- A timer summary in microseconds
|
||||
- The accumulated time
|
||||
- That at least the phrase 'dm_r' is in the output
|
||||
|
||||
Note that the time values are not checked.
|
||||
"""
|
||||
output = ubman.run_command('bootstage report')
|
||||
assert 'Timer summary in microseconds' in output
|
||||
assert 'Accumulated time:' in output
|
||||
@@ -34,6 +48,13 @@ def test_bootstage_report(ubman):
|
||||
@pytest.mark.buildconfigspec('cmd_bootstage')
|
||||
@pytest.mark.buildconfigspec('bootstage_stash')
|
||||
def test_bootstage_stash_and_unstash(ubman):
|
||||
"""Test the bootstage stash and unstash subcommands
|
||||
|
||||
After checking that we have configured an environment file to use, we will
|
||||
use the stash subcommand to save information. Then we will use the md
|
||||
command to verify the contents in memory. Finally we confirm the unstash
|
||||
subcommand runs successfully.
|
||||
"""
|
||||
f = ubman.config.env.get('env__bootstage_cmd_file', None)
|
||||
if not f:
|
||||
pytest.skip('No bootstage environment file is defined')
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
"""Tests for the button command"""
|
||||
|
||||
import pytest
|
||||
|
||||
@pytest.mark.boardspec('sandbox')
|
||||
|
||||
@@ -66,9 +66,29 @@ ITS_DATA = '''
|
||||
#address-cells = <1>;
|
||||
|
||||
images {
|
||||
efi {
|
||||
helloworld {
|
||||
description = "Test EFI";
|
||||
data = /incbin/("%(efi-bin)s");
|
||||
data = /incbin/("%(hello-bin)s");
|
||||
type = "%(kernel-type)s";
|
||||
arch = "%(sys-arch)s";
|
||||
os = "efi";
|
||||
compression = "%(efi-comp)s";
|
||||
load = <0x0>;
|
||||
entry = <0x0>;
|
||||
};
|
||||
dtbdump {
|
||||
description = "Test EFI fdtdump";
|
||||
data = /incbin/("%(dtbdump-bin)s");
|
||||
type = "%(kernel-type)s";
|
||||
arch = "%(sys-arch)s";
|
||||
os = "efi";
|
||||
compression = "%(efi-comp)s";
|
||||
load = <0x0>;
|
||||
entry = <0x0>;
|
||||
};
|
||||
initrddump {
|
||||
description = "Test EFI initrddump";
|
||||
data = /incbin/("%(initrddump-bin)s");
|
||||
type = "%(kernel-type)s";
|
||||
arch = "%(sys-arch)s";
|
||||
os = "efi";
|
||||
@@ -83,18 +103,33 @@ ITS_DATA = '''
|
||||
arch = "%(sys-arch)s";
|
||||
compression = "%(fdt-comp)s";
|
||||
};
|
||||
initrd {
|
||||
description = "Initial RAM Disk";
|
||||
data = /incbin/("%(initrd-fs)s");
|
||||
type = "ramdisk";
|
||||
compression = "%(initrd-comp)s";
|
||||
os = "efi";
|
||||
};
|
||||
};
|
||||
|
||||
configurations {
|
||||
default = "config-efi-fdt";
|
||||
|
||||
config-efi {
|
||||
description = "EFI FIT w/o FDT";
|
||||
kernel = "helloworld";
|
||||
};
|
||||
|
||||
config-efi-fdt {
|
||||
description = "EFI FIT w/ FDT";
|
||||
kernel = "efi";
|
||||
kernel = "dtbdump";
|
||||
fdt = "fdt";
|
||||
};
|
||||
config-efi-nofdt {
|
||||
description = "EFI FIT w/o FDT";
|
||||
kernel = "efi";
|
||||
|
||||
config-efi-initrd {
|
||||
description = "EFI FIT w/ initrd";
|
||||
kernel = "initrddump";
|
||||
ramdisk = "initrd";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -108,7 +143,7 @@ FDT_DATA = '''
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
model = "%(sys-arch)s %(fdt_type)s EFI FIT Boot Test";
|
||||
model = "%(sys-arch)s %(fdt_type)s EFI FIT FDT Boot Test";
|
||||
compatible = "%(sys-arch)s";
|
||||
|
||||
reset@0 {
|
||||
@@ -120,6 +155,7 @@ FDT_DATA = '''
|
||||
|
||||
@pytest.mark.buildconfigspec('bootm_efi')
|
||||
@pytest.mark.buildconfigspec('BOOTEFI_HELLO_COMPILE')
|
||||
@pytest.mark.buildconfigspec('EFI_LOAD_FILE2_INITRD')
|
||||
@pytest.mark.buildconfigspec('fit')
|
||||
@pytest.mark.notbuildconfigspec('generate_acpi_table')
|
||||
@pytest.mark.requiredtool('dtc')
|
||||
@@ -137,8 +173,10 @@ def test_efi_fit_launch(ubman):
|
||||
The following test cases are currently defined and enabled:
|
||||
- Launch uncompressed FIT EFI & internal FDT
|
||||
- Launch uncompressed FIT EFI & FIT FDT
|
||||
- Launch uncompressed FIT EFI & internal FDT & FIT initrd
|
||||
- Launch compressed FIT EFI & internal FDT
|
||||
- Launch compressed FIT EFI & FIT FDT
|
||||
- Launch compressed FIT EFI & internal FDT & FIT initrd
|
||||
"""
|
||||
|
||||
def net_pre_commands():
|
||||
@@ -210,7 +248,7 @@ def test_efi_fit_launch(ubman):
|
||||
|
||||
return os.path.join(ubman.config.build_dir, file_name)
|
||||
|
||||
def make_efi(fname, comp):
|
||||
def make_efi(fname, efi_file, comp):
|
||||
"""Create an UEFI binary.
|
||||
|
||||
This simply copies lib/efi_loader/helloworld.efi into U-Boot
|
||||
@@ -218,6 +256,7 @@ def test_efi_fit_launch(ubman):
|
||||
|
||||
Args:
|
||||
fname -- The target file name within U-Boot build dir.
|
||||
efi_file -- The source .efi application
|
||||
comp -- Flag to enable gzip compression.
|
||||
Return:
|
||||
The path of the created file.
|
||||
@@ -225,7 +264,7 @@ def test_efi_fit_launch(ubman):
|
||||
|
||||
bin_path = make_fpath(fname)
|
||||
utils.run_and_log(ubman,
|
||||
['cp', make_fpath('lib/efi_loader/helloworld.efi'),
|
||||
['cp', make_fpath(f'lib/efi_loader/{efi_file}'),
|
||||
bin_path])
|
||||
if comp:
|
||||
utils.run_and_log(ubman, ['gzip', '-f', bin_path])
|
||||
@@ -264,6 +303,27 @@ def test_efi_fit_launch(ubman):
|
||||
dtb += '.gz'
|
||||
return dtb
|
||||
|
||||
def make_initrd(comp):
|
||||
"""Create a sample initrd.
|
||||
|
||||
Creates an initrd.
|
||||
|
||||
Args:
|
||||
comp -- Flag to enable gzip compression.
|
||||
Return:
|
||||
The path of the created file.
|
||||
"""
|
||||
|
||||
# Generate a test initrd file.
|
||||
initrd = make_fpath('test-efi-initrd')
|
||||
with open(initrd, 'w', encoding='ascii') as file:
|
||||
file.write('test-efi-initrd')
|
||||
|
||||
if comp:
|
||||
utils.run_and_log(ubman, ['gzip', '-f', initrd])
|
||||
initrd += '.gz'
|
||||
return initrd
|
||||
|
||||
def make_fit(comp):
|
||||
"""Create a sample FIT image.
|
||||
|
||||
@@ -275,22 +335,35 @@ def test_efi_fit_launch(ubman):
|
||||
"""
|
||||
|
||||
# Generate resources referenced by ITS.
|
||||
hello_bin = os.path.basename(make_efi('test-efi-helloworld.efi', 'helloworld.efi', comp))
|
||||
dtbdump_bin = os.path.basename(make_efi('test-efi-dtbdump.efi', 'dtbdump.efi', comp))
|
||||
initrddump_bin = os.path.basename(make_efi('test-efi-initrddump.efi', 'initrddump.efi', comp))
|
||||
fdt_bin = os.path.basename(make_dtb('user', comp))
|
||||
initrd_fs = make_initrd(comp)
|
||||
initrd_fs = os.path.basename(initrd_fs)
|
||||
compression = 'gzip' if comp else 'none'
|
||||
kernel_type = 'kernel' if comp else 'kernel_noload'
|
||||
|
||||
its_params = {
|
||||
'sys-arch': sys_arch,
|
||||
'efi-bin': os.path.basename(make_efi('test-efi-fit-helloworld.efi', comp)),
|
||||
'kernel-type': 'kernel' if comp else 'kernel_noload',
|
||||
'efi-comp': 'gzip' if comp else 'none',
|
||||
'fdt-bin': os.path.basename(make_dtb('user', comp)),
|
||||
'fdt-comp': 'gzip' if comp else 'none',
|
||||
'hello-bin': hello_bin,
|
||||
'dtbdump-bin': dtbdump_bin,
|
||||
'initrddump-bin': initrddump_bin,
|
||||
'kernel-type': kernel_type,
|
||||
'efi-comp': compression,
|
||||
'fdt-bin': fdt_bin,
|
||||
'fdt-comp': compression,
|
||||
'initrd-fs': initrd_fs,
|
||||
'initrd-comp': compression,
|
||||
}
|
||||
|
||||
# Generate a test ITS file.
|
||||
its_path = make_fpath('test-efi-fit-helloworld.its')
|
||||
its_path = make_fpath('test-efi-fit.its')
|
||||
with open(its_path, 'w', encoding='ascii') as file:
|
||||
file.write(ITS_DATA % its_params)
|
||||
|
||||
# Build the test ITS.
|
||||
fit_path = make_fpath('test-efi-fit-helloworld.fit')
|
||||
fit_path = make_fpath('test-efi-fit.fit')
|
||||
utils.run_and_log(
|
||||
ubman, [make_fpath('tools/mkimage'), '-f', its_path, fit_path])
|
||||
return fit_path
|
||||
@@ -357,7 +430,7 @@ def test_efi_fit_launch(ubman):
|
||||
|
||||
return addr
|
||||
|
||||
def launch_efi(enable_fdt, enable_comp):
|
||||
def launch_efi(enable_fdt, enable_initrd, enable_comp):
|
||||
"""Launch U-Boot's helloworld.efi binary from a FIT image.
|
||||
|
||||
An external image file can be downloaded from TFTP, when related
|
||||
@@ -372,19 +445,20 @@ def test_efi_fit_launch(ubman):
|
||||
from the host filesystem.
|
||||
|
||||
Once the load address is available on U-Boot console, the 'bootm'
|
||||
command is executed for either 'config-efi-fdt' or 'config-efi-nofdt'
|
||||
FIT configuration, depending on the value of the 'enable_fdt' function
|
||||
argument.
|
||||
command is executed for either 'config-efi', 'config-efi-fdt' or
|
||||
'config-efi-initrd' FIT configuration, depending on the value of the
|
||||
'enable_fdt' and 'enable_initrd' function arguments.
|
||||
|
||||
Eventually the 'Hello, world' message is expected in the U-Boot console.
|
||||
|
||||
Args:
|
||||
enable_fdt -- Flag to enable using the FDT blob inside FIT image.
|
||||
enable_initrd -- Flag to enable using an initrd inside FIT image.
|
||||
enable_comp -- Flag to enable GZIP compression on EFI and FDT
|
||||
generated content.
|
||||
"""
|
||||
|
||||
with ubman.log.section('FDT=%s;COMP=%s' % (enable_fdt, enable_comp)):
|
||||
with ubman.log.section('FDT=%s;INITRD=%s;COMP=%s' % (enable_fdt, enable_initrd, enable_comp)):
|
||||
if is_sandbox:
|
||||
fit = {
|
||||
'dn': ubman.config.build_dir,
|
||||
@@ -420,14 +494,28 @@ def test_efi_fit_launch(ubman):
|
||||
addr = load_fit_from_host(fit) if is_sandbox else load_fit_from_tftp(fit)
|
||||
|
||||
# Select boot configuration.
|
||||
fit_config = 'config-efi-fdt' if enable_fdt else 'config-efi-nofdt'
|
||||
fit_config = 'config-efi'
|
||||
fit_config = fit_config + '-fdt' if enable_fdt else fit_config
|
||||
fit_config = fit_config + '-initrd' if enable_initrd else fit_config
|
||||
|
||||
# Try booting.
|
||||
ubman.run_command('setenv bootargs nocolor')
|
||||
output = ubman.run_command('bootm %x#%s' % (addr, fit_config))
|
||||
assert '## Application failed' not in output
|
||||
if enable_fdt:
|
||||
assert 'Booting using the fdt blob' in output
|
||||
assert 'Hello, world' in output
|
||||
assert '## Application failed' not in output
|
||||
assert 'DTB Dump' in output
|
||||
if enable_initrd:
|
||||
assert 'Loading ramdisk' in output
|
||||
assert 'INITRD Dump' in output
|
||||
if enable_fdt:
|
||||
response = ubman.run_command(cmd = 'dump', wait_for_echo=False)
|
||||
assert 'EFI FIT FDT Boot Test' in response
|
||||
if enable_initrd:
|
||||
response = ubman.run_command('load', wait_for_echo=False)
|
||||
assert f"crc32: 0x0c77b025" in response
|
||||
if not enable_fdt and not enable_initrd:
|
||||
assert 'Hello, world' in output
|
||||
ubman.restart_uboot()
|
||||
|
||||
# Array slice removes leading/trailing quotes.
|
||||
@@ -449,16 +537,20 @@ def test_efi_fit_launch(ubman):
|
||||
ubman.config.dtb = control_dtb
|
||||
|
||||
# Run tests
|
||||
# - fdt OFF, gzip OFF
|
||||
launch_efi(False, False)
|
||||
# - fdt ON, gzip OFF
|
||||
launch_efi(True, False)
|
||||
# - fdt OFF, initrd OFF, gzip OFF
|
||||
launch_efi(False, False, False)
|
||||
# - fdt ON, initrd OFF, gzip OFF
|
||||
launch_efi(True, False, False)
|
||||
# - fdt OFF, initrd ON, gzip OFF
|
||||
launch_efi(False, True, False)
|
||||
|
||||
if is_sandbox:
|
||||
# - fdt OFF, gzip ON
|
||||
launch_efi(False, True)
|
||||
# - fdt ON, gzip ON
|
||||
launch_efi(True, True)
|
||||
# - fdt OFF, initrd OFF, gzip ON
|
||||
launch_efi(False, False, True)
|
||||
# - fdt ON, initrd OFF, gzip ON
|
||||
launch_efi(True, False, True)
|
||||
# - fdt OFF, initrd ON, gzip ON
|
||||
launch_efi(False, True, True)
|
||||
|
||||
finally:
|
||||
if is_sandbox:
|
||||
|
||||
@@ -13,43 +13,45 @@ that rely on network will be automatically skipped.
|
||||
|
||||
For example:
|
||||
|
||||
# Boolean indicating whether the Ethernet device is attached to USB, and hence
|
||||
# USB enumeration needs to be performed prior to network tests.
|
||||
# This variable may be omitted if its value is False.
|
||||
env__net_uses_usb = False
|
||||
.. code-block:: python
|
||||
|
||||
# Boolean indicating whether the Ethernet device is attached to PCI, and hence
|
||||
# PCI enumeration needs to be performed prior to network tests.
|
||||
# This variable may be omitted if its value is False.
|
||||
env__net_uses_pci = True
|
||||
# Boolean indicating whether the Ethernet device is attached to USB, and hence
|
||||
# USB enumeration needs to be performed prior to network tests.
|
||||
# This variable may be omitted if its value is False.
|
||||
env__net_uses_usb = False
|
||||
|
||||
# True if a DHCP server is attached to the network, and should be tested.
|
||||
# If DHCP testing is not possible or desired, this variable may be omitted or
|
||||
# set to False.
|
||||
env__net_dhcp_server = True
|
||||
# Boolean indicating whether the Ethernet device is attached to PCI, and hence
|
||||
# PCI enumeration needs to be performed prior to network tests.
|
||||
# This variable may be omitted if its value is False.
|
||||
env__net_uses_pci = True
|
||||
|
||||
# A list of environment variables that should be set in order to configure a
|
||||
# static IP. If solely relying on DHCP, this variable may be omitted or set to
|
||||
# an empty list.
|
||||
env__net_static_env_vars = [
|
||||
('ipaddr', '10.0.0.100'),
|
||||
('netmask', '255.255.255.0'),
|
||||
('serverip', '10.0.0.1'),
|
||||
]
|
||||
# True if a DHCP server is attached to the network, and should be tested.
|
||||
# If DHCP testing is not possible or desired, this variable may be omitted or
|
||||
# set to False.
|
||||
env__net_dhcp_server = True
|
||||
|
||||
# Details regarding a file that may be read from a TFTP server. This variable
|
||||
# may be omitted or set to None if TFTP testing is not possible or desired.
|
||||
env__efi_loader_helloworld_file = {
|
||||
'fn': 'lib/efi_loader/helloworld.efi', # file name
|
||||
'size': 5058624, # file length in bytes
|
||||
'crc32': 'c2244b26', # CRC32 check sum
|
||||
'addr': 0x40400000, # load address
|
||||
}
|
||||
# A list of environment variables that should be set in order to configure a
|
||||
# static IP. If solely relying on DHCP, this variable may be omitted or set to
|
||||
# an empty list.
|
||||
env__net_static_env_vars = [
|
||||
('ipaddr', '10.0.0.100'),
|
||||
('netmask', '255.255.255.0'),
|
||||
('serverip', '10.0.0.1'),
|
||||
]
|
||||
|
||||
# False if the helloworld EFI over HTTP boot test should be performed.
|
||||
# If HTTP boot testing is not possible or desired, set this variable to True or
|
||||
# ommit it.
|
||||
env__efi_helloworld_net_http_test_skip = True
|
||||
# Details regarding a file that may be read from a TFTP server. This variable
|
||||
# may be omitted or set to None if TFTP testing is not possible or desired.
|
||||
env__efi_loader_helloworld_file = {
|
||||
'fn': 'lib/efi_loader/helloworld.efi', # file name
|
||||
'size': 5058624, # file length in bytes
|
||||
'crc32': 'c2244b26', # CRC32 check sum
|
||||
'addr': 0x40400000, # load address
|
||||
}
|
||||
|
||||
# False if the helloworld EFI over HTTP boot test should be performed.
|
||||
# If HTTP boot testing is not possible or desired, set this variable to True or
|
||||
# ommit it.
|
||||
env__efi_helloworld_net_http_test_skip = True
|
||||
"""
|
||||
|
||||
import pytest
|
||||
@@ -161,6 +163,11 @@ def fetch_file(ubman, env_conf, proto):
|
||||
return addr
|
||||
|
||||
def do_test_efi_helloworld_net(ubman, proto):
|
||||
"""Download and execute the helloworld appliation
|
||||
|
||||
The helloworld.efi file is downloaded based on the value passed to us as a
|
||||
protocol and is executed using the fallback device tree at $fdtcontroladdr.
|
||||
"""
|
||||
addr = fetch_file(ubman, 'env__efi_loader_helloworld_file', proto)
|
||||
|
||||
output = ubman.run_command('bootefi %x' % addr)
|
||||
@@ -175,8 +182,7 @@ def do_test_efi_helloworld_net(ubman, proto):
|
||||
def test_efi_helloworld_net_tftp(ubman):
|
||||
"""Run the helloworld.efi binary via TFTP.
|
||||
|
||||
The helloworld.efi file is downloaded from the TFTP server and is executed
|
||||
using the fallback device tree at $fdtcontroladdr.
|
||||
Call the do_test_efi_helloworld_net function to execute the test via TFTP.
|
||||
"""
|
||||
|
||||
do_test_efi_helloworld_net(ubman, PROTO_TFTP);
|
||||
@@ -187,8 +193,7 @@ def test_efi_helloworld_net_tftp(ubman):
|
||||
def test_efi_helloworld_net_http(ubman):
|
||||
"""Run the helloworld.efi binary via HTTP.
|
||||
|
||||
The helloworld.efi file is downloaded from the HTTP server and is executed
|
||||
using the fallback device tree at $fdtcontroladdr.
|
||||
Call the do_test_efi_helloworld_net function to execute the test via HTTP.
|
||||
"""
|
||||
if ubman.config.env.get('env__efi_helloworld_net_http_test_skip', True):
|
||||
pytest.skip('helloworld.efi HTTP test is not enabled!')
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
# Test various network-related functionality, such as the dhcp, ping, and
|
||||
# tftpboot commands.
|
||||
|
||||
import pytest
|
||||
import utils
|
||||
import uuid
|
||||
import datetime
|
||||
import re
|
||||
|
||||
"""
|
||||
Note: This test relies on boardenv_* containing configuration values to define
|
||||
which network environment is available for testing. Without this, this test
|
||||
@@ -17,77 +11,85 @@ will be automatically skipped.
|
||||
|
||||
For example:
|
||||
|
||||
# Boolean indicating whether the Ethernet device is attached to USB, and hence
|
||||
# USB enumeration needs to be performed prior to network tests.
|
||||
# This variable may be omitted if its value is False.
|
||||
env__net_uses_usb = False
|
||||
.. code-block:: python
|
||||
|
||||
# Boolean indicating whether the Ethernet device is attached to PCI, and hence
|
||||
# PCI enumeration needs to be performed prior to network tests.
|
||||
# This variable may be omitted if its value is False.
|
||||
env__net_uses_pci = True
|
||||
# Boolean indicating whether the Ethernet device is attached to USB, and hence
|
||||
# USB enumeration needs to be performed prior to network tests.
|
||||
# This variable may be omitted if its value is False.
|
||||
env__net_uses_usb = False
|
||||
|
||||
# True if a DHCP server is attached to the network, and should be tested.
|
||||
# If DHCP testing is not possible or desired, this variable may be omitted or
|
||||
# set to False.
|
||||
env__net_dhcp_server = True
|
||||
# Boolean indicating whether the Ethernet device is attached to PCI, and hence
|
||||
# PCI enumeration needs to be performed prior to network tests.
|
||||
# This variable may be omitted if its value is False.
|
||||
env__net_uses_pci = True
|
||||
|
||||
# False or omitted if a DHCP server is attached to the network, and dhcp abort
|
||||
# case should be tested.
|
||||
# If DHCP abort testing is not possible or desired, set this variable to True.
|
||||
# For example: On some setup, dhcp is too fast and this case may not work.
|
||||
env__dhcp_abort_test_skip = True
|
||||
# True if a DHCP server is attached to the network, and should be tested.
|
||||
# If DHCP testing is not possible or desired, this variable may be omitted or
|
||||
# set to False.
|
||||
env__net_dhcp_server = True
|
||||
|
||||
# True if a DHCPv6 server is attached to the network, and should be tested.
|
||||
# If DHCPv6 testing is not possible or desired, this variable may be omitted or
|
||||
# set to False.
|
||||
env__net_dhcp6_server = True
|
||||
# False or omitted if a DHCP server is attached to the network, and dhcp abort
|
||||
# case should be tested.
|
||||
# If DHCP abort testing is not possible or desired, set this variable to True.
|
||||
# For example: On some setup, dhcp is too fast and this case may not work.
|
||||
env__dhcp_abort_test_skip = True
|
||||
|
||||
# A list of environment variables that should be set in order to configure a
|
||||
# static IP. If solely relying on DHCP, this variable may be omitted or set to
|
||||
# an empty list.
|
||||
env__net_static_env_vars = [
|
||||
('ipaddr', '10.0.0.100'),
|
||||
('netmask', '255.255.255.0'),
|
||||
('serverip', '10.0.0.1'),
|
||||
]
|
||||
# True if a DHCPv6 server is attached to the network, and should be tested.
|
||||
# If DHCPv6 testing is not possible or desired, this variable may be omitted or
|
||||
# set to False.
|
||||
env__net_dhcp6_server = True
|
||||
|
||||
# Details regarding a file that may be read from a TFTP server. This variable
|
||||
# may be omitted or set to None if TFTP testing is not possible or desired.
|
||||
env__net_tftp_readable_file = {
|
||||
'fn': 'ubtest-readable.bin',
|
||||
'addr': 0x10000000,
|
||||
'size': 5058624,
|
||||
'crc32': 'c2244b26',
|
||||
'timeout': 50000,
|
||||
'fnu': 'ubtest-upload.bin',
|
||||
}
|
||||
# A list of environment variables that should be set in order to configure a
|
||||
# static IP. If solely relying on DHCP, this variable may be omitted or set to
|
||||
# an empty list.
|
||||
env__net_static_env_vars = [
|
||||
('ipaddr', '10.0.0.100'),
|
||||
('netmask', '255.255.255.0'),
|
||||
('serverip', '10.0.0.1'),
|
||||
]
|
||||
|
||||
# Details regarding a file that may be read from a NFS server. This variable
|
||||
# may be omitted or set to None if NFS testing is not possible or desired.
|
||||
env__net_nfs_readable_file = {
|
||||
'fn': 'ubtest-readable.bin',
|
||||
'addr': 0x10000000,
|
||||
'size': 5058624,
|
||||
'crc32': 'c2244b26',
|
||||
}
|
||||
# Details regarding a file that may be read from a TFTP server. This variable
|
||||
# may be omitted or set to None if TFTP testing is not possible or desired.
|
||||
env__net_tftp_readable_file = {
|
||||
'fn': 'ubtest-readable.bin',
|
||||
'addr': 0x10000000,
|
||||
'size': 5058624,
|
||||
'crc32': 'c2244b26',
|
||||
'timeout': 50000,
|
||||
'fnu': 'ubtest-upload.bin',
|
||||
}
|
||||
|
||||
# Details regarding a file that may be read from a TFTP server. This variable
|
||||
# may be omitted or set to None if PXE testing is not possible or desired.
|
||||
env__net_pxe_readable_file = {
|
||||
'fn': 'default',
|
||||
'addr': 0x2000000,
|
||||
'size': 74,
|
||||
'timeout': 50000,
|
||||
'pattern': 'Linux',
|
||||
}
|
||||
# Details regarding a file that may be read from a NFS server. This variable
|
||||
# may be omitted or set to None if NFS testing is not possible or desired.
|
||||
env__net_nfs_readable_file = {
|
||||
'fn': 'ubtest-readable.bin',
|
||||
'addr': 0x10000000,
|
||||
'size': 5058624,
|
||||
'crc32': 'c2244b26',
|
||||
}
|
||||
|
||||
# True if a router advertisement service is connected to the network, and should
|
||||
# be tested. If router advertisement testing is not possible or desired, this
|
||||
variable may be omitted or set to False.
|
||||
env__router_on_net = True
|
||||
# Details regarding a file that may be read from a TFTP server. This variable
|
||||
# may be omitted or set to None if PXE testing is not possible or desired.
|
||||
env__net_pxe_readable_file = {
|
||||
'fn': 'default',
|
||||
'addr': 0x2000000,
|
||||
'size': 74,
|
||||
'timeout': 50000,
|
||||
'pattern': 'Linux',
|
||||
}
|
||||
|
||||
# True if a router advertisement service is connected to the network, and should
|
||||
# be tested. If router advertisement testing is not possible or desired, this
|
||||
variable may be omitted or set to False.
|
||||
env__router_on_net = True
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import utils
|
||||
import uuid
|
||||
import datetime
|
||||
import re
|
||||
|
||||
net_set_up = False
|
||||
net6_set_up = False
|
||||
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# (C) Copyright 2023, Advanced Micro Devices, Inc.
|
||||
|
||||
import pytest
|
||||
import utils
|
||||
import test_net
|
||||
import re
|
||||
|
||||
"""
|
||||
Note: This test relies on boardenv_* containing configuration values to define
|
||||
which the network environment available for testing. Without this, this test
|
||||
@@ -13,77 +8,88 @@ will be automatically skipped.
|
||||
|
||||
For example:
|
||||
|
||||
# Details regarding a boot image file that may be read from a TFTP server. This
|
||||
# variable may be omitted or set to None if TFTP boot testing is not possible
|
||||
# or desired.
|
||||
env__net_tftp_bootable_file = {
|
||||
'fn': 'image.ub',
|
||||
'addr': 0x10000000,
|
||||
'size': 5058624,
|
||||
'crc32': 'c2244b26',
|
||||
'pattern': 'Linux',
|
||||
'config': 'config@2',
|
||||
'timeout': 50000,
|
||||
'check_type': 'boot_error',
|
||||
'check_pattern': 'ERROR',
|
||||
}
|
||||
.. code-block:: python
|
||||
|
||||
# False or omitted if a TFTP boot test should be tested.
|
||||
# If TFTP boot testing is not possible or desired, set this variable to True.
|
||||
# For example: If FIT image is not proper to boot
|
||||
env__tftp_boot_test_skip = False
|
||||
# Details regarding a boot image file that may be read from a TFTP server. This
|
||||
# variable may be omitted or set to None if TFTP boot testing is not possible
|
||||
# or desired.
|
||||
env__net_tftp_bootable_file = {
|
||||
'fn': 'image.ub',
|
||||
'addr': 0x10000000,
|
||||
'size': 5058624,
|
||||
'crc32': 'c2244b26',
|
||||
'pattern': 'Linux',
|
||||
'config': 'config@2',
|
||||
'timeout': 50000,
|
||||
'check_type': 'boot_error',
|
||||
'check_pattern': 'ERROR',
|
||||
}
|
||||
|
||||
# Here is the example of FIT image configurations:
|
||||
configurations {
|
||||
default = "config@1";
|
||||
config@1 {
|
||||
description = "Boot Linux kernel with config@1";
|
||||
kernel = "kernel@0";
|
||||
fdt = "fdt@0";
|
||||
ramdisk = "ramdisk@0";
|
||||
hash@1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
config@2 {
|
||||
description = "Boot Linux kernel with config@2";
|
||||
kernel = "kernel@1";
|
||||
fdt = "fdt@1";
|
||||
ramdisk = "ramdisk@1";
|
||||
hash@1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
};
|
||||
# False or omitted if a TFTP boot test should be tested.
|
||||
# If TFTP boot testing is not possible or desired, set this variable to True.
|
||||
# For example: If FIT image is not proper to boot
|
||||
env__tftp_boot_test_skip = False
|
||||
|
||||
# Details regarding a file that may be read from a TFTP server. This variable
|
||||
# may be omitted or set to None if PXE testing is not possible or desired.
|
||||
env__net_pxe_bootable_file = {
|
||||
'fn': 'default',
|
||||
'addr': 0x10000000,
|
||||
'size': 74,
|
||||
'timeout': 50000,
|
||||
'pattern': 'Linux',
|
||||
'valid_label': '1',
|
||||
'invalid_label': '2',
|
||||
'exp_str_invalid': 'Skipping install for failure retrieving',
|
||||
'local_label': '3',
|
||||
'exp_str_local': 'missing environment variable: localcmd',
|
||||
'empty_label': '4',
|
||||
'exp_str_empty': 'No kernel given, skipping boot',
|
||||
'check_type': 'boot_error',
|
||||
'check_pattern': 'ERROR',
|
||||
}
|
||||
|
||||
# False if a PXE boot test should be tested.
|
||||
# If PXE boot testing is not possible or desired, set this variable to True.
|
||||
# For example: If pxe configuration file is not proper to boot
|
||||
env__pxe_boot_test_skip = False
|
||||
Here is the example of FIT image configurations:
|
||||
|
||||
.. code-block:: devicetree
|
||||
|
||||
configurations {
|
||||
default = "config@1";
|
||||
config@1 {
|
||||
description = "Boot Linux kernel with config@1";
|
||||
kernel = "kernel@0";
|
||||
fdt = "fdt@0";
|
||||
ramdisk = "ramdisk@0";
|
||||
hash@1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
config@2 {
|
||||
description = "Boot Linux kernel with config@2";
|
||||
kernel = "kernel@1";
|
||||
fdt = "fdt@1";
|
||||
ramdisk = "ramdisk@1";
|
||||
hash@1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Details regarding a file that may be read from a TFTP server. This variable
|
||||
# may be omitted or set to None if PXE testing is not possible or desired.
|
||||
env__net_pxe_bootable_file = {
|
||||
'fn': 'default',
|
||||
'addr': 0x10000000,
|
||||
'size': 74,
|
||||
'timeout': 50000,
|
||||
'pattern': 'Linux',
|
||||
'valid_label': '1',
|
||||
'invalid_label': '2',
|
||||
'exp_str_invalid': 'Skipping install for failure retrieving',
|
||||
'local_label': '3',
|
||||
'exp_str_local': 'missing environment variable: localcmd',
|
||||
'empty_label': '4',
|
||||
'exp_str_empty': 'No kernel given, skipping boot',
|
||||
'check_type': 'boot_error',
|
||||
'check_pattern': 'ERROR',
|
||||
}
|
||||
|
||||
# False if a PXE boot test should be tested.
|
||||
# If PXE boot testing is not possible or desired, set this variable to True.
|
||||
# For example: If pxe configuration file is not proper to boot
|
||||
env__pxe_boot_test_skip = False
|
||||
|
||||
Here is the example of pxe configuration file ordered based on the execution
|
||||
flow:
|
||||
|
||||
# Here is the example of pxe configuration file ordered based on the execution
|
||||
# flow:
|
||||
1) /tftpboot/pxelinux.cfg/default-arm-zynqmp
|
||||
|
||||
.. code-block::
|
||||
|
||||
menu include pxelinux.cfg/default-arm
|
||||
timeout 50
|
||||
|
||||
@@ -91,6 +97,8 @@ env__pxe_boot_test_skip = False
|
||||
|
||||
2) /tftpboot/pxelinux.cfg/default-arm
|
||||
|
||||
.. code-block::
|
||||
|
||||
menu title Linux boot selections
|
||||
menu include pxelinux.cfg/default
|
||||
|
||||
@@ -110,6 +118,8 @@ env__pxe_boot_test_skip = False
|
||||
|
||||
3) /tftpboot/pxelinux.cfg/default
|
||||
|
||||
.. code-block::
|
||||
|
||||
label Linux
|
||||
menu label Boot kernel
|
||||
kernel Image
|
||||
@@ -117,12 +127,27 @@ env__pxe_boot_test_skip = False
|
||||
initrd rootfs.cpio.gz.u-boot
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import utils
|
||||
import test_net
|
||||
import re
|
||||
|
||||
def setup_networking(ubman):
|
||||
"""Setup networking
|
||||
|
||||
Making use of the test_net test, first try and configure networking via
|
||||
DHCP. If this fails, fall back to static configuration.
|
||||
"""
|
||||
test_net.test_net_dhcp(ubman)
|
||||
if not test_net.net_set_up:
|
||||
test_net.test_net_setup_static(ubman)
|
||||
|
||||
def setup_tftpboot_boot(ubman):
|
||||
"""Setup for the tftpboot 'boot' test
|
||||
|
||||
We check that a file to use has been configured. If it has, we download it
|
||||
and ensure it has the expected crc32 value.
|
||||
"""
|
||||
f = ubman.config.env.get('env__net_tftp_bootable_file', None)
|
||||
if not f:
|
||||
pytest.skip('No TFTP bootable file to read')
|
||||
@@ -198,6 +223,10 @@ def test_net_tftpboot_boot(ubman):
|
||||
ubman.cleanup_spawn()
|
||||
|
||||
def setup_pxe_boot(ubman):
|
||||
"""Setup for the PXE 'boot' test
|
||||
|
||||
Make sure that the file to load via PXE boot has been configured.
|
||||
"""
|
||||
f = ubman.config.env.get('env__net_pxe_bootable_file', None)
|
||||
if not f:
|
||||
pytest.skip('No PXE bootable file to read')
|
||||
|
||||
Reference in New Issue
Block a user