当前位置:网站首页>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 :
边栏推荐
- Altium designer 19.1.18 - change the transparency of copper laying
- Random function usage notes
- Altium Designer 19.1.18 - 更改铺铜的透明度
- Global and Chinese market of resistivity meter 2022-2028: Research Report on technology, participants, trends, market size and share
- Software designer: 03 database system
- Screen record of the opening ceremony of the Beijing winter olympics 2
- Batch modify the txt file code to UTF-8 (notepad++)
- Readme, self study record
- . Net service governance flow limiting middleware -fireflysoft RateLimit
- cygwin
猜你喜欢
Oracle-触发器和程序包
Pagoda create multiple sites with one server
About the problem that MySQL connector net cannot be cleared in MySQL
Openxlsx field reading problem
C language uses arrays to realize the intersection, union, difference and complement of sets
Win10 shortcut key
MySQL blind note common functions
Package ‘*****‘ has no installation candidate
Numpy——1.数组的创建
Altium Designer 19.1.18 - 隐藏某一个网络的飞线
随机推荐
[neo4j] common operations of neo4j cypher and py2neo
Acwing-宠物小精灵之收服-(多维01背包+正序倒序+两种形式dp求答案)
Day08 ternary operator extension operator character connector symbol priority
. Net service governance flow limiting middleware -fireflysoft RateLimit
软件设计师:03-数据库系统
Use stm32cubemx tool to write the demo program of FreeRTOS
P3D gauge size problem
Scm-05 basis of independent keyboard
Day01 markdown log entry tips
A simple method to prove 1/t Fourier transform
Record the torch encountered by win10 cuda. is_ False problem in available()
Function and usage of function pointer
MySQL - storage engine
Global and Chinese market for blood typing 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of core pallets 2022-2028: Research Report on technology, participants, trends, market size and share
.NET服务治理之限流中间件-FireflySoft.RateLimit
A series of problems in offline installation of automated test environment (ride)
Global and Chinese market of digital shore durometer 2022-2028: Research Report on technology, participants, trends, market size and share
Random function usage notes
QT's excellent articles