窄口牛_山西太原♂ 6:13:44
https://github.com/FlyGoat/csmwrap
窄口牛_山西太原♂ 6:15:48
CSMWrap
CSMWrap is a cool little hack that brings back the good old PC BIOS on those fancy-pants UEFI-only systems. It utilises the CSM (Compatibility Support Module) and VESA VBIOS from SeaBIOS Project to emulate a legacy BIOS environment.
CSMWrap 是一个很酷的小技巧,它可以在那些花哨的纯 UEFI 系统上恢复了旧的 PC BIOS。它利用 SeaBIOS Project 的 CSM(兼容性支持模块)和 VESA VBIOS 来模拟传统的 BIOS 环境。
Current Status
Right now, CSMWrap can: 现在,CSMWrap 可以:
Boot FreeDOS, Windows XP, and Windows 7 in QEMU (both q35 and piix4 machines)
在 QEMU 中启动 FreeDOS、Windows XP 和 Windows 7(q35 和 piix4 机器)
Run on some real hardware too! (Your mileage may vary)
也可以在一些真实的硬件上运行!(您的里程可能会有所不同)
Implementation Details 实现细节
CSMWrap works by: CSMWrap 的工作原理是:
Unlocking the legacy BIOS memory region (0xC0000-0xFFFFF)
解锁传统 BIOS 内存区域 (0xC0000-0xFFFFF)
Loading the SeaBIOS CSM module into memory
将 SeaBIOS CSM 模块加载到内存中
Configuring memory mapping for legacy applications
为传统应用程序配置内存映射
Setting up VGA BIOS with information from EFI GOP
使用 EFI GOP 提供的信息设置 VGA BIOS
Building an E820 memory map based on EFI memory map
基于 EFI 内存映射构建 E820 内存映射
Providing essential compatibility tables (ACPI, SMBIOS)
提供基本兼容性表 (ACPI、SMBIOS)
Initializing the CSM module and legacy services
初始化 CSM 模块和传统服务
Transferring control to the legacy boot process
将控制权转移到传统引导进程
How to Use 如何使用
Simply use csmwarp.efi as your bootloader, you can place it in your EFI partition and boot from it. Remember to disable Secure Boot, and Above 4G Decoding in your BIOS/UEFI settings.
只需使用 csmwarp.efi 作为 bootloader,您就可以将其放在 EFI 分区中并从中启动。请记住在 BIOS/UEFI 设置中禁用安全启动和 4G 以上解码。
Limitations
Above 4G Decoding 4G 解码以上
It is almost required to run CSMWrap with above 4G decoding disabled in your BIOS/UEFI. As UEFI firmwares are likely to place GPU's VRAM BAR above 4G, and legacy BIOS are 32bit which means it can only access the first 4G of memory.
在 BIOS/UEFI 中禁用上述 4G 解码的情况下运行 CSMWrap 几乎是必需的。由于 UEFI 固件可能会将 GPU 的 VRAM BAR 置于 4G 以上,而旧版 BIOS 是 32 位的,这意味着它只能访问前 4G 内存。
Legacy Region Unlocking 旧版区域解锁
Currently csmwrap relies on EFI_LEGACY_REGION2_PROTOCOL to enable writing to the legacy region. This is not available on all systems. For system that do not support this protocol, csmwrap will attempt to use PAM registers in chipset to perform decoding, which is not guaranteed to work.
目前,csmwrap 依赖 EFI_LEGACY_REGION2_PROTOCOL 来启用对旧版区域的写入。这并非在所有系统上都可用。对于不支持此协议的系统,csmwrap 将尝试使用芯片组中的 PAM 寄存器进行解码,但不能保证有效。
Windows Video Modesetting Issues Windows 视频模式设置问题
Windows XP/7's video modesetting logic is a bit mysterious. It may try to set a incompatible mode using int10h, which will cause flickering or even black screen after transferring control to the legacy OS.
Windows XP/7 的视频模式设置逻辑有点神秘。它可能会尝试使用 int10h 设置不兼容模式,这将导致控制权转移到旧版作系统后闪烁甚至黑屏。
This is a known issue and may be fixed in the future.
这是一个已知问题,将来可能会修复。
Meanwhile you can try to inject the GPU driver to OS image to avoid using the VESA BIOS.
同时,您可以尝试将 GPU 驱动程序注入作系统镜像,以避免使用 VESA BIOS。
Credits
SeaBIOS for the CSM module and VESA VBIOS
用于 CSM 模块和 VESA VBIOS 的 SeaBIOS
Nyu-EFI for EFI C runtime, build system, and headers
Nyu-EFI 用于 EFI C 运行时、构建系统和头文件
EDK2 for code snippets
EDK2 用于代码片段
@CanonKong for test feedback and general knowledge
测试反馈和常识@CanonKong