[PATCH v3 00/46] pxe: Support read_all() for extlinux and PXE
Tom Rini
trini at konsulko.com
Tue Jan 21 00:44:57 CET 2025
On Mon, Jan 20, 2025 at 12:20:06PM -0700, Simon Glass wrote:
> Hi Tom,
>
> On Thu, 16 Jan 2025 at 16:28, Tom Rini <trini at konsulko.com> wrote:
> >
> > On Thu, Dec 05, 2024 at 07:35:39PM -0700, Simon Glass wrote:
> >
> > > This series implements read_all() so that it is possible to read all the
> > > files relating to a bootflow, make adjustments and then boot.
> > >
> > > Unfortunately quite a few things stand in the way, so this series
> > > finishes off several pending items: zboot without CONFIG_CMDLINE,
> > > required support in pxe_utils and the differing code in the extlinux and
> > > PXE bootmeths. There is very little new code, but quite a lot of
> > > refactoring.
> > >
> > > The bootm, booti and bootz commands have all been refactored previously,
> > > so that they can operate without needing CONFIG_CMDLINE to be enabled.
> > > At the, time, zboot was left alone, since it is x86-specific and a bit
> > > more trouble.
> > >
> > > However it turns out that the booti support doesn't work with compressed
> > > booti images, so this series resolved that problem too.
> > >
> > > This series adds a programatic API for zboot and uses the forthcoming
> > > bootstd 'image list' to collect information from an extlinux file. It is
> > > therefore possible to parse the file, load the resulting images and then
> > > examine/adjust the resulting bootflow, before booting.
> > >
> > > The addition of options to extlinux resulted in the PXE and extlinux
> > > bootmeth having slightly different features. This is tidied up in this
> > > series, with common functions for both. This allows the same features
> > > (loading images as a separate step) to be provided for PXE.
> >
> > To sync up with what I said on IRC, this breaks
> > test/py/tests/test_net_boot.py likely due to changes in the output.
>
> I am taking a look at this, but I'm really not sure how to set up
> test_net_pxe_boot_config test
>
> I have this in my py/ellesmere/u_boot_boardenv_rpi_3_32b.py file:
>
> env__pxe_boot_test_skip = False
> env__net_pxe_bootable_file = {
> 'fn': 'default.boot',
> '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',
> }
>
> This is what I see when running test_net_pxe_boot_config :
>
> test/py/tests/test_net_boot.py +u-boot-test-reset rpi_3_32b rpi3
> {lab mode}
> Building U-Boot in pytest-source dir for rpi_3_32b
> Bootstrapping U-Boot from dir /tmp/b/rpi_3_32b
> Writing U-Boot using method rpi3
> cat: /sys/class/block/sdz1/size: No such file or directory
> cat: /sys/class/block/sdz1/size: No such file or directory
>
> {lab ready in 10.4s: U-Boot 2025.01-rc6-00508-gd6da3dbaef57-dirty (Jan
> 20 2025 - 12:11:05 -0700)}
> skip False
> U-Boot> setenv autoload no
> U-Boot> U-Boot> dhcp
> Waiting for Ethernet connection... done.
> BOOTP broadcast 1
> DHCP client bound to address 192.168.4.50 (4 ms)
> U-Boot> U-Boot> echo $bootfile
>
> U-Boot> U-Boot> setenv pxefile_addr_r 10000000
> U-Boot> U-Boot> pxe get
> missing environment variable: pxeuuid
> Retrieving file: pxelinux.cfg/01-b8-27-eb-b4-f9-f2
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/01-b8-27-eb-b4-f9-f2'.
> Load address: 0x10000000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Retrieving file: pxelinux.cfg/C0A80432
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/C0A80432'.
> Load address: 0x10000000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Retrieving file: pxelinux.cfg/C0A8043
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/C0A8043'.
> Load address: 0x10000000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Retrieving file: pxelinux.cfg/C0A804
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/C0A804'.
> Load address: 0x10000000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Retrieving file: pxelinux.cfg/C0A80
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/C0A80'.
> Load address: 0x10000000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Retrieving file: pxelinux.cfg/C0A8
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/C0A8'.
> Load address: 0x10000000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Retrieving file: pxelinux.cfg/C0A
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/C0A'.
> Load address: 0x10000000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Retrieving file: pxelinux.cfg/C0
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/C0'.
> Load address: 0x10000000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Retrieving file: pxelinux.cfg/C
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/C'.
> Load address: 0x10000000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Retrieving file: pxelinux.cfg/default-arm-bcm283x-rpi
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/default-arm-bcm283x-rpi'.
> Load address: 0x10000000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Retrieving file: pxelinux.cfg/default-arm-bcm283x
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/default-arm-bcm283x'.
> Load address: 0x10000000
> Loading: ################################################## 64 Bytes
> 4.9 KiB/s
> done
> Bytes transferred = 64 (40 hex)
> Config file '<NULL>' found
> U-Boot> U-Boot> pxe boot 10000000
> Retrieving file: pxelinux.cfg/default-arm
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/default-arm'.
> Load address: 0x10000044
> Loading: ################################################## 349 Bytes
> 30.3 KiB/s
> done
> Bytes transferred = 349 (15d hex)
> Retrieving file: pxelinux.cfg/default
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/default'.
> Load address: 0x100001a4
> Loading: ################################################## 108 Bytes
> 9.8 KiB/s
> done
> Bytes transferred = 108 (6c hex)
> Linux boot selections
> 1: Boot kernel
> 2: Invalid boot
> 3: Local boot
> 4: Empty boot
> Enter choice: 3
> 3: Local boot
> missing environment variable: localcmd
> U-Boot> pxe boot 10000000
> Retrieving file: pxelinux.cfg/default-arm
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/default-arm'.
> Load address: 0x10000044
> Loading: ################################################## 349 Bytes
> 19.5 KiB/s
> done
> Bytes transferred = 349 (15d hex)
> Retrieving file: pxelinux.cfg/default
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'pxelinux.cfg/default'.
> Load address: 0x100001a4
> Loading: ################################################## 108 Bytes
> 9.8 KiB/s
> done
> Bytes transferred = 108 (6c hex)
> Linux boot selections
> 1: Boot kernel
> 2: Invalid boot
> 3: Local boot
> 4: Empty boot
> Enter choice: 4
> 4: Empty boot
> No kernel given, skipping boot
> 1: Boot kernel
> Retrieving file: Image
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'Image'.
> Load address: 0x80000
> Loading: ################################################## 6 Bytes
> 0 Bytes/s
> done
> Bytes transferred = 6 (6 hex)
> Retrieving file: rootfs.cpio.gz.u-boot
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'rootfs.cpio.gz.u-boot'.
> Load address: 0x2700000
> Loading: ################################################## 30.6 MiB
> 995.1 KiB/s
> done
> Bytes transferred = 32123014 (1ea2886 hex)
> Retrieving file: system.dtb
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'system.dtb'.
> Load address: 0x2600000
> Loading: ################################################## 11 Bytes
> 1000 Bytes/s
> done
> Bytes transferred = 11 (b hex)
> zimage: Bad magic!
> 2: Invalid boot
> Retrieving file: kernels/install.bin
> Waiting for Ethernet connection... done.
> Using smsc95xx_eth device
> TFTP from server 192.168.4.1; our IP address is 192.168.4.50
> Filename 'kernels/install.bin'.
> Load address: 0x80000
> Loading: *
> TFTP error: 'File not found' (1)
> Not retrying...
> Skipping install for failure retrieving kernel
> 3: Local boot
> missing environment variable: localcmd
> U-Boot> F
>
> Do you have a passing run I could compare against, and/or a boardenv
> file that works?
I didn't test this on 32bit ARM, only 64bit. For Pi 3:
env__net_uses_usb = True
env__net_dhcp_server = True
env__tftp_boot_test_skip = False
env__net_tftp_bootable_file = {
'fn': 'v6.6/image.fit.nocomp',
'addr': 0x00200000,
'size': 85984256,
'crc32': '754c839a',
'pattern': 'Linux',
'config': 'conf-852',
}
# 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': 0x00200000,
'size': 64,
'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',
}
# False or omitted 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
And:
$ cat /srv/tftp/pxelinux.cfg/default
label Linux
menu label Boot kernel
kernel Image
fdt system.dtb
initrd rootfs.cpio.gz.u-boot
$ cat /srv/tftp/pxelinux.cfg/default-arm
menu title Linux boot selections
menu include pxelinux.cfg/default
label install
menu label Invalid boot
kernel kernels/install.bin
append console=ttyAMA0,38400 debug earlyprintk
initrd initrds/uzInitrdDebInstall
label local
menu label Local boot
append root=/dev/sdb1
localboot 1
label boot
menu label Empty boot
$ cat /srv/tftp/pxelinux.cfg/01-b8-27-eb-fc-64-a6
menu include pxelinux.cfg/default-arm
timeout 50
default Linux
And kernels/install.bin, etc, do not exist. Only v6.6/image.fit.nocomp
exists.
--
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/20250120/d1e97388/attachment.sig>
More information about the U-Boot
mailing list