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