编译第一个uefi文件
来源:互联网 发布:nero刻录软件怎样下载 编辑:程序博客网 时间:2024/05/17 07:24
搭建好uefi开发环境之后,在MyWorkspace文件夹中建立一个文件夹ExamplePkg; ,然后在ExamplePkg文件夹中创建HelloWorld文件夹,Include文件夹,ExamplePkg.dec文件,ExamplePkg.dsc文件,buildx86.bat文件(这个文件的文件名不重要,重要的是里面的批处理命令,)
.dec文件中内容为
[Defines]
DEC_SPECIFICATION = 0x00010006
PACKAGE_NAME = ExamplePkg
PACKAGE_GUID = A0D78D6-2CAF-414b-BD4D-B6762A894289
PACKAGE_VERSION = 1.01
[Includes]
Include
[LibraryClasses]
.dsc文件中内容为
[Defines]
PLATFORM_NAME = Example
PLATFORM_GUID = 587CE499-6CBE-43cd-94E2-186218569479
PLATFORM_VERSION = 1.01
DSC_SPECIFICATION = 0x00010006
OUTPUT_DIRECTORY = Build/Example
SUPPORTED_ARCHITECTURES = IA32|IPF|X64|EBC|ARM|AARCH64
BUILD_TARGETS = DEBUG|RELEASE
SKUID_IDENTIFIER = DEFAULT
[LibraryClasses]
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
[Components]
ExamplePkg/HelloWorld/HelloWorld.inf
.bat文件中内容为
@call "C:\MyWorkSpace\edksetup.bat"
Build -t VS2008x86 -a IA32 -p ExamplePkg\ExamplePkg.dsc -m ExamplePkg\HelloWorld\HelloWorld.inf -b RELEASE
pause
HelloWorld文件夹中要两个文件,HelloWorld.c HelloWorld.inf
.c文件中内容为
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/UefiApplicationEntryPoint.h>
EFI_STATUS EFIAPI UefiMain(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
Print(L"HelloWorld_jyw");
return EFI_SUCCESS;
}
.inf文件中内容为
[Defines]
INF_VERSION = 0x00010006
BASE_NAME = HelloWorld
FILE_GUID = 6987936E-ED34-44db-AE97-1FA5E4ED2117
MODULE_TYPE = UEFI_APPLICATION
VERSION_STRING = 1.01
ENTRY_POINT = UefiMain
[Sources]
HelloWorld.c
[Packages]
MdePkg/MdePkg.dec
ExamplePkg/ExamplePkg.dec
[LibraryClasses]
UefiApplicationEntryPoint
UefiLib
因为要做的事情很简单只是打印hellowold所以Include文件夹中不需要东西
其目录形式为:
ExamplePkg-->HelloWorld-->HelloWorld.c
ExamplePkg-->HelloWorld-->HelloWorld.inf
ExamplePkg-->Include
ExamplePkg-->buildx86.bat
ExamplePkg-->ExamplePkg.dec
ExamplePkg-->ExamplePkg.dsc
然后执行buildx86.bat
在MyWorkspace文件夹中的build文件夹中会发现一个名为Example文件夹,里面有RELEASE_VS2008x86文件夹,进去有 IA32文件夹,再进去有HelloWorld.efi文件,这便是编译生成的efi文件,其实会生成两个.efi文件,另一个在哪里可以在资源管理器中搜一下,
然后打开MyWorkSpace\Build\NT32IA32\DEBUG_VS2008x86\IA32\SecMain.exe,这是一个模拟环境回车一下,然后输入”fsnt0:“回车,再输入helloworld.efi(如果不想敲全名还可以敲 h 然后tab键),然后回车就可以看到输出了。
- 编译第一个uefi文件
- 如何编译第一个uefi程序【转载】
- 编译第一个文件
- 第一个Uefi驱动--helloworld
- 调用Uefi第一个驱动--hello world
- 第一个linux编译
- 第一个QT文件为毛编译不出来
- 第一个LED驱动 , (一) . 编译步骤 , 文件目录
- mac 环境下 编译运行第一个java文件
- 第一个Makefile文件
- 第一个Makefile文件
- 第一个shell文件
- 第一个.so文件
- 第一个bootstrap文件
- 编译第一个驱动程序笔记
- 内核编译第一个错误
- 【我所认知的BIOS】—> uEFI AHCI Driver(4) — 第一个Protocol真难搞
- 第一个Makefile文件(可以用来编译前面红黑树的实现程序和测试程序)
- BZOJ 1853 SCOI2010 幸运数字 容斥原理+DFS
- 【Android】android:windowSoftInputMode属性详解
- js正则表达式(简单例子)
- js特效
- 屹立腊月寒冬中的山园小梅是如此铮铮傲骨
- 编译第一个uefi文件
- linux gcc常用命令
- 1. vs2012创建live555工程
- 茶与水的缘;
- 【LeetCode】Swap Nodes in Pairs
- IOS:Size Classes
- Android应用资源---字符串资源类型(String)
- 定位单词位置
- 日本二手服装生意火爆,你看到商机了吗?