当前位置:网站首页>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 :
边栏推荐
- How to excavate and research ideas from the paper
- Altium Designer 19.1.18 - 清除测量距离产生的信息
- Record the opening ceremony of Beijing Winter Olympics with display equipment
- Application of ultra pure water particle counter in electronic semiconductors
- PIL's image tool image reduction and splicing.
- The printer encountered an abnormal configuration problem 0x8007007e (win10)
- RTOS in the development of STM32 single chip microcomputer
- [neo4j] common operations of neo4j cypher and py2neo
- What is deep learning?
- Count and sort the occurrence times of specific fields through SQL statements
猜你喜欢
Leetcode solution - number of islands
Thunderbird tutorial \ easy to use mail client
Train your dataset with yolov4
Pagoda create multiple sites with one server
Altium Designer 19.1.18 - 更改铺铜的透明度
研究发现,跨境电商客服系统都有这五点功能!
MySQL blind note common functions
II Simple NSIS installation package
研究發現,跨境電商客服系統都有這五點功能!
Opendrive arc drawing script
随机推荐
·Practical website·
Ads learning record (lna_atf54143)
Global and Chinese market of blackbody calibration source 2022-2028: Research Report on technology, participants, trends, market size and share
Calibre garbled
Openxlsx field reading problem
如何将EasyCVR平台RTSP接入的设备数据迁移到EasyNVR中?
QT's excellent articles
mysql 盲注常见函数
Altium Designer 19.1.18 - 更改铺铜的透明度
Ads usage skills
A series of problems in offline installation of automated test environment (ride)
Use stm32cubemx tool to write the demo program of FreeRTOS
The folder directly enters CMD mode, with the same folder location
研究发现,跨境电商客服系统都有这五点功能!
Could NOT find XXX (missing: XXX_LIBRARY XXX_DIR)
Close of office 365 reading
MySQL blind note common functions
1089 insert or merge, including test point 5
Threads and processes
String judgment