How to implement an UEFI Shell Application

1.在$(EFI_SOURCE)\Application\Shell下创建一个文档HelloWorld,包括:

        C header file (HelloWorld.h)

        C source file (HelloWorld.c)

         A component  description HelloWorld.inf file

HelloWorld.inf 为:

[defines]
BASE_NAME            = HelloWorld
FILE_GUID            = C794AFD5-ABA6-4d80-8347-38F5A022A827
COMPONENT_TYPE       = APPLICATION

[sources.common]
 EfiShellLib.h
 HelloWorld.h  
 HelloWorld.c

  
[includes.common]
  $(EDK_SOURCE)\Foundation
  $(EDK_SOURCE)\Foundation\Include
  $(EDK_SOURCE)\Foundation\Include\IndustryStandard
  $(EDK_SOURCE)\Foundation\Efi
  $(EDK_SOURCE)\Foundation\Efi\Include
  $(EDK_SOURCE)\Foundation\FrameWork
  $(EDK_SOURCE)\Foundation\FrameWork\Include
  $(EDK_SOURCE)\Foundation\Core\Dxe
  $(EFI_SOURCE)\Application\Shell\Inc
  $(EFI_SOURCE)\Application\Shell\Library
  $(DEST_DIR)\

[libraries.common] 
  EfiShellLib

[nmake.common]
  IMAGE_ENTRY_POINT=HelloMain

HelloWorld.c为:

EFI_APPLICATION_ENTRY_POINT(HelloMain)

EFI_STATUS
HelloMain(
 IN EFI_HANDLE      ImageHandle,
 IN EFI_SYSTEM_TABLE    *SystemTable
)
{
 EFI_SHELL_APP_INIT(ImageHandle,SystemTable); 
 
 Print(L"This probably works\n");

 return EFI_SUCCESS;
}

2.在build.dsc中添加HelloWorld.inf模块

Application\Shell\HelloWorld\HelloWorld.inf  FV=NULL

FV=NULL是产生的*.EFI没有被包在 firmware volume

3.编译完成后,在uefi64\X64 or uefi64ddt\X64 下生产${BASE_NAME}.efi,通过U盘在Shell环境下测试生成的*.efi

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值