Compare commits

...

6 Commits

Author SHA1 Message Date
Simon Glass
2ee1c3b067 scripts: build-qemu: Allow enabling TKey access
Provide a -T/--tkey option to enable access to a USB-attached Tillitis
TKey.

Series-to: concept
Series-cc: heinrich
Cover-letter:
Bootstage and script enhancements
This series collects together a few improvements to the bootstage
subsystem, principally some new tests.

It also adds support for ACPI FPDT which is a way of passing timing
information to the OS.

A bug fix is provided for mouse clicks with expo.

Finally the series includes some new options for the build-efi script
for networking, spice, etc.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-23 10:00:31 +01:00
Simon Glass
bc6fd0e137 scripts: build-efi: Flush output before running QEMU
Complete writing of any output before running QEMU, since otherwise it
does not always appear until QEMU exits (e.g. with 'tee')

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-23 10:00:31 +01:00
Simon Glass
c6c8597951 scripts: build-efi: Allow enabling networking
Provide a -N/--net flag to enable networking for the guest.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-23 10:00:31 +01:00
Simon Glass
4bbd4dcf9a scripts: build-efi: Support spice integration
Add a -c/--spice flag to enable spice, so that copy/paste works between
the guest and host.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-23 10:00:31 +01:00
Simon Glass
af5d7bdf02 bootm: Update FPDT boot times before handing off to OS
Update the FPDT boot performance record's ebs_entry and ebs_exit
fields in bootm_final() to record the time when we're about to
hand off to the operating system.

The timing is recorded just before we start the kernel, after all
device cleanup and before interrupts are disabled, which corresponds
to the ExitBootServices phase in UEFI.

If EFI is used to boot, a further update could be made, but that is
left for later.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-23 10:00:31 +01:00
Simon Glass
d46a3706e6 acpi: fpdt: Generate the table
Add an ACPI writer to automatically generate the FPDT table with boot
timing information when ACPI tables are created.

This allows the OS to read firmware boot-timing metrics from the FPDT
table.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-23 10:00:31 +01:00
4 changed files with 50 additions and 1 deletions

View File

@@ -5,9 +5,11 @@
* Copyright 2025 Simon Glass <sjg@chromium.org>
*/
#include <acpi/acpi_table.h>
#include <bootm.h>
#include <bootstage.h>
#include <event.h>
#include <timer.h>
#include <usb.h>
#include <dm/root.h>
@@ -25,6 +27,21 @@ void bootm_final(enum bootm_final_t flags)
bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
/* Update FPDT boot performance record if it exists */
if (IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) {
struct acpi_fpdt_boot *fpdt;
fpdt = acpi_get_fpdt_boot();
if (fpdt) {
u64 time;
time = timer_get_boot_us();
fpdt->ebs_entry = time;
fpdt->ebs_exit = time;
acpi_fix_fpdt_checksum();
}
}
if (IS_ENABLED(CONFIG_BOOTSTAGE_FDT) && IS_ENABLED(CONFIG_CMD_FDT))
bootstage_fdt_add_report();
if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))

View File

@@ -785,3 +785,14 @@ int acpi_fix_fpdt_checksum(void)
return 0;
}
static int acpi_create_fpdt(struct acpi_ctx *ctx,
const struct acpi_writer *entry)
{
u64 uboot_start;
uboot_start = bootstage_get_time(BOOTSTAGE_ID_START_UBOOT_F);
return acpi_write_fpdt(ctx, uboot_start);
}
ACPI_WRITER(6fpdt, "FPDT", acpi_create_fpdt, 0);

View File

@@ -19,6 +19,7 @@ from argparse import ArgumentParser
import os
from pathlib import Path
import shutil
import sys
import build_helper
@@ -47,6 +48,10 @@ def parse_args():
help='Package up the payload instead of the app')
parser.add_argument('-P', '--partition', action='store_true',
help='Create a partition table')
parser.add_argument('-c', '--spice', action='store_true',
help='Enable SPICE for clipboard sharing')
parser.add_argument('-N', '--net', action='store_true',
help='Enable networking (with SSH forwarding on port 2222)')
parser.add_argument('-v', '--verbose', action='store_true',
help='Show executed commands')
@@ -115,6 +120,12 @@ class BuildEfi:
else: # x86
extra += ['-device', 'qemu-xhci', '-device', 'usb-kbd',
'-device', 'usb-mouse']
# This uses QEMU's GTK clipboard integration with SPICE vdagent
if self.args.spice:
extra += ['-device', 'virtio-serial-pci']
extra += ['-chardev', 'qemu-vdagent,id=spicechannel0,name=vdagent,clipboard=on']
extra += ['-device', 'virtserialport,chardev=spicechannel0,name=com.redhat.spice.0']
extra += ['-serial', 'mon:stdio']
serial_msg = ''
if self.args.kvm:
@@ -134,10 +145,15 @@ class BuildEfi:
cmd = [qemu]
cmd += '-m', mem
cmd += '-nic', 'none'
if self.args.net:
cmd += '-netdev', 'user,id=net0,hostfwd=tcp::2222-:22'
cmd += '-device', 'virtio-net-pci,netdev=net0'
else:
cmd += '-nic', 'none'
cmd += extra
self.helper.add_qemu_args(self.args, cmd, base_hd=1)
tout.info(' '.join(cmd))
sys.stdout.flush()
command.run(*cmd)
def setup_files(self, build, build_type, dst):

View File

@@ -51,6 +51,8 @@ def parse_args():
help='Run qboot instead of U-Boot')
parser.add_argument('-x', '--xpl', action='store_true',
help='Use xPL image rather than U-Boot proper')
parser.add_argument('-T', '--tkey', action='store_true',
help='Enable TKey USB passthrough for testing')
parser.add_argument(
'--sct-seq',
help='SCT sequence-file to be written into the SCT image if -e')
@@ -153,6 +155,9 @@ class BuildQemu:
default_bios = 'u-boot.rom'
self.helper.qemu = 'qemu-system-i386'
self.qemu_extra.extend(['-machine', 'q35'])
if args.tkey:
# Pass through TKey USB device to QEMU
self.qemu_extra.extend(['-device', 'usb-host,vendorid=0x1207,productid=0x8887'])
if self.helper.bitness == 64:
self.board = 'qemu-x86_64'
self.helper.qemu = 'qemu-system-x86_64'