On Sat, Oct 17, 2026 at 5:19 AM Elliot Berman <[email protected]> wrote:
>
> Provide guidance for testing capsule updates on x86/x86_64.
>
> Signed-off-by: Elliot Berman <[email protected]>
> ---
>  doc/board/emulation/qemu-x86.rst | 39 +++++++++++++++++++++++++++++++++++++--
>  1 file changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/doc/board/emulation/qemu-x86.rst 
> b/doc/board/emulation/qemu-x86.rst
> index c604e42990e..d40cc500994 100644
> --- a/doc/board/emulation/qemu-x86.rst
> +++ b/doc/board/emulation/qemu-x86.rst
> @@ -113,17 +113,52 @@ sure the specified CPU supports 64-bit like '-cpu 
> core2duo'. Conversely
>  '-cpu pentium' won't work for obvious reasons that the processor only
>  supports 32-bit.
>
> +Running as flash binary
> +-----------------------
> +
> +Running U-Boot from emulated flash lets QEMU write a new image back to the 
> ROM.
> +This allows EFI capsule updates to be tested. To create a U-Boot binary that 
> can
> +accept capsule updates, build qemu-x86_64_defconfig or qemu-x86_defconfig 
> with::
> +
> +   CONFIG_EFI_CAPSULE_ON_DISK=y
> +   CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y

On x86, the linking of u-boot.rom failed due to address overlap (with
gcc 15.2 on Ubuntu 26.04)

  LD      u-boot
/usr/bin/x86_64-linux-gnu-ld.bfd: section .rel.dyn VMA wraps around
address space
/usr/bin/x86_64-linux-gnu-ld.bfd: section .start16 LMA
[fffff800,fffff86f] overlaps section .rel.dyn LMA [fffdfd78,00000c37]
make: *** [Makefile:2131: u-boot] Err

> +
> +See :ref:`uefi_capsule_update_ref` for the full set of capsule options and 
> the
> +general update procedure.
> +
> +Instead of the '-bios' option, attach u-boot.rom as writable pflash with
> +readonly=false. For 64-bit U-Boot::
> +
> +   $ qemu-system-x86_64 -nographic \
> +     -drive if=pflash,format=raw,file=path/to/u-boot.rom,readonly=off
> +
> +For 32-bit U-Boot::
> +
> +   $ qemu-system-i386 -nographic \
> +     -drive if=pflash,format=raw,file=path/to/u-boot.rom,readonly=off
> +
> +Generate a capsule with mkeficapsule::
> +
> +   $ mkeficapsule --index 1 --guid 5bb9ce0d-a389-456f-83a8-2bdfb8ad01a1 \
> +       u-boot.rom uboot.capsule    # qemu-x86_64

Please use u-boot.capsule as the file name.

With gcc 15.2 on Ubuntu 26.04, the generated x86_64 uboot.capsule is
about 2.1MiB, which slightly exceeds the SYS_MALLOC_LEN.

as the malloc(file_size) in efi_capsule_read_file() reads the whole
file at once by allocating the size of the capsule file.

> +   $ mkeficapsule --index 1 --guid 8dfcd6f5-42fe-44c6-a8ae-637da61b6b95 \
> +       u-boot.rom uboot.capsule    # qemu-x86
> +
> +Place the capsule under '\EFI\UpdateCapsule' on the EFI system partition and
> +reboot to apply it; see :ref:`uefi_capsule_update_ref` for the OsIndications 
> and
> +authentication details.
> +
>  Booting distros
>  ---------------
>
>  It is possible to install and boot a standard Linux distribution using
>  qemu-x86_64 by setting up a root disk::
>
> -   qemu-img create root.img 10G
> +   $ qemu-img create root.img 10G
>
>  then using the installer to install. For example, with Ubuntu 2023.04::
>
> -   qemu-system-x86_64 -m 8G -smp 4 -bios /tmp/b/qemu-x86_64/u-boot.rom \
> +   $ qemu-system-x86_64 -m 8G -smp 4 -bios /tmp/b/qemu-x86_64/u-boot.rom \
>       -drive file=root.img,if=virtio,driver=raw \
>       -drive file=ubuntu-23.04-desktop-amd64.iso,if=virtio,driver=raw
>
>

Regards,
Bin

Reply via email to