33 Commits

Author SHA1 Message Date
Simon Glass
3a801fde21 scripts: Provide a way to use custom firmware
Update both build-efi and build-scripts to allow a -c option to provide
custom firmware. This makes the scripts more generally useful.

Drop the existing -c for --spice since it conflicts and is also is bit
hard to remember.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 06:09:52 -07:00
Simon Glass
7c1597588d scripts: build-efi: Allow including other files
Provide a way to include a directory of files in the firmware image
created by build-efi

This is useful for including a U-Boot environment, for example.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 06:09:52 -07:00
Simon Glass
a12023a01a scripts: build-efi: Write uboot.env file for bootcmd support
When running U-Boot as an EFI application under EDK2/OVMF, U-Boot doesn't
have direct access to QEMU's fw_cfg interface. To support the --bootcmd
option, write a uboot.env file to the EFI partition containing the boot
command.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-25 18:19:23 +01:00
Simon Glass
357418fc47 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 19:36:32 +01:00
Simon Glass
b6d52a75b8 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 19:36:32 +01:00
Simon Glass
ab855a1aa4 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 19:36:32 +01:00
Simon Glass
935ae7fc6a scripts: build-efi: Use a locally built OVMF image
The standard OVMF image does not include mouse support. Use a locally
built release build instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-18 09:38:25 +01:00
Simon Glass
b1110b1fe7 scripts: build-efi: Use the USB mouse
The USB mouse seems to have an absolute-pointer driver which can be
enabled in OVMF. Switch to this for x86.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-13 14:20:15 +01:00
Simon Glass
81e1ce0ea7 script: Use a minimum of 1G of memory for EFI
Since the U-Boot app now requests 512MB (to fit the ramdisk, etc.) and
Tianocore uses some as well, the current 512MB is not enough. Double it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-24 18:29:39 -06:00
Simon Glass
4669ad3785 scripts: Update build-efi/qemu to support disabling pager
The pager can interfere with tests and there is a lab test which uses
the build-efi script. Add an option to disable the pager so that the
labgrid test can request that.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-23 12:22:45 -06:00
Simon Glass
ff37f4218a script: Support mouse with build-efi/qemu scripts
Provide arguments to QEMU to enable a mouse. Note that this does not
work with EFI at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 04:49:38 -06:00
Simon Glass
c6883b8a71 scripts: Add an option for the build directory
When running in CI it is better to specify the build directory rather
than provide a device. Add a --build-dir option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-12 13:41:05 -06:00
Simon Glass
5f6e2806b0 scripts: build-efi: Enable the display on ARM
Enable the display on ARM devices, so it works when running Tianocore.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 16:53:16 -06:00
Simon Glass
f7a683d3f3 scripts: Adjust EFI script to support a root disk
At present the root disk conflicts with the boot disk used to hold the
app (or payload). Use virtio for this disk and number the others after
that.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-05 11:49:30 -06:00
Simon Glass
65d7446e31 scripts: Move root-disk processing to helper
The build-efi and build-qemu scripts have common code to set up the root
disk. Move it to build_helper to avoid duplication.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-02 12:34:59 -06:00
Simon Glass
fcc852c0f0 scripts: Move OS selection into the helper
Both scripts allow booting from an ISO containing an OS, so move this
handling into the common helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:25:33 -06:00
Simon Glass
e2e338d4f1 scripts: Move bitness and os_arch to helper
These two concepts are used in both scripts, so move them to the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:58 -06:00
Simon Glass
f8de2c4048 scripts: Move some QEMU-arg building into build_helper
Providing a kernel, initrd and related options are useful in the EFI app
too, so move them into the common code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:58 -06:00
Simon Glass
cd73d77f92 scripts: build-efi: Use --write-kernel instead of -K
We want to use the -K option for providing a kernel via QEMU's QFW
interface. Perhaps we could use the same option and require that the
file be provided always, but that is less convenient.

For now, rename the option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:58 -06:00
Simon Glass
686ee0523a scripts: build-efi: Use -a instead of -A
It seems better to specify the arch rather than using somewhat cryptic
flags. The build-qemu scripts uses -a (for Architecture) so do the same
for build-efi

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-06-30 14:14:58 -06:00
Simon Glass
12e532f710 scripts: build-efi: Drop the -a option
This is not really needed, since it is the default and we have -p to
select the payload. It also conflicts with -a in build-qemu

Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:58 -06:00
Simon Glass
ce85d868e1 scripts: Use the same main() approach fo both scripts
Add a main() function for EFI and adjust the scripts to look the same in
this area.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:57 -06:00
Simon Glass
c44dd6832c scripts: Move common arguments into build_helper.py
The two main QEMU scripts (build-efi and build-qemu) share some common
arguments, so put them in the common file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-30 14:14:57 -06:00
Simon Glass
e18a8940a6 scripts: Update build-efi to allow firmware settings
At present the -bios option is used to specify the firmware, but this does
not allow settings to be adjusted.

Use the pflash method instead, with a separate variables file, so that
settings can be changed.

Add a -g option to tell QEMU to stop and wait for gdb to connect.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
a69d83f77a scripts: Update build-efi to support debugging with QEMU
Add a -g option to tell QEMU to stop and wait for gdb to connect.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
026ca64102 scripts: Update build-efi to support passing a root disk
Add a -d option to specify a root disk to boot with.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
4d22a33cf6 scripts: Update build-efi to allow showing the QEMU cmdline
Add a -v option for verbose output. For now this just shows the QEMU
cmdline before starting it. This allows the user to start it separately,
perhaps tweaking the args.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
680591f692 scripts: Update build-efi to support booting an OS
Bring this script into line with build-qemu so an OS and release can be
specified. As with that script, only Ubuntu is supported for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
e70d3b6ab8 scripts: Update build-efi to support kvm
This is a useful feature when booting the EFI app, so add this option to
the build-efi script too, matching the same option in build-qemu

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
ab87f396c5 scripts: Change -k and -o options
These have a different meaning in build-qemu, so capitalise these
options to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:40 -06:00
Simon Glass
3a6ba29bd2 scripts: Create a common settings file for QEMU scripts
Move the settings into a common file so they can be used by all tools.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-15 06:35:37 +02:00
Simon Glass
9b5decd807 scripts: Convert the build-efi script to avoid sudo
Make use of the mk_fs() function to avoid needing to use sudo to mount
the loopback partition. This makes the script a little more friendly for
those nervous about sudo in their tools.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-15 06:35:37 +02:00
Simon Glass
721804b0f8 scripts: Rename build-efi.py to drop the file extension
The .py extension isn't very useful. Drop it and update the shebang to
specify Python 3

Update the docs for this and also drop the old reference to 2021 images.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-15 06:35:37 +02:00