我已经构建了一个bflat示例应用程序,可以直接在 UEFI 上运行。bootx64.efi
现在我有了应用程序的启动文件夹和文件。
我做错了什么导致该应用程序无法运行?是图片文件有问题还是其他什么问题?
这是我尝试运行的文件,以防您想检查它:https://file.io/b5cg47YHEkXZ
另外,这是在 QEMU 上运行此示例应用程序的指令:https://github.com/bflattened/bflat/tree/master/samples/Snake# :~:text=To%20run%20this%20with%20QEMU
更新:这就是我制作虚拟机的方法:
- 我在包含以下内容的源文件夹中打开 CMD
efi/boot/...
- 我打开
diskpart
并运行这些命令:
Microsoft DiskPart version 10.0.22621.1
Copyright (C) Microsoft Corporation.
On computer: MATIN
DISKPART> create vdisk file=F:\disk.vhdx maximum=500
100 percent completed
DiskPart successfully created the virtual disk file.
DISKPART> select vdisk file=F:\disk.vhdx
DiskPart successfully selected the virtual disk file.
DISKPART> attach vdisk
100 percent completed
DiskPart successfully attached the virtual disk file.
DISKPART> convert gpt
DiskPart successfully converted the selected disk to GPT format.
DISKPART> create partition efi size=100
DiskPart succeeded in creating the specified partition.
DISKPART> format quick fs=fat32 label="System"
100 percent completed
DiskPart successfully formatted the volume.
DISKPART> assign letter="X"
DiskPart successfully assigned the drive letter or mount point.
DISKPART> exit
- 然后,我将文件复制到附加驱动器
X:
:
C:\Source\bflat\samples\Snake>xcopy efi\boot\BOOTX64.EFI X:\EFI\BOOT\
efi\boot\BOOTX64.EFI
1 File(s) copied
- 之后,我重新打开
diskpart
并运行以下命令:
Microsoft DiskPart version 10.0.22621.1
Copyright (C) Microsoft Corporation.
On computer: MATIN
DISKPART> select vdisk file=F:\disk.vhdx
DiskPart successfully selected the virtual disk file.
DISKPART> select partition 2
Partition 2 is now the selected partition.
DISKPART> remove letter=X
DiskPart successfully removed the drive letter or mount point.
DISKPART> detach vdisk
DiskPart successfully detached the virtual disk file.
DISKPART> exit
- 现在,根据给定的说明,虚拟磁盘已准备就绪。所以我打开 Hyper-V Manager 并执行以下操作
New -> Virtual Machine
- 我命名它
BootTest
并将位置设置为默认值 - 然后,我将 Generation 设置为 Gen-2 以支持 UEFI
- 我分配 2048MB 内存并禁用动态内存,因为它可能会导致问题
- 然后,我将连接设置为“未连接”
- 接下来,我将驱动器中存储的 VHDX 文件连接
F:
到虚拟机,如下所示:
- 现在,这是摘要中显示的内容:
Description:
Name:
Generation: Generation 2
Memory:
Network:
Hard Disk:
BootTest
2048 MB
Not Connected
F:\disk.vhdx (VHDX, fixed size)
我还禁用了安全启动,因为它也可能会导致问题:
现在,我打开虚拟机连接到它并运行它,这是显示的错误: