- 不方便讲,自己搞
- It's not convenient to talk, do it yourself
- 定义BootConfig类,如下定义:
- Definition struct BootConfig, as follows definition:
QuantumNEC::Boot::BootConfig bootConfig { };
- 定义BootService类,如下定义:
- Definition class BootService, as follows definition:
/* 初始化屏幕和初始化日志系统 */
QuantumNEC::Boot::BootServiceMain bootService { &bootConfig };
- 使用BootService类,如下
- Use class BootService, as follows:
/// 读取Logo并显示
Status = bootService.getBmpConfig( &bootConfig.BmpData ).displayLogo( L"\\EFI\\Boot\\Logo.BMP" );
// 读取ACPI表
Status = bootService.getApicTable( );
// 获取内存布局
Status = bootService.getMemoryMap( );
// 读取并装载内核
Status = bootService.loadKernel( L"\\QuantumNEC\\microKernel.elf" );
// 设置内核页表
Status = bootService.setPageTable( );
// 读取Unicode字体并弹出
Status = bootService.setUnicodeTTF( );
// 跳转内核
Status = bootService.jumpToKernel( &bootConfig );
- 示例
#include <Boot/Boot.hpp>
#include <Boot/Include.hpp>
auto initializeGlobalData( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) -> VOID { // 初始化全局变量
QuantumNEC::Boot::GlobalImageHandle = ImageHandle;
QuantumNEC::Boot::GlobalSystemTable = SystemTable;
return;
}
extern "C" EFI_STATUS EFIAPI UefiMain( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) {
EFI_STATUS Status { EFI_SUCCESS };
initializeGlobalData( ImageHandle, SystemTable );
QuantumNEC::Boot::BootConfig bootConfig { };
QuantumNEC::Boot::BootServiceMain bootService { &bootConfig };
// 读取Logo并显示
Status = bootService.getBmpConfig( &bootConfig.BmpData ).displayLogo( L"\\EFI\\Boot\\Logo.BMP" );
// 读取ACPI表
Status = bootService.getApicTable( );
// 获取内存布局
Status = bootService.getMemoryMap( );
// 读取并装载内核
Status = bootService.loadKernel( L"\\QuantumNEC\\microKernel.elf" );
// 设置内核页表
Status = bootService.setPageTable( );
// 读取Unicode字体并弹出
Status = bootService.setUnicodeTTF( );
// 跳转内核
Status = bootService.jumpToKernel( &bootConfig );
return EFI_SUCCESS;
}
- 如有盗版,全家死🐎
- If there is piracy, the whole family dies mother