EDK2是Intel 的UEFI實作 open source出來的成果。目前的build script裡面還沒把VC2012加進去。
以下簡單說明抓取EDK2到怎麼加入一個toolchain然後compile。
下載EDK2我是直接透過svn來fetch code。
svn co https://edk2.sourceforge.net/svnroot/edk2 edk2
修改Build Script抓下來後我們修改的地方是trunk\edk2
- edksetup.bat
這邊要把VS110COMNTOOLS這個環境變數加上去,圖中圈起來的部分就是額外加入的部分。
if defined VS110COMNTOOLS (
call "%VS110COMNTOOLS%\vsvars32.bat"
) else (
Conf/tools_def.txt
加入的地方分成三個部分。
- 在 Line49的地方加入
DEFINE VS2012x86_BIN = C:\Program Files (x86)\Microsoft Visual Studio 11.0\Vc\bin
DEFINE VS2012x86_DLL = C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE;DEF(VS2012x86_BIN)
DEFINE VS2012x86_BINX64 = DEF(VS2012x86_BIN)\x86_amd64
DEFINE VS2012x86_BIN64 = DEF(VS2012x86_BIN)\x86_ia64
在Line 479的地方加入# VS2005x86xASL -win64- Requires:
# Microsoft Visual Studio 2005 Team Suite Edition (x86)
# Microsoft Windows Server 2003 Driver Development Kit(Microsoft WINDDK) version 3790.1830
# Optional:
# Required to build EBC drivers:
# Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler)
# Required to build platforms or ACPI tables:
# Microsoft ASL ACPI Compiler (asl.exe) v4.0.0 from
# http://download.microsoft.com/download/2/c/1/2c16c7e0-96c1-40f5-81fc-3e4bf7b65496/microsoft_asl_compiler-v4-0-0.msi
第三個比較長,我是貼在2299行,也就是上一段IPF Definition結束的地方。
####################################################################################
# VS2012x86xASL - Microsoft Visual Studio 2012 with Microsoft ASL
# ASL - Microsoft ACPI Source Language Compiler (asl.exe)
####################################################################################
*_VS2012x86xASL_*_*_FAMILY = MSFT
*_VS2012x86xASL_*_MAKE_PATH = DEF(VS2012x86_BIN)\nmake.exe
*_VS2012x86xASL_*_MAKE_FLAG = /nologo
*_VS2012x86xASL_*_RC_PATH = DEF(WINSDK_BIN)\rc.exe
*_VS2012x86xASL_*_MAKE_FLAGS = /nologo
*_VS2012x86xASL_*_SLINK_FLAGS = /NOLOGO /LTCG
*_VS2012x86xASL_*_APP_FLAGS = /nologo /E /TC
*_VS2012x86xASL_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
*_VS2012x86xASL_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2012x86xASL_*_ASM16_PATH = DEF(VS2012x86_BIN)\ml.exe
##################
# ASL definitions
##################
*_VS2012x86xASL_*_ASL_PATH = DEF(WIN_ASL_BIN)
*_VS2012x86xASL_*_ASL_FLAGS = DEF(MS_ASL_FLAGS)
*_VS2012x86xASL_*_ASL_OUTFLAGS = DEF(MS_ASL_OUTFLAGS)
*_VS2012x86xASL_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
*_VS2012x86xASL_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
*_VS2012x86xASL_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
##################
# IA32 definitions
##################
*_VS2012x86xASL_IA32_*_DLL = DEF(VS2012x86_DLL)
*_VS2012x86xASL_IA32_MAKE_PATH = DEF(VS2012x86_BIN)\nmake.exe
*_VS2012x86xASL_IA32_CC_PATH = DEF(VS2012x86_BIN)\cl.exe
*_VS2012x86xASL_IA32_VFRPP_PATH = DEF(VS2012x86_BIN)\cl.exe
*_VS2012x86xASL_IA32_ASLCC_PATH = DEF(VS2012x86_BIN)\cl.exe
*_VS2012x86xASL_IA32_ASLPP_PATH = DEF(VS2012x86_BIN)\cl.exe
*_VS2012x86xASL_IA32_SLINK_PATH = DEF(VS2012x86_BIN)\lib.exe
*_VS2012x86xASL_IA32_DLINK_PATH = DEF(VS2012x86_BIN)\link.exe
*_VS2012x86xASL_IA32_ASLDLINK_PATH= DEF(VS2012x86_BIN)\link.exe
*_VS2012x86xASL_IA32_APP_PATH = DEF(VS2012x86_BIN)\cl.exe
*_VS2012x86xASL_IA32_PP_PATH = DEF(VS2012x86_BIN)\cl.exe
*_VS2012x86xASL_IA32_ASM_PATH = DEF(VS2012x86_BIN)\ml.exe
*_VS2012x86xASL_IA32_MAKE_FLAGS = /nologo
DEBUG_VS2012x86xASL_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm
RELEASE_VS2012x86xASL_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
NOOPT_VS2012x86xASL_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm /Od
DEBUG_VS2012x86xASL_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
RELEASE_VS2012x86xASL_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2012x86xASL_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
DEBUG_VS2012x86xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2012x86xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
NOOPT_VS2012x86xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
##################
# X64 definitions
##################
*_VS2012x86xASL_X64_*_DLL = DEF(VS2012x86_DLL)
*_VS2012x86xASL_X64_CC_PATH = DEF(VS2012x86_BINX64)\cl.exe
*_VS2012x86xASL_X64_PP_PATH = DEF(VS2012x86_BINX64)\cl.exe
*_VS2012x86xASL_X64_APP_PATH = DEF(VS2012x86_BINX64)\cl.exe
*_VS2012x86xASL_X64_VFRPP_PATH = DEF(VS2012x86_BINX64)\cl.exe
*_VS2012x86xASL_X64_ASLCC_PATH = DEF(VS2012x86_BINX64)\cl.exe
*_VS2012x86xASL_X64_ASLPP_PATH = DEF(VS2012x86_BINX64)\cl.exe
*_VS2012x86xASL_X64_ASM_PATH = DEF(VS2012x86_BINX64)\ml64.exe
*_VS2012x86xASL_X64_SLINK_PATH = DEF(VS2012x86_BINX64)\lib.exe
*_VS2012x86xASL_X64_DLINK_PATH = DEF(VS2012x86_BINX64)\link.exe
*_VS2012x86xASL_X64_ASLDLINK_PATH = DEF(VS2012x86_BINX64)\link.exe
DEBUG_VS2012x86xASL_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs32768 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
RELEASE_VS2012x86xASL_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs32768 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
NOOPT_VS2012x86xASL_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm /Od
DEBUG_VS2012x86xASL_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
RELEASE_VS2012x86xASL_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2012x86xASL_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
DEBUG_VS2012x86xASL_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2012x86xASL_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
NOOPT_VS2012x86xASL_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
編譯
- edksetup.bat --nt32
- build -t VS2012x86xASL
啟動模擬器build -t VS2012x86xASL run