2012年8月15日 星期三

使用Visual Studio 2010建立 EDK application

編輯EFI code最常遇到幾點不方便像是沒有小番茄可用、沒有方便的操作介面,再加上全都是C code,這更是考驗你對程式語言的熟析程度。
在網路上找了好久,終於找到可以透過Visual Studio直接編譯EFI code的方法,以下就介紹如何透過Visual Studio的操作來編譯EFI application

Step1. 開新專案
        開啟Visual Studio 2010並點選 FileNewProject From Existing Code.

Step2. 指定專案類型Visual C++

Step3. 指定專案與程式碼來源
        (1)UDK2010資料夾存放路徑
        (2)指定專案名稱
        (3)加入需要使用附檔名
*.cpp;*.cxx;*.cc;*.c;*.inl;*.h;*.hpp;*.hxx;*.hm;*.inc;*.rc;*.resx;*.idl;*.rc2;*.def;*.odl;*.asm;*.asmx;*.xsd;*.bin;*.rgs;*.html;*.htm為預設附檔名,在此添加*.inf

Step4. 指定專案使用設定,選擇Use external build system選項

Step5. 設定偵錯組態
        (1)先建立一個批次檔UDK2010.bat並加入以下執行命令

call edksetup.bat
set EFI_SOURCE=%CD%\MyPkg

if not "%1"=="" goto ALL
build -a X64 -p MyPkg\MyPkg.dsc --log=build.log
goto end

:ALL
if not "%1"=="all" goto CLEAN
build %1 -p MyPkg\MyPkg.dsc --log=build.log
goto end

:CLEAN
if not "%1"=="clean" goto X86
build %1 -p MyPkg\MyPkg.dsc --log=build.log
echo %1
goto end

:X86
if not "%1"=="32" goto X64
build -a IA32 -p MyPkg\MyPkg.dsc --log=build.log
goto end

:X64
if not "%1"=="64" goto other
build -a X64 -p MyPkg\MyPkg.dsc --log=build.log
goto end

:other
echo ERROR ! Input variable
goto end

:end

        (2)在“Build command line”輸入“UDK2010.bat
        (3)在“Rebuild command line”輸入“UDK2010.bat 64(建立x64 EFI application)
        (4)在“Clean command line”輸入“UDK2010.bat clean

設定成功畫面


Step6. 建立UEFI application
點選BuildBuild Solution,成功建立時將出現以下紅色框框的訊息


沒有留言:

張貼留言