test: Add a test for booting Ubuntu 24.04

Now that U-Boot can boot this quickly, using kvm, add a test that the
installer starts up correctly.

Use the qemu-x86_64 board in the SJG lab.

Series-to: u-boot
Series-cc: bin
Series-version: 5
Series-links: 447304 2:445849 1:444626
Series-changes: 2
- Add more patches to support booting with kvm
- Add new patch with a test for booting Ubuntu 24.04

Series-changes: 3
- Significantly expanded to correct e820 and other issues

Series-changes: 5
- Drop timeouts patch
- Use Ctrl-N instead of down-arrow to make the test more reliable
- Add more logging into the test

Cover-letter:
x86: Improve operation under QEMU
U-Boot can start and boot an OS in both qemu-x86 and qemu-x86_64 but it
is not perfect.

With both builds, executing the VESA ROM causes an intermittent hang, at
least on some AMD CPUs.

With qemu-x86_64 kvm cannot be used since the move to long mode (64-bit)
is done in a way that works on real hardware but not with QEMU. This
means that performance is 4-5x slower than it could be, at least on my
CPU.

We can work around the first problem by using Bochs, which is anyway a
better choice than VESA for QEMU. The second can be addressed by using
the same descriptor across the jump to long mode.

With an MTRR fix this allows booting into Ubuntu on qemu-x86_64

In v3 some e820 patches are included to make booting reliable and avoid
ACPI tables being dropped. Also, several MTTR problems are addressed, to
support memory sizes above 4GB reliably.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-02-16 08:58:35 -07:00
parent ced1110a20
commit 0f3954c21a
2 changed files with 68 additions and 1 deletions

View File

@@ -572,7 +572,7 @@ coreboot test.py:
- export USE_LABGRID_SJG=1
# export verbose="-v"
- ${SRC}/test/py/test.py --role ${ROLE} --build-dir "${OUT}"
--capture=tee-sys -k "not bootstd" || ret=$?
--capture=tee-sys -k "not bootstd ${TEST_PY_TEST_SPEC}" || ret=$?
- U_BOOT_BOARD_IDENTITY="${ROLE}" u-boot-test-release || true
- if [[ $ret -ne 0 ]]; then
exit $ret;
@@ -747,3 +747,9 @@ zybo:
variables:
ROLE: zybo
<<: *lab_dfn
qemu-x86_64:
variables:
ROLE: qemu-x86_64
TEST_PY_TEST_SPEC: "and not sleep"
<<: *lab_dfn

View File

@@ -0,0 +1,61 @@
# SPDX-License-Identifier: GPL-2.0+
# Copyright 2025 Canonical Ltd.
# Written by Simon Glass <simon.glass@canonical.com>
import pytest
# Enable early console so that the test can see if something goes wrong
CONSOLE = 'earlycon=uart8250,io,0x3f8 console=uart8250,io,0x3f8'
@pytest.mark.boardspec('qemu-x86_64')
@pytest.mark.role('qemu-x86_64')
def test_distro(ubman):
"""Test that of-platdata can be generated and used in sandbox"""
with ubman.log.section('boot'):
ubman.run_command('boot', wait_for_prompt=False)
with ubman.log.section('Grub'):
# Wait for grub to come up and offset a menu
ubman.p.expect(['Try or Install Ubuntu'])
# Press 'e' to edit the command line
ubman.log.info("Pressing 'e'")
ubman.run_command('e', wait_for_prompt=False, send_nl=False)
# Wait until we see the editor appear
ubman.p.expect(['/casper/initrd'])
# Go down to the 'linux' line. Avoid using down-arrow as that includes
# an Escape character, which may be parsed by Grub as such, causing it
# to return to the top menu
ubman.log.info("Going DOWN")
ubman.ctrl('N')
ubman.ctrl('N')
ubman.ctrl('N')
# Go to end of line
ubman.log.info("Going to EOL")
ubman.ctrl('E')
# Backspace to remove 'quiet splash'
ubman.log.info("Erasing quiet and splash")
ubman.send('\b' * len('quiet splash'))
# Send our noisy console
ubman.log.info("Noisy console")
ubman.send(CONSOLE)
# Tell grub to boot
ubman.log.info("boot")
ubman.ctrl('X')
ubman.p.expect(['Booting a command list'])
with ubman.log.section('Linux'):
# Linux should start immediately
ubman.p.expect(['Linux version'])
with ubman.log.section('Ubuntu'):
# Shortly later, we should see this banner
ubman.p.expect(['Welcome to .*Ubuntu 24.04.1 LTS.*!'])
ubman.restart_uboot()