Files
u-boot/doc/board/emulation/script.rst
Simon Glass fd087fd131 scripts: Convert the build-qemu script to Python
Convert this to Python and make use of the build_helpers module. Update
that module to remove old options and improve the ordering of options.

The script doubles in size, part of which is being a lot more friendly
with virtiofsd problems, as well as adding a verbose mode.

Update the documentation as well.

Series-to: u-boot
Cover-letter:
script: Improve the QEMU scripts to Python
This series updates the two QEMU scripts available in U-Boot:

- Converts build-qemu to Python
- Converts build-efi to avoid sudo (unless SCT is used)
- Introduces a proper settings file shared between both scripts

It also includes a few documentation updates.

The next step is to get these scripts running in CI.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-11 15:32:10 +02:00

110 lines
2.6 KiB
ReStructuredText

.. SPDX-License-Identifier: GPL-2.0+
Script for building and running
===============================
You may find the script `scripts/build-qemu` helpful for building and testing
U-Boot on QEMU.
If uses a settings file `~/.u_boot_qemu` to control how it works:
build_dir
base directory for building U-Boot, with each board being in its own
subdirectory
image_dir
directory containing OS images, containing a subdirectory for each distro
type (e.g. `ubuntu/`)
bzimage
path to a bzImage file to supply to boot x86 Linux
efi_image_file
output filename for the disk image containing an EFI app / payload
efi_dir
directory when pre-built UEFI images are kept, e.g. OVMF-pure-efi.i386.fd
sct_dir
directory when the UEFI Self-Certification Test (SCT) is kept
sct_mnt
temporary mount point for building SCT: note this requires sudo
A sample file is written if you don't have one, e.g.::
# U-Boot QEMU-scripts config
[DEFAULT]
# Set to the build directory where you build U-Boot out-of-tree
# We avoid in-tree build because it gets confusing trying different builds
# Each board gets a build in a separate subdir
build_dir = /tmp/b
# Image directory (for OS images)
image_dir = ~/dev/os
# Build the kernel with: make O=/tmp/kernel
bzimage = /tmp/kernel/arch/x86/boot/bzImage
# EFI image-output filename
efi_image_file = try.img
# Directory where OVMF-pure-efi.i386.fd etc. are kept
efi_dir = ~/dev/efi
# Directory where SCT image (sct.img) is kept
sct_dir = ~/dev/efi/sct
# Directory where the SCT image is temporarily mounted for modification
sct_mnt = /mnt/sct
Once configured, you can build and run QEMU for arm64 like this::
scripts/build-qemu -rsw
Options
~~~~~~~
Options are available to control the script:
-a <arch>
Select architecture (default arm, x86)
-B
Don't build; assume a build exists
-d/--disk DISK
Root disk image file to use with QEMU
-e/--sct-run
Package an run UEFI Self-Certification Test (SCT)
-E/--use-tianocore
Run Tianocore (OVMF) instead of U-Boot
-k
Use kvm - kernel-based Virtual Machine. By default QEMU uses its own
emulator
-o <os>
Run an Operating System. For now this only supports 'ubuntu'. The name of
the OS file must remain unchanged from its standard name on the Ubuntu
website.
-r
Run QEMU with the image (by default this is not done)
-R
Select OS release (e.g. 24.04).
-s
Use serial only (no display)
-S/--sct-seq SCT_SEQ
SCT sequence-file to be written into the SCT image if -e
-w
Use word version (32-bit). By default, 64-bit is used