当前位置:网站首页>UEFI development learning 3 - create UEFI program
UEFI development learning 3 - create UEFI program
2022-07-05 07:51:00 【Yang_ Winston】
This article mainly explains one UEFI How the program is created , There are no complex functions , It just includes writing a UEFI Some basic documents and operations required by the program , stay shell Simple interface output Hello world. Let's talk about the steps :
First, in the vUDK2017/EmulatorPkg/Application Create a new one in the directory HelloWorld Folder , Creating HelloWorld.c and HelloWorld.inf file . It doesn't have to be EmulatorPkg Can only be created after UEFI Program , We can also create our own Pkg Directories are used to write your own programs , But when compiling, you should specify which one to compile Pkg, You can specify , It can also be in build In the catalog target.txt File specifies the default compilation Pkg.
ACTIVE_PLATFORM = EmulatorPkg/EmulatorPkg.dsc
HelloWorld.c file
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/UefiApplicationEntryPoint.h>
EFI_STATUS
EFIAPI
UefiMain(IN EFI_HANDLE ImageHandle,IN EFI_SYSTEM_TABLE *SystemTable)
{
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"HelloWorld\n");
return EFI_SUCCESS;
}
HelloWorld.inf file
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = UefiMain
FILE_GUID = A51354BA-A1DC-4179-AAE1-887EDFC9D9F7
MODULE_TYPE = UEFI_APPLICATION
VERSION_STRING = 1.0
ENTRY_POINT = UefiMain
[Sources]
HelloWorld.c
[Packages]
MdePkg/MdePkg.dec
[LibraryClasses]
UefiApplicationEntryPoint
UefiLib
Last but not least EmulatorPkg.dsc Of documents [Components] Add the module we created under the directory .
[Components]
EmulatorPkg/Application/HelloWorld/HelloWorld.inf
EmulatorPkg/Application/DrawRectangle/DrawRectangle.inf
EmulatorPkg/Application/MyUseProtocol/MyUseProtocol.inf
EmulatorPkg/Application/CreateProtocol/CreateProtocol.inf
EmulatorPkg/Application/EventTest/EventTest.inf
EmulatorPkg/Application/GraphicsOutput/GraphicsOutput.inf
EmulatorPkg/Application/GluSnake/GluSnake.inf
Compile operation
- The command line terminal enters vUDK2017 Catalog . function build command .
- After compiling successfully, in vUDK2017/Build/EmulatorX64/DEBUG_GCC5/X64/EmulatorPkg/Application/HelloWorld/HelloWorld The programmed UefiMain.efi file ( This file name is the same as inf In the document BASE_NAME Agreement ) Copied to the run-ovmf/hda-contents Under the table of contents .
- Command the terminal to enter run-ovmf Catalog , function qemu command , Start simulator .
qemu-system-x86_64 -pflash bios.bin -hda fat:hda-contents -net none
function UefiMain.efi Program . The results are shown in the following figure :
边栏推荐
- Esmini longspeedaction modification
- 1089 insert or merge, including test point 5
- Software designer: 03 database system
- assert_ Usage of param function
- Apple modify system shortcut key
- RF ride side door processing of prompt box
- Acwing-宠物小精灵之收服-(多维01背包+正序倒序+两种形式dp求答案)
- Embedded AI intelligent technology liquid particle counter
- High end electronic chips help upgrade traditional oil particle monitoring
- II Simple NSIS installation package
猜你喜欢
Opendrive arc drawing script
Altium designer 19.1.18 - change the transparency of copper laying
生产中影响滑环质量的因素
Ads usage skills
mysql 盲注常见函数
Win10 shortcut key
MySQL - storage engine
Embedded AI intelligent technology liquid particle counter
Pagoda create multiple sites with one server
MySQL blind note common functions
随机推荐
Summary of STM32 serial port sending and receiving data methods
Altium Designer 19.1.18 - 导入板框
Ads learning record (lna_atf54143)
Calibre garbled
msys2
Practical application cases of digital Twins - fans
PIL's image tool image reduction and splicing.
Cadence simulation encountered "input.scs": can not open input file change path problem
Mlperf training v2.0 list released, with the same GPU configuration, the performance of Baidu PaddlePaddle ranks first in the world
1089 insert or merge, including test point 5
Typecho adds Baidu collection (automatic API submission plug-in and crawler protocol)
Global and Chinese market for blood typing 2022-2028: Research Report on technology, participants, trends, market size and share
How to excavate and research ideas from the paper
Function and usage of function pointer
Detailed explanation of C language pointer
MLPerf Training v2.0 榜单发布,在同等GPU配置下百度飞桨性能世界第一
Exit of pyGame, idle and pycharm
Linked list (establishment, deletion, insertion and printing of one-way linked list)
Altium Designer 19.1.18 - 清除测量距离产生的信息
RF ride side door processing of prompt box