Booting Windows 11

Simon Glass sjg at chromium.org
Wed Aug 16 16:15:42 CEST 2023


Hi Heinrich,

On Wed, 16 Aug 2023 at 04:50, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 8/16/23 09:41, Heinrich Schuchardt wrote:
> > On 8/16/23 03:22, Simon Glass wrote:
> >> Hi Heinrich,
> >>
> >> I thought I would try booting Windows on U-Boot but it does not get
> >> very far. Have you tried that? I note a ew odd things below. Is there
> >> a validation suite for it?
> >>
> >> https://github.com/sjg20/u-boot/tree/efi2

Thanks for all the helpful info. I know very little about this so am
happy that you do!

> >
> > qemu-x86_64_defconfig does not build with your tree (commit
> > d4caae6bce9082d0a770047e8f3d3a68b7084740, sjg/efi2):
> >
> >    BINMAN  .binman_stamp
> > Wrote map file './rom.map' to show errors
> > binman: Node '/binman/rom/u-boot-spl-with-ucode-ptr': Offset 0xfffd8000
> > (4294803456) overlaps with previous entry '/binman/rom/u-boot' ending at
> > 0xfffd84e8 (4294804712)
> > make: *** [Makefile:1115: .binman_stamp] Error 1
> >
> > ImagePos    Offset      Size  Name
> > <none>    00000000  00100000  rom
> > <none>     fff00000  000d84e8  u-boot
> > <none>      00000000  000d79a0  u-boot-nodtb
> > <none>      000d79a0  00000b48  u-boot-dtb
> > <none>     fffd8000  00015f60  u-boot-spl-with-ucode-ptr
> > <none>     fffd84e8  00000b48  u-boot-dtb
> > <none>     fffd9030  000004c6  fdtmap
> > <none>     fffd94f6  00000000  private-files
> > <none>     fffedf60  00000b48  u-boot-dtb-with-ucode2
> > <none>     fffff800  00000070  x86-start16-spl
> > <none>     fffffff0  00000005  x86-reset16-spl
> > <none>     fffffff8  00000008  image-header

I am building with

> >
> >>
> >> qemu-system-x86_64  -smp 4 -m 8G -serial mon:stdio -bios
> >> /tmp/b/qemu-x86_64/u-boot.rom -drive
> >> id=fisk,file=root.img,if=virtio,driver=raw -drive
> >> id=disk,if=virtio,file=/vid/software/win/Win11_22H2_English_x64v2.iso
> >
> > This does not work with EDK II either.
> >

OK

> > I was able to start the installer with:
> >
> > qemu-system-x86_64 \
> > -M q35,smm=on,accel=kvm -smp 8 -m 4G -gdb tcp::1234 \
> > -serial mon:stdio \
> > -vga std \
> > -device qemu-xhci \
> > -device usb-kbd \
> > -device usb-mouse \
> > -global driver=cfi.pflash01,property=secure,value=on \
> > -drive
> > if=pflash,format=raw,unit=0,file=OVMF_CODE_4M.secboot.fd,readonly=on \
> > -drive if=pflash,format=raw,unit=1,file=OVMF_VARS.ms.fd \
> > -drive file=root.img,if=virtio,format=raw \
> > -drive file=Win11_22H2_EnglishInternational_x64v2.iso,media=cdrom
> >

For me I get an error:

$ dpkg -l ovmf
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version                  Architecture Description
+++-==============-========================-============-=============================================
ii  ovmf           2022.02-3ubuntu0.22.04.1 all          UEFI firmware
for 64-bit x86 virtual machines

$ qemu-system-x86_64 -M q35,smm=on,accel=kvm -smp 8 -m 4G -gdb
tcp::1234 -serial mon:stdio -vga std -device qemu-xhci -device usb-kbd
-device usb-mouse -global driver=cfi.pflash01,property=secure,value=on
-drive if=pflash,format=raw,unit=0,file=/usr/share/OVMF/OVMF_CODE_4M.secboot.fd,readonly=on
-drive if=pflash,format=raw,unit=1,file=//vid/software/devel/u-boot/efi/OVMF_VARS.ms.fd
-drive file=root.img,if=virtio,format=raw -drive
file=/vid/software/win/Win11_22H2_English_x64v2.iso,media=cdrom
qemu-system-x86_64: Gdk:
gdk_wayland_window_set_dbus_properties_libgtk_only: assertion
'GDK_IS_WAYLAND_WINDOW (window)' failed
!!!! X64 Exception Type - 06(#UD - Invalid Opcode)  CPU Apic ID - 00000000 !!!!
RIP  - 0000000000030000, CS  - 0000000000000038, RFLAGS - 0000000000010246
RAX  - 0000000000000000, RCX - 0000000000000000, RDX - 0000000000000000
RBX  - FFFFFFFFFFFFFFFF, RSP - 000000007EEC1E18, RBP - 0000000000000001
RSI  - 000000007E8EC818, RDI - 000000007EED9830
R8   - 0000000000000000, R9  - 0000000003041001, R10 - 000000000000003A
R11  - 000000007E8E9680, R12 - 000000007E8E9018, R13 - 000000007EEC1EA0
R14  - 000000007EED72F0, R15 - 0000000000000000
DS   - 0000000000000030, ES  - 0000000000000030, FS  - 0000000000000030
GS   - 0000000000000030, SS  - 0000000000000030
CR0  - 0000000080010033, CR2 - 0000000000000000, CR3 - 000000007EC01000
CR4  - 0000000000000668, CR8 - 0000000000000000
DR0  - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000
DR3  - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400
GDTR - 000000007E9E2000 0000000000000047, LDTR - 0000000000000000
IDTR - 000000007E4E6018 0000000000000FFF,   TR - 0000000000000000
FXSAVE_STATE - 000000007EEC1A70
!!!! Can't find image information. !!!!


> > The Windows installer does not work without SMM but returns to the EFI
> > shell. This might be what you have seen.

OK.

> >
> > U-Boot's qemu-x86_64_defconfig does not start with
> > -M q35,smm=on,accel=kvm
> >
> > Instead of using KVM you could specify -cpu Skylake-Client-v4 which is
> > supported by the Windows 11. But of course this is very slow.
> >
> > Please, retry with:
> > qemu-system-x86_64 \
> > -machine pc-i440fx-2.5,smm=on -cpu Skylake-Client-v4 \
> > -vga std \

That does the same thing for me with qemu-x86_64 (eventually reboots).
I tried using Q35 too:

qemu-system-x86_64 -M smm=on  -cpu Skylake-Client-v4 -vga std  -m 4G
-serial mon:stdio -bios /tmp/b/qemu-x86_64/u-boot.rom -drive
id=fisk,file=root.img,if=virtio,driver=raw  -drive
id=disk,file=/vid/software/win/Win11_22H2_English_x64v2.iso,if=none
   -device ich9-ahci,id=ahci       -device
ide-hd,drive=disk,bus=ahci.0

Trying the same idea with the OVMF stuff hangs with nothing on the display:

qemu-system-x86_64 -M pc-i440fx-2.5,smm=on -cpu Skylake-Client-v4 -vga
std  -m 4G -gdb tcp::1234 -serial mon:stdio -vga std -device qemu-xhci
-device usb-kbd -device usb-mouse -global
driver=cfi.pflash01,property=secure,value=on -drive
if=pflash,format=raw,unit=0,file=/usr/share/OVMF/OVMF_CODE_4M.secboot.fd,readonly=on
-drive if=pflash,format=raw,unit=1,file=//vid/software/devel/u-boot/efi/OVMF_VARS.ms.fd
-drive file=root.img,if=virtio,format=raw -drive
file=/vid/software/win/Win11_22H2_English_x64v2.iso,media=cdrom

> >
> > Can we get support for -M q35 into U-Boot? Cf.
> > https://wiki.qemu.org/Features/Q35. This would allow us to actually
> > compare EDK II and U-Boot when running with the same settings.

Yes but you need to change CONFIG_DEVICE_TREE to "qemu-x86_q35"

> >
> > Why wouldn't U-Boot support kvm on an AMD Ryzen 5 2500U?
>
> With KVM I either get:
> "int_exception_handler() Exception 13 while executing option rom"
> or the code hangs in cpu_call64.

Yes, that is a bug I mentioned to Bin as well. It happens when jumping
into 64-bit mode. However, it works fine with booting from coreboot,
so it is probably something missing in the CPU init. I have not dug
into that yet.

I pushed a new tree to my github/efi2 with the Q35 changes so that you
can try that.

>
> Best regards
>
> Heinrich
>
> >
> >>
> >> Scanning bootdev 'virtio-blk#0.bootdev':
> >> efi_install_multiple_protocol_interfaces_int() EFI: Call:
> >> efi_locate_device_path(protocol, &dp, &old_handle)
> >> efi_locate_device_path()   EFI: Entry efi_locate_device_path(Device
> >> Path, 00000000becf6848, 00000000becf6840)
> >> efi_locate_device_path()     EFI: Call:
> >> efi_locate_handle_buffer(BY_PROTOCOL, protocol, NULL, &no_handles,
> >> &handles)
> >> efi_locate_handle_buffer()       EFI: Entry
> >> efi_locate_handle_buffer(2, Device Path, 0000000000000000,
> >> 00000000becf67b8, 00000000becf67b0)
> >> efi_locate_handle_buffer()       EFI: Exit: efi_locate_handle_buffer: 0
> >> efi_locate_device_path()     EFI: 0 returned by
> >> efi_locate_handle_buffer(BY_PROTOCOL, protocol, NULL, &no_handles,
> >> &handles)
> >> efi_locate_device_path()   EFI: Exit: efi_locate_device_path: 14
> >> efi_install_multiple_protocol_interfaces_int() EFI: 14 returned by
> >>
> >>
> >> ^ This seems unhappy because it is a virtio device?
> >
> > Before a device path protocol is installed we check that the same device
> > path has not been installed before (lib/efi_loader/efi_boottime.c:2685).
> >
> > EFI_NOT_FOUND signals that we are good to continue.

OK, thanks.

Regards,
Simon


More information about the U-Boot mailing list