[PATCH v5] test/py: net_boot: Add test cases for net boot

Tom Rini trini at konsulko.com
Tue May 28 23:30:24 CEST 2024


On Tue, May 28, 2024 at 02:33:17PM +0530, Love Kumar wrote:

> 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.

Good news is that the kernel test is working for me now. Bad news is the
PXE test fails, but good news is I figure out the problem.

[snip]
> +def setup_tftpboot_boot(u_boot_console):
> +    f = u_boot_console.config.env.get('env__net_tftp_bootable_file', None)
> +    if not f:
> +        pytest.skip('No TFTP bootable file to read')
> +
> +    test_net.test_net_dhcp(u_boot_console)
> +    if not test_net.net_set_up:
> +        test_net.test_net_setup_static(u_boot_console)

This works for me, and matches how other tests are written. However:

[snip]
> +def setup_pxe_boot(u_boot_console):
> +    f = u_boot_console.config.env.get('env__net_pxe_bootable_file', None)
> +    if not f:
> +        pytest.skip('No PXE bootable file to read')
> +
> +    test_net.test_net_dhcp(u_boot_console)
> +    test_net.test_net_setup_static(u_boot_console)
> +    return f

This doesn't check for if dhcp worked and skips the test when DHCP works
but there's no static config, which is how my lab is. For v6 we should
have a setup_networking function that both the TFTP and PXE tests call
in to that does what I suggested above. And what I suggested above
would be a good clean-up to the xilinx-specific tests.

That said, with a local fixup so that my network is configured, and
having pxelinux.cfg/01-b8-27-eb-fc-64-a6 (the first file pxe boot looks
for on my test Pi), pxeboot.cfg/default and pxeboot.cfg/default-arm all
configured from the examples given in the test itself, I get:
------------------------------------ Captured stdout call -------------------------------------
U-Boot> setenv autoload no
U-Boot> U-Boot> dhcp
Waiting for Ethernet connection... done.
BOOTP broadcast 1
BOOTP broadcast 2
DHCP client bound to address 192.168.1.100 (255 ms)
U-Boot> U-Boot> pxe get
missing environment variable: pxeuuid
Retrieving file: pxelinux.cfg/01-b8-27-eb-fc-64-a6
Waiting for Ethernet connection... done.
Using smsc95xx_eth device
TFTP from server 192.168.1.10; our IP address is 192.168.1.100
Filename 'pxelinux.cfg/01-b8-27-eb-fc-64-a6'.
Load address: 0x2500000
Loading: ##################################################  64 Bytes
         0 Bytes/s
done
Bytes transferred = 64 (40 hex)
Config file '<NULL>' found
U-Boot>
=================================== short test summary info ===================================

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240528/d0f936c0/attachment.sig>


More information about the U-Boot mailing list