1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-11-02 11:26:41 +01:00

efi: Add a script to build an image for testing on UEFI

It is quite complicated to run U-Boot on QEMU since we have four
different builds and they must use different versions of qemu and the
UEFI binaries.

Add a script to help. It requires U-Boot itself to be built. Once that
is done you can use this script to build an image for use with qemu and
optionally run it.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-11-03 21:09:03 -06:00
committed by Heinrich Schuchardt
parent 7fc93cae49
commit 6b2f82901e
3 changed files with 256 additions and 0 deletions

View File

@@ -98,6 +98,11 @@ that EFI does not support booting a 64-bit application from a 32-bit
EFI (or vice versa). Also it will often fail to print an error message if
you get this wrong.
You may find the script `scripts/build-efi.sh` helpful for building and testing
U-Boot on UEFI on QEMU. It also includes links to UEFI binaries dating from
2021.
See `Example run`_ for an example run.
Inner workings
--------------
@@ -193,6 +198,63 @@ of code is built this way (see the extra- line in lib/efi/Makefile).
Everything else is built as a normal U-Boot, so is always 32-bit on x86 at
present.
Example run
-----------
This shows running with serial enabled (see `include/configs/efi-x86_app.h`)::
$ scripts/build-efi.sh -wsPr
Packaging efi-x86_app32
Running qemu-system-i386
BdsDxe: failed to load Boot0001 "UEFI QEMU HARDDISK QM00005 " from PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0): Not Found
BdsDxe: loading Boot0002 "EFI Internal Shell" from Fv(7CB8BDC9-F8EB-4F34-AAEA-3EE4AF6516A1)/FvFile(7C04A583-9E3E-4F1C-AD65-E05268D0B4D1)
BdsDxe: starting Boot0002 "EFI Internal Shell" from Fv(7CB8BDC9-F8EB-4F34-AAEA-3EE4AF6516A1)/FvFile(7C04A583-9E3E-4F1C-AD65-E05268D0B4D1)
UEFI Interactive Shell v2.2
EDK II
UEFI v2.70 (EDK II, 0x00010000)
Mapping table
FS0: Alias(s):HD0a65535a1:;BLK1:
PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)/HD(1,GPT,0FFD5E61-3B0C-4326-8049-BDCDC910AF72,0x800,0xB000)
BLK0: Alias(s):
PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)
Press ESC in 5 seconds to skip startup.nsh or any other key to continue.
Shell> fs0:u-boot-app.efi
U-Boot EFI App (using allocated RAM address 47d4000) key=8d4, image=06a6f610
starting
U-Boot 2022.01-rc4 (Sep 19 2021 - 14:03:20 -0600)
CPU: x86, vendor Intel, device 663h
DRAM: 32 MiB
0: efi_media_0 PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)
1: <partition> PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)/HD(1,GPT,0FFD5E61-3B0C-4326-8049-BDCDC910AF72,0x800,0xB000)
Loading Environment from nowhere... OK
Model: EFI x86 Application
Hit any key to stop autoboot: 0
Partition Map for EFI device 0 -- Partition Type: EFI
Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000800 0x0000b7ff "boot"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
guid: 0ffd5e61-3b0c-4326-8049-bdcdc910af72
19 startup.nsh
528384 u-boot-app.efi
10181 NvVars
3 file(s), 0 dir(s)
=> QEMU: Terminated
Future work
-----------
This work could be extended in a number of ways: