使用者工具

網站工具


uefi_learning

差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
下次修改
前次修改
uefi_learning [2024/04/07 11:33]
don
uefi_learning [2024/04/30 08:27] (目前版本)
don
行 1: 行 1:
 ====== UEFI 學習 ====== ====== UEFI 學習 ======
 +
 +[[https://uefi.org/specifications | UEFI specification download]]
 +
  
 {{:uefi_flow1.png|}} {{:uefi_flow1.png|}}
行 27: 行 30:
 |[FeaturePcd]| 用於列出本模塊用到的Pcd 常量| |[FeaturePcd]| 用於列出本模塊用到的Pcd 常量|
 |[PatchPcd]| 列出的Pcd 變量僅本模塊可用| |[PatchPcd]| 列出的Pcd 變量僅本模塊可用|
 +
 +[[http://guidgen.com|GUID 的生成]]
  
 1、[Defines]塊: 1、[Defines]塊:
行 69: 行 74:
  
 5、[BuildOptions]塊:\\ 5、[BuildOptions]塊:\\
-1、語法: +5-1、語法: 
-[BuildOptions]\\ +     [BuildOptions] 
-[編譯器家族] : [$ (Target)][Tool_CHAIN_TAG][$ (Arch)]_[CC | DLINK]_FLAGS [= |==]選項\\+     [編譯器家族] : [$ (Target)][Tool_CHAIN_TAG][$ (Arch)]_[CC | DLINK]_FLAGS [= |==]選項
  
-2、編譯器家族可以是MSFT(Visual Studio編譯器家族)、INTEL(Intel編譯器家族)、GCC(Gcc編譯器家族)和 RVCT(ARM編譯器家族)中的一個\\ +5-2、編譯器家族 
-Target是DEBUG、RELEASE和*中的一個,*是萬用字元\\ +     可以是MSFT(Visual Studio編譯器家族)、INTEL(Intel編譯器家族)、GCC(Gcc編譯器家族) 
-TOOL_CHAIN_TAG是編譯器的名字,編譯器定義在Conf/tools_def.txt檔中,*表示對指定編譯器家族內的所有編譯器都有效\\ +     和 RVCT(ARM編譯器家族)中的一個 
-Arch是體系結構,可以是IA32、X64、IPF、EBC或ARM,*是萬用字元\\ +     Target是DEBUG、RELEASE和*中的一個,*是萬用字元 
-CC表示編譯選項,DLINK表示連結選項\\ +     TOOL_CHAIN_TAG是編譯器的名字,編譯器定義在Conf/tools_def.txt檔中,*表示對指定編譯器家族內的所有編譯器都有效 
-=表示選項附加到預設選項後面,==表示僅使用所定義的選項,不用預設選項。它們後面是編譯選項或連接選項\\+     Arch是體系結構,可以是IA32、X64、IPF、EBC或ARM,*是萬用字元 
 +     CC表示編譯選項, 
 +     DLINK表示連結選項 
 +     =表示選項附加到預設選項後面, 
 +     ==表示僅使用所定義的選項,不用預設選項。它們後面是編譯選項或連接選項
  
-<code> 
-[BuildOptions] 
-  # Enable STDARG for variable arguments 
-  *_*_*_CC_FLAGS = -DHAVE_STDARG_H 
  
-  # Override MSFT build option to remove /Oi and /GL +==== inf檔編譯運行 ====
-  MSFT:*_*_*_CC_FLAGS          /GL- +
-  INTEL:*_*_*_CC_FLAGS         /Oi-+
  
-  # Oniguruma: potentially uninitialized local variable used 
-  MSFT:*_*_*_CC_FLAGS = /wd4701 /wd4703 
- 
-  # Oniguruma: intrinsic function not declared 
-  MSFT:*_*_*_CC_FLAGS = /wd4164 
- 
-  # Oniguruma: old style declaration in st.c 
-  MSFT:*_*_*_CC_FLAGS = /wd4131 
- 
-  # Oniguruma: 'type cast' : truncation from 'OnigUChar *' to 'unsigned int' 
-  MSFT:*_*_*_CC_FLAGS = /wd4305 /wd4306 
- 
-  # Oniguruma: nameless union declared in regparse.h 
-  MSFT:*_*_*_CC_FLAGS = /wd4201 
- 
-  # Oniguruma: 'type cast' : "int" to "OnigUChar", function pointer to "void *" 
-  MSFT:*_*_*_CC_FLAGS = /wd4244 /wd4054 
- 
-  # Oniguruma: previous local declaration 
-  MSFT:*_*_*_CC_FLAGS = /wd4456 
- 
-  # Oniguruma: signed and unsigned mismatch/cast 
-  MSFT:*_*_*_CC_FLAGS = /wd4018 /wd4245 /wd4389 
- 
-  # Oniguruma: tag_end in parse_callout_of_name 
-  GCC:*_*_*_CC_FLAGS = -Wno-error=maybe-uninitialized 
- 
-  # Oniguruma: implicit conversion from 'UINTN' (aka 'unsigned long long') to 'long' 
-  GCC:*_CLANG9_*_CC_FLAGS = -Wno-error=constant-conversion 
- 
-  # Not add -Wno-error=maybe-uninitialized option for XCODE 
-  # XCODE doesn't know this option 
-  XCODE:*_*_*_CC_FLAGS = 
- 
-</code> 
- 
-inf檔編譯運行\\ 
 原始檔案,inf工程檔完成,想要編譯運行這個模組,需要將inf工程檔添加到dsc的[Components]部分,然後就可以使用build工具編譯\\ 原始檔案,inf工程檔完成,想要編譯運行這個模組,需要將inf工程檔添加到dsc的[Components]部分,然後就可以使用build工具編譯\\
 模組應用程式是如何被編譯成.efi文件的:\\ 模組應用程式是如何被編譯成.efi文件的:\\
行 137: 行 103:
 efi模組檔————gBS ->LoadImage()將efi檔載入到記憶體中生成image物件————gBS->StartImage(Image)啟動Image物件\\ efi模組檔————gBS ->LoadImage()將efi檔載入到記憶體中生成image物件————gBS->StartImage(Image)啟動Image物件\\
  
-gBS 指向啟動服務表 global Boot Servers\\ +  * gBS 指向啟動服務表 global Boot Servers\\ 
-gST 指向系統表 global System Table\\ +  gST 指向系統表 global System Table\\ 
-gRT 指向運行時服務表 global Running Time\\ +  gRT 指向運行時服務表 global Running Time\\ 
-gImageHandle 指向正在執行的驅動或應用程式\\+  gImageHandle 指向正在執行的驅動或應用程式\\
  
 <code> <code>
行 276: 行 242:
   return Status;   return Status;
 } }
-+
-+
-+
-+
-+
-+
-+
-+
-+
-10 +
-11 +
-12 +
-13 +
-14 +
-15 +
-16 +
-17 +
-18 +
-19 +
-20 +
-21 +
-22 +
-23 +
-24 +
-25 +
-26 +
-27 +
-28 +
-29 +
-30 +
-31 +
-32 +
-33 +
-34 +
-35 +
-36 +
-37 +
-38 +
-39 +
-40 +
-41 +
-42 +
-43 +
-44 +
-45 +
-46 +
-47 +
-48 +
-49 +
-50 +
-51 +
-52 +
-53 +
-54 +
-55 +
-56 +
-57 +
-58 +
-59 +
-60 +
-61 +
-62 +
-63 +
-64 +
-65 +
-66 +
-67 +
-68 +
-69 +
-70 +
-71 +
-72 +
-73 +
-74 +
-75 +
-76 +
-77+
 _ModuleEntryPoint函数: _ModuleEntryPoint函数:
  
行 397: 行 287:
 </code> </code>
 標準應用程式工程模組入口函式呼叫過程:\\ 標準應用程式工程模組入口函式呼叫過程:\\
-efi——LoadImage——StartImage——_ModuleEntryPoint——ProcessModuleEntryPointList ——inf中指定的入口函数+efi——LoadImage——StartImage——_ModuleEntryPoint——ProcessModuleEntryPointList ——inf中指定的入口函数\\ 
 +原文連結:https://blog.csdn.net/wangyongh/article/details/105345077 
 + 
 + 
 +===== DSC 文件 ===== 
 +.inf 用于编译一个模块, 而.dsc 文件用于编译一个Package, 它包含了[Defines]、 
 +[LibraryClasses]、[Components] 几个必需部分以及[PCD]、[BuildOptions] 等几个可选部分。 
 + 
 + 
 +===== DEC 文件 ===== 
 +.dec 文件定义了公开的数据和接口,供其他模块使用。它包含了必需区块[Defines] 以及可选区块[Includes]、[LibraryClasses]、[Guids]、[Protocols]、[Ppis] 和[PCD] 几个部分。 
 +.dec文件需要被调用模块.inf文件所包含。
  
  
行 452: 行 353:
 |FatPkg, FatBinPkg|FAT支持包。| \\                     |FatPkg, FatBinPkg|FAT支持包。| \\                    
 原文連結:https://blog.csdn.net/u011057409/article/details/117636656 原文連結:https://blog.csdn.net/u011057409/article/details/117636656
 +
 +
 +===== Build 參數 =====
 +
 +^ 命令參數縮寫 ^ 命令參數全稱 ^ 描述 ^
 +|-h |--help |show this help message and exit顯示説明資訊。|
 +|-a TARGETARCH |--arch=TARGETARCH|選擇目標平臺架構,該選項被指定會取代Conf/target.txt中的TARGET_ARCH。|
 +|-p PLATFORMFILE |--platform=PLATFORMFILE|通過指定.dsc檔指定要編譯的package,該選項將會Conf/target.txt文件ACTIVE_PLATFORM。|
 +|-m MODULEFILE| --module=MODULEFILE|Build the module specified by the INF file name argument。|
 +|-b BUILDTARGET| --buildtarget=BUILDTARGET |選擇編譯成DEBUG還是RELEASE。指定該選項後會取代target.txt文件中TARGET。|
 +|-t TOOLCHAIN| --tagname=TOOLCHAIN|選擇tools_def.txt中定義的編譯工具,例如VS2012:-t vs2012|
 +|-n THREADNUMBER| |編譯器使用的執行緒數量,指定後取代target.txt檔中MAX_CONCURRENT_THREAD_NUMBER指定的執行緒數量。 Less than 2 will disable multi-thread builds.小於2就禁止多執行緒編譯。|
 +|-u| --skip-autogen | Skip AutoGen step.跳過AutoGen這一步。|
 +|-c| --case-insensitive | Don't check case of file name.檔案名不區分大小寫。|
 +|-w| --warning-as-error | Treat warning in tools as error.將警告做錯誤處理。|
 +|-j LOGFILE| --log=LOGFILE| Put log in specified file as well as on console.將編譯資訊輸出到檔。|
 +|-s| --silent| Make use of silent mode of (n)make.使用沉默模式執行make或nmake。|
 +|-q| --quiet| Disable all messages except FATAL ERRORS.編譯過程中只顯示嚴重錯誤資訊。|
 +|-d DEBUG| --debug=DEBUG| Enable debug messages at specified level.在指定的級別啟用調試消息。|
 +|-D MACROS| --define=MACROS| Macro: "Name [= Value]".定義宏。|
 +| | ---version| show program's version number and exit。|
 +
  
 ===== UEFI API ===== ===== UEFI API =====
行 462: 行 385:
 ==== PcdGetPtr() ==== ==== PcdGetPtr() ====
 PcdGetPtr(PcdHelloWorldPrintString) 讀取在PcdHelloWorldPrintString 的字串。 PcdGetPtr(PcdHelloWorldPrintString) 讀取在PcdHelloWorldPrintString 的字串。
 +
 +==== AMI VEB ====
 +AMI VEB 基本上就是一堆 .CIF 檔案的集合
 +
 + 
uefi_learning.1712460806.txt.gz · 上一次變更: 2024/04/07 11:33 由 don