光陰似箭,歲月如梭! 在EDK推出好幾年後,緊接著BIOS界中的另一個大事情就是又來了一個EDKII。
其實EDK II 推出的概念是因為EDK 有許多使用者有一堆抱怨,像是不能跨平台使用啦~不能用"微軟"之外的Compiler啦~東西不夠模組化啦~
因此針對了使用者的抱怨而做了一些修改? (一些嗎? 改的還蠻大的,不過幾乎都是在Build tool端,本身你寫EFI driver的方式沒啥改變)
從寫EFI driver的角度來看,你會發現有許多的EntryPoint全部被導入到EDKII的Library內去做初始化,這個好處是當Platform改變時容易移植到其他平台!
而其他的部分你就要去習慣新的Build tool的語法以及用法了。
不多說,那要怎麼開始呢? 一樣找Google 大神,找EDKII後點擊第一個連結去抓code吧!
1. 先下載 EDKII codebase
2.解壓縮到隨便一個目錄,我是解壓縮到 E:\UDK2010.SR1.UP1
3.從說明文件 "UDK2010.SR1.UP1-ReleaseNotes-MyWorkSpace.txt" 內你可以得知下面幾件事情
1) REFERENCE PLATFORMS 有兩種:
a.Desktop - [Nt32Pkg]
Nt32Pkg\Nt32Pkg.dsc
b. DUET - UEFI Simulation Environment directly on Hardware (via boot process)
2) HOW TO BUILD (WINDOWS SYSTEM) 你要如何在windows系統去建構他
a.Setup Build Environment 設定你的建構環境
- Install Microsoft Visual Studio 2008* SP1 in the build machine and make sure that AMD64
complier was selected when installing.
(安裝微軟的VS2008 SP1,在安裝時要確認你有把AMD64 Compiler選項打勾)
- Download "iasl-win-20070508.zip" from "http://www.acpica.org/downloads/Version_20070508.php"
and extract file "iasl.exe" to C:\ASL
(去這個連結抓iasl-win-20070508.zip 這個檔案,並解壓縮後把iasl.exe複製到C:\ASL ,如果
C:\ASL目錄不存在請自己建立)
b . Extract Common Source Code 解壓縮需要的檔案
- Extract files in [UDK2010.SR1.UP1.MyWorkSpace] to the working space directory (e.g C:).
Note the Directory "MyWorkSpace" will be created as a result.
In this case, it is C:\MyWorkspace. There are two BaseTools package one is for Windows
system and another is for UNIX-Like system.
Please make sure BaseTools(Windows).zip is used here. Expand the appropriate BaseTools to
C:\MyWorkSpace
- Make sure the patch utility has been installed in your machine.
(把UDK2010.SR1.UP1.MyWorkSpace.zip檔案解壓縮後他會產生一個目錄叫做
MyWorkSpace,在這目錄內有需要的檔案,你可以把這個目錄複製到
C:\MyWorkSpace然後再把Windows的Build tool "BaseTools(Windows).zip"也解壓縮到
這個目錄裡面)
因為我是放在E:\MyWorkSpace,所以會長得像下面這樣子:
c. Generate OpenSSL* Crypto Library (產生OpenSSL Crypto 函數庫)
OpenSSL 的 Crypto 函數庫實作了許多資料編碼方法,像是資料摘要函數(使用
MD2/MD4/MD5/SHA雜湊演算法),對稱式加密函數(使用RC2/RC4/RC5/DES/IDEA
演算法)以及非對稱式加密函數(DSA/RSA 演算法)。
- Open file "C:\MyWorkspace\CryptoPkg\Library\OpensslLib\Patch-HOWTO.txt" and
follow the instruction to install OpenSSL* for UEFI building.
(打開這個目錄下的文件"Patch-HOWTO.txt",然後跟著他的說明去安裝需要的檔案)
◎ Download OpenSSL 0.9.8w from official website:
http://www.openssl.org/source/openssl-0.9.8w.tar.gz (先把這個檔案抓下來)
◎ Extract TAR into CryptoPkg/Library/OpenSslLib/openssl-0.9.8w
(把解壓縮出來的目錄openssl-0.9.8w 放到CryptoPkg/Library/OpenSslLib底下)
◎ Apply this patch: EDKII_openssl-0.9.8w.patch, and make installation
(套用以及安裝這個修正)
-----------------------------
For Windows Environment:
------------------------------ Make sure the patch utility has been installed in your machine.
(確認你有安裝Patch的工具,如果沒有,請先到下面網站下載及安裝)
Install Cygwin or get the patch utility binary from
http://gnuwin32.sourceforge.net/packages/patch.htm
Install Cygwin or get the patch utility binary from
http://gnuwin32.sourceforge.net/packages/patch.htm
我是下載下面紅色框框的那一個
安裝後會在我的C:\Program Files (x86)\GnuWin32目錄內
- cd $(WORKSPACE)\CryptoPkg\Library\OpensslLib\openssl-0.9.8w
- "C:\Program Files (x86)\GnuWin32\bin\patch" -p0 -i ..\EDKII_openssl-0.9.8w.patch
- "C:\Program Files (x86)\GnuWin32\bin\patch" -p0 -i ..\EDKII_openssl-0.9.8w.patch
- cd ..
d. Build Steps (開始Build code吧~)
*** NT32 ***
- Open a command prompt, type command "cd C:\MyWorkspace" to enter the workspace
- Install.cmd
*** NT32 ***
- Open a command prompt, type command "cd C:\MyWorkspace" to enter the workspace
directory, and then type command "edksetup" to initialize the working environment.
- Type below commands to build platforms "build -t VS2008x86
- Type below commands to build platforms "build -t VS2008x86
(進入到你想到的Platform 目錄內,然後輸入build -t VS2008x86 ,然後你就可以
看到開始建構你的Code了,做到這一步就算完成了!)
底下是其他注意事項:
There are two methods to select the tool chain (Use Microsoft Visual Studio 2008* as sample):
- Update TOOL_CHAIN_TAG in file Conf/target.txt: TOOL_CHAIN_TAG = VS2008
- Add -t build option in command line: "build -t VS2008 ... "
For 32-bit VS2008 on 64-bit WINDOWS OS, VS2008x86 should be selected instead of VS2008.
Please refer to tools_def.txt for all supported tool chains and detailed descriptions.
(tools_def.txt will be generated at Conf directory after running "edksetup".)
最後,希望大家都能夠成功建立自己的建構環境!
3 則留言:
請問我在build的時候
會出現u1077的錯誤
分別是cl.exe和nmake.exe
請問該如何解?
照著做已經成功建立環境.但有兩點要注意(以我的情況)
1. 假如Program Files後面沒有(x86), 則VS2008後面也不需要加
2. 須要先做 "edksetup.bat --nt32"再build,否則會找不到windows.h
感謝版主的流程...
請問我在安裝edk2 的時候
出現
NT32IA32\DEBUG_VS2010\IA32\MdeModulePkg\Universal\Network\Mtftp4Dxe\Mtftp4Dxe\DE
BUG\Mtftp4Dxe.dll
NMAKE : fatal error U1077: 'copy' : 傳回碼 '0x1'
Stop.
ComponentName.c
build...
: error 7000: Failed to execute command
C:\Program Files\Microsoft Visual Studio 10.0\Vc\bin\nmake.exe /nologo t
build [c:\edk2\Build\NT32IA32\DEBUG_VS2010\IA32\MdeModulePkg\Universal\Network\A
rpDxe\ArpDxe]
build...
: error F002: Failed to build module
c:\edk2\MdeModulePkg\Universal\Network\ArpDxe\ArpDxe.inf [IA32, VS2010,
DEBUG]
- Failed -
請問這是甚麼問題呢?
我爬文爬了很久
都沒有看到相關解決辦法
拜託~~請告訴我哪邊弄錯了
感謝~~
張貼留言