Write a BLS type 1 loader entry alongside the extlinux.conf already on the
Fedora test image, pointing at the same kernel, initrd and devicetree.

The entry is inert until the bootmeth is bound, so no test expectations
change here.

Signed-off-by: Alexey Charkov <[email protected]>
---
 test/py/tests/test_ut.py | 58 +++++++++++++++++++++++++++++++++---------------
 1 file changed, 40 insertions(+), 18 deletions(-)

diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index fa50c8008a58..28f028453ea9 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -159,10 +159,13 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
     fsh.cleanup()
 
 
-def setup_extlinux_image(ubman, devnum, basename, vmlinux, initrd, dtbdir,
-                         script):
+def setup_extlinux_bls_image(ubman, devnum, basename, vmlinux, initrd, dtbdir):
     """Create a 20MB disk image with a single FAT partition
 
+    The image carries both an extlinux/extlinux.conf and an equivalent BLS
+    type 1 entry under loader/entries/, so that the two bootmeths can be
+    exercised against the same kernel, initrd and devicetree.
+
     Args:
         ubman (ConsoleBase): Console to use
         devnum (int): Device number to use, e.g. 1
@@ -170,7 +173,6 @@ def setup_extlinux_image(ubman, devnum, basename, vmlinux, 
initrd, dtbdir,
         vmlinux (str): Kernel filename
         initrd (str): Ramdisk filename
         dtbdir (str or None): Devicetree filename
-        script (str): Script to place in the extlinux.conf file
     """
     fsh = FsHelper(ubman.config, 'vfat', 18, prefix=basename)
     fsh.setup()
@@ -178,10 +180,44 @@ def setup_extlinux_image(ubman, devnum, basename, 
vmlinux, initrd, dtbdir,
     ext = os.path.join(fsh.srcdir, 'extlinux')
     mkdir_cond(ext)
 
+    script = '''# extlinux.conf generated by appliance-creator
+ui menu.c32
+menu autoboot Welcome to Fedora-Workstation-armhfp-31-1.9. Automatic boot in # 
second{,s}. Press a key for options.
+menu title Fedora-Workstation-armhfp-31-1.9 Boot Options.
+menu hidden
+timeout 20
+totaltimeout 600
+
+label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
+        kernel /%s
+        append ro root=UUID=9732b35b-4cd5-458b-9b91-80f7047e0b8a rhgb quiet 
LANG=en_US.UTF-8 cma=192MB cma=256MB
+        fdtdir /%s/
+        initrd /%s''' % (vmlinux, dtbdir, initrd)
+
     conf = os.path.join(ext, 'extlinux.conf')
     with open(conf, 'w', encoding='ascii') as fd:
         print(script, file=fd)
 
+    bls = os.path.join(fsh.srcdir, 'loader')
+    mkdir_cond(bls)
+    bls = os.path.join(bls, 'entries')
+    mkdir_cond(bls)
+
+    script = '''# BLS type 1 loader entry generated by appliance-creator
+title Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
+version 5.3.7-301.fc31.armv7hl
+machine-id 4098b3f648d74c13b1f04ccfba7798e8
+sort-key fedora
+architecture arm
+linux /%s
+options ro root=UUID=9732b35b-4cd5-458b-9b91-80f7047e0b8a rhgb quiet 
LANG=en_US.UTF-8 cma=192MB cma=256MB
+devicetree /%s/sandbox.dtb
+initrd /%s''' % (vmlinux, dtbdir, initrd)
+
+    conf = os.path.join(bls, 
'4098b3f648d74c13b1f04ccfba7798e8-5.3.7-301.fc31.armv7hl.conf')
+    with open(conf, 'w', encoding='ascii') as fd:
+        print(script, file=fd)
+
     inf = os.path.join(ubman.config.persistent_data_dir, 'inf')
     with open(inf, 'wb') as fd:
         fd.write(gzip.compress(b'vmlinux'))
@@ -223,21 +259,7 @@ def setup_fedora_image(ubman, devnum, basename):
     vmlinux = 'vmlinuz-5.3.7-301.fc31.armv7hl'
     initrd = 'initramfs-5.3.7-301.fc31.armv7hl.img'
     dtbdir = 'dtb-5.3.7-301.fc31.armv7hl'
-    script = '''# extlinux.conf generated by appliance-creator
-ui menu.c32
-menu autoboot Welcome to Fedora-Workstation-armhfp-31-1.9. Automatic boot in # 
second{,s}. Press a key for options.
-menu title Fedora-Workstation-armhfp-31-1.9 Boot Options.
-menu hidden
-timeout 20
-totaltimeout 600
-
-label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
-        kernel /%s
-        append ro root=UUID=9732b35b-4cd5-458b-9b91-80f7047e0b8a rhgb quiet 
LANG=en_US.UTF-8 cma=192MB cma=256MB
-        fdtdir /%s/
-        initrd /%s''' % (vmlinux, dtbdir, initrd)
-    setup_extlinux_image(ubman, devnum, basename, vmlinux, initrd, dtbdir,
-                         script)
+    setup_extlinux_bls_image(ubman, devnum, basename, vmlinux, initrd, dtbdir)
 
 def setup_cros_image(ubman):
     """Create a 20MB disk image with ChromiumOS partitions"""

-- 
2.54.0

Reply via email to