[u-boot-test-hooks PATCH 3/3] RFC: Add some network info for ellesmere lab
Simon Glass
sjg at chromium.org
Fri Feb 21 21:32:42 CET 2025
Provide network configuration so that some networking tests can be run
on ellesmere.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
py/ellesmere/ellesmere_tftp.py | 32 ++++++++++++++++
py/ellesmere/u_boot_boardenv_qemu_arm64_na.py | 18 +++++++++
py/ellesmere/u_boot_boardenv_qemu_arm_na.py | 18 +++++++++
py/ellesmere/u_boot_boardenv_rpi_3_32b.py | 38 +++++++++++++++++++
4 files changed, 106 insertions(+)
create mode 100644 py/ellesmere/ellesmere_tftp.py
create mode 100644 py/ellesmere/u_boot_boardenv_qemu_arm64_na.py
create mode 100644 py/ellesmere/u_boot_boardenv_qemu_arm_na.py
create mode 100644 py/ellesmere/u_boot_boardenv_rpi_3_32b.py
diff --git a/py/ellesmere/ellesmere_tftp.py b/py/ellesmere/ellesmere_tftp.py
new file mode 100644
index 0000000..d2aeb58
--- /dev/null
+++ b/py/ellesmere/ellesmere_tftp.py
@@ -0,0 +1,32 @@
+import os
+import binascii
+
+def file2env(file_name, addr=None):
+ """Create dictionary describing file
+
+ @filename: name of the file to be described
+ @addr: address used for loading the file as int (e.g. 0x40400000)
+ Return: dictionary describing the file with entries
+ * fn - filename
+ * size - file size in bytes
+ * crc32 - checksum using CRC-32 algorithm
+ * addr - loading address, optional
+ """
+ file_full = '/tmp/b/qemu_arm64/' + file_name
+
+ if not os.path.isfile(file_full):
+ print(f'{file_full} not found')
+ return None
+
+ ret = {
+ "fn": file_name,
+ "size": os.path.getsize(file_full),
+ }
+
+ with open(file_full, 'rb') as fd:
+ ret["crc32"] = hex(binascii.crc32(fd.read()) & 0xffffffff)[2:]
+
+ if addr is not None:
+ ret['addr'] = addr
+
+ return ret
diff --git a/py/ellesmere/u_boot_boardenv_qemu_arm64_na.py b/py/ellesmere/u_boot_boardenv_qemu_arm64_na.py
new file mode 100644
index 0000000..23db106
--- /dev/null
+++ b/py/ellesmere/u_boot_boardenv_qemu_arm64_na.py
@@ -0,0 +1,18 @@
+import os
+import ellesmere_tftp
+
+#env__net_static_env_vars = [
+ #('ipaddr', '192.168.4.41'),
+ #('netmask', '255.255.255.0'),
+ #('serverip', '192.168.4.1'),
+#]
+
+env__net_uses_pci = True
+env__net_dhcp_server = True
+env__net_tftp_readable_file = ellesmere_tftp.file2env('u-boot.bin', 0x40400000)
+env__efi_loader_helloworld_file = ellesmere_tftp.file2env('helloworld.efi', 0x40400000)
+env__efi_loader_grub_file = ellesmere_tftp.file2env('grubaa64.efi', 0x40400000)
+env__efi_fit_tftp_file = {
+ 'addr' : 0x40400000,
+ "dn" : os.environ['UBOOT_TRAVIS_BUILD_DIR'],
+}
diff --git a/py/ellesmere/u_boot_boardenv_qemu_arm_na.py b/py/ellesmere/u_boot_boardenv_qemu_arm_na.py
new file mode 100644
index 0000000..23db106
--- /dev/null
+++ b/py/ellesmere/u_boot_boardenv_qemu_arm_na.py
@@ -0,0 +1,18 @@
+import os
+import ellesmere_tftp
+
+#env__net_static_env_vars = [
+ #('ipaddr', '192.168.4.41'),
+ #('netmask', '255.255.255.0'),
+ #('serverip', '192.168.4.1'),
+#]
+
+env__net_uses_pci = True
+env__net_dhcp_server = True
+env__net_tftp_readable_file = ellesmere_tftp.file2env('u-boot.bin', 0x40400000)
+env__efi_loader_helloworld_file = ellesmere_tftp.file2env('helloworld.efi', 0x40400000)
+env__efi_loader_grub_file = ellesmere_tftp.file2env('grubaa64.efi', 0x40400000)
+env__efi_fit_tftp_file = {
+ 'addr' : 0x40400000,
+ "dn" : os.environ['UBOOT_TRAVIS_BUILD_DIR'],
+}
diff --git a/py/ellesmere/u_boot_boardenv_rpi_3_32b.py b/py/ellesmere/u_boot_boardenv_rpi_3_32b.py
new file mode 100644
index 0000000..9cc2e1f
--- /dev/null
+++ b/py/ellesmere/u_boot_boardenv_rpi_3_32b.py
@@ -0,0 +1,38 @@
+import ellesmere_tftp
+
+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
--
2.43.0
More information about the U-Boot
mailing list