關於部落格
研究所升學、程式語言資訊、C/C++、Python、Perl、Shell、MySQL、PHP、CSS、VBA、JavaScript
  • 80316

    累積人氣

  • 2

    今日人氣

    0

    訂閱人氣

Build UEFI Application --- ShellCEntryLib.h + ShellAppMain (EFI Library build)

 

C:EDK2MdeModulePkgApplicationHelloWorld整個folder複製到C:EDK2MyPkgApplication中改名Hello,接下來修改一些地方

 1.1 MyPkgApplicationHelloHello.inf

=============================================================

[Defines]

  #為避免衝突而改

  INF_VERSION         = 0x00010006

  #產生文件名字為 Hello.efi

  BASE_NAME             = hello

  #(避免 GUID 與其他文件衝突, Create GUIDs online 產生新的一組GUID,或開啟VS2010 -> Tools -> Create GUID 來產生GUID)

  FILE_GUID            = ab0f9969-0a54-4695-ace7-42fe6bb84a1d  

  #模型種類:UEFI_DRIVER, DXE_DRIVER, DXE_RUNTIME_DRIVER, UEFI_APPLICATION, BASE

  MODULE_TYPE     = UEFI_APPLICATION

  #可自行修改

  VERSION_STRING = 1.0

  #入口函數

  ENTRY_POINT          = ShellCEntryLib

 

#

#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC

#

#主要的編譯文件

[Sources]

  Hello.c

# .dec裡面定義include的路徑

[Packages]

  MdePkg/MdePkg.dec

  ShellPkg/ShellPkg.dec

#連結的函數庫

[LibraryClasses]

  ShellCEntryLib

  UefiLib

=============================================================

 1.2 增加入口函數到Nt32PkgNt32Pkg.dsc,注意紅色字所添加的位置

=============================================================

[LibraryClasses]

  #

  # Entry point

  #

UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf

ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf

============================================================= 

1.3 Hello.inf 添加到 Nt32Pkg.dsc UnixPkg.dsc [Components.IA32]部分

=============================================================

[Components.IA32]

  MdeModulePkg/Application/HelloWorld/HelloWorld.inf

  MyPkg/Application/Hello/Hello.inf 

1.4 Hello.c

=============================================================

#include <Uefi.h>

#include <Library/UefiLib.h>

 

INTN EFIAPI

ShellAppMain (

  IN UINTN Argc,

  IN CHAR16 **Argv

  )

{

  Print(L"Hello !Welcome to the world of EDK II.n"); #注意’P’大寫

  return(0);

}

=============================================================

1.5 再一次執行以下三行指令即可 

        (1) build cleanall

        (2) build

        (3) build run       

1.6 Shell中輸入 hello  

 

相簿設定
標籤設定
相簿狀態