scripts: Add a script for building and booting QEMU

It is handy to be able to quickly build and boot a QEMU image for a
particular architecture and distro.

Add a script for this purpose. It supports only arm and x86 at present.
For distros it only supports Ubuntu. Both 32- and 64-bit builds are
supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2024-11-12 06:58:54 -07:00
parent b557c73feb
commit cee7f69038
4 changed files with 245 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ Emulation
acpi
blkdev
script
qemu-arm
qemu-mips
qemu-ppce500

View File

@@ -0,0 +1,61 @@
.. SPDX-License-Identifier: GPL-2.0+
Script for building and running
===============================
You may find the script `scripts/build-qemu.sh` helpful for building and testing
U-Boot on QEMU.
If uses a environment variables to control how it works:
ubdir
base directory for building U-Boot, with each board being in its own
subdirectory
imagedir
directory containing OS images, containin a subdirectory for each distro
type (e.g. ubuntu/
Once configured, you can build and run QEMU for arm64 like this::
scripts/build-qemu.sh -rsw
No support is currently included for specifying a root disk, so this script can
only be used to start installers.
Options
~~~~~~~
Options are available to control the script:
-a <arch>
Select architecture (default arm, x86)
-B
Don't build; assume a build exists
-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)
-w
Use word version (32-bit). By default, 64-bit is used
.. note::
Note: For now this is a shell script, but if it expands it might be better
as Python, accepting the slower startup.