UEFI(使用EDK2)编程

参考从零开始的UEFI裸机编程 (kagurazakakotori.github.io)https://kagurazakakotori.github.io/ubmp-cn/print.html

下载EDK2

不习惯它的开发方式,改!

头文件Uefi.h,搜索,在MdePkg/Include/Uefi.h。

UEFI文档Welcome to Unified Extensible Firmware Interface Forum | Unified Extensible Firmware Interface Forumhttps://uefi.org

开始按照教程

环境ubuntu,交叉编译工具链使用教程方式,做一个OS LOADER的EFI

1. HELLO UEFI

1.1 编译efi

struct EFI_SYSTEM_TABLE {
    char _buf[60];
    struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
        unsigned long long _buf;
        unsigned long long (*OutputString)(
            struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
            unsigned short *String);
        unsigned long long _buf2[4];
        unsigned long long (*ClearScreen)(
             struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This);
    } *ConOut;
};
  
void efi_main(void *ImageHandle __attribute__ ((unused)),
    struct EFI_SYSTEM_TABLE *SystemTable)
{
    SystemTable->ConOut->ClearScreen(SystemTable->ConOut);
    SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Hello UEFI!\n");
    while (1);
}

BIOS的EFI初始化好了,放在了struct EFI_SYSTEM_TABLE *SystemTable中,再运行自己的EFI,然后调用其中的接口。

main.c

#include <uefi.h>

/*
4.1 UEFI

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值