Sync BaseTool trunk (version r2649) into EDKII BaseTools.
Signed-off-by: Gao, Liming <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15188 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -192,11 +192,6 @@ DEFINE IPHONE_TOOLS = /Developer/Platforms/iPhoneOS.platform/Develope
|
|||||||
|
|
||||||
DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G++ Lite/bin
|
DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G++ Lite/bin
|
||||||
|
|
||||||
#
|
|
||||||
# Change to the location clang was built
|
|
||||||
#
|
|
||||||
DEFINE CLANG_BIN = /usr/bin/
|
|
||||||
|
|
||||||
####################################################################################
|
####################################################################################
|
||||||
#
|
#
|
||||||
# format: TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE = <string>
|
# format: TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE = <string>
|
||||||
@@ -3136,11 +3131,11 @@ DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -
|
|||||||
DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
|
DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
|
||||||
DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe
|
DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe
|
||||||
DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency
|
DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency
|
||||||
DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address
|
DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
|
||||||
DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mcmodel=large -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address
|
DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mcmodel=large -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address
|
||||||
DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
|
DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
|
||||||
DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
|
DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
|
||||||
DEFINE GCC_ARM_AARCH64_DLINK_COMMON= -Ttext=0x0 --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
|
DEFINE GCC_ARM_AARCH64_DLINK_COMMON= -Ttext=0x0 --emit-relocs -nostdlib --gc-sections -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
|
||||||
DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
|
DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
|
||||||
DEFINE GCC_ARM_AARCH64_ASLDLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) --entry ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
|
DEFINE GCC_ARM_AARCH64_ASLDLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) --entry ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
|
||||||
DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
|
DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
|
||||||
@@ -3184,7 +3179,7 @@ DEFINE GCC46_IA32_X64_DLINK_FLAGS = DEF(GCC45_IA32_X64_DLINK_FLAGS)
|
|||||||
DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
|
DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
|
||||||
DEFINE GCC46_ASM_FLAGS = DEF(GCC45_ASM_FLAGS)
|
DEFINE GCC46_ASM_FLAGS = DEF(GCC45_ASM_FLAGS)
|
||||||
DEFINE GCC46_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
|
DEFINE GCC46_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
|
||||||
DEFINE GCC46_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums -save-temps -fsigned-char -mno-unaligned-access -Wno-address -fomit-frame-pointer
|
DEFINE GCC46_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_ARM_CC_FLAGS) -mno-unaligned-access
|
||||||
DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) --oformat=elf32-littlearm
|
DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) --oformat=elf32-littlearm
|
||||||
DEFINE GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS) --oformat=elf32-littlearm
|
DEFINE GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS) --oformat=elf32-littlearm
|
||||||
|
|
||||||
@@ -3198,7 +3193,7 @@ DEFINE GCC47_ASM_FLAGS = DEF(GCC46_ASM_FLAGS)
|
|||||||
DEFINE GCC47_ARM_ASM_FLAGS = DEF(GCC46_ARM_ASM_FLAGS)
|
DEFINE GCC47_ARM_ASM_FLAGS = DEF(GCC46_ARM_ASM_FLAGS)
|
||||||
DEFINE GCC47_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
|
DEFINE GCC47_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
|
||||||
DEFINE GCC47_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS)
|
DEFINE GCC47_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS)
|
||||||
DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mcmodel=large -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address
|
DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS)
|
||||||
DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
|
DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
|
||||||
DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON)
|
DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON)
|
||||||
DEFINE GCC47_ARM_ASLDLINK_FLAGS = DEF(GCC46_ARM_ASLDLINK_FLAGS)
|
DEFINE GCC47_ARM_ASLDLINK_FLAGS = DEF(GCC46_ARM_ASLDLINK_FLAGS)
|
||||||
@@ -3516,7 +3511,7 @@ DEFINE GCC48_AARCH64_ASLDLINK_FLAGS = DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS)
|
|||||||
*_GCC46_ARM_ASLPP_PATH = ENV(GCC46_ARM_PREFIX)gcc
|
*_GCC46_ARM_ASLPP_PATH = ENV(GCC46_ARM_PREFIX)gcc
|
||||||
*_GCC46_ARM_RC_PATH = ENV(GCC46_ARM_PREFIX)objcopy
|
*_GCC46_ARM_RC_PATH = ENV(GCC46_ARM_PREFIX)objcopy
|
||||||
|
|
||||||
*_GCC46_ARM_ARCHCC_FLAGS = -mthumb
|
*_GCC46_ARM_ARCHCC_FLAGS =
|
||||||
*_GCC46_ARM_PLATFORM_FLAGS = -march=armv7-a
|
*_GCC46_ARM_PLATFORM_FLAGS = -march=armv7-a
|
||||||
|
|
||||||
*_GCC46_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
|
*_GCC46_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
|
||||||
@@ -3610,7 +3605,7 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-v
|
|||||||
*_GCC47_ARM_ASLPP_PATH = ENV(GCC47_ARM_PREFIX)gcc
|
*_GCC47_ARM_ASLPP_PATH = ENV(GCC47_ARM_PREFIX)gcc
|
||||||
*_GCC47_ARM_RC_PATH = ENV(GCC47_ARM_PREFIX)objcopy
|
*_GCC47_ARM_RC_PATH = ENV(GCC47_ARM_PREFIX)objcopy
|
||||||
|
|
||||||
*_GCC47_ARM_ARCHCC_FLAGS = -mthumb
|
*_GCC47_ARM_ARCHCC_FLAGS =
|
||||||
*_GCC47_ARM_PLATFORM_FLAGS = -march=armv7-a
|
*_GCC47_ARM_PLATFORM_FLAGS = -march=armv7-a
|
||||||
|
|
||||||
*_GCC47_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
|
*_GCC47_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
|
||||||
@@ -5484,15 +5479,15 @@ RELEASE_XCODE32_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mthumb-inter
|
|||||||
RELEASE_XCLANG_*_MTOC_FLAGS = -align 0x20
|
RELEASE_XCLANG_*_MTOC_FLAGS = -align 0x20
|
||||||
|
|
||||||
|
|
||||||
*_XCLANG_*_CC_PATH = DEF(CLANG_BIN)clang
|
*_XCLANG_*_CC_PATH = ENV(CLANG_BIN)clang
|
||||||
*_XCLANG_*_SLINK_PATH = libtool
|
*_XCLANG_*_SLINK_PATH = libtool
|
||||||
*_XCLANG_*_DLINK_PATH = ld
|
*_XCLANG_*_DLINK_PATH = ld
|
||||||
*_XCLANG_*_ASM_PATH = as
|
*_XCLANG_*_ASM_PATH = as
|
||||||
*_XCLANG_*_PP_PATH = DEF(CLANG_BIN)clang
|
*_XCLANG_*_PP_PATH = ENV(CLANG_BIN)clang
|
||||||
*_XCLANG_*_VFRPP_PATH = DEF(CLANG_BIN)clang
|
*_XCLANG_*_VFRPP_PATH = ENV(CLANG_BIN)clang
|
||||||
*_XCLANG_*_ASL_PATH = iasl
|
*_XCLANG_*_ASL_PATH = iasl
|
||||||
*_XCLANG_*_ASLCC_PATH = DEF(CLANG_BIN)clang
|
*_XCLANG_*_ASLCC_PATH = ENV(CLANG_BIN)clang
|
||||||
*_XCLANG_*_ASLPP_PATH = DEF(CLANG_BIN)clang
|
*_XCLANG_*_ASLPP_PATH = ENV(CLANG_BIN)clang
|
||||||
*_XCLANG_*_ASLDLINK_PATH = ld
|
*_XCLANG_*_ASLDLINK_PATH = ld
|
||||||
|
|
||||||
####################
|
####################
|
||||||
@@ -5550,7 +5545,7 @@ DEFINE RVCT_ALL_DLINK_FLAGS = --ro-base 0 --no_scanlib --reloc --no_exceptions
|
|||||||
#
|
#
|
||||||
# Use default values, or override in DSC file
|
# Use default values, or override in DSC file
|
||||||
#
|
#
|
||||||
*_RVCT_ARM_ARCHCC_FLAGS = --thumb
|
*_RVCT_ARM_ARCHCC_FLAGS = --thumb --fpu=softvfp
|
||||||
*_RVCT_ARM_ARCHASM_FLAGS =
|
*_RVCT_ARM_ARCHASM_FLAGS =
|
||||||
*_RVCT_ARM_ARCHDLINK_FLAGS =
|
*_RVCT_ARM_ARCHDLINK_FLAGS =
|
||||||
*_RVCT_ARM_PLATFORM_FLAGS = --cpu 7-A
|
*_RVCT_ARM_PLATFORM_FLAGS = --cpu 7-A
|
||||||
@@ -5592,7 +5587,7 @@ RELEASE_RVCT_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --diag_suppress=5
|
|||||||
#
|
#
|
||||||
# Use default values, or override in DSC file
|
# Use default values, or override in DSC file
|
||||||
#
|
#
|
||||||
*_RVCTLINUX_ARM_ARCHCC_FLAGS = --thumb
|
*_RVCTLINUX_ARM_ARCHCC_FLAGS = --thumb --fpu=softvfp
|
||||||
*_RVCTLINUX_ARM_ARCHASM_FLAGS =
|
*_RVCTLINUX_ARM_ARCHASM_FLAGS =
|
||||||
*_RVCTLINUX_ARM_ARCHDLINK_FLAGS =
|
*_RVCTLINUX_ARM_ARCHDLINK_FLAGS =
|
||||||
*_RVCTLINUX_ARM_PLATFORM_FLAGS = --cpu 7-A
|
*_RVCTLINUX_ARM_PLATFORM_FLAGS = --cpu 7-A
|
||||||
@@ -5639,7 +5634,7 @@ RELEASE_RVCTLINUX_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --diag_suppr
|
|||||||
#
|
#
|
||||||
# Use default values, or override in DSC file
|
# Use default values, or override in DSC file
|
||||||
#
|
#
|
||||||
*_RVCTCYGWIN_ARM_ARCHCC_FLAGS = --thumb
|
*_RVCTCYGWIN_ARM_ARCHCC_FLAGS = --thumb --fpu=softvfp
|
||||||
*_RVCTCYGWIN_ARM_ARCHASM_FLAGS =
|
*_RVCTCYGWIN_ARM_ARCHASM_FLAGS =
|
||||||
*_RVCTCYGWIN_ARM_ARCHDLINK_FLAGS =
|
*_RVCTCYGWIN_ARM_ARCHDLINK_FLAGS =
|
||||||
*_RVCTCYGWIN_ARM_PLATFORM_FLAGS = --cpu 7-A
|
*_RVCTCYGWIN_ARM_PLATFORM_FLAGS = --cpu 7-A
|
||||||
@@ -5707,7 +5702,7 @@ RELEASE_RVCTCYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_F
|
|||||||
#
|
#
|
||||||
# Use default values, or override in DSC file
|
# Use default values, or override in DSC file
|
||||||
#
|
#
|
||||||
*_ARMGCC_ARM_ARCHCC_FLAGS = -mthumb
|
*_ARMGCC_ARM_ARCHCC_FLAGS =
|
||||||
*_ARMGCC_ARM_ARCHASM_FLAGS =
|
*_ARMGCC_ARM_ARCHASM_FLAGS =
|
||||||
*_ARMGCC_ARM_ARCHDLINK_FLAGS =
|
*_ARMGCC_ARM_ARCHDLINK_FLAGS =
|
||||||
*_ARMGCC_ARM_PLATFORM_FLAGS = -march=armv7-a
|
*_ARMGCC_ARM_PLATFORM_FLAGS = -march=armv7-a
|
||||||
@@ -5719,7 +5714,7 @@ RELEASE_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -mlittle-end
|
|||||||
*_ARMGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
|
*_ARMGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
|
||||||
|
|
||||||
*_ARMGCC_ARM_SLINK_FLAGS = -rc
|
*_ARMGCC_ARM_SLINK_FLAGS = -rc
|
||||||
*_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -Ttext=0x0 --oformat=elf32-littlearm --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
|
*_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(GCC_ARM_AARCH64_DLINK_COMMON) --oformat=elf32-littlearm
|
||||||
|
|
||||||
DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -O0
|
DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -O0
|
||||||
RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -Wno-unused
|
RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -Wno-unused
|
||||||
@@ -5755,7 +5750,7 @@ RELEASE_ARMGCC_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS)
|
|||||||
*_ARMGCC_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
|
*_ARMGCC_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
|
||||||
|
|
||||||
*_ARMGCC_AARCH64_SLINK_FLAGS = -rc
|
*_ARMGCC_AARCH64_SLINK_FLAGS = -rc
|
||||||
*_ARMGCC_AARCH64_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -Ttext=0x0 --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
|
*_ARMGCC_AARCH64_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(GCC_ARM_AARCH64_DLINK_COMMON)
|
||||||
|
|
||||||
DEBUG_ARMGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -O0
|
DEBUG_ARMGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -O0
|
||||||
RELEASE_ARMGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable
|
RELEASE_ARMGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable
|
||||||
@@ -5801,7 +5796,7 @@ RELEASE_ARMGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARC
|
|||||||
#
|
#
|
||||||
# Use default values, or override in DSC file
|
# Use default values, or override in DSC file
|
||||||
#
|
#
|
||||||
*_ARMLINUXGCC_ARM_ARCHCC_FLAGS = -mthumb
|
*_ARMLINUXGCC_ARM_ARCHCC_FLAGS =
|
||||||
*_ARMLINUXGCC_ARM_ARCHASM_FLAGS =
|
*_ARMLINUXGCC_ARM_ARCHASM_FLAGS =
|
||||||
*_ARMLINUXGCC_ARM_ARCHDLINK_FLAGS =
|
*_ARMLINUXGCC_ARM_ARCHDLINK_FLAGS =
|
||||||
*_ARMLINUXGCC_ARM_PLATFORM_FLAGS = -march=armv7-a
|
*_ARMLINUXGCC_ARM_PLATFORM_FLAGS = -march=armv7-a
|
||||||
@@ -5813,7 +5808,7 @@ RELEASE_ARMLINUXGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -mlittl
|
|||||||
*_ARMLINUXGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
|
*_ARMLINUXGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
|
||||||
|
|
||||||
*_ARMLINUXGCC_ARM_SLINK_FLAGS = -rc
|
*_ARMLINUXGCC_ARM_SLINK_FLAGS = -rc
|
||||||
*_ARMLINUXGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -Ttext=0x0 --oformat=elf32-littlearm --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
|
*_ARMLINUXGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(GCC_ARM_AARCH64_DLINK_COMMON) --oformat=elf32-littlearm
|
||||||
|
|
||||||
DEBUG_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fno-stack-protector -mno-unaligned-access -O0
|
DEBUG_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fno-stack-protector -mno-unaligned-access -O0
|
||||||
RELEASE_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fno-stack-protector -mno-unaligned-access -Wno-unused-but-set-variable
|
RELEASE_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fno-stack-protector -mno-unaligned-access -Wno-unused-but-set-variable
|
||||||
@@ -5849,7 +5844,7 @@ RELEASE_ARMLINUXGCC_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS)
|
|||||||
*_ARMLINUXGCC_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
|
*_ARMLINUXGCC_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
|
||||||
|
|
||||||
*_ARMLINUXGCC_AARCH64_SLINK_FLAGS = -rc
|
*_ARMLINUXGCC_AARCH64_SLINK_FLAGS = -rc
|
||||||
*_ARMLINUXGCC_AARCH64_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -Ttext=0x0 --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
|
*_ARMLINUXGCC_AARCH64_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(GCC_ARM_AARCH64_DLINK_COMMON)
|
||||||
|
|
||||||
DEBUG_ARMLINUXGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -O0
|
DEBUG_ARMLINUXGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -O0
|
||||||
RELEASE_ARMLINUXGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable
|
RELEASE_ARMLINUXGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable
|
||||||
|
@@ -1,87 +1,87 @@
|
|||||||
## @file
|
## @file
|
||||||
# GNU/Linux makefile for C tools build.
|
# GNU/Linux makefile for C tools build.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
ifndef ARCH
|
ifndef ARCH
|
||||||
#
|
#
|
||||||
# If ARCH is not defined, then we use 'uname -m' to attempt
|
# If ARCH is not defined, then we use 'uname -m' to attempt
|
||||||
# try to figure out the appropriate ARCH.
|
# try to figure out the appropriate ARCH.
|
||||||
#
|
#
|
||||||
uname_m = $(shell uname -m)
|
uname_m = $(shell uname -m)
|
||||||
$(info Attempting to detect ARCH from 'uname -m': $(uname_m))
|
$(info Attempting to detect ARCH from 'uname -m': $(uname_m))
|
||||||
ifeq ($(uname_m),x86_64)
|
ifeq ($(uname_m),x86_64)
|
||||||
ARCH=X64
|
ARCH=X64
|
||||||
endif
|
endif
|
||||||
ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
|
ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
|
||||||
ARCH=IA32
|
ARCH=IA32
|
||||||
endif
|
endif
|
||||||
ifndef ARCH
|
ifndef ARCH
|
||||||
$(info Could not detected ARCH from uname results)
|
$(info Could not detected ARCH from uname results)
|
||||||
$(error ARCH is not defined!)
|
$(error ARCH is not defined!)
|
||||||
endif
|
endif
|
||||||
$(info Detected ARCH of $(ARCH) using uname.)
|
$(info Detected ARCH of $(ARCH) using uname.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export ARCH
|
export ARCH
|
||||||
|
|
||||||
MAKEROOT = .
|
MAKEROOT = .
|
||||||
|
|
||||||
include Makefiles/header.makefile
|
include Makefiles/header.makefile
|
||||||
|
|
||||||
all: makerootdir subdirs $(MAKEROOT)/libs
|
all: makerootdir subdirs $(MAKEROOT)/libs
|
||||||
@echo Finished building BaseTools C Tools with ARCH=$(ARCH)
|
@echo Finished building BaseTools C Tools with ARCH=$(ARCH)
|
||||||
|
|
||||||
LIBRARIES = Common
|
LIBRARIES = Common
|
||||||
# NON_BUILDABLE_APPLICATIONS = GenBootSector BootSectImage
|
# NON_BUILDABLE_APPLICATIONS = GenBootSector BootSectImage
|
||||||
APPLICATIONS = \
|
APPLICATIONS = \
|
||||||
GnuGenBootSector \
|
GnuGenBootSector \
|
||||||
BootSectImage \
|
BootSectImage \
|
||||||
EfiLdrImage \
|
EfiLdrImage \
|
||||||
EfiRom \
|
EfiRom \
|
||||||
GenFfs \
|
GenFfs \
|
||||||
GenFv \
|
GenFv \
|
||||||
GenFw \
|
GenFw \
|
||||||
GenPage \
|
GenPage \
|
||||||
GenSec \
|
GenSec \
|
||||||
GenCrc32 \
|
GenCrc32 \
|
||||||
GenVtf \
|
GenVtf \
|
||||||
LzmaCompress \
|
LzmaCompress \
|
||||||
Split \
|
Split \
|
||||||
TianoCompress \
|
TianoCompress \
|
||||||
VolInfo \
|
VolInfo \
|
||||||
VfrCompile
|
VfrCompile
|
||||||
|
|
||||||
SUBDIRS := $(LIBRARIES) $(APPLICATIONS)
|
SUBDIRS := $(LIBRARIES) $(APPLICATIONS)
|
||||||
|
|
||||||
.PHONY: outputdirs
|
.PHONY: outputdirs
|
||||||
makerootdir:
|
makerootdir:
|
||||||
-mkdir -p $(MAKEROOT)
|
-mkdir -p $(MAKEROOT)
|
||||||
|
|
||||||
.PHONY: subdirs $(SUBDIRS)
|
.PHONY: subdirs $(SUBDIRS)
|
||||||
subdirs: $(SUBDIRS)
|
subdirs: $(SUBDIRS)
|
||||||
$(SUBDIRS):
|
$(SUBDIRS):
|
||||||
$(MAKE) -C $@
|
$(MAKE) -C $@
|
||||||
|
|
||||||
.PHONY: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
|
.PHONY: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
|
||||||
$(patsubst %,%-clean,$(sort $(SUBDIRS))):
|
$(patsubst %,%-clean,$(sort $(SUBDIRS))):
|
||||||
-$(MAKE) -C $(@:-clean=) clean
|
-$(MAKE) -C $(@:-clean=) clean
|
||||||
|
|
||||||
clean: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
|
clean: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
|
||||||
|
|
||||||
clean: localClean
|
clean: localClean
|
||||||
|
|
||||||
localClean:
|
localClean:
|
||||||
rm -f $(MAKEROOT)/bin/*
|
rm -f $(MAKEROOT)/bin/*
|
||||||
-rmdir $(MAKEROOT)/libs $(MAKEROOT)/bin
|
-rmdir $(MAKEROOT)/libs $(MAKEROOT)/bin
|
||||||
|
|
||||||
include Makefiles/footer.makefile
|
include Makefiles/footer.makefile
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,24 +1,24 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _ELF_32_CONVERT_
|
#ifndef _ELF_32_CONVERT_
|
||||||
#define _ELF_32_CONVERT_
|
#define _ELF_32_CONVERT_
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
InitializeElf32 (
|
InitializeElf32 (
|
||||||
UINT8 *FileBuffer,
|
UINT8 *FileBuffer,
|
||||||
ELF_FUNCTION_TABLE *ElfFunctions
|
ELF_FUNCTION_TABLE *ElfFunctions
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,24 +1,24 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _ELF_64_CONVERT_
|
#ifndef _ELF_64_CONVERT_
|
||||||
#define _ELF_64_CONVERT_
|
#define _ELF_64_CONVERT_
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
InitializeElf64 (
|
InitializeElf64 (
|
||||||
UINT8 *FileBuffer,
|
UINT8 *FileBuffer,
|
||||||
ELF_FUNCTION_TABLE *ElfFunctions
|
ELF_FUNCTION_TABLE *ElfFunctions
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,233 +1,233 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "WinNtInclude.h"
|
#include "WinNtInclude.h"
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <Common/UefiBaseTypes.h>
|
#include <Common/UefiBaseTypes.h>
|
||||||
#include <IndustryStandard/PeImage.h>
|
#include <IndustryStandard/PeImage.h>
|
||||||
|
|
||||||
#include "EfiUtilityMsgs.h"
|
#include "EfiUtilityMsgs.h"
|
||||||
|
|
||||||
#include "GenFw.h"
|
#include "GenFw.h"
|
||||||
#include "ElfConvert.h"
|
#include "ElfConvert.h"
|
||||||
#include "Elf32Convert.h"
|
#include "Elf32Convert.h"
|
||||||
#include "Elf64Convert.h"
|
#include "Elf64Convert.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Result Coff file in memory.
|
// Result Coff file in memory.
|
||||||
//
|
//
|
||||||
UINT8 *mCoffFile = NULL;
|
UINT8 *mCoffFile = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// COFF relocation data
|
// COFF relocation data
|
||||||
//
|
//
|
||||||
EFI_IMAGE_BASE_RELOCATION *mCoffBaseRel;
|
EFI_IMAGE_BASE_RELOCATION *mCoffBaseRel;
|
||||||
UINT16 *mCoffEntryRel;
|
UINT16 *mCoffEntryRel;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Current offset in coff file.
|
// Current offset in coff file.
|
||||||
//
|
//
|
||||||
UINT32 mCoffOffset;
|
UINT32 mCoffOffset;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Offset in Coff file of headers and sections.
|
// Offset in Coff file of headers and sections.
|
||||||
//
|
//
|
||||||
UINT32 mTableOffset;
|
UINT32 mTableOffset;
|
||||||
|
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// Common ELF Functions
|
// Common ELF Functions
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CoffAddFixupEntry(
|
CoffAddFixupEntry(
|
||||||
UINT16 Val
|
UINT16 Val
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
*mCoffEntryRel = Val;
|
*mCoffEntryRel = Val;
|
||||||
mCoffEntryRel++;
|
mCoffEntryRel++;
|
||||||
mCoffBaseRel->SizeOfBlock += 2;
|
mCoffBaseRel->SizeOfBlock += 2;
|
||||||
mCoffOffset += 2;
|
mCoffOffset += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CoffAddFixup(
|
CoffAddFixup(
|
||||||
UINT32 Offset,
|
UINT32 Offset,
|
||||||
UINT8 Type
|
UINT8 Type
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (mCoffBaseRel == NULL
|
if (mCoffBaseRel == NULL
|
||||||
|| mCoffBaseRel->VirtualAddress != (Offset & ~0xfff)) {
|
|| mCoffBaseRel->VirtualAddress != (Offset & ~0xfff)) {
|
||||||
if (mCoffBaseRel != NULL) {
|
if (mCoffBaseRel != NULL) {
|
||||||
//
|
//
|
||||||
// Add a null entry (is it required ?)
|
// Add a null entry (is it required ?)
|
||||||
//
|
//
|
||||||
CoffAddFixupEntry (0);
|
CoffAddFixupEntry (0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pad for alignment.
|
// Pad for alignment.
|
||||||
//
|
//
|
||||||
if (mCoffOffset % 4 != 0)
|
if (mCoffOffset % 4 != 0)
|
||||||
CoffAddFixupEntry (0);
|
CoffAddFixupEntry (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
mCoffFile = realloc (
|
mCoffFile = realloc (
|
||||||
mCoffFile,
|
mCoffFile,
|
||||||
mCoffOffset + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000
|
mCoffOffset + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000
|
||||||
);
|
);
|
||||||
memset (
|
memset (
|
||||||
mCoffFile + mCoffOffset, 0,
|
mCoffFile + mCoffOffset, 0,
|
||||||
sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000
|
sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000
|
||||||
);
|
);
|
||||||
|
|
||||||
mCoffBaseRel = (EFI_IMAGE_BASE_RELOCATION*)(mCoffFile + mCoffOffset);
|
mCoffBaseRel = (EFI_IMAGE_BASE_RELOCATION*)(mCoffFile + mCoffOffset);
|
||||||
mCoffBaseRel->VirtualAddress = Offset & ~0xfff;
|
mCoffBaseRel->VirtualAddress = Offset & ~0xfff;
|
||||||
mCoffBaseRel->SizeOfBlock = sizeof(EFI_IMAGE_BASE_RELOCATION);
|
mCoffBaseRel->SizeOfBlock = sizeof(EFI_IMAGE_BASE_RELOCATION);
|
||||||
|
|
||||||
mCoffEntryRel = (UINT16 *)(mCoffBaseRel + 1);
|
mCoffEntryRel = (UINT16 *)(mCoffBaseRel + 1);
|
||||||
mCoffOffset += sizeof(EFI_IMAGE_BASE_RELOCATION);
|
mCoffOffset += sizeof(EFI_IMAGE_BASE_RELOCATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fill the entry.
|
// Fill the entry.
|
||||||
//
|
//
|
||||||
CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff)));
|
CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff)));
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CreateSectionHeader (
|
CreateSectionHeader (
|
||||||
const CHAR8 *Name,
|
const CHAR8 *Name,
|
||||||
UINT32 Offset,
|
UINT32 Offset,
|
||||||
UINT32 Size,
|
UINT32 Size,
|
||||||
UINT32 Flags
|
UINT32 Flags
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_IMAGE_SECTION_HEADER *Hdr;
|
EFI_IMAGE_SECTION_HEADER *Hdr;
|
||||||
Hdr = (EFI_IMAGE_SECTION_HEADER*)(mCoffFile + mTableOffset);
|
Hdr = (EFI_IMAGE_SECTION_HEADER*)(mCoffFile + mTableOffset);
|
||||||
|
|
||||||
strcpy((char *)Hdr->Name, Name);
|
strcpy((char *)Hdr->Name, Name);
|
||||||
Hdr->Misc.VirtualSize = Size;
|
Hdr->Misc.VirtualSize = Size;
|
||||||
Hdr->VirtualAddress = Offset;
|
Hdr->VirtualAddress = Offset;
|
||||||
Hdr->SizeOfRawData = Size;
|
Hdr->SizeOfRawData = Size;
|
||||||
Hdr->PointerToRawData = Offset;
|
Hdr->PointerToRawData = Offset;
|
||||||
Hdr->PointerToRelocations = 0;
|
Hdr->PointerToRelocations = 0;
|
||||||
Hdr->PointerToLinenumbers = 0;
|
Hdr->PointerToLinenumbers = 0;
|
||||||
Hdr->NumberOfRelocations = 0;
|
Hdr->NumberOfRelocations = 0;
|
||||||
Hdr->NumberOfLinenumbers = 0;
|
Hdr->NumberOfLinenumbers = 0;
|
||||||
Hdr->Characteristics = Flags;
|
Hdr->Characteristics = Flags;
|
||||||
|
|
||||||
mTableOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
|
mTableOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// Functions called from GenFw main code.
|
// Functions called from GenFw main code.
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
|
|
||||||
INTN
|
INTN
|
||||||
IsElfHeader (
|
IsElfHeader (
|
||||||
UINT8 *FileBuffer
|
UINT8 *FileBuffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return (FileBuffer[EI_MAG0] == ELFMAG0 &&
|
return (FileBuffer[EI_MAG0] == ELFMAG0 &&
|
||||||
FileBuffer[EI_MAG1] == ELFMAG1 &&
|
FileBuffer[EI_MAG1] == ELFMAG1 &&
|
||||||
FileBuffer[EI_MAG2] == ELFMAG2 &&
|
FileBuffer[EI_MAG2] == ELFMAG2 &&
|
||||||
FileBuffer[EI_MAG3] == ELFMAG3);
|
FileBuffer[EI_MAG3] == ELFMAG3);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
ConvertElf (
|
ConvertElf (
|
||||||
UINT8 **FileBuffer,
|
UINT8 **FileBuffer,
|
||||||
UINT32 *FileLength
|
UINT32 *FileLength
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ELF_FUNCTION_TABLE ElfFunctions;
|
ELF_FUNCTION_TABLE ElfFunctions;
|
||||||
UINT8 EiClass;
|
UINT8 EiClass;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine ELF type and set function table pointer correctly.
|
// Determine ELF type and set function table pointer correctly.
|
||||||
//
|
//
|
||||||
VerboseMsg ("Check Elf Image Header");
|
VerboseMsg ("Check Elf Image Header");
|
||||||
EiClass = (*FileBuffer)[EI_CLASS];
|
EiClass = (*FileBuffer)[EI_CLASS];
|
||||||
if (EiClass == ELFCLASS32) {
|
if (EiClass == ELFCLASS32) {
|
||||||
if (!InitializeElf32 (*FileBuffer, &ElfFunctions)) {
|
if (!InitializeElf32 (*FileBuffer, &ElfFunctions)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else if (EiClass == ELFCLASS64) {
|
} else if (EiClass == ELFCLASS64) {
|
||||||
if (!InitializeElf64 (*FileBuffer, &ElfFunctions)) {
|
if (!InitializeElf64 (*FileBuffer, &ElfFunctions)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Error (NULL, 0, 3000, "Unsupported", "ELF EI_CLASS not supported.");
|
Error (NULL, 0, 3000, "Unsupported", "ELF EI_CLASS not supported.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Compute sections new address.
|
// Compute sections new address.
|
||||||
//
|
//
|
||||||
VerboseMsg ("Compute sections new address.");
|
VerboseMsg ("Compute sections new address.");
|
||||||
ElfFunctions.ScanSections ();
|
ElfFunctions.ScanSections ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Write and relocate sections.
|
// Write and relocate sections.
|
||||||
//
|
//
|
||||||
VerboseMsg ("Write and relocate sections.");
|
VerboseMsg ("Write and relocate sections.");
|
||||||
ElfFunctions.WriteSections (SECTION_TEXT);
|
ElfFunctions.WriteSections (SECTION_TEXT);
|
||||||
ElfFunctions.WriteSections (SECTION_DATA);
|
ElfFunctions.WriteSections (SECTION_DATA);
|
||||||
ElfFunctions.WriteSections (SECTION_HII);
|
ElfFunctions.WriteSections (SECTION_HII);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Translate and write relocations.
|
// Translate and write relocations.
|
||||||
//
|
//
|
||||||
VerboseMsg ("Translate and write relocations.");
|
VerboseMsg ("Translate and write relocations.");
|
||||||
ElfFunctions.WriteRelocations ();
|
ElfFunctions.WriteRelocations ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Write debug info.
|
// Write debug info.
|
||||||
//
|
//
|
||||||
VerboseMsg ("Write debug info.");
|
VerboseMsg ("Write debug info.");
|
||||||
ElfFunctions.WriteDebug ();
|
ElfFunctions.WriteDebug ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure image size is correct before returning the new image.
|
// Make sure image size is correct before returning the new image.
|
||||||
//
|
//
|
||||||
VerboseMsg ("Set image size.");
|
VerboseMsg ("Set image size.");
|
||||||
ElfFunctions.SetImageSize ();
|
ElfFunctions.SetImageSize ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Replace.
|
// Replace.
|
||||||
//
|
//
|
||||||
free (*FileBuffer);
|
free (*FileBuffer);
|
||||||
*FileBuffer = mCoffFile;
|
*FileBuffer = mCoffFile;
|
||||||
*FileLength = mCoffOffset;
|
*FileLength = mCoffOffset;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Free resources used by ELF functions.
|
// Free resources used by ELF functions.
|
||||||
//
|
//
|
||||||
ElfFunctions.CleanUp ();
|
ElfFunctions.CleanUp ();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -1,83 +1,83 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _ELF_CONVERT_H_
|
#ifndef _ELF_CONVERT_H_
|
||||||
#define _ELF_CONVERT_H_
|
#define _ELF_CONVERT_H_
|
||||||
|
|
||||||
#include "elf_common.h"
|
#include "elf_common.h"
|
||||||
#include "elf32.h"
|
#include "elf32.h"
|
||||||
#include "elf64.h"
|
#include "elf64.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Externally defined variables
|
// Externally defined variables
|
||||||
//
|
//
|
||||||
extern UINT32 mCoffOffset;
|
extern UINT32 mCoffOffset;
|
||||||
extern CHAR8 *mInImageName;
|
extern CHAR8 *mInImageName;
|
||||||
extern UINT32 mImageTimeStamp;
|
extern UINT32 mImageTimeStamp;
|
||||||
extern UINT8 *mCoffFile;
|
extern UINT8 *mCoffFile;
|
||||||
extern UINT32 mTableOffset;
|
extern UINT32 mTableOffset;
|
||||||
extern UINT32 mOutImageType;
|
extern UINT32 mOutImageType;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Common EFI specific data.
|
// Common EFI specific data.
|
||||||
//
|
//
|
||||||
#define ELF_HII_SECTION_NAME ".hii"
|
#define ELF_HII_SECTION_NAME ".hii"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Filter Types
|
// Filter Types
|
||||||
//
|
//
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SECTION_TEXT,
|
SECTION_TEXT,
|
||||||
SECTION_HII,
|
SECTION_HII,
|
||||||
SECTION_DATA
|
SECTION_DATA
|
||||||
|
|
||||||
} SECTION_FILTER_TYPES;
|
} SECTION_FILTER_TYPES;
|
||||||
|
|
||||||
//
|
//
|
||||||
// FunctionTalbe
|
// FunctionTalbe
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
VOID (*ScanSections) ();
|
VOID (*ScanSections) ();
|
||||||
BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType);
|
BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType);
|
||||||
VOID (*WriteRelocations) ();
|
VOID (*WriteRelocations) ();
|
||||||
VOID (*WriteDebug) ();
|
VOID (*WriteDebug) ();
|
||||||
VOID (*SetImageSize) ();
|
VOID (*SetImageSize) ();
|
||||||
VOID (*CleanUp) ();
|
VOID (*CleanUp) ();
|
||||||
|
|
||||||
} ELF_FUNCTION_TABLE;
|
} ELF_FUNCTION_TABLE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Common functions
|
// Common functions
|
||||||
//
|
//
|
||||||
VOID
|
VOID
|
||||||
CoffAddFixup (
|
CoffAddFixup (
|
||||||
UINT32 Offset,
|
UINT32 Offset,
|
||||||
UINT8 Type
|
UINT8 Type
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CoffAddFixupEntry (
|
CoffAddFixupEntry (
|
||||||
UINT16 Val
|
UINT16 Val
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CreateSectionHeader (
|
CreateSectionHeader (
|
||||||
const CHAR8 *Name,
|
const CHAR8 *Name,
|
||||||
UINT32 Offset,
|
UINT32 Offset,
|
||||||
UINT32 Size,
|
UINT32 Size,
|
||||||
UINT32 Flags
|
UINT32 Flags
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,55 +1,55 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _GEN_FW_H_
|
#ifndef _GEN_FW_H_
|
||||||
#define _GEN_FW_H_
|
#define _GEN_FW_H_
|
||||||
|
|
||||||
//
|
//
|
||||||
// Action for this tool.
|
// Action for this tool.
|
||||||
//
|
//
|
||||||
#define FW_DUMMY_IMAGE 0
|
#define FW_DUMMY_IMAGE 0
|
||||||
#define FW_EFI_IMAGE 1
|
#define FW_EFI_IMAGE 1
|
||||||
#define FW_TE_IMAGE 2
|
#define FW_TE_IMAGE 2
|
||||||
#define FW_ACPI_IMAGE 3
|
#define FW_ACPI_IMAGE 3
|
||||||
#define FW_BIN_IMAGE 4
|
#define FW_BIN_IMAGE 4
|
||||||
#define FW_ZERO_DEBUG_IMAGE 5
|
#define FW_ZERO_DEBUG_IMAGE 5
|
||||||
#define FW_SET_STAMP_IMAGE 6
|
#define FW_SET_STAMP_IMAGE 6
|
||||||
#define FW_MCI_IMAGE 7
|
#define FW_MCI_IMAGE 7
|
||||||
#define FW_MERGE_IMAGE 8
|
#define FW_MERGE_IMAGE 8
|
||||||
#define FW_RELOC_STRIPEED_IMAGE 9
|
#define FW_RELOC_STRIPEED_IMAGE 9
|
||||||
#define FW_HII_PACKAGE_LIST_RCIMAGE 10
|
#define FW_HII_PACKAGE_LIST_RCIMAGE 10
|
||||||
#define FW_HII_PACKAGE_LIST_BINIMAGE 11
|
#define FW_HII_PACKAGE_LIST_BINIMAGE 11
|
||||||
#define FW_REBASE_IMAGE 12
|
#define FW_REBASE_IMAGE 12
|
||||||
#define FW_SET_ADDRESS_IMAGE 13
|
#define FW_SET_ADDRESS_IMAGE 13
|
||||||
|
|
||||||
#define DUMP_TE_HEADER 0x11
|
#define DUMP_TE_HEADER 0x11
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SetHiiResourceHeader (
|
SetHiiResourceHeader (
|
||||||
UINT8 *HiiBinData,
|
UINT8 *HiiBinData,
|
||||||
UINT32 OffsetToFile
|
UINT32 OffsetToFile
|
||||||
);
|
);
|
||||||
|
|
||||||
INTN
|
INTN
|
||||||
IsElfHeader (
|
IsElfHeader (
|
||||||
UINT8 *FileBuffer
|
UINT8 *FileBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
ConvertElf (
|
ConvertElf (
|
||||||
UINT8 **FileBuffer,
|
UINT8 **FileBuffer,
|
||||||
UINT32 *FileLength
|
UINT32 *FileLength
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,258 +1,258 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Ported ELF include files from FreeBSD
|
Ported ELF include files from FreeBSD
|
||||||
|
|
||||||
Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1996-1998 John D. Polstra.
|
* Copyright (c) 1996-1998 John D. Polstra.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.2 2007/12/03 21:30:36 marius Exp $
|
* $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.2 2007/12/03 21:30:36 marius Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SYS_ELF32_H_
|
#ifndef _SYS_ELF32_H_
|
||||||
#define _SYS_ELF32_H_ 1
|
#define _SYS_ELF32_H_ 1
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ELF definitions common to all 32-bit architectures.
|
* ELF definitions common to all 32-bit architectures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef UINT32 Elf32_Addr;
|
typedef UINT32 Elf32_Addr;
|
||||||
typedef UINT16 Elf32_Half;
|
typedef UINT16 Elf32_Half;
|
||||||
typedef UINT32 Elf32_Off;
|
typedef UINT32 Elf32_Off;
|
||||||
typedef INT32 Elf32_Sword;
|
typedef INT32 Elf32_Sword;
|
||||||
typedef UINT32 Elf32_Word;
|
typedef UINT32 Elf32_Word;
|
||||||
typedef UINT64 Elf32_Lword;
|
typedef UINT64 Elf32_Lword;
|
||||||
|
|
||||||
typedef Elf32_Word Elf32_Hashelt;
|
typedef Elf32_Word Elf32_Hashelt;
|
||||||
|
|
||||||
/* Non-standard class-dependent datatype used for abstraction. */
|
/* Non-standard class-dependent datatype used for abstraction. */
|
||||||
typedef Elf32_Word Elf32_Size;
|
typedef Elf32_Word Elf32_Size;
|
||||||
typedef Elf32_Sword Elf32_Ssize;
|
typedef Elf32_Sword Elf32_Ssize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ELF header.
|
* ELF header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||||
Elf32_Half e_type; /* File type. */
|
Elf32_Half e_type; /* File type. */
|
||||||
Elf32_Half e_machine; /* Machine architecture. */
|
Elf32_Half e_machine; /* Machine architecture. */
|
||||||
Elf32_Word e_version; /* ELF format version. */
|
Elf32_Word e_version; /* ELF format version. */
|
||||||
Elf32_Addr e_entry; /* Entry point. */
|
Elf32_Addr e_entry; /* Entry point. */
|
||||||
Elf32_Off e_phoff; /* Program header file offset. */
|
Elf32_Off e_phoff; /* Program header file offset. */
|
||||||
Elf32_Off e_shoff; /* Section header file offset. */
|
Elf32_Off e_shoff; /* Section header file offset. */
|
||||||
Elf32_Word e_flags; /* Architecture-specific flags. */
|
Elf32_Word e_flags; /* Architecture-specific flags. */
|
||||||
Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
|
Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||||
Elf32_Half e_phentsize; /* Size of program header entry. */
|
Elf32_Half e_phentsize; /* Size of program header entry. */
|
||||||
Elf32_Half e_phnum; /* Number of program header entries. */
|
Elf32_Half e_phnum; /* Number of program header entries. */
|
||||||
Elf32_Half e_shentsize; /* Size of section header entry. */
|
Elf32_Half e_shentsize; /* Size of section header entry. */
|
||||||
Elf32_Half e_shnum; /* Number of section header entries. */
|
Elf32_Half e_shnum; /* Number of section header entries. */
|
||||||
Elf32_Half e_shstrndx; /* Section name strings section. */
|
Elf32_Half e_shstrndx; /* Section name strings section. */
|
||||||
} Elf32_Ehdr;
|
} Elf32_Ehdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Section header.
|
* Section header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Word sh_name; /* Section name (index into the
|
Elf32_Word sh_name; /* Section name (index into the
|
||||||
section header string table). */
|
section header string table). */
|
||||||
Elf32_Word sh_type; /* Section type. */
|
Elf32_Word sh_type; /* Section type. */
|
||||||
Elf32_Word sh_flags; /* Section flags. */
|
Elf32_Word sh_flags; /* Section flags. */
|
||||||
Elf32_Addr sh_addr; /* Address in memory image. */
|
Elf32_Addr sh_addr; /* Address in memory image. */
|
||||||
Elf32_Off sh_offset; /* Offset in file. */
|
Elf32_Off sh_offset; /* Offset in file. */
|
||||||
Elf32_Word sh_size; /* Size in bytes. */
|
Elf32_Word sh_size; /* Size in bytes. */
|
||||||
Elf32_Word sh_link; /* Index of a related section. */
|
Elf32_Word sh_link; /* Index of a related section. */
|
||||||
Elf32_Word sh_info; /* Depends on section type. */
|
Elf32_Word sh_info; /* Depends on section type. */
|
||||||
Elf32_Word sh_addralign; /* Alignment in bytes. */
|
Elf32_Word sh_addralign; /* Alignment in bytes. */
|
||||||
Elf32_Word sh_entsize; /* Size of each entry in section. */
|
Elf32_Word sh_entsize; /* Size of each entry in section. */
|
||||||
} Elf32_Shdr;
|
} Elf32_Shdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Program header.
|
* Program header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Word p_type; /* Entry type. */
|
Elf32_Word p_type; /* Entry type. */
|
||||||
Elf32_Off p_offset; /* File offset of contents. */
|
Elf32_Off p_offset; /* File offset of contents. */
|
||||||
Elf32_Addr p_vaddr; /* Virtual address in memory image. */
|
Elf32_Addr p_vaddr; /* Virtual address in memory image. */
|
||||||
Elf32_Addr p_paddr; /* Physical address (not used). */
|
Elf32_Addr p_paddr; /* Physical address (not used). */
|
||||||
Elf32_Word p_filesz; /* Size of contents in file. */
|
Elf32_Word p_filesz; /* Size of contents in file. */
|
||||||
Elf32_Word p_memsz; /* Size of contents in memory. */
|
Elf32_Word p_memsz; /* Size of contents in memory. */
|
||||||
Elf32_Word p_flags; /* Access permission flags. */
|
Elf32_Word p_flags; /* Access permission flags. */
|
||||||
Elf32_Word p_align; /* Alignment in memory and file. */
|
Elf32_Word p_align; /* Alignment in memory and file. */
|
||||||
} Elf32_Phdr;
|
} Elf32_Phdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dynamic structure. The ".dynamic" section contains an array of them.
|
* Dynamic structure. The ".dynamic" section contains an array of them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Sword d_tag; /* Entry type. */
|
Elf32_Sword d_tag; /* Entry type. */
|
||||||
union {
|
union {
|
||||||
Elf32_Word d_val; /* Integer value. */
|
Elf32_Word d_val; /* Integer value. */
|
||||||
Elf32_Addr d_ptr; /* Address value. */
|
Elf32_Addr d_ptr; /* Address value. */
|
||||||
} d_un;
|
} d_un;
|
||||||
} Elf32_Dyn;
|
} Elf32_Dyn;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Relocation entries.
|
* Relocation entries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Relocations that don't need an addend field. */
|
/* Relocations that don't need an addend field. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||||
} Elf32_Rel;
|
} Elf32_Rel;
|
||||||
|
|
||||||
/* Relocations that need an addend field. */
|
/* Relocations that need an addend field. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||||
Elf32_Sword r_addend; /* Addend. */
|
Elf32_Sword r_addend; /* Addend. */
|
||||||
} Elf32_Rela;
|
} Elf32_Rela;
|
||||||
|
|
||||||
/* Macros for accessing the fields of r_info. */
|
/* Macros for accessing the fields of r_info. */
|
||||||
#define ELF32_R_SYM(info) ((info) >> 8)
|
#define ELF32_R_SYM(info) ((info) >> 8)
|
||||||
#define ELF32_R_TYPE(info) ((unsigned char)(info))
|
#define ELF32_R_TYPE(info) ((unsigned char)(info))
|
||||||
|
|
||||||
/* Macro for constructing r_info from field values. */
|
/* Macro for constructing r_info from field values. */
|
||||||
#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
|
#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note entry header
|
* Note entry header
|
||||||
*/
|
*/
|
||||||
typedef Elf_Note Elf32_Nhdr;
|
typedef Elf_Note Elf32_Nhdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move entry
|
* Move entry
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Lword m_value; /* symbol value */
|
Elf32_Lword m_value; /* symbol value */
|
||||||
Elf32_Word m_info; /* size + index */
|
Elf32_Word m_info; /* size + index */
|
||||||
Elf32_Word m_poffset; /* symbol offset */
|
Elf32_Word m_poffset; /* symbol offset */
|
||||||
Elf32_Half m_repeat; /* repeat count */
|
Elf32_Half m_repeat; /* repeat count */
|
||||||
Elf32_Half m_stride; /* stride info */
|
Elf32_Half m_stride; /* stride info */
|
||||||
} Elf32_Move;
|
} Elf32_Move;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The macros compose and decompose values for Move.r_info
|
* The macros compose and decompose values for Move.r_info
|
||||||
*
|
*
|
||||||
* sym = ELF32_M_SYM(M.m_info)
|
* sym = ELF32_M_SYM(M.m_info)
|
||||||
* size = ELF32_M_SIZE(M.m_info)
|
* size = ELF32_M_SIZE(M.m_info)
|
||||||
* M.m_info = ELF32_M_INFO(sym, size)
|
* M.m_info = ELF32_M_INFO(sym, size)
|
||||||
*/
|
*/
|
||||||
#define ELF32_M_SYM(info) ((info)>>8)
|
#define ELF32_M_SYM(info) ((info)>>8)
|
||||||
#define ELF32_M_SIZE(info) ((unsigned char)(info))
|
#define ELF32_M_SIZE(info) ((unsigned char)(info))
|
||||||
#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hardware/Software capabilities entry
|
* Hardware/Software capabilities entry
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Word c_tag; /* how to interpret value */
|
Elf32_Word c_tag; /* how to interpret value */
|
||||||
union {
|
union {
|
||||||
Elf32_Word c_val;
|
Elf32_Word c_val;
|
||||||
Elf32_Addr c_ptr;
|
Elf32_Addr c_ptr;
|
||||||
} c_un;
|
} c_un;
|
||||||
} Elf32_Cap;
|
} Elf32_Cap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Symbol table entries.
|
* Symbol table entries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Word st_name; /* String table index of name. */
|
Elf32_Word st_name; /* String table index of name. */
|
||||||
Elf32_Addr st_value; /* Symbol value. */
|
Elf32_Addr st_value; /* Symbol value. */
|
||||||
Elf32_Word st_size; /* Size of associated object. */
|
Elf32_Word st_size; /* Size of associated object. */
|
||||||
unsigned char st_info; /* Type and binding information. */
|
unsigned char st_info; /* Type and binding information. */
|
||||||
unsigned char st_other; /* Reserved (not used). */
|
unsigned char st_other; /* Reserved (not used). */
|
||||||
Elf32_Half st_shndx; /* Section index of symbol. */
|
Elf32_Half st_shndx; /* Section index of symbol. */
|
||||||
} Elf32_Sym;
|
} Elf32_Sym;
|
||||||
|
|
||||||
/* Macros for accessing the fields of st_info. */
|
/* Macros for accessing the fields of st_info. */
|
||||||
#define ELF32_ST_BIND(info) ((info) >> 4)
|
#define ELF32_ST_BIND(info) ((info) >> 4)
|
||||||
#define ELF32_ST_TYPE(info) ((info) & 0xf)
|
#define ELF32_ST_TYPE(info) ((info) & 0xf)
|
||||||
|
|
||||||
/* Macro for constructing st_info from field values. */
|
/* Macro for constructing st_info from field values. */
|
||||||
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||||
|
|
||||||
/* Macro for accessing the fields of st_other. */
|
/* Macro for accessing the fields of st_other. */
|
||||||
#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3)
|
#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||||
|
|
||||||
/* Structures used by Sun & GNU symbol versioning. */
|
/* Structures used by Sun & GNU symbol versioning. */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Elf32_Half vd_version;
|
Elf32_Half vd_version;
|
||||||
Elf32_Half vd_flags;
|
Elf32_Half vd_flags;
|
||||||
Elf32_Half vd_ndx;
|
Elf32_Half vd_ndx;
|
||||||
Elf32_Half vd_cnt;
|
Elf32_Half vd_cnt;
|
||||||
Elf32_Word vd_hash;
|
Elf32_Word vd_hash;
|
||||||
Elf32_Word vd_aux;
|
Elf32_Word vd_aux;
|
||||||
Elf32_Word vd_next;
|
Elf32_Word vd_next;
|
||||||
} Elf32_Verdef;
|
} Elf32_Verdef;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Elf32_Word vda_name;
|
Elf32_Word vda_name;
|
||||||
Elf32_Word vda_next;
|
Elf32_Word vda_next;
|
||||||
} Elf32_Verdaux;
|
} Elf32_Verdaux;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Elf32_Half vn_version;
|
Elf32_Half vn_version;
|
||||||
Elf32_Half vn_cnt;
|
Elf32_Half vn_cnt;
|
||||||
Elf32_Word vn_file;
|
Elf32_Word vn_file;
|
||||||
Elf32_Word vn_aux;
|
Elf32_Word vn_aux;
|
||||||
Elf32_Word vn_next;
|
Elf32_Word vn_next;
|
||||||
} Elf32_Verneed;
|
} Elf32_Verneed;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Elf32_Word vna_hash;
|
Elf32_Word vna_hash;
|
||||||
Elf32_Half vna_flags;
|
Elf32_Half vna_flags;
|
||||||
Elf32_Half vna_other;
|
Elf32_Half vna_other;
|
||||||
Elf32_Word vna_name;
|
Elf32_Word vna_name;
|
||||||
Elf32_Word vna_next;
|
Elf32_Word vna_next;
|
||||||
} Elf32_Vernaux;
|
} Elf32_Vernaux;
|
||||||
|
|
||||||
typedef Elf32_Half Elf32_Versym;
|
typedef Elf32_Half Elf32_Versym;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf32_Half si_boundto; /* direct bindings - symbol bound to */
|
Elf32_Half si_boundto; /* direct bindings - symbol bound to */
|
||||||
Elf32_Half si_flags; /* per symbol flags */
|
Elf32_Half si_flags; /* per symbol flags */
|
||||||
} Elf32_Syminfo;
|
} Elf32_Syminfo;
|
||||||
|
|
||||||
#endif /* !_SYS_ELF32_H_ */
|
#endif /* !_SYS_ELF32_H_ */
|
||||||
|
@@ -1,260 +1,260 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Ported ELF include files from FreeBSD
|
Ported ELF include files from FreeBSD
|
||||||
|
|
||||||
Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1996-1998 John D. Polstra.
|
* Copyright (c) 1996-1998 John D. Polstra.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.2 2007/12/03 21:30:36 marius Exp $
|
* $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.2 2007/12/03 21:30:36 marius Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SYS_ELF64_H_
|
#ifndef _SYS_ELF64_H_
|
||||||
#define _SYS_ELF64_H_ 1
|
#define _SYS_ELF64_H_ 1
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ELF definitions common to all 64-bit architectures.
|
* ELF definitions common to all 64-bit architectures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef UINT64 Elf64_Addr;
|
typedef UINT64 Elf64_Addr;
|
||||||
typedef UINT16 Elf64_Half;
|
typedef UINT16 Elf64_Half;
|
||||||
typedef UINT64 Elf64_Off;
|
typedef UINT64 Elf64_Off;
|
||||||
typedef INT32 Elf64_Sword;
|
typedef INT32 Elf64_Sword;
|
||||||
typedef INT64 Elf64_Sxword;
|
typedef INT64 Elf64_Sxword;
|
||||||
typedef UINT32 Elf64_Word;
|
typedef UINT32 Elf64_Word;
|
||||||
typedef UINT64 Elf64_Lword;
|
typedef UINT64 Elf64_Lword;
|
||||||
typedef UINT64 Elf64_Xword;
|
typedef UINT64 Elf64_Xword;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Types of dynamic symbol hash table bucket and chain elements.
|
* Types of dynamic symbol hash table bucket and chain elements.
|
||||||
*
|
*
|
||||||
* This is inconsistent among 64 bit architectures, so a machine dependent
|
* This is inconsistent among 64 bit architectures, so a machine dependent
|
||||||
* typedef is required.
|
* typedef is required.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef Elf64_Word Elf64_Hashelt;
|
typedef Elf64_Word Elf64_Hashelt;
|
||||||
|
|
||||||
/* Non-standard class-dependent datatype used for abstraction. */
|
/* Non-standard class-dependent datatype used for abstraction. */
|
||||||
typedef Elf64_Xword Elf64_Size;
|
typedef Elf64_Xword Elf64_Size;
|
||||||
typedef Elf64_Sxword Elf64_Ssize;
|
typedef Elf64_Sxword Elf64_Ssize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ELF header.
|
* ELF header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||||
Elf64_Half e_type; /* File type. */
|
Elf64_Half e_type; /* File type. */
|
||||||
Elf64_Half e_machine; /* Machine architecture. */
|
Elf64_Half e_machine; /* Machine architecture. */
|
||||||
Elf64_Word e_version; /* ELF format version. */
|
Elf64_Word e_version; /* ELF format version. */
|
||||||
Elf64_Addr e_entry; /* Entry point. */
|
Elf64_Addr e_entry; /* Entry point. */
|
||||||
Elf64_Off e_phoff; /* Program header file offset. */
|
Elf64_Off e_phoff; /* Program header file offset. */
|
||||||
Elf64_Off e_shoff; /* Section header file offset. */
|
Elf64_Off e_shoff; /* Section header file offset. */
|
||||||
Elf64_Word e_flags; /* Architecture-specific flags. */
|
Elf64_Word e_flags; /* Architecture-specific flags. */
|
||||||
Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
|
Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||||
Elf64_Half e_phentsize; /* Size of program header entry. */
|
Elf64_Half e_phentsize; /* Size of program header entry. */
|
||||||
Elf64_Half e_phnum; /* Number of program header entries. */
|
Elf64_Half e_phnum; /* Number of program header entries. */
|
||||||
Elf64_Half e_shentsize; /* Size of section header entry. */
|
Elf64_Half e_shentsize; /* Size of section header entry. */
|
||||||
Elf64_Half e_shnum; /* Number of section header entries. */
|
Elf64_Half e_shnum; /* Number of section header entries. */
|
||||||
Elf64_Half e_shstrndx; /* Section name strings section. */
|
Elf64_Half e_shstrndx; /* Section name strings section. */
|
||||||
} Elf64_Ehdr;
|
} Elf64_Ehdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Section header.
|
* Section header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Word sh_name; /* Section name (index into the
|
Elf64_Word sh_name; /* Section name (index into the
|
||||||
section header string table). */
|
section header string table). */
|
||||||
Elf64_Word sh_type; /* Section type. */
|
Elf64_Word sh_type; /* Section type. */
|
||||||
Elf64_Xword sh_flags; /* Section flags. */
|
Elf64_Xword sh_flags; /* Section flags. */
|
||||||
Elf64_Addr sh_addr; /* Address in memory image. */
|
Elf64_Addr sh_addr; /* Address in memory image. */
|
||||||
Elf64_Off sh_offset; /* Offset in file. */
|
Elf64_Off sh_offset; /* Offset in file. */
|
||||||
Elf64_Xword sh_size; /* Size in bytes. */
|
Elf64_Xword sh_size; /* Size in bytes. */
|
||||||
Elf64_Word sh_link; /* Index of a related section. */
|
Elf64_Word sh_link; /* Index of a related section. */
|
||||||
Elf64_Word sh_info; /* Depends on section type. */
|
Elf64_Word sh_info; /* Depends on section type. */
|
||||||
Elf64_Xword sh_addralign; /* Alignment in bytes. */
|
Elf64_Xword sh_addralign; /* Alignment in bytes. */
|
||||||
Elf64_Xword sh_entsize; /* Size of each entry in section. */
|
Elf64_Xword sh_entsize; /* Size of each entry in section. */
|
||||||
} Elf64_Shdr;
|
} Elf64_Shdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Program header.
|
* Program header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Word p_type; /* Entry type. */
|
Elf64_Word p_type; /* Entry type. */
|
||||||
Elf64_Word p_flags; /* Access permission flags. */
|
Elf64_Word p_flags; /* Access permission flags. */
|
||||||
Elf64_Off p_offset; /* File offset of contents. */
|
Elf64_Off p_offset; /* File offset of contents. */
|
||||||
Elf64_Addr p_vaddr; /* Virtual address in memory image. */
|
Elf64_Addr p_vaddr; /* Virtual address in memory image. */
|
||||||
Elf64_Addr p_paddr; /* Physical address (not used). */
|
Elf64_Addr p_paddr; /* Physical address (not used). */
|
||||||
Elf64_Xword p_filesz; /* Size of contents in file. */
|
Elf64_Xword p_filesz; /* Size of contents in file. */
|
||||||
Elf64_Xword p_memsz; /* Size of contents in memory. */
|
Elf64_Xword p_memsz; /* Size of contents in memory. */
|
||||||
Elf64_Xword p_align; /* Alignment in memory and file. */
|
Elf64_Xword p_align; /* Alignment in memory and file. */
|
||||||
} Elf64_Phdr;
|
} Elf64_Phdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dynamic structure. The ".dynamic" section contains an array of them.
|
* Dynamic structure. The ".dynamic" section contains an array of them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Sxword d_tag; /* Entry type. */
|
Elf64_Sxword d_tag; /* Entry type. */
|
||||||
union {
|
union {
|
||||||
Elf64_Xword d_val; /* Integer value. */
|
Elf64_Xword d_val; /* Integer value. */
|
||||||
Elf64_Addr d_ptr; /* Address value. */
|
Elf64_Addr d_ptr; /* Address value. */
|
||||||
} d_un;
|
} d_un;
|
||||||
} Elf64_Dyn;
|
} Elf64_Dyn;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Relocation entries.
|
* Relocation entries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Relocations that don't need an addend field. */
|
/* Relocations that don't need an addend field. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||||
} Elf64_Rel;
|
} Elf64_Rel;
|
||||||
|
|
||||||
/* Relocations that need an addend field. */
|
/* Relocations that need an addend field. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||||
Elf64_Sxword r_addend; /* Addend. */
|
Elf64_Sxword r_addend; /* Addend. */
|
||||||
} Elf64_Rela;
|
} Elf64_Rela;
|
||||||
|
|
||||||
/* Macros for accessing the fields of r_info. */
|
/* Macros for accessing the fields of r_info. */
|
||||||
#define ELF64_R_SYM(info) ((info) >> 32)
|
#define ELF64_R_SYM(info) ((info) >> 32)
|
||||||
#define ELF64_R_TYPE(info) ((info) & 0xffffffffL)
|
#define ELF64_R_TYPE(info) ((info) & 0xffffffffL)
|
||||||
|
|
||||||
/* Macro for constructing r_info from field values. */
|
/* Macro for constructing r_info from field values. */
|
||||||
#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL))
|
#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL))
|
||||||
|
|
||||||
#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40)
|
#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40)
|
||||||
#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56)
|
#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56)
|
||||||
#define ELF64_R_TYPE_INFO(data, type) \
|
#define ELF64_R_TYPE_INFO(data, type) \
|
||||||
(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
|
(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note entry header
|
* Note entry header
|
||||||
*/
|
*/
|
||||||
typedef Elf_Note Elf64_Nhdr;
|
typedef Elf_Note Elf64_Nhdr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move entry
|
* Move entry
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Lword m_value; /* symbol value */
|
Elf64_Lword m_value; /* symbol value */
|
||||||
Elf64_Xword m_info; /* size + index */
|
Elf64_Xword m_info; /* size + index */
|
||||||
Elf64_Xword m_poffset; /* symbol offset */
|
Elf64_Xword m_poffset; /* symbol offset */
|
||||||
Elf64_Half m_repeat; /* repeat count */
|
Elf64_Half m_repeat; /* repeat count */
|
||||||
Elf64_Half m_stride; /* stride info */
|
Elf64_Half m_stride; /* stride info */
|
||||||
} Elf64_Move;
|
} Elf64_Move;
|
||||||
|
|
||||||
#define ELF64_M_SYM(info) ((info)>>8)
|
#define ELF64_M_SYM(info) ((info)>>8)
|
||||||
#define ELF64_M_SIZE(info) ((unsigned char)(info))
|
#define ELF64_M_SIZE(info) ((unsigned char)(info))
|
||||||
#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hardware/Software capabilities entry
|
* Hardware/Software capabilities entry
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Xword c_tag; /* how to interpret value */
|
Elf64_Xword c_tag; /* how to interpret value */
|
||||||
union {
|
union {
|
||||||
Elf64_Xword c_val;
|
Elf64_Xword c_val;
|
||||||
Elf64_Addr c_ptr;
|
Elf64_Addr c_ptr;
|
||||||
} c_un;
|
} c_un;
|
||||||
} Elf64_Cap;
|
} Elf64_Cap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Symbol table entries.
|
* Symbol table entries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Word st_name; /* String table index of name. */
|
Elf64_Word st_name; /* String table index of name. */
|
||||||
unsigned char st_info; /* Type and binding information. */
|
unsigned char st_info; /* Type and binding information. */
|
||||||
unsigned char st_other; /* Reserved (not used). */
|
unsigned char st_other; /* Reserved (not used). */
|
||||||
Elf64_Half st_shndx; /* Section index of symbol. */
|
Elf64_Half st_shndx; /* Section index of symbol. */
|
||||||
Elf64_Addr st_value; /* Symbol value. */
|
Elf64_Addr st_value; /* Symbol value. */
|
||||||
Elf64_Xword st_size; /* Size of associated object. */
|
Elf64_Xword st_size; /* Size of associated object. */
|
||||||
} Elf64_Sym;
|
} Elf64_Sym;
|
||||||
|
|
||||||
/* Macros for accessing the fields of st_info. */
|
/* Macros for accessing the fields of st_info. */
|
||||||
#define ELF64_ST_BIND(info) ((info) >> 4)
|
#define ELF64_ST_BIND(info) ((info) >> 4)
|
||||||
#define ELF64_ST_TYPE(info) ((info) & 0xf)
|
#define ELF64_ST_TYPE(info) ((info) & 0xf)
|
||||||
|
|
||||||
/* Macro for constructing st_info from field values. */
|
/* Macro for constructing st_info from field values. */
|
||||||
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||||
|
|
||||||
/* Macro for accessing the fields of st_other. */
|
/* Macro for accessing the fields of st_other. */
|
||||||
#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3)
|
#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||||
|
|
||||||
/* Structures used by Sun & GNU-style symbol versioning. */
|
/* Structures used by Sun & GNU-style symbol versioning. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Half vd_version;
|
Elf64_Half vd_version;
|
||||||
Elf64_Half vd_flags;
|
Elf64_Half vd_flags;
|
||||||
Elf64_Half vd_ndx;
|
Elf64_Half vd_ndx;
|
||||||
Elf64_Half vd_cnt;
|
Elf64_Half vd_cnt;
|
||||||
Elf64_Word vd_hash;
|
Elf64_Word vd_hash;
|
||||||
Elf64_Word vd_aux;
|
Elf64_Word vd_aux;
|
||||||
Elf64_Word vd_next;
|
Elf64_Word vd_next;
|
||||||
} Elf64_Verdef;
|
} Elf64_Verdef;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Word vda_name;
|
Elf64_Word vda_name;
|
||||||
Elf64_Word vda_next;
|
Elf64_Word vda_next;
|
||||||
} Elf64_Verdaux;
|
} Elf64_Verdaux;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Half vn_version;
|
Elf64_Half vn_version;
|
||||||
Elf64_Half vn_cnt;
|
Elf64_Half vn_cnt;
|
||||||
Elf64_Word vn_file;
|
Elf64_Word vn_file;
|
||||||
Elf64_Word vn_aux;
|
Elf64_Word vn_aux;
|
||||||
Elf64_Word vn_next;
|
Elf64_Word vn_next;
|
||||||
} Elf64_Verneed;
|
} Elf64_Verneed;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Word vna_hash;
|
Elf64_Word vna_hash;
|
||||||
Elf64_Half vna_flags;
|
Elf64_Half vna_flags;
|
||||||
Elf64_Half vna_other;
|
Elf64_Half vna_other;
|
||||||
Elf64_Word vna_name;
|
Elf64_Word vna_name;
|
||||||
Elf64_Word vna_next;
|
Elf64_Word vna_next;
|
||||||
} Elf64_Vernaux;
|
} Elf64_Vernaux;
|
||||||
|
|
||||||
typedef Elf64_Half Elf64_Versym;
|
typedef Elf64_Half Elf64_Versym;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Elf64_Half si_boundto; /* direct bindings - symbol bound to */
|
Elf64_Half si_boundto; /* direct bindings - symbol bound to */
|
||||||
Elf64_Half si_flags; /* per symbol flags */
|
Elf64_Half si_flags; /* per symbol flags */
|
||||||
} Elf64_Syminfo;
|
} Elf64_Syminfo;
|
||||||
|
|
||||||
#endif /* !_SYS_ELF64_H_ */
|
#endif /* !_SYS_ELF64_H_ */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,158 +1,158 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Processor or Compiler specific defines and types for ARM.
|
Processor or Compiler specific defines and types for ARM.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef __PROCESSOR_BIND_H__
|
#ifndef __PROCESSOR_BIND_H__
|
||||||
#define __PROCESSOR_BIND_H__
|
#define __PROCESSOR_BIND_H__
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Define the processor type so other code can make processor based choices
|
/// Define the processor type so other code can make processor based choices
|
||||||
///
|
///
|
||||||
#define MDE_CPU_ARM
|
#define MDE_CPU_ARM
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure we are using the correct packing rules per EFI specification
|
// Make sure we are using the correct packing rules per EFI specification
|
||||||
//
|
//
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
//
|
//
|
||||||
// use Microsoft* C complier dependent integer width types
|
// use Microsoft* C complier dependent integer width types
|
||||||
//
|
//
|
||||||
typedef unsigned __int64 UINT64;
|
typedef unsigned __int64 UINT64;
|
||||||
typedef __int64 INT64;
|
typedef __int64 INT64;
|
||||||
typedef unsigned __int32 UINT32;
|
typedef unsigned __int32 UINT32;
|
||||||
typedef __int32 INT32;
|
typedef __int32 INT32;
|
||||||
typedef unsigned short UINT16;
|
typedef unsigned short UINT16;
|
||||||
typedef unsigned short CHAR16;
|
typedef unsigned short CHAR16;
|
||||||
typedef short INT16;
|
typedef short INT16;
|
||||||
typedef unsigned char BOOLEAN;
|
typedef unsigned char BOOLEAN;
|
||||||
typedef unsigned char UINT8;
|
typedef unsigned char UINT8;
|
||||||
typedef char CHAR8;
|
typedef char CHAR8;
|
||||||
typedef signed char INT8;
|
typedef signed char INT8;
|
||||||
#else
|
#else
|
||||||
//
|
//
|
||||||
// Assume standard ARM alignment.
|
// Assume standard ARM alignment.
|
||||||
//
|
//
|
||||||
typedef unsigned long long UINT64;
|
typedef unsigned long long UINT64;
|
||||||
typedef long long INT64;
|
typedef long long INT64;
|
||||||
typedef unsigned int UINT32;
|
typedef unsigned int UINT32;
|
||||||
typedef int INT32;
|
typedef int INT32;
|
||||||
typedef unsigned short UINT16;
|
typedef unsigned short UINT16;
|
||||||
typedef unsigned short CHAR16;
|
typedef unsigned short CHAR16;
|
||||||
typedef short INT16;
|
typedef short INT16;
|
||||||
typedef unsigned char BOOLEAN;
|
typedef unsigned char BOOLEAN;
|
||||||
typedef unsigned char UINT8;
|
typedef unsigned char UINT8;
|
||||||
typedef char CHAR8;
|
typedef char CHAR8;
|
||||||
typedef signed char INT8;
|
typedef signed char INT8;
|
||||||
|
|
||||||
#define UINT8_MAX 0xff
|
#define UINT8_MAX 0xff
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
|
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||||
/// 8 bytes on supported 64-bit processor instructions)
|
/// 8 bytes on supported 64-bit processor instructions)
|
||||||
///
|
///
|
||||||
typedef UINT32 UINTN;
|
typedef UINT32 UINTN;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
|
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||||
/// 8 bytes on supported 64-bit processor instructions)
|
/// 8 bytes on supported 64-bit processor instructions)
|
||||||
///
|
///
|
||||||
typedef INT32 INTN;
|
typedef INT32 INTN;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Processor specific defines
|
// Processor specific defines
|
||||||
//
|
//
|
||||||
|
|
||||||
///
|
///
|
||||||
/// A value of native width with the highest bit set.
|
/// A value of native width with the highest bit set.
|
||||||
///
|
///
|
||||||
#define MAX_BIT 0x80000000
|
#define MAX_BIT 0x80000000
|
||||||
|
|
||||||
///
|
///
|
||||||
/// A value of native width with the two highest bits set.
|
/// A value of native width with the two highest bits set.
|
||||||
///
|
///
|
||||||
#define MAX_2_BITS 0xC0000000
|
#define MAX_2_BITS 0xC0000000
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Maximum legal ARM address
|
/// Maximum legal ARM address
|
||||||
///
|
///
|
||||||
#define MAX_ADDRESS 0xFFFFFFFF
|
#define MAX_ADDRESS 0xFFFFFFFF
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The stack alignment required for ARM
|
/// The stack alignment required for ARM
|
||||||
///
|
///
|
||||||
#define CPU_STACK_ALIGNMENT sizeof(UINT64)
|
#define CPU_STACK_ALIGNMENT sizeof(UINT64)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
||||||
// use the correct C calling convention. All protocol member functions and
|
// use the correct C calling convention. All protocol member functions and
|
||||||
// EFI intrinsics are required to modify their member functions with EFIAPI.
|
// EFI intrinsics are required to modify their member functions with EFIAPI.
|
||||||
//
|
//
|
||||||
#define EFIAPI
|
#define EFIAPI
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
///
|
///
|
||||||
/// For GNU assembly code, .global or .globl can declare global symbols.
|
/// For GNU assembly code, .global or .globl can declare global symbols.
|
||||||
/// Define this macro to unify the usage.
|
/// Define this macro to unify the usage.
|
||||||
///
|
///
|
||||||
#define ASM_GLOBAL .globl
|
#define ASM_GLOBAL .globl
|
||||||
|
|
||||||
#if !defined(__APPLE__)
|
#if !defined(__APPLE__)
|
||||||
///
|
///
|
||||||
/// ARM EABI defines that the linker should not manipulate call relocations
|
/// ARM EABI defines that the linker should not manipulate call relocations
|
||||||
/// (do bl/blx conversion) unless the target symbol has function type.
|
/// (do bl/blx conversion) unless the target symbol has function type.
|
||||||
/// CodeSourcery 2010.09 started requiring the .type to function properly
|
/// CodeSourcery 2010.09 started requiring the .type to function properly
|
||||||
///
|
///
|
||||||
#define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
|
#define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
|
||||||
|
|
||||||
#define GCC_ASM_EXPORT(func__) \
|
#define GCC_ASM_EXPORT(func__) \
|
||||||
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
|
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
|
||||||
.type ASM_PFX(func__), %function
|
.type ASM_PFX(func__), %function
|
||||||
|
|
||||||
#define GCC_ASM_IMPORT(func__) \
|
#define GCC_ASM_IMPORT(func__) \
|
||||||
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
|
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
//
|
//
|
||||||
// .type not supported by Apple Xcode tools
|
// .type not supported by Apple Xcode tools
|
||||||
//
|
//
|
||||||
#define INTERWORK_FUNC(func__)
|
#define INTERWORK_FUNC(func__)
|
||||||
|
|
||||||
#define GCC_ASM_EXPORT(func__) \
|
#define GCC_ASM_EXPORT(func__) \
|
||||||
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
|
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
|
||||||
|
|
||||||
#define GCC_ASM_IMPORT(name)
|
#define GCC_ASM_IMPORT(name)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the pointer to the first instruction of a function given a function pointer.
|
Return the pointer to the first instruction of a function given a function pointer.
|
||||||
On ARM CPU architectures, these two pointer values are the same,
|
On ARM CPU architectures, these two pointer values are the same,
|
||||||
so the implementation of this macro is very simple.
|
so the implementation of this macro is very simple.
|
||||||
|
|
||||||
@param FunctionPointer A pointer to a function.
|
@param FunctionPointer A pointer to a function.
|
||||||
|
|
||||||
@return The pointer to the first instruction of a function given a function pointer.
|
@return The pointer to the first instruction of a function given a function pointer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -14,4 +14,4 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#define __BUILD_VERSION "Build 2640"
|
#define __BUILD_VERSION "Build 2649"
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
@REM # http://opensource.org/licenses/bsd-license.php
|
@REM # http://opensource.org/licenses/bsd-license.php
|
||||||
@REM #
|
@REM #
|
||||||
@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
|
@@ -1,27 +1,27 @@
|
|||||||
## @file
|
## @file
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
MAKEROOT ?= ../..
|
MAKEROOT ?= ../..
|
||||||
|
|
||||||
include $(MAKEROOT)/Makefiles/header.makefile
|
include $(MAKEROOT)/Makefiles/header.makefile
|
||||||
|
|
||||||
APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
|
APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
|
||||||
|
|
||||||
.PHONY:all
|
.PHONY:all
|
||||||
all: $(MAKEROOT)/bin $(APPLICATION)
|
all: $(MAKEROOT)/bin $(APPLICATION)
|
||||||
|
|
||||||
$(APPLICATION): $(OBJECTS)
|
$(APPLICATION): $(OBJECTS)
|
||||||
$(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
|
$(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
|
||||||
|
|
||||||
$(OBJECTS): ../Include/Common/BuildVersion.h
|
$(OBJECTS): ../Include/Common/BuildVersion.h
|
||||||
|
|
||||||
include $(MAKEROOT)/Makefiles/footer.makefile
|
include $(MAKEROOT)/Makefiles/footer.makefile
|
||||||
|
@@ -7,28 +7,28 @@
|
|||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
DEPFILES = $(OBJECTS:%.o=%.d)
|
DEPFILES = $(OBJECTS:%.o=%.d)
|
||||||
|
|
||||||
$(MAKEROOT)/libs-$(ARCH):
|
$(MAKEROOT)/libs-$(ARCH):
|
||||||
mkdir -p $(MAKEROOT)/libs-$(ARCH)
|
mkdir -p $(MAKEROOT)/libs-$(ARCH)
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: $(MAKEROOT)/libs-$(ARCH) $(LIBRARY)
|
install: $(MAKEROOT)/libs-$(ARCH) $(LIBRARY)
|
||||||
cp $(LIBRARY) $(MAKEROOT)/libs-$(ARCH)
|
cp $(LIBRARY) $(MAKEROOT)/libs-$(ARCH)
|
||||||
|
|
||||||
$(LIBRARY): $(OBJECTS)
|
$(LIBRARY): $(OBJECTS)
|
||||||
$(AR) crs $@ $^
|
$(AR) crs $@ $^
|
||||||
|
|
||||||
%.o : %.c
|
%.o : %.c
|
||||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
||||||
|
|
||||||
%.o : %.S
|
%.o : %.S
|
||||||
$(AS) -c $(ASFLAGS) $< -o $@
|
$(AS) -c $(ASFLAGS) $< -o $@
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@rm -f $(OBJECTS) $(LIBRARY) $(DEPFILES)
|
@rm -f $(OBJECTS) $(LIBRARY) $(DEPFILES)
|
||||||
|
|
||||||
-include $(DEPFILES)
|
-include $(DEPFILES)
|
||||||
|
@@ -7,28 +7,28 @@
|
|||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
!INCLUDE ..\Makefiles\ms.common
|
!INCLUDE ..\Makefiles\ms.common
|
||||||
|
|
||||||
APPLICATION = $(BIN_PATH)\$(APPNAME).exe
|
APPLICATION = $(BIN_PATH)\$(APPNAME).exe
|
||||||
|
|
||||||
all: $(APPLICATION)
|
all: $(APPLICATION)
|
||||||
|
|
||||||
$(APPLICATION) : $(OBJECTS)
|
$(APPLICATION) : $(OBJECTS)
|
||||||
-@if not exist $(BIN_PATH) mkdir $(BIN_PATH)
|
-@if not exist $(BIN_PATH) mkdir $(BIN_PATH)
|
||||||
$(LD) /nologo /debug /incremental:no /nodefaultlib:libc.lib /out:$@ $(LIBS) $**
|
$(LD) /nologo /debug /incremental:no /nodefaultlib:libc.lib /out:$@ $(LIBS) $**
|
||||||
|
|
||||||
$(OBJECTS) : ..\Include\Common\BuildVersion.h
|
$(OBJECTS) : ..\Include\Common\BuildVersion.h
|
||||||
|
|
||||||
.PHONY:clean
|
.PHONY:clean
|
||||||
.PHONY:cleanall
|
.PHONY:cleanall
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
del /f /q $(OBJECTS) *.pdb > nul
|
del /f /q $(OBJECTS) *.pdb > nul
|
||||||
|
|
||||||
cleanall:
|
cleanall:
|
||||||
del /f /q $(OBJECTS) $(APPLICATION) *.pdb $(BIN_PATH)\*.pdb > nul
|
del /f /q $(OBJECTS) $(APPLICATION) *.pdb $(BIN_PATH)\*.pdb > nul
|
||||||
|
|
||||||
!INCLUDE ..\Makefiles\ms.rule
|
!INCLUDE ..\Makefiles\ms.rule
|
||||||
|
|
||||||
|
@@ -7,54 +7,54 @@
|
|||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
!IFNDEF EDK_TOOLS_PATH
|
!IFNDEF EDK_TOOLS_PATH
|
||||||
!ERROR "Please set your EDK_TOOLS_PATH!"
|
!ERROR "Please set your EDK_TOOLS_PATH!"
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
!IFNDEF BASE_TOOLS_PATH
|
!IFNDEF BASE_TOOLS_PATH
|
||||||
!ERROR "BASE_TOOLS_PATH is not set! Please run build_tools.bat at first!"
|
!ERROR "BASE_TOOLS_PATH is not set! Please run build_tools.bat at first!"
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
!IFNDEF ARCH
|
!IFNDEF ARCH
|
||||||
ARCH = IA32
|
ARCH = IA32
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
MAKE = nmake -nologo
|
MAKE = nmake -nologo
|
||||||
|
|
||||||
SOURCE_PATH = $(BASE_TOOLS_PATH)\Source\C
|
SOURCE_PATH = $(BASE_TOOLS_PATH)\Source\C
|
||||||
BIN_PATH = $(BASE_TOOLS_PATH)\Bin
|
BIN_PATH = $(BASE_TOOLS_PATH)\Bin
|
||||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib
|
LIB_PATH = $(BASE_TOOLS_PATH)\Lib
|
||||||
|
|
||||||
SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin
|
SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin
|
||||||
SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib
|
SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib
|
||||||
|
|
||||||
!IF "$(ARCH)"=="IA32"
|
!IF "$(ARCH)"=="IA32"
|
||||||
ARCH_INCLUDE = $(SOURCE_PATH)\Include\Ia32
|
ARCH_INCLUDE = $(SOURCE_PATH)\Include\Ia32
|
||||||
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32
|
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32
|
||||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
|
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
|
||||||
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
|
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
|
||||||
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
|
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
!IF "$(ARCH)"=="X64"
|
!IF "$(ARCH)"=="X64"
|
||||||
ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64
|
ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64
|
||||||
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
|
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
|
||||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
|
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
|
||||||
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
|
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
|
||||||
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
|
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
CC = cl.exe
|
CC = cl.exe
|
||||||
CXX = cl.exe
|
CXX = cl.exe
|
||||||
AS = ml.exe
|
AS = ml.exe
|
||||||
AR = lib.exe
|
AR = lib.exe
|
||||||
LD = link.exe
|
LD = link.exe
|
||||||
LINKER = $(LD)
|
LINKER = $(LD)
|
||||||
|
|
||||||
INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
|
INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
|
||||||
|
|
||||||
CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
||||||
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
||||||
|
|
||||||
|
@@ -7,25 +7,25 @@
|
|||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
!INCLUDE ..\Makefiles\ms.common
|
!INCLUDE ..\Makefiles\ms.common
|
||||||
|
|
||||||
LIBRARY = $(LIB_PATH)\$(LIBNAME).lib
|
LIBRARY = $(LIB_PATH)\$(LIBNAME).lib
|
||||||
|
|
||||||
all: $(LIBRARY)
|
all: $(LIBRARY)
|
||||||
|
|
||||||
$(LIBRARY) : $(OBJECTS)
|
$(LIBRARY) : $(OBJECTS)
|
||||||
-@if not exist $(LIB_PATH) mkdir $(LIB_PATH)
|
-@if not exist $(LIB_PATH) mkdir $(LIB_PATH)
|
||||||
$(AR) /nologo /out:$@ $**
|
$(AR) /nologo /out:$@ $**
|
||||||
|
|
||||||
.PHONY:clean
|
.PHONY:clean
|
||||||
clean:
|
clean:
|
||||||
del /f /q $(OBJECTS) *.pdb > nul
|
del /f /q $(OBJECTS) *.pdb > nul
|
||||||
|
|
||||||
.PHONY:cleanall
|
.PHONY:cleanall
|
||||||
cleanall:
|
cleanall:
|
||||||
del /f /q $(OBJECTS) $(LIBRARY) *.pdb > nul
|
del /f /q $(OBJECTS) $(LIBRARY) *.pdb > nul
|
||||||
|
|
||||||
!INCLUDE ..\Makefiles\ms.rule
|
!INCLUDE ..\Makefiles\ms.rule
|
||||||
|
|
||||||
|
@@ -7,18 +7,18 @@
|
|||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
#DEPFILES = $(OBJECTS:%.o=%.d)
|
#DEPFILES = $(OBJECTS:%.o=%.d)
|
||||||
|
|
||||||
.c.obj :
|
.c.obj :
|
||||||
$(CC) -c $(CFLAGS) $(INC) $< -Fo$@
|
$(CC) -c $(CFLAGS) $(INC) $< -Fo$@
|
||||||
|
|
||||||
.S.obj :
|
.S.obj :
|
||||||
$(AS) -c $(ASFLAGS) $< -Fo$@
|
$(AS) -c $(ASFLAGS) $< -Fo$@
|
||||||
|
|
||||||
.cpp.obj :
|
.cpp.obj :
|
||||||
$(CXX) -c $(CPPFLAGS) $(INC) $< -Fo$@
|
$(CXX) -c $(CPPFLAGS) $(INC) $< -Fo$@
|
||||||
|
|
||||||
#-include $(DEPFILES)
|
#-include $(DEPFILES)
|
||||||
|
|
||||||
|
@@ -7,17 +7,17 @@
|
|||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
!INCLUDE ..\Makefiles\ms.common
|
!INCLUDE ..\Makefiles\ms.common
|
||||||
|
|
||||||
APPNAME = GenSec
|
APPNAME = GenSec
|
||||||
|
|
||||||
LIBS = $(LIB_PATH)\Common.lib
|
LIBS = $(LIB_PATH)\Common.lib
|
||||||
|
|
||||||
OBJECTS = GenSec.obj
|
OBJECTS = GenSec.obj
|
||||||
|
|
||||||
#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
|
#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
|
||||||
|
|
||||||
!INCLUDE ..\Makefiles\ms.app
|
!INCLUDE ..\Makefiles\ms.app
|
||||||
|
|
||||||
|
@@ -7,17 +7,17 @@
|
|||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
!INCLUDE ..\Makefiles\ms.common
|
!INCLUDE ..\Makefiles\ms.common
|
||||||
|
|
||||||
APPNAME = GenSec
|
APPNAME = GenSec
|
||||||
|
|
||||||
LIBS = $(LIB_PATH)\Common.lib
|
LIBS = $(LIB_PATH)\Common.lib
|
||||||
|
|
||||||
OBJECTS = PyUtility.obj
|
OBJECTS = PyUtility.obj
|
||||||
|
|
||||||
#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
|
#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
|
||||||
|
|
||||||
!INCLUDE ..\Makefiles\ms.app
|
!INCLUDE ..\Makefiles\ms.app
|
||||||
|
|
||||||
|
@@ -82,7 +82,7 @@ SPendingAssign::AssignValue (
|
|||||||
IN UINT32 Len
|
IN UINT32 Len
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
memcpy (mAddr, Addr, (mLen < Len ? mLen : Len));
|
memmove (mAddr, Addr, (mLen < Len ? mLen : Len));
|
||||||
mFlag = ASSIGNED;
|
mFlag = ASSIGNED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,7 +685,7 @@ CFormPkg::AdjustDynamicInsertOpcode (
|
|||||||
//
|
//
|
||||||
// Override the restore buffer data.
|
// Override the restore buffer data.
|
||||||
//
|
//
|
||||||
memcpy (LastFormEndAddr, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
|
memmove (LastFormEndAddr, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
|
||||||
InsertOpcodeNode->mBufferFree -= NeedRestoreCodeLen;
|
InsertOpcodeNode->mBufferFree -= NeedRestoreCodeLen;
|
||||||
memset (InsertOpcodeNode->mBufferFree, 0, NeedRestoreCodeLen);
|
memset (InsertOpcodeNode->mBufferFree, 0, NeedRestoreCodeLen);
|
||||||
} else {
|
} else {
|
||||||
@@ -733,7 +733,7 @@ CFormPkg::AdjustDynamicInsertOpcode (
|
|||||||
//
|
//
|
||||||
// Override the restore buffer data.
|
// Override the restore buffer data.
|
||||||
//
|
//
|
||||||
memcpy (InsertOpcodeNode->mBufferStart, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
|
memmove (InsertOpcodeNode->mBufferStart, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
|
||||||
InsertOpcodeNode->mBufferFree -= InsertOpcodeAddr - InsertOpcodeNode->mBufferStart;
|
InsertOpcodeNode->mBufferFree -= InsertOpcodeAddr - InsertOpcodeNode->mBufferStart;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1542,7 +1542,7 @@ CIfrObj::_EMIT_PENDING_OBJ (
|
|||||||
//
|
//
|
||||||
ObjBinBuf = gCFormPkg.IfrBinBufferGet (mObjBinLen);
|
ObjBinBuf = gCFormPkg.IfrBinBufferGet (mObjBinLen);
|
||||||
if (ObjBinBuf != NULL) {
|
if (ObjBinBuf != NULL) {
|
||||||
memcpy (ObjBinBuf, mObjBinBuf, mObjBinLen);
|
memmove (ObjBinBuf, mObjBinBuf, mObjBinLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -368,7 +368,7 @@ public:
|
|||||||
VOID VARSTORE_INFO (OUT EFI_VARSTORE_INFO *Info) {
|
VOID VARSTORE_INFO (OUT EFI_VARSTORE_INFO *Info) {
|
||||||
if (Info != NULL) {
|
if (Info != NULL) {
|
||||||
Info->mVarStoreId = mHeader->VarStoreId;
|
Info->mVarStoreId = mHeader->VarStoreId;
|
||||||
memcpy (&Info->mVarStoreId, &mHeader->VarStoreInfo, sizeof (Info->mVarStoreId));
|
memmove (&Info->mVarStoreId, &mHeader->VarStoreInfo, sizeof (Info->mVarStoreId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,7 +615,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||||
memcpy (&mFormSet->Guid, Guid, sizeof (EFI_GUID));
|
memmove (&mFormSet->Guid, Guid, sizeof (EFI_GUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SetFormSetTitle (IN EFI_STRING_ID FormSetTitle) {
|
VOID SetFormSetTitle (IN EFI_STRING_ID FormSetTitle) {
|
||||||
@@ -627,7 +627,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID SetClassGuid (IN EFI_GUID *Guid) {
|
VOID SetClassGuid (IN EFI_GUID *Guid) {
|
||||||
memcpy (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID));
|
memmove (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 GetFlags() {
|
UINT8 GetFlags() {
|
||||||
@@ -749,7 +749,7 @@ public:
|
|||||||
IncLength (sizeof (EFI_IFR_FORM_MAP_METHOD));
|
IncLength (sizeof (EFI_IFR_FORM_MAP_METHOD));
|
||||||
|
|
||||||
mMethodMap->MethodTitle = MethodTitle;
|
mMethodMap->MethodTitle = MethodTitle;
|
||||||
memcpy (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID));
|
memmove (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID));
|
||||||
mMethodMap ++;
|
mMethodMap ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -769,7 +769,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||||
memcpy (&mVarStore->Guid, Guid, sizeof (EFI_GUID));
|
memmove (&mVarStore->Guid, Guid, sizeof (EFI_GUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SetVarStoreId (IN EFI_VARSTORE_ID VarStoreId) {
|
VOID SetVarStoreId (IN EFI_VARSTORE_ID VarStoreId) {
|
||||||
@@ -809,7 +809,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||||
memcpy (&mVarStoreEfi->Guid, Guid, sizeof (EFI_GUID));
|
memmove (&mVarStoreEfi->Guid, Guid, sizeof (EFI_GUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SetVarStoreId (IN UINT16 VarStoreId) {
|
VOID SetVarStoreId (IN UINT16 VarStoreId) {
|
||||||
@@ -863,7 +863,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||||
memcpy (&mVarStoreNameValue->Guid, Guid, sizeof (EFI_GUID));
|
memmove (&mVarStoreNameValue->Guid, Guid, sizeof (EFI_GUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SetVarStoreId (IN UINT16 VarStoreId) {
|
VOID SetVarStoreId (IN UINT16 VarStoreId) {
|
||||||
@@ -938,7 +938,7 @@ public:
|
|||||||
CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header, Size) {
|
CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header, Size) {
|
||||||
mDefault->Type = Type;
|
mDefault->Type = Type;
|
||||||
mDefault->DefaultId = DefaultId;
|
mDefault->DefaultId = DefaultId;
|
||||||
memcpy (&(mDefault->Value), &Value, Size - OFFSET_OF (EFI_IFR_DEFAULT, Value));
|
memmove (&(mDefault->Value), &Value, Size - OFFSET_OF (EFI_IFR_DEFAULT, Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SetDefaultId (IN UINT16 DefaultId) {
|
VOID SetDefaultId (IN UINT16 DefaultId) {
|
||||||
@@ -950,7 +950,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
|
VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
|
||||||
memcpy (&mDefault->Value, &Value, mDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value));
|
memmove (&mDefault->Value, &Value, mDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1673,7 +1673,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID SetRefreshEventGroutId (IN EFI_GUID *RefreshEventGroupId) {
|
VOID SetRefreshEventGroutId (IN EFI_GUID *RefreshEventGroupId) {
|
||||||
memcpy (&mRefreshId->RefreshEventGroupId, RefreshEventGroupId, sizeof (EFI_GUID));
|
memmove (&mRefreshId->RefreshEventGroupId, RefreshEventGroupId, sizeof (EFI_GUID));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1755,7 +1755,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
|
VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
|
||||||
memcpy (&mOneOfOption->Value, &Value, mOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
|
memmove (&mOneOfOption->Value, &Value, mOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 GetFlags (VOID) {
|
UINT8 GetFlags (VOID) {
|
||||||
@@ -1904,11 +1904,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||||
memcpy (&mGuid->Guid, Guid, sizeof (EFI_GUID));
|
memmove (&mGuid->Guid, Guid, sizeof (EFI_GUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SetData (IN UINT8* DataBuff, IN UINT8 Size) {
|
VOID SetData (IN UINT8* DataBuff, IN UINT8 Size) {
|
||||||
memcpy ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size);
|
memmove ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2214,7 +2214,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID SetPermissions (IN EFI_GUID *Permissions) {
|
VOID SetPermissions (IN EFI_GUID *Permissions) {
|
||||||
memcpy (&mSecurity->Permissions, Permissions, sizeof (EFI_GUID));
|
memmove (&mSecurity->Permissions, Permissions, sizeof (EFI_GUID));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,41 +1,41 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
|
|
||||||
VolInfo.c
|
VolInfo.c
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
Local Definitions for the VolInfo utility
|
Local Definitions for the VolInfo utility
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _VOLINFO_H_
|
#ifndef _VOLINFO_H_
|
||||||
#define _VOLINFO_H_ 1
|
#define _VOLINFO_H_ 1
|
||||||
|
|
||||||
#define PI_SPECIFICATION_VERSION 0x00010000
|
#define PI_SPECIFICATION_VERSION 0x00010000
|
||||||
|
|
||||||
#define EFI_DEP_BEFORE 0x00
|
#define EFI_DEP_BEFORE 0x00
|
||||||
#define EFI_DEP_AFTER 0x01
|
#define EFI_DEP_AFTER 0x01
|
||||||
#define EFI_DEP_PUSH 0x02
|
#define EFI_DEP_PUSH 0x02
|
||||||
#define EFI_DEP_AND 0x03
|
#define EFI_DEP_AND 0x03
|
||||||
#define EFI_DEP_OR 0x04
|
#define EFI_DEP_OR 0x04
|
||||||
#define EFI_DEP_NOT 0x05
|
#define EFI_DEP_NOT 0x05
|
||||||
#define EFI_DEP_TRUE 0x06
|
#define EFI_DEP_TRUE 0x06
|
||||||
#define EFI_DEP_FALSE 0x07
|
#define EFI_DEP_FALSE 0x07
|
||||||
#define EFI_DEP_END 0x08
|
#define EFI_DEP_END 0x08
|
||||||
#define EFI_DEP_SOR 0x09
|
#define EFI_DEP_SOR 0x09
|
||||||
|
|
||||||
#define EFI_SECTION_LAST_LEAF_SECTION_TYPE 0x1B
|
#define EFI_SECTION_LAST_LEAF_SECTION_TYPE 0x1B
|
||||||
#define EFI_SECTION_LAST_SECTION_TYPE 0x1B
|
#define EFI_SECTION_LAST_SECTION_TYPE 0x1B
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,154 +1,154 @@
|
|||||||
## @file
|
## @file
|
||||||
# Standardized Error Hanlding infrastructures.
|
# Standardized Error Hanlding infrastructures.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
FILE_OPEN_FAILURE = 1
|
FILE_OPEN_FAILURE = 1
|
||||||
FILE_WRITE_FAILURE = 2
|
FILE_WRITE_FAILURE = 2
|
||||||
FILE_PARSE_FAILURE = 3
|
FILE_PARSE_FAILURE = 3
|
||||||
FILE_READ_FAILURE = 4
|
FILE_READ_FAILURE = 4
|
||||||
FILE_CREATE_FAILURE = 5
|
FILE_CREATE_FAILURE = 5
|
||||||
FILE_CHECKSUM_FAILURE = 6
|
FILE_CHECKSUM_FAILURE = 6
|
||||||
FILE_COMPRESS_FAILURE = 7
|
FILE_COMPRESS_FAILURE = 7
|
||||||
FILE_DECOMPRESS_FAILURE = 8
|
FILE_DECOMPRESS_FAILURE = 8
|
||||||
FILE_MOVE_FAILURE = 9
|
FILE_MOVE_FAILURE = 9
|
||||||
FILE_DELETE_FAILURE = 10
|
FILE_DELETE_FAILURE = 10
|
||||||
FILE_COPY_FAILURE = 11
|
FILE_COPY_FAILURE = 11
|
||||||
FILE_POSITIONING_FAILURE = 12
|
FILE_POSITIONING_FAILURE = 12
|
||||||
FILE_ALREADY_EXIST = 13
|
FILE_ALREADY_EXIST = 13
|
||||||
FILE_NOT_FOUND = 14
|
FILE_NOT_FOUND = 14
|
||||||
FILE_TYPE_MISMATCH = 15
|
FILE_TYPE_MISMATCH = 15
|
||||||
FILE_CASE_MISMATCH = 16
|
FILE_CASE_MISMATCH = 16
|
||||||
FILE_DUPLICATED = 17
|
FILE_DUPLICATED = 17
|
||||||
FILE_UNKNOWN_ERROR = 0x0FFF
|
FILE_UNKNOWN_ERROR = 0x0FFF
|
||||||
|
|
||||||
OPTION_UNKNOWN = 0x1000
|
OPTION_UNKNOWN = 0x1000
|
||||||
OPTION_MISSING = 0x1001
|
OPTION_MISSING = 0x1001
|
||||||
OPTION_CONFLICT = 0x1002
|
OPTION_CONFLICT = 0x1002
|
||||||
OPTION_VALUE_INVALID = 0x1003
|
OPTION_VALUE_INVALID = 0x1003
|
||||||
OPTION_DEPRECATED = 0x1004
|
OPTION_DEPRECATED = 0x1004
|
||||||
OPTION_NOT_SUPPORTED = 0x1005
|
OPTION_NOT_SUPPORTED = 0x1005
|
||||||
OPTION_UNKNOWN_ERROR = 0x1FFF
|
OPTION_UNKNOWN_ERROR = 0x1FFF
|
||||||
|
|
||||||
PARAMETER_INVALID = 0x2000
|
PARAMETER_INVALID = 0x2000
|
||||||
PARAMETER_MISSING = 0x2001
|
PARAMETER_MISSING = 0x2001
|
||||||
PARAMETER_UNKNOWN_ERROR =0x2FFF
|
PARAMETER_UNKNOWN_ERROR =0x2FFF
|
||||||
|
|
||||||
FORMAT_INVALID = 0x3000
|
FORMAT_INVALID = 0x3000
|
||||||
FORMAT_NOT_SUPPORTED = 0x3001
|
FORMAT_NOT_SUPPORTED = 0x3001
|
||||||
FORMAT_UNKNOWN = 0x3002
|
FORMAT_UNKNOWN = 0x3002
|
||||||
FORMAT_UNKNOWN_ERROR = 0x3FFF
|
FORMAT_UNKNOWN_ERROR = 0x3FFF
|
||||||
|
|
||||||
RESOURCE_NOT_AVAILABLE = 0x4000
|
RESOURCE_NOT_AVAILABLE = 0x4000
|
||||||
RESOURCE_ALLOCATE_FAILURE = 0x4001
|
RESOURCE_ALLOCATE_FAILURE = 0x4001
|
||||||
RESOURCE_FULL = 0x4002
|
RESOURCE_FULL = 0x4002
|
||||||
RESOURCE_OVERFLOW = 0x4003
|
RESOURCE_OVERFLOW = 0x4003
|
||||||
RESOURCE_UNDERRUN = 0x4004
|
RESOURCE_UNDERRUN = 0x4004
|
||||||
RESOURCE_UNKNOWN_ERROR = 0x4FFF
|
RESOURCE_UNKNOWN_ERROR = 0x4FFF
|
||||||
|
|
||||||
ATTRIBUTE_NOT_AVAILABLE = 0x5000
|
ATTRIBUTE_NOT_AVAILABLE = 0x5000
|
||||||
ATTRIBUTE_GET_FAILURE = 0x5001
|
ATTRIBUTE_GET_FAILURE = 0x5001
|
||||||
ATTRIBUTE_SET_FAILURE = 0x5002
|
ATTRIBUTE_SET_FAILURE = 0x5002
|
||||||
ATTRIBUTE_UPDATE_FAILURE = 0x5003
|
ATTRIBUTE_UPDATE_FAILURE = 0x5003
|
||||||
ATTRIBUTE_ACCESS_DENIED = 0x5004
|
ATTRIBUTE_ACCESS_DENIED = 0x5004
|
||||||
ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF
|
ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF
|
||||||
|
|
||||||
IO_NOT_READY = 0x6000
|
IO_NOT_READY = 0x6000
|
||||||
IO_BUSY = 0x6001
|
IO_BUSY = 0x6001
|
||||||
IO_TIMEOUT = 0x6002
|
IO_TIMEOUT = 0x6002
|
||||||
IO_UNKNOWN_ERROR = 0x6FFF
|
IO_UNKNOWN_ERROR = 0x6FFF
|
||||||
|
|
||||||
COMMAND_FAILURE = 0x7000
|
COMMAND_FAILURE = 0x7000
|
||||||
|
|
||||||
PERMISSION_FAILURE = 0x8000
|
PERMISSION_FAILURE = 0x8000
|
||||||
|
|
||||||
CODE_ERROR = 0xC0DE
|
CODE_ERROR = 0xC0DE
|
||||||
|
|
||||||
AUTOGEN_ERROR = 0xF000
|
AUTOGEN_ERROR = 0xF000
|
||||||
PARSER_ERROR = 0xF001
|
PARSER_ERROR = 0xF001
|
||||||
BUILD_ERROR = 0xF002
|
BUILD_ERROR = 0xF002
|
||||||
GENFDS_ERROR = 0xF003
|
GENFDS_ERROR = 0xF003
|
||||||
ECC_ERROR = 0xF004
|
ECC_ERROR = 0xF004
|
||||||
EOT_ERROR = 0xF005
|
EOT_ERROR = 0xF005
|
||||||
DDC_ERROR = 0xF009
|
DDC_ERROR = 0xF009
|
||||||
WARNING_AS_ERROR = 0xF006
|
WARNING_AS_ERROR = 0xF006
|
||||||
MIGRATION_ERROR = 0xF010
|
MIGRATION_ERROR = 0xF010
|
||||||
ABORT_ERROR = 0xFFFE
|
ABORT_ERROR = 0xFFFE
|
||||||
UNKNOWN_ERROR = 0xFFFF
|
UNKNOWN_ERROR = 0xFFFF
|
||||||
|
|
||||||
## Error message of each error code
|
## Error message of each error code
|
||||||
gErrorMessage = {
|
gErrorMessage = {
|
||||||
FILE_NOT_FOUND : "File/directory not found in workspace",
|
FILE_NOT_FOUND : "File/directory not found in workspace",
|
||||||
FILE_OPEN_FAILURE : "File open failure",
|
FILE_OPEN_FAILURE : "File open failure",
|
||||||
FILE_WRITE_FAILURE : "File write failure",
|
FILE_WRITE_FAILURE : "File write failure",
|
||||||
FILE_PARSE_FAILURE : "File parse failure",
|
FILE_PARSE_FAILURE : "File parse failure",
|
||||||
FILE_READ_FAILURE : "File read failure",
|
FILE_READ_FAILURE : "File read failure",
|
||||||
FILE_CREATE_FAILURE : "File create failure",
|
FILE_CREATE_FAILURE : "File create failure",
|
||||||
FILE_CHECKSUM_FAILURE : "Invalid checksum of file",
|
FILE_CHECKSUM_FAILURE : "Invalid checksum of file",
|
||||||
FILE_COMPRESS_FAILURE : "File compress failure",
|
FILE_COMPRESS_FAILURE : "File compress failure",
|
||||||
FILE_DECOMPRESS_FAILURE : "File decompress failure",
|
FILE_DECOMPRESS_FAILURE : "File decompress failure",
|
||||||
FILE_MOVE_FAILURE : "File move failure",
|
FILE_MOVE_FAILURE : "File move failure",
|
||||||
FILE_DELETE_FAILURE : "File delete failure",
|
FILE_DELETE_FAILURE : "File delete failure",
|
||||||
FILE_COPY_FAILURE : "File copy failure",
|
FILE_COPY_FAILURE : "File copy failure",
|
||||||
FILE_POSITIONING_FAILURE: "Failed to seeking position",
|
FILE_POSITIONING_FAILURE: "Failed to seeking position",
|
||||||
FILE_ALREADY_EXIST : "File or directory already exists",
|
FILE_ALREADY_EXIST : "File or directory already exists",
|
||||||
FILE_TYPE_MISMATCH : "Incorrect file type",
|
FILE_TYPE_MISMATCH : "Incorrect file type",
|
||||||
FILE_CASE_MISMATCH : "File name case mismatch",
|
FILE_CASE_MISMATCH : "File name case mismatch",
|
||||||
FILE_DUPLICATED : "Duplicated file found",
|
FILE_DUPLICATED : "Duplicated file found",
|
||||||
FILE_UNKNOWN_ERROR : "Unknown error encountered on file",
|
FILE_UNKNOWN_ERROR : "Unknown error encountered on file",
|
||||||
|
|
||||||
OPTION_UNKNOWN : "Unknown option",
|
OPTION_UNKNOWN : "Unknown option",
|
||||||
OPTION_MISSING : "Missing option",
|
OPTION_MISSING : "Missing option",
|
||||||
OPTION_CONFLICT : "Conflict options",
|
OPTION_CONFLICT : "Conflict options",
|
||||||
OPTION_VALUE_INVALID : "Invalid value of option",
|
OPTION_VALUE_INVALID : "Invalid value of option",
|
||||||
OPTION_DEPRECATED : "Deprecated option",
|
OPTION_DEPRECATED : "Deprecated option",
|
||||||
OPTION_NOT_SUPPORTED : "Unsupported option",
|
OPTION_NOT_SUPPORTED : "Unsupported option",
|
||||||
OPTION_UNKNOWN_ERROR : "Unknown error when processing options",
|
OPTION_UNKNOWN_ERROR : "Unknown error when processing options",
|
||||||
|
|
||||||
PARAMETER_INVALID : "Invalid parameter",
|
PARAMETER_INVALID : "Invalid parameter",
|
||||||
PARAMETER_MISSING : "Missing parameter",
|
PARAMETER_MISSING : "Missing parameter",
|
||||||
PARAMETER_UNKNOWN_ERROR : "Unknown error in parameters",
|
PARAMETER_UNKNOWN_ERROR : "Unknown error in parameters",
|
||||||
|
|
||||||
FORMAT_INVALID : "Invalid syntax/format",
|
FORMAT_INVALID : "Invalid syntax/format",
|
||||||
FORMAT_NOT_SUPPORTED : "Not supported syntax/format",
|
FORMAT_NOT_SUPPORTED : "Not supported syntax/format",
|
||||||
FORMAT_UNKNOWN : "Unknown format",
|
FORMAT_UNKNOWN : "Unknown format",
|
||||||
FORMAT_UNKNOWN_ERROR : "Unknown error in syntax/format ",
|
FORMAT_UNKNOWN_ERROR : "Unknown error in syntax/format ",
|
||||||
|
|
||||||
RESOURCE_NOT_AVAILABLE : "Not available",
|
RESOURCE_NOT_AVAILABLE : "Not available",
|
||||||
RESOURCE_ALLOCATE_FAILURE : "Allocate failure",
|
RESOURCE_ALLOCATE_FAILURE : "Allocate failure",
|
||||||
RESOURCE_FULL : "Full",
|
RESOURCE_FULL : "Full",
|
||||||
RESOURCE_OVERFLOW : "Overflow",
|
RESOURCE_OVERFLOW : "Overflow",
|
||||||
RESOURCE_UNDERRUN : "Underrun",
|
RESOURCE_UNDERRUN : "Underrun",
|
||||||
RESOURCE_UNKNOWN_ERROR : "Unknown error",
|
RESOURCE_UNKNOWN_ERROR : "Unknown error",
|
||||||
|
|
||||||
ATTRIBUTE_NOT_AVAILABLE : "Not available",
|
ATTRIBUTE_NOT_AVAILABLE : "Not available",
|
||||||
ATTRIBUTE_GET_FAILURE : "Failed to retrieve",
|
ATTRIBUTE_GET_FAILURE : "Failed to retrieve",
|
||||||
ATTRIBUTE_SET_FAILURE : "Failed to set",
|
ATTRIBUTE_SET_FAILURE : "Failed to set",
|
||||||
ATTRIBUTE_UPDATE_FAILURE: "Failed to update",
|
ATTRIBUTE_UPDATE_FAILURE: "Failed to update",
|
||||||
ATTRIBUTE_ACCESS_DENIED : "Access denied",
|
ATTRIBUTE_ACCESS_DENIED : "Access denied",
|
||||||
ATTRIBUTE_UNKNOWN_ERROR : "Unknown error when accessing",
|
ATTRIBUTE_UNKNOWN_ERROR : "Unknown error when accessing",
|
||||||
|
|
||||||
COMMAND_FAILURE : "Failed to execute command",
|
COMMAND_FAILURE : "Failed to execute command",
|
||||||
|
|
||||||
IO_NOT_READY : "Not ready",
|
IO_NOT_READY : "Not ready",
|
||||||
IO_BUSY : "Busy",
|
IO_BUSY : "Busy",
|
||||||
IO_TIMEOUT : "Timeout",
|
IO_TIMEOUT : "Timeout",
|
||||||
IO_UNKNOWN_ERROR : "Unknown error in IO operation",
|
IO_UNKNOWN_ERROR : "Unknown error in IO operation",
|
||||||
|
|
||||||
UNKNOWN_ERROR : "Unknown error",
|
UNKNOWN_ERROR : "Unknown error",
|
||||||
}
|
}
|
||||||
|
|
||||||
## Exception indicating a fatal error
|
## Exception indicating a fatal error
|
||||||
class FatalError(Exception):
|
class FatalError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
pass
|
pass
|
||||||
|
@@ -13,4 +13,4 @@
|
|||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
gBUILD_VERSION = "Build 2640"
|
gBUILD_VERSION = "Build 2649"
|
||||||
|
@@ -1,269 +1,269 @@
|
|||||||
## @file
|
## @file
|
||||||
# This file implements the log mechanism for Python tools.
|
# This file implements the log mechanism for Python tools.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
## Import modules
|
## Import modules
|
||||||
import sys, os, logging
|
import sys, os, logging
|
||||||
import traceback
|
import traceback
|
||||||
from BuildToolError import *
|
from BuildToolError import *
|
||||||
|
|
||||||
## Log level constants
|
## Log level constants
|
||||||
DEBUG_0 = 1
|
DEBUG_0 = 1
|
||||||
DEBUG_1 = 2
|
DEBUG_1 = 2
|
||||||
DEBUG_2 = 3
|
DEBUG_2 = 3
|
||||||
DEBUG_3 = 4
|
DEBUG_3 = 4
|
||||||
DEBUG_4 = 5
|
DEBUG_4 = 5
|
||||||
DEBUG_5 = 6
|
DEBUG_5 = 6
|
||||||
DEBUG_6 = 7
|
DEBUG_6 = 7
|
||||||
DEBUG_7 = 8
|
DEBUG_7 = 8
|
||||||
DEBUG_8 = 9
|
DEBUG_8 = 9
|
||||||
DEBUG_9 = 10
|
DEBUG_9 = 10
|
||||||
VERBOSE = 15
|
VERBOSE = 15
|
||||||
INFO = 20
|
INFO = 20
|
||||||
WARN = 30
|
WARN = 30
|
||||||
QUIET = 40
|
QUIET = 40
|
||||||
ERROR = 50
|
ERROR = 50
|
||||||
|
|
||||||
IsRaiseError = True
|
IsRaiseError = True
|
||||||
|
|
||||||
# Tool name
|
# Tool name
|
||||||
_ToolName = os.path.basename(sys.argv[0])
|
_ToolName = os.path.basename(sys.argv[0])
|
||||||
|
|
||||||
# For validation purpose
|
# For validation purpose
|
||||||
_LogLevels = [DEBUG_0, DEBUG_1, DEBUG_2, DEBUG_3, DEBUG_4, DEBUG_5, DEBUG_6, DEBUG_7, DEBUG_8, DEBUG_9, VERBOSE, WARN, INFO, ERROR, QUIET]
|
_LogLevels = [DEBUG_0, DEBUG_1, DEBUG_2, DEBUG_3, DEBUG_4, DEBUG_5, DEBUG_6, DEBUG_7, DEBUG_8, DEBUG_9, VERBOSE, WARN, INFO, ERROR, QUIET]
|
||||||
|
|
||||||
# For DEBUG level (All DEBUG_0~9 are applicable)
|
# For DEBUG level (All DEBUG_0~9 are applicable)
|
||||||
_DebugLogger = logging.getLogger("tool_debug")
|
_DebugLogger = logging.getLogger("tool_debug")
|
||||||
_DebugFormatter = logging.Formatter("[%(asctime)s.%(msecs)d]: %(message)s", datefmt="%H:%M:%S")
|
_DebugFormatter = logging.Formatter("[%(asctime)s.%(msecs)d]: %(message)s", datefmt="%H:%M:%S")
|
||||||
|
|
||||||
# For VERBOSE, INFO, WARN level
|
# For VERBOSE, INFO, WARN level
|
||||||
_InfoLogger = logging.getLogger("tool_info")
|
_InfoLogger = logging.getLogger("tool_info")
|
||||||
_InfoFormatter = logging.Formatter("%(message)s")
|
_InfoFormatter = logging.Formatter("%(message)s")
|
||||||
|
|
||||||
# For ERROR level
|
# For ERROR level
|
||||||
_ErrorLogger = logging.getLogger("tool_error")
|
_ErrorLogger = logging.getLogger("tool_error")
|
||||||
_ErrorFormatter = logging.Formatter("%(message)s")
|
_ErrorFormatter = logging.Formatter("%(message)s")
|
||||||
|
|
||||||
# String templates for ERROR/WARN/DEBUG log message
|
# String templates for ERROR/WARN/DEBUG log message
|
||||||
_ErrorMessageTemplate = '\n\n%(tool)s...\n%(file)s(%(line)s): error %(errorcode)04X: %(msg)s\n\t%(extra)s'
|
_ErrorMessageTemplate = '\n\n%(tool)s...\n%(file)s(%(line)s): error %(errorcode)04X: %(msg)s\n\t%(extra)s'
|
||||||
_ErrorMessageTemplateWithoutFile = '\n\n%(tool)s...\n : error %(errorcode)04X: %(msg)s\n\t%(extra)s'
|
_ErrorMessageTemplateWithoutFile = '\n\n%(tool)s...\n : error %(errorcode)04X: %(msg)s\n\t%(extra)s'
|
||||||
_WarningMessageTemplate = '%(tool)s...\n%(file)s(%(line)s): warning: %(msg)s'
|
_WarningMessageTemplate = '%(tool)s...\n%(file)s(%(line)s): warning: %(msg)s'
|
||||||
_WarningMessageTemplateWithoutFile = '%(tool)s: : warning: %(msg)s'
|
_WarningMessageTemplateWithoutFile = '%(tool)s: : warning: %(msg)s'
|
||||||
_DebugMessageTemplate = '%(file)s(%(line)s): debug: \n %(msg)s'
|
_DebugMessageTemplate = '%(file)s(%(line)s): debug: \n %(msg)s'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Flag used to take WARN as ERROR.
|
# Flag used to take WARN as ERROR.
|
||||||
# By default, only ERROR message will break the tools execution.
|
# By default, only ERROR message will break the tools execution.
|
||||||
#
|
#
|
||||||
_WarningAsError = False
|
_WarningAsError = False
|
||||||
|
|
||||||
## Log debug message
|
## Log debug message
|
||||||
#
|
#
|
||||||
# @param Level DEBUG level (DEBUG0~9)
|
# @param Level DEBUG level (DEBUG0~9)
|
||||||
# @param Message Debug information
|
# @param Message Debug information
|
||||||
# @param ExtraData More information associated with "Message"
|
# @param ExtraData More information associated with "Message"
|
||||||
#
|
#
|
||||||
def debug(Level, Message, ExtraData=None):
|
def debug(Level, Message, ExtraData=None):
|
||||||
if _DebugLogger.level > Level:
|
if _DebugLogger.level > Level:
|
||||||
return
|
return
|
||||||
if Level > DEBUG_9:
|
if Level > DEBUG_9:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Find out the caller method information
|
# Find out the caller method information
|
||||||
CallerStack = traceback.extract_stack()[-2]
|
CallerStack = traceback.extract_stack()[-2]
|
||||||
TemplateDict = {
|
TemplateDict = {
|
||||||
"file" : CallerStack[0],
|
"file" : CallerStack[0],
|
||||||
"line" : CallerStack[1],
|
"line" : CallerStack[1],
|
||||||
"msg" : Message,
|
"msg" : Message,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ExtraData != None:
|
if ExtraData != None:
|
||||||
LogText = _DebugMessageTemplate % TemplateDict + "\n %s" % ExtraData
|
LogText = _DebugMessageTemplate % TemplateDict + "\n %s" % ExtraData
|
||||||
else:
|
else:
|
||||||
LogText = _DebugMessageTemplate % TemplateDict
|
LogText = _DebugMessageTemplate % TemplateDict
|
||||||
|
|
||||||
_DebugLogger.log(Level, LogText)
|
_DebugLogger.log(Level, LogText)
|
||||||
|
|
||||||
## Log verbose message
|
## Log verbose message
|
||||||
#
|
#
|
||||||
# @param Message Verbose information
|
# @param Message Verbose information
|
||||||
#
|
#
|
||||||
def verbose(Message):
|
def verbose(Message):
|
||||||
return _InfoLogger.log(VERBOSE, Message)
|
return _InfoLogger.log(VERBOSE, Message)
|
||||||
|
|
||||||
## Log warning message
|
## Log warning message
|
||||||
#
|
#
|
||||||
# Warning messages are those which might be wrong but won't fail the tool.
|
# Warning messages are those which might be wrong but won't fail the tool.
|
||||||
#
|
#
|
||||||
# @param ToolName The name of the tool. If not given, the name of caller
|
# @param ToolName The name of the tool. If not given, the name of caller
|
||||||
# method will be used.
|
# method will be used.
|
||||||
# @param Message Warning information
|
# @param Message Warning information
|
||||||
# @param File The name of file which caused the warning.
|
# @param File The name of file which caused the warning.
|
||||||
# @param Line The line number in the "File" which caused the warning.
|
# @param Line The line number in the "File" which caused the warning.
|
||||||
# @param ExtraData More information associated with "Message"
|
# @param ExtraData More information associated with "Message"
|
||||||
#
|
#
|
||||||
def warn(ToolName, Message, File=None, Line=None, ExtraData=None):
|
def warn(ToolName, Message, File=None, Line=None, ExtraData=None):
|
||||||
if _InfoLogger.level > WARN:
|
if _InfoLogger.level > WARN:
|
||||||
return
|
return
|
||||||
|
|
||||||
# if no tool name given, use caller's source file name as tool name
|
# if no tool name given, use caller's source file name as tool name
|
||||||
if ToolName == None or ToolName == "":
|
if ToolName == None or ToolName == "":
|
||||||
ToolName = os.path.basename(traceback.extract_stack()[-2][0])
|
ToolName = os.path.basename(traceback.extract_stack()[-2][0])
|
||||||
|
|
||||||
if Line == None:
|
if Line == None:
|
||||||
Line = "..."
|
Line = "..."
|
||||||
else:
|
else:
|
||||||
Line = "%d" % Line
|
Line = "%d" % Line
|
||||||
|
|
||||||
TemplateDict = {
|
TemplateDict = {
|
||||||
"tool" : ToolName,
|
"tool" : ToolName,
|
||||||
"file" : File,
|
"file" : File,
|
||||||
"line" : Line,
|
"line" : Line,
|
||||||
"msg" : Message,
|
"msg" : Message,
|
||||||
}
|
}
|
||||||
|
|
||||||
if File != None:
|
if File != None:
|
||||||
LogText = _WarningMessageTemplate % TemplateDict
|
LogText = _WarningMessageTemplate % TemplateDict
|
||||||
else:
|
else:
|
||||||
LogText = _WarningMessageTemplateWithoutFile % TemplateDict
|
LogText = _WarningMessageTemplateWithoutFile % TemplateDict
|
||||||
|
|
||||||
if ExtraData != None:
|
if ExtraData != None:
|
||||||
LogText += "\n %s" % ExtraData
|
LogText += "\n %s" % ExtraData
|
||||||
|
|
||||||
_InfoLogger.log(WARN, LogText)
|
_InfoLogger.log(WARN, LogText)
|
||||||
|
|
||||||
# Raise an execption if indicated
|
# Raise an execption if indicated
|
||||||
if _WarningAsError == True:
|
if _WarningAsError == True:
|
||||||
raise FatalError(WARNING_AS_ERROR)
|
raise FatalError(WARNING_AS_ERROR)
|
||||||
|
|
||||||
## Log INFO message
|
## Log INFO message
|
||||||
info = _InfoLogger.info
|
info = _InfoLogger.info
|
||||||
|
|
||||||
## Log ERROR message
|
## Log ERROR message
|
||||||
#
|
#
|
||||||
# Once an error messages is logged, the tool's execution will be broken by raising
|
# Once an error messages is logged, the tool's execution will be broken by raising
|
||||||
# an execption. If you don't want to break the execution later, you can give
|
# an execption. If you don't want to break the execution later, you can give
|
||||||
# "RaiseError" with "False" value.
|
# "RaiseError" with "False" value.
|
||||||
#
|
#
|
||||||
# @param ToolName The name of the tool. If not given, the name of caller
|
# @param ToolName The name of the tool. If not given, the name of caller
|
||||||
# method will be used.
|
# method will be used.
|
||||||
# @param ErrorCode The error code
|
# @param ErrorCode The error code
|
||||||
# @param Message Warning information
|
# @param Message Warning information
|
||||||
# @param File The name of file which caused the error.
|
# @param File The name of file which caused the error.
|
||||||
# @param Line The line number in the "File" which caused the warning.
|
# @param Line The line number in the "File" which caused the warning.
|
||||||
# @param ExtraData More information associated with "Message"
|
# @param ExtraData More information associated with "Message"
|
||||||
# @param RaiseError Raise an exception to break the tool's executuion if
|
# @param RaiseError Raise an exception to break the tool's executuion if
|
||||||
# it's True. This is the default behavior.
|
# it's True. This is the default behavior.
|
||||||
#
|
#
|
||||||
def error(ToolName, ErrorCode, Message=None, File=None, Line=None, ExtraData=None, RaiseError=IsRaiseError):
|
def error(ToolName, ErrorCode, Message=None, File=None, Line=None, ExtraData=None, RaiseError=IsRaiseError):
|
||||||
if Line == None:
|
if Line == None:
|
||||||
Line = "..."
|
Line = "..."
|
||||||
else:
|
else:
|
||||||
Line = "%d" % Line
|
Line = "%d" % Line
|
||||||
|
|
||||||
if Message == None:
|
if Message == None:
|
||||||
if ErrorCode in gErrorMessage:
|
if ErrorCode in gErrorMessage:
|
||||||
Message = gErrorMessage[ErrorCode]
|
Message = gErrorMessage[ErrorCode]
|
||||||
else:
|
else:
|
||||||
Message = gErrorMessage[UNKNOWN_ERROR]
|
Message = gErrorMessage[UNKNOWN_ERROR]
|
||||||
|
|
||||||
if ExtraData == None:
|
if ExtraData == None:
|
||||||
ExtraData = ""
|
ExtraData = ""
|
||||||
|
|
||||||
TemplateDict = {
|
TemplateDict = {
|
||||||
"tool" : _ToolName,
|
"tool" : _ToolName,
|
||||||
"file" : File,
|
"file" : File,
|
||||||
"line" : Line,
|
"line" : Line,
|
||||||
"errorcode" : ErrorCode,
|
"errorcode" : ErrorCode,
|
||||||
"msg" : Message,
|
"msg" : Message,
|
||||||
"extra" : ExtraData
|
"extra" : ExtraData
|
||||||
}
|
}
|
||||||
|
|
||||||
if File != None:
|
if File != None:
|
||||||
LogText = _ErrorMessageTemplate % TemplateDict
|
LogText = _ErrorMessageTemplate % TemplateDict
|
||||||
else:
|
else:
|
||||||
LogText = _ErrorMessageTemplateWithoutFile % TemplateDict
|
LogText = _ErrorMessageTemplateWithoutFile % TemplateDict
|
||||||
|
|
||||||
_ErrorLogger.log(ERROR, LogText)
|
_ErrorLogger.log(ERROR, LogText)
|
||||||
if RaiseError:
|
if RaiseError:
|
||||||
raise FatalError(ErrorCode)
|
raise FatalError(ErrorCode)
|
||||||
|
|
||||||
# Log information which should be always put out
|
# Log information which should be always put out
|
||||||
quiet = _ErrorLogger.error
|
quiet = _ErrorLogger.error
|
||||||
|
|
||||||
## Initialize log system
|
## Initialize log system
|
||||||
def Initialize():
|
def Initialize():
|
||||||
#
|
#
|
||||||
# Since we use different format to log different levels of message into different
|
# Since we use different format to log different levels of message into different
|
||||||
# place (stdout or stderr), we have to use different "Logger" objects to do this.
|
# place (stdout or stderr), we have to use different "Logger" objects to do this.
|
||||||
#
|
#
|
||||||
# For DEBUG level (All DEBUG_0~9 are applicable)
|
# For DEBUG level (All DEBUG_0~9 are applicable)
|
||||||
_DebugLogger.setLevel(INFO)
|
_DebugLogger.setLevel(INFO)
|
||||||
_DebugChannel = logging.StreamHandler(sys.stdout)
|
_DebugChannel = logging.StreamHandler(sys.stdout)
|
||||||
_DebugChannel.setFormatter(_DebugFormatter)
|
_DebugChannel.setFormatter(_DebugFormatter)
|
||||||
_DebugLogger.addHandler(_DebugChannel)
|
_DebugLogger.addHandler(_DebugChannel)
|
||||||
|
|
||||||
# For VERBOSE, INFO, WARN level
|
# For VERBOSE, INFO, WARN level
|
||||||
_InfoLogger.setLevel(INFO)
|
_InfoLogger.setLevel(INFO)
|
||||||
_InfoChannel = logging.StreamHandler(sys.stdout)
|
_InfoChannel = logging.StreamHandler(sys.stdout)
|
||||||
_InfoChannel.setFormatter(_InfoFormatter)
|
_InfoChannel.setFormatter(_InfoFormatter)
|
||||||
_InfoLogger.addHandler(_InfoChannel)
|
_InfoLogger.addHandler(_InfoChannel)
|
||||||
|
|
||||||
# For ERROR level
|
# For ERROR level
|
||||||
_ErrorLogger.setLevel(INFO)
|
_ErrorLogger.setLevel(INFO)
|
||||||
_ErrorCh = logging.StreamHandler(sys.stderr)
|
_ErrorCh = logging.StreamHandler(sys.stderr)
|
||||||
_ErrorCh.setFormatter(_ErrorFormatter)
|
_ErrorCh.setFormatter(_ErrorFormatter)
|
||||||
_ErrorLogger.addHandler(_ErrorCh)
|
_ErrorLogger.addHandler(_ErrorCh)
|
||||||
|
|
||||||
## Set log level
|
## Set log level
|
||||||
#
|
#
|
||||||
# @param Level One of log level in _LogLevel
|
# @param Level One of log level in _LogLevel
|
||||||
def SetLevel(Level):
|
def SetLevel(Level):
|
||||||
if Level not in _LogLevels:
|
if Level not in _LogLevels:
|
||||||
info("Not supported log level (%d). Use default level instead." % Level)
|
info("Not supported log level (%d). Use default level instead." % Level)
|
||||||
Level = INFO
|
Level = INFO
|
||||||
_DebugLogger.setLevel(Level)
|
_DebugLogger.setLevel(Level)
|
||||||
_InfoLogger.setLevel(Level)
|
_InfoLogger.setLevel(Level)
|
||||||
_ErrorLogger.setLevel(Level)
|
_ErrorLogger.setLevel(Level)
|
||||||
|
|
||||||
## Get current log level
|
## Get current log level
|
||||||
def GetLevel():
|
def GetLevel():
|
||||||
return _InfoLogger.getEffectiveLevel()
|
return _InfoLogger.getEffectiveLevel()
|
||||||
|
|
||||||
## Raise up warning as error
|
## Raise up warning as error
|
||||||
def SetWarningAsError():
|
def SetWarningAsError():
|
||||||
global _WarningAsError
|
global _WarningAsError
|
||||||
_WarningAsError = True
|
_WarningAsError = True
|
||||||
|
|
||||||
## Specify a file to store the log message as well as put on console
|
## Specify a file to store the log message as well as put on console
|
||||||
#
|
#
|
||||||
# @param LogFile The file path used to store the log message
|
# @param LogFile The file path used to store the log message
|
||||||
#
|
#
|
||||||
def SetLogFile(LogFile):
|
def SetLogFile(LogFile):
|
||||||
if os.path.exists(LogFile):
|
if os.path.exists(LogFile):
|
||||||
os.remove(LogFile)
|
os.remove(LogFile)
|
||||||
|
|
||||||
_Ch = logging.FileHandler(LogFile)
|
_Ch = logging.FileHandler(LogFile)
|
||||||
_Ch.setFormatter(_DebugFormatter)
|
_Ch.setFormatter(_DebugFormatter)
|
||||||
_DebugLogger.addHandler(_Ch)
|
_DebugLogger.addHandler(_Ch)
|
||||||
|
|
||||||
_Ch= logging.FileHandler(LogFile)
|
_Ch= logging.FileHandler(LogFile)
|
||||||
_Ch.setFormatter(_InfoFormatter)
|
_Ch.setFormatter(_InfoFormatter)
|
||||||
_InfoLogger.addHandler(_Ch)
|
_InfoLogger.addHandler(_Ch)
|
||||||
|
|
||||||
_Ch = logging.FileHandler(LogFile)
|
_Ch = logging.FileHandler(LogFile)
|
||||||
_Ch.setFormatter(_ErrorFormatter)
|
_Ch.setFormatter(_ErrorFormatter)
|
||||||
_ErrorLogger.addHandler(_Ch)
|
_ErrorLogger.addHandler(_Ch)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@@ -1,71 +1,71 @@
|
|||||||
## @file
|
## @file
|
||||||
# This file is used to define common static strings used by INF/DEC/DSC files
|
# This file is used to define common static strings used by INF/DEC/DSC files
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
gIsWindows = None
|
gIsWindows = None
|
||||||
|
|
||||||
gEdkCompatibilityPkg = "EdkCompatibilityPkg"
|
gEdkCompatibilityPkg = "EdkCompatibilityPkg"
|
||||||
gWorkspace = "."
|
gWorkspace = "."
|
||||||
gEdkSource = "EdkCompatibilityPkg"
|
gEdkSource = "EdkCompatibilityPkg"
|
||||||
gEfiSource = "."
|
gEfiSource = "."
|
||||||
gEcpSource = "EdkCompatibilityPkg"
|
gEcpSource = "EdkCompatibilityPkg"
|
||||||
|
|
||||||
gOptions = None
|
gOptions = None
|
||||||
gCaseInsensitive = False
|
gCaseInsensitive = False
|
||||||
gAllFiles = None
|
gAllFiles = None
|
||||||
|
|
||||||
gGlobalDefines = {}
|
gGlobalDefines = {}
|
||||||
gPlatformDefines = {}
|
gPlatformDefines = {}
|
||||||
# PCD name and value pair for fixed at build and feature flag
|
# PCD name and value pair for fixed at build and feature flag
|
||||||
gPlatformPcds = {}
|
gPlatformPcds = {}
|
||||||
# PCDs with type that are not fixed at build and feature flag
|
# PCDs with type that are not fixed at build and feature flag
|
||||||
gPlatformOtherPcds = {}
|
gPlatformOtherPcds = {}
|
||||||
gActivePlatform = None
|
gActivePlatform = None
|
||||||
gCommandLineDefines = {}
|
gCommandLineDefines = {}
|
||||||
gEdkGlobal = {}
|
gEdkGlobal = {}
|
||||||
gOverrideDir = {}
|
gOverrideDir = {}
|
||||||
|
|
||||||
# for debug trace purpose when problem occurs
|
# for debug trace purpose when problem occurs
|
||||||
gProcessingFile = ''
|
gProcessingFile = ''
|
||||||
gBuildingModule = ''
|
gBuildingModule = ''
|
||||||
|
|
||||||
## Regular expression for matching macro used in DSC/DEC/INF file inclusion
|
## Regular expression for matching macro used in DSC/DEC/INF file inclusion
|
||||||
gMacroRefPattern = re.compile("\$\(([A-Z][_A-Z0-9]*)\)", re.UNICODE)
|
gMacroRefPattern = re.compile("\$\(([A-Z][_A-Z0-9]*)\)", re.UNICODE)
|
||||||
gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
|
gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
|
||||||
gMacroNamePattern = re.compile("^[A-Z][A-Z0-9_]*$")
|
gMacroNamePattern = re.compile("^[A-Z][A-Z0-9_]*$")
|
||||||
# C-style wide string pattern
|
# C-style wide string pattern
|
||||||
gWideStringPattern = re.compile('(\W|\A)L"')
|
gWideStringPattern = re.compile('(\W|\A)L"')
|
||||||
#
|
#
|
||||||
# A global variable for whether current build in AutoGen phase or not.
|
# A global variable for whether current build in AutoGen phase or not.
|
||||||
#
|
#
|
||||||
gAutoGenPhase = False
|
gAutoGenPhase = False
|
||||||
|
|
||||||
#
|
#
|
||||||
# The Conf dir outside the workspace dir
|
# The Conf dir outside the workspace dir
|
||||||
#
|
#
|
||||||
gConfDirectory = ''
|
gConfDirectory = ''
|
||||||
|
|
||||||
#
|
#
|
||||||
# The relative default database file path
|
# The relative default database file path
|
||||||
#
|
#
|
||||||
gDatabasePath = ".cache/build.db"
|
gDatabasePath = ".cache/build.db"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build flag for binary build
|
# Build flag for binary build
|
||||||
#
|
#
|
||||||
gIgnoreSource = False
|
gIgnoreSource = False
|
||||||
|
|
||||||
#
|
#
|
||||||
# FDF parser
|
# FDF parser
|
||||||
#
|
#
|
||||||
gFdfParser = None
|
gFdfParser = None
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,20 +1,20 @@
|
|||||||
## @file
|
## @file
|
||||||
# Python 'Library' package initialization file.
|
# Python 'Library' package initialization file.
|
||||||
#
|
#
|
||||||
# This file is required to make Python interpreter treat the directory
|
# This file is required to make Python interpreter treat the directory
|
||||||
# as containing package.
|
# as containing package.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available
|
# This program and the accompanying materials are licensed and made available
|
||||||
# under the terms and conditions of the BSD License which accompanies this
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
# distribution. The full text of the license may be found at
|
# distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Xml
|
Xml
|
||||||
'''
|
'''
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -80,11 +80,11 @@ class EfiSection (EfiSectionClassObject):
|
|||||||
FileList = []
|
FileList = []
|
||||||
if Filename != None:
|
if Filename != None:
|
||||||
Filename = GenFdsGlobalVariable.MacroExtend(Filename, Dict)
|
Filename = GenFdsGlobalVariable.MacroExtend(Filename, Dict)
|
||||||
# check if the path is absolute or relative
|
# check if the path is absolute or relative
|
||||||
if os.path.isabs(Filename):
|
if os.path.isabs(Filename):
|
||||||
Filename = os.path.normpath(Filename)
|
Filename = os.path.normpath(Filename)
|
||||||
else:
|
else:
|
||||||
Filename = os.path.normpath(os.path.join(FfsInf.EfiOutputPath, Filename))
|
Filename = os.path.normpath(os.path.join(FfsInf.EfiOutputPath, Filename))
|
||||||
|
|
||||||
if not self.Optional:
|
if not self.Optional:
|
||||||
FileList.append(Filename)
|
FileList.append(Filename)
|
||||||
|
@@ -296,13 +296,13 @@ class FV (FvClassObject):
|
|||||||
Buffer = ''
|
Buffer = ''
|
||||||
for Index in range (0, len(self.FvExtEntryType)):
|
for Index in range (0, len(self.FvExtEntryType)):
|
||||||
if self.FvExtEntryType[Index] == 'FILE':
|
if self.FvExtEntryType[Index] == 'FILE':
|
||||||
# check if the path is absolute or relative
|
# check if the path is absolute or relative
|
||||||
if os.path.isabs(self.FvExtEntryData[Index]):
|
if os.path.isabs(self.FvExtEntryData[Index]):
|
||||||
FileFullPath = os.path.normpath(self.FvExtEntryData[Index])
|
FileFullPath = os.path.normpath(self.FvExtEntryData[Index])
|
||||||
else:
|
else:
|
||||||
FileFullPath = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.FvExtEntryData[Index]))
|
FileFullPath = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.FvExtEntryData[Index]))
|
||||||
# check if the file path exists or not
|
# check if the file path exists or not
|
||||||
if not os.path.isfile(FileFullPath):
|
if not os.path.isfile(FileFullPath):
|
||||||
GenFdsGlobalVariable.ErrorLogger("Error opening FV Extension Header Entry file %s." % (self.FvExtEntryData[Index]))
|
GenFdsGlobalVariable.ErrorLogger("Error opening FV Extension Header Entry file %s." % (self.FvExtEntryData[Index]))
|
||||||
FvExtFile = open (FileFullPath,'rb')
|
FvExtFile = open (FileFullPath,'rb')
|
||||||
FvExtFile.seek(0,2)
|
FvExtFile.seek(0,2)
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
|||||||
## @file
|
## @file
|
||||||
# Generate PCD table for 'Patchable In Module' type PCD with given .map file.
|
# Generate PCD table for 'Patchable In Module' type PCD with given .map file.
|
||||||
# The Patch PCD table like:
|
# The Patch PCD table like:
|
||||||
#
|
#
|
||||||
# PCD Name Offset in binary
|
# PCD Name Offset in binary
|
||||||
# ======== ================
|
# ======== ================
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||||
@@ -14,77 +14,77 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
#====================================== External Libraries ========================================
|
#====================================== External Libraries ========================================
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import array
|
import array
|
||||||
|
|
||||||
from Common.BuildToolError import *
|
from Common.BuildToolError import *
|
||||||
import Common.EdkLogger as EdkLogger
|
import Common.EdkLogger as EdkLogger
|
||||||
from Common.Misc import PeImageClass
|
from Common.Misc import PeImageClass
|
||||||
from Common.BuildVersion import gBUILD_VERSION
|
from Common.BuildVersion import gBUILD_VERSION
|
||||||
|
|
||||||
# Version and Copyright
|
# Version and Copyright
|
||||||
__version_number__ = ("0.10" + " " + gBUILD_VERSION)
|
__version_number__ = ("0.10" + " " + gBUILD_VERSION)
|
||||||
__version__ = "%prog Version " + __version_number__
|
__version__ = "%prog Version " + __version_number__
|
||||||
__copyright__ = "Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved."
|
__copyright__ = "Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved."
|
||||||
|
|
||||||
#====================================== Internal Libraries ========================================
|
#====================================== Internal Libraries ========================================
|
||||||
|
|
||||||
#============================================== Code ===============================================
|
#============================================== Code ===============================================
|
||||||
secRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]? +([.\w\$]+) +(\w+)', re.UNICODE)
|
secRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]? +([.\w\$]+) +(\w+)', re.UNICODE)
|
||||||
symRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.:\\\\\w\?@\$]+) +([\da-fA-F]+)', re.UNICODE)
|
symRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.:\\\\\w\?@\$]+) +([\da-fA-F]+)', re.UNICODE)
|
||||||
|
|
||||||
def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
|
def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
|
||||||
""" Parse map file to get binary patch pcd information
|
""" Parse map file to get binary patch pcd information
|
||||||
@param path Map file absolution path
|
@param path Map file absolution path
|
||||||
|
|
||||||
@return a list which element hold (PcdName, Offset, SectionName)
|
@return a list which element hold (PcdName, Offset, SectionName)
|
||||||
"""
|
"""
|
||||||
lines = []
|
lines = []
|
||||||
try:
|
try:
|
||||||
f = open(mapfilepath, 'r')
|
f = open(mapfilepath, 'r')
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
f.close()
|
f.close()
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if len(lines) == 0: return None
|
if len(lines) == 0: return None
|
||||||
if lines[0].strip().find("Archive member included because of file (symbol)") != -1:
|
if lines[0].strip().find("Archive member included because of file (symbol)") != -1:
|
||||||
return _parseForGCC(lines, efifilepath)
|
return _parseForGCC(lines, efifilepath)
|
||||||
return _parseGeneral(lines, efifilepath)
|
return _parseGeneral(lines, efifilepath)
|
||||||
|
|
||||||
def _parseForGCC(lines, efifilepath):
|
def _parseForGCC(lines, efifilepath):
|
||||||
""" Parse map file generated by GCC linker """
|
""" Parse map file generated by GCC linker """
|
||||||
status = 0
|
status = 0
|
||||||
imageBase = -1
|
imageBase = -1
|
||||||
sections = []
|
sections = []
|
||||||
bpcds = []
|
bpcds = []
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
# status machine transection
|
# status machine transection
|
||||||
if status == 0 and line == "Memory Configuration":
|
if status == 0 and line == "Memory Configuration":
|
||||||
status = 1
|
status = 1
|
||||||
continue
|
continue
|
||||||
elif status == 1 and line == 'Linker script and memory map':
|
elif status == 1 and line == 'Linker script and memory map':
|
||||||
status = 2
|
status = 2
|
||||||
continue
|
continue
|
||||||
elif status ==2 and line == 'START GROUP':
|
elif status ==2 and line == 'START GROUP':
|
||||||
status = 3
|
status = 3
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# status handler
|
# status handler
|
||||||
if status == 2:
|
if status == 2:
|
||||||
m = re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$', line)
|
m = re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$', line)
|
||||||
if m != None:
|
if m != None:
|
||||||
sections.append(m.groups(0))
|
sections.append(m.groups(0))
|
||||||
if status == 2:
|
if status == 2:
|
||||||
m = re.match("^([\da-fA-Fx]+) +[_]+gPcd_BinaryPatch_([\w_\d]+)$", line)
|
m = re.match("^([\da-fA-Fx]+) +[_]+gPcd_BinaryPatch_([\w_\d]+)$", line)
|
||||||
if m != None:
|
if m != None:
|
||||||
bpcds.append((m.groups(0)[1], int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0]))
|
bpcds.append((m.groups(0)[1], int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0]))
|
||||||
|
|
||||||
# get section information from efi file
|
# get section information from efi file
|
||||||
efisecs = PeImageClass(efifilepath).SectionHeaderList
|
efisecs = PeImageClass(efifilepath).SectionHeaderList
|
||||||
@@ -102,104 +102,104 @@ def _parseForGCC(lines, efifilepath):
|
|||||||
if pcd[1] >= efisec[1] and pcd[1] < efisec[1]+efisec[3]:
|
if pcd[1] >= efisec[1] and pcd[1] < efisec[1]+efisec[3]:
|
||||||
#assert efisec[0].strip() == pcd[3].strip() and efisec[1] + redirection == pcd[2], "There are some differences between map file and efi file"
|
#assert efisec[0].strip() == pcd[3].strip() and efisec[1] + redirection == pcd[2], "There are some differences between map file and efi file"
|
||||||
pcds.append([pcd[0], efisec[2] + pcd[1] - efisec[1] - redirection, efisec[0]])
|
pcds.append([pcd[0], efisec[2] + pcd[1] - efisec[1] - redirection, efisec[0]])
|
||||||
return pcds
|
return pcds
|
||||||
|
|
||||||
def _parseGeneral(lines, efifilepath):
|
def _parseGeneral(lines, efifilepath):
|
||||||
""" For MSFT, ICC, EBC
|
""" For MSFT, ICC, EBC
|
||||||
@param lines line array for map file
|
@param lines line array for map file
|
||||||
|
|
||||||
@return a list which element hold (PcdName, Offset, SectionName)
|
@return a list which element hold (PcdName, Offset, SectionName)
|
||||||
"""
|
"""
|
||||||
status = 0 #0 - beginning of file; 1 - PE section definition; 2 - symbol table
|
status = 0 #0 - beginning of file; 1 - PE section definition; 2 - symbol table
|
||||||
secs = [] # key = section name
|
secs = [] # key = section name
|
||||||
bPcds = []
|
bPcds = []
|
||||||
|
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if re.match("^Start[' ']+Length[' ']+Name[' ']+Class", line):
|
if re.match("^Start[' ']+Length[' ']+Name[' ']+Class", line):
|
||||||
status = 1
|
status = 1
|
||||||
continue
|
continue
|
||||||
if re.match("^Address[' ']+Publics by Value[' ']+Rva\+Base", line):
|
if re.match("^Address[' ']+Publics by Value[' ']+Rva\+Base", line):
|
||||||
status = 2
|
status = 2
|
||||||
continue
|
continue
|
||||||
if re.match("^entry point at", line):
|
if re.match("^entry point at", line):
|
||||||
status = 3
|
status = 3
|
||||||
continue
|
continue
|
||||||
if status == 1 and len(line) != 0:
|
if status == 1 and len(line) != 0:
|
||||||
m = secRe.match(line)
|
m = secRe.match(line)
|
||||||
assert m != None, "Fail to parse the section in map file , line is %s" % line
|
assert m != None, "Fail to parse the section in map file , line is %s" % line
|
||||||
sec_no, sec_start, sec_length, sec_name, sec_class = m.groups(0)
|
sec_no, sec_start, sec_length, sec_name, sec_class = m.groups(0)
|
||||||
secs.append([int(sec_no, 16), int(sec_start, 16), int(sec_length, 16), sec_name, sec_class])
|
secs.append([int(sec_no, 16), int(sec_start, 16), int(sec_length, 16), sec_name, sec_class])
|
||||||
if status == 2 and len(line) != 0:
|
if status == 2 and len(line) != 0:
|
||||||
m = symRe.match(line)
|
m = symRe.match(line)
|
||||||
assert m != None, "Fail to parse the symbol in map file, line is %s" % line
|
assert m != None, "Fail to parse the symbol in map file, line is %s" % line
|
||||||
sec_no, sym_offset, sym_name, vir_addr = m.groups(0)
|
sec_no, sym_offset, sym_name, vir_addr = m.groups(0)
|
||||||
sec_no = int(sec_no, 16)
|
sec_no = int(sec_no, 16)
|
||||||
sym_offset = int(sym_offset, 16)
|
sym_offset = int(sym_offset, 16)
|
||||||
vir_addr = int(vir_addr, 16)
|
vir_addr = int(vir_addr, 16)
|
||||||
m2 = re.match('^[_]+gPcd_BinaryPatch_([\w]+)', sym_name)
|
m2 = re.match('^[_]+gPcd_BinaryPatch_([\w]+)', sym_name)
|
||||||
if m2 != None:
|
if m2 != None:
|
||||||
# fond a binary pcd entry in map file
|
# fond a binary pcd entry in map file
|
||||||
for sec in secs:
|
for sec in secs:
|
||||||
if sec[0] == sec_no and (sym_offset >= sec[1] and sym_offset < sec[1] + sec[2]):
|
if sec[0] == sec_no and (sym_offset >= sec[1] and sym_offset < sec[1] + sec[2]):
|
||||||
bPcds.append([m2.groups(0)[0], sec[3], sym_offset, vir_addr, sec_no])
|
bPcds.append([m2.groups(0)[0], sec[3], sym_offset, vir_addr, sec_no])
|
||||||
|
|
||||||
if len(bPcds) == 0: return None
|
if len(bPcds) == 0: return None
|
||||||
|
|
||||||
# get section information from efi file
|
# get section information from efi file
|
||||||
efisecs = PeImageClass(efifilepath).SectionHeaderList
|
efisecs = PeImageClass(efifilepath).SectionHeaderList
|
||||||
if efisecs == None or len(efisecs) == 0:
|
if efisecs == None or len(efisecs) == 0:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
pcds = []
|
pcds = []
|
||||||
for pcd in bPcds:
|
for pcd in bPcds:
|
||||||
index = 0
|
index = 0
|
||||||
for efisec in efisecs:
|
for efisec in efisecs:
|
||||||
index = index + 1
|
index = index + 1
|
||||||
if pcd[1].strip() == efisec[0].strip():
|
if pcd[1].strip() == efisec[0].strip():
|
||||||
pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]])
|
pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]])
|
||||||
elif pcd[4] == index:
|
elif pcd[4] == index:
|
||||||
pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]])
|
pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]])
|
||||||
return pcds
|
return pcds
|
||||||
|
|
||||||
def generatePcdTable(list, pcdpath):
|
def generatePcdTable(list, pcdpath):
|
||||||
try:
|
try:
|
||||||
f = open(pcdpath, 'w')
|
f = open(pcdpath, 'w')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
f.write('PCD Name Offset Section Name\r\n')
|
f.write('PCD Name Offset Section Name\r\n')
|
||||||
|
|
||||||
for pcditem in list:
|
for pcditem in list:
|
||||||
f.write('%-30s 0x%-08X %-6s\r\n' % (pcditem[0], pcditem[1], pcditem[2]))
|
f.write('%-30s 0x%-08X %-6s\r\n' % (pcditem[0], pcditem[1], pcditem[2]))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
#print 'Success to generate Binary Patch PCD table at %s!' % pcdpath
|
#print 'Success to generate Binary Patch PCD table at %s!' % pcdpath
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
UsageString = "%prog -m <MapFile> -e <EfiFile> -o <OutFile>"
|
UsageString = "%prog -m <MapFile> -e <EfiFile> -o <OutFile>"
|
||||||
AdditionalNotes = "\nPCD table is generated in file name with .BinaryPcdTable.txt postfix"
|
AdditionalNotes = "\nPCD table is generated in file name with .BinaryPcdTable.txt postfix"
|
||||||
parser = optparse.OptionParser(description=__copyright__, version=__version__, usage=UsageString)
|
parser = optparse.OptionParser(description=__copyright__, version=__version__, usage=UsageString)
|
||||||
parser.add_option('-m', '--mapfile', action='store', dest='mapfile',
|
parser.add_option('-m', '--mapfile', action='store', dest='mapfile',
|
||||||
help='Absolute path of module map file.')
|
help='Absolute path of module map file.')
|
||||||
parser.add_option('-e', '--efifile', action='store', dest='efifile',
|
parser.add_option('-e', '--efifile', action='store', dest='efifile',
|
||||||
help='Absolute path of EFI binary file.')
|
help='Absolute path of EFI binary file.')
|
||||||
parser.add_option('-o', '--outputfile', action='store', dest='outfile',
|
parser.add_option('-o', '--outputfile', action='store', dest='outfile',
|
||||||
help='Absolute path of output file to store the got patchable PCD table.')
|
help='Absolute path of output file to store the got patchable PCD table.')
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if options.mapfile == None or options.efifile == None:
|
if options.mapfile == None or options.efifile == None:
|
||||||
print parser.get_usage()
|
print parser.get_usage()
|
||||||
elif os.path.exists(options.mapfile) and os.path.exists(options.efifile):
|
elif os.path.exists(options.mapfile) and os.path.exists(options.efifile):
|
||||||
list = parsePcdInfoFromMapFile(options.mapfile, options.efifile)
|
list = parsePcdInfoFromMapFile(options.mapfile, options.efifile)
|
||||||
if list != None:
|
if list != None:
|
||||||
if options.outfile != None:
|
if options.outfile != None:
|
||||||
generatePcdTable(list, options.outfile)
|
generatePcdTable(list, options.outfile)
|
||||||
else:
|
else:
|
||||||
generatePcdTable(list, options.mapfile.replace('.map', '.BinaryPcdTable.txt'))
|
generatePcdTable(list, options.mapfile.replace('.map', '.BinaryPcdTable.txt'))
|
||||||
else:
|
else:
|
||||||
print 'Fail to generate Patch PCD Table based on map file and efi file'
|
print 'Fail to generate Patch PCD Table based on map file and efi file'
|
||||||
else:
|
else:
|
||||||
print 'Fail to generate Patch PCD Table for fail to find map file or efi file!'
|
print 'Fail to generate Patch PCD Table for fail to find map file or efi file!'
|
||||||
|
@@ -1,290 +1,290 @@
|
|||||||
## @file
|
## @file
|
||||||
# Patch value into the binary file.
|
# Patch value into the binary file.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from optparse import make_option
|
from optparse import make_option
|
||||||
from Common.BuildToolError import *
|
from Common.BuildToolError import *
|
||||||
import Common.EdkLogger as EdkLogger
|
import Common.EdkLogger as EdkLogger
|
||||||
from Common.BuildVersion import gBUILD_VERSION
|
from Common.BuildVersion import gBUILD_VERSION
|
||||||
import array
|
import array
|
||||||
|
|
||||||
# Version and Copyright
|
# Version and Copyright
|
||||||
__version_number__ = ("0.10" + " " + gBUILD_VERSION)
|
__version_number__ = ("0.10" + " " + gBUILD_VERSION)
|
||||||
__version__ = "%prog Version " + __version_number__
|
__version__ = "%prog Version " + __version_number__
|
||||||
__copyright__ = "Copyright (c) 2010, Intel Corporation. All rights reserved."
|
__copyright__ = "Copyright (c) 2010, Intel Corporation. All rights reserved."
|
||||||
|
|
||||||
## PatchBinaryFile method
|
## PatchBinaryFile method
|
||||||
#
|
#
|
||||||
# This method mainly patches the data into binary file.
|
# This method mainly patches the data into binary file.
|
||||||
#
|
#
|
||||||
# @param FileName File path of the binary file
|
# @param FileName File path of the binary file
|
||||||
# @param ValueOffset Offset value
|
# @param ValueOffset Offset value
|
||||||
# @param TypeName DataType Name
|
# @param TypeName DataType Name
|
||||||
# @param Value Value String
|
# @param Value Value String
|
||||||
# @param MaxSize MaxSize value
|
# @param MaxSize MaxSize value
|
||||||
#
|
#
|
||||||
# @retval 0 File is updated successfully.
|
# @retval 0 File is updated successfully.
|
||||||
# @retval not 0 File is updated failed.
|
# @retval not 0 File is updated failed.
|
||||||
#
|
#
|
||||||
def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||||
#
|
#
|
||||||
# Length of Binary File
|
# Length of Binary File
|
||||||
#
|
#
|
||||||
FileHandle = open (FileName, 'rb')
|
FileHandle = open (FileName, 'rb')
|
||||||
FileHandle.seek (0, 2)
|
FileHandle.seek (0, 2)
|
||||||
FileLength = FileHandle.tell()
|
FileLength = FileHandle.tell()
|
||||||
FileHandle.close()
|
FileHandle.close()
|
||||||
#
|
#
|
||||||
# Unify string to upper string
|
# Unify string to upper string
|
||||||
#
|
#
|
||||||
TypeName = TypeName.upper()
|
TypeName = TypeName.upper()
|
||||||
#
|
#
|
||||||
# Get PCD value data length
|
# Get PCD value data length
|
||||||
#
|
#
|
||||||
ValueLength = 0
|
ValueLength = 0
|
||||||
if TypeName == 'BOOLEAN':
|
if TypeName == 'BOOLEAN':
|
||||||
ValueLength = 1
|
ValueLength = 1
|
||||||
elif TypeName == 'UINT8':
|
elif TypeName == 'UINT8':
|
||||||
ValueLength = 1
|
ValueLength = 1
|
||||||
elif TypeName == 'UINT16':
|
elif TypeName == 'UINT16':
|
||||||
ValueLength = 2
|
ValueLength = 2
|
||||||
elif TypeName == 'UINT32':
|
elif TypeName == 'UINT32':
|
||||||
ValueLength = 4
|
ValueLength = 4
|
||||||
elif TypeName == 'UINT64':
|
elif TypeName == 'UINT64':
|
||||||
ValueLength = 8
|
ValueLength = 8
|
||||||
elif TypeName == 'VOID*':
|
elif TypeName == 'VOID*':
|
||||||
if MaxSize == 0:
|
if MaxSize == 0:
|
||||||
return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD."
|
return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD."
|
||||||
ValueLength = int(MaxSize)
|
ValueLength = int(MaxSize)
|
||||||
else:
|
else:
|
||||||
return PARAMETER_INVALID, "PCD type %s is not valid." %(CommandOptions.PcdTypeName)
|
return PARAMETER_INVALID, "PCD type %s is not valid." %(CommandOptions.PcdTypeName)
|
||||||
#
|
#
|
||||||
# Check PcdValue is in the input binary file.
|
# Check PcdValue is in the input binary file.
|
||||||
#
|
#
|
||||||
if ValueOffset + ValueLength > FileLength:
|
if ValueOffset + ValueLength > FileLength:
|
||||||
return PARAMETER_INVALID, "PcdOffset + PcdMaxSize(DataType) is larger than the input file size."
|
return PARAMETER_INVALID, "PcdOffset + PcdMaxSize(DataType) is larger than the input file size."
|
||||||
#
|
#
|
||||||
# Read binary file into array
|
# Read binary file into array
|
||||||
#
|
#
|
||||||
FileHandle = open (FileName, 'rb')
|
FileHandle = open (FileName, 'rb')
|
||||||
ByteArray = array.array('B')
|
ByteArray = array.array('B')
|
||||||
ByteArray.fromfile(FileHandle, FileLength)
|
ByteArray.fromfile(FileHandle, FileLength)
|
||||||
FileHandle.close()
|
FileHandle.close()
|
||||||
OrigByteList = ByteArray.tolist()
|
OrigByteList = ByteArray.tolist()
|
||||||
ByteList = ByteArray.tolist()
|
ByteList = ByteArray.tolist()
|
||||||
#
|
#
|
||||||
# Clear the data in file
|
# Clear the data in file
|
||||||
#
|
#
|
||||||
for Index in range(ValueLength):
|
for Index in range(ValueLength):
|
||||||
ByteList[ValueOffset + Index] = 0
|
ByteList[ValueOffset + Index] = 0
|
||||||
#
|
#
|
||||||
# Patch value into offset
|
# Patch value into offset
|
||||||
#
|
#
|
||||||
SavedStr = ValueString
|
SavedStr = ValueString
|
||||||
ValueString = ValueString.upper()
|
ValueString = ValueString.upper()
|
||||||
ValueNumber = 0
|
ValueNumber = 0
|
||||||
if TypeName == 'BOOLEAN':
|
if TypeName == 'BOOLEAN':
|
||||||
#
|
#
|
||||||
# Get PCD value for BOOLEAN data type
|
# Get PCD value for BOOLEAN data type
|
||||||
#
|
#
|
||||||
try:
|
try:
|
||||||
if ValueString == 'TRUE':
|
if ValueString == 'TRUE':
|
||||||
ValueNumber = 1
|
ValueNumber = 1
|
||||||
elif ValueString == 'FALSE':
|
elif ValueString == 'FALSE':
|
||||||
ValueNumber = 0
|
ValueNumber = 0
|
||||||
elif ValueString.startswith('0X'):
|
elif ValueString.startswith('0X'):
|
||||||
ValueNumber = int (ValueString, 16)
|
ValueNumber = int (ValueString, 16)
|
||||||
else:
|
else:
|
||||||
ValueNumber = int (ValueString)
|
ValueNumber = int (ValueString)
|
||||||
if ValueNumber != 0:
|
if ValueNumber != 0:
|
||||||
ValueNumber = 1
|
ValueNumber = 1
|
||||||
except:
|
except:
|
||||||
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString)
|
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString)
|
||||||
#
|
#
|
||||||
# Set PCD value into binary data
|
# Set PCD value into binary data
|
||||||
#
|
#
|
||||||
ByteList[ValueOffset] = ValueNumber
|
ByteList[ValueOffset] = ValueNumber
|
||||||
elif TypeName in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:
|
elif TypeName in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:
|
||||||
#
|
#
|
||||||
# Get PCD value for UINT* data type
|
# Get PCD value for UINT* data type
|
||||||
#
|
#
|
||||||
try:
|
try:
|
||||||
if ValueString.startswith('0X'):
|
if ValueString.startswith('0X'):
|
||||||
ValueNumber = int (ValueString, 16)
|
ValueNumber = int (ValueString, 16)
|
||||||
else:
|
else:
|
||||||
ValueNumber = int (ValueString)
|
ValueNumber = int (ValueString)
|
||||||
except:
|
except:
|
||||||
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString)
|
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString)
|
||||||
#
|
#
|
||||||
# Set PCD value into binary data
|
# Set PCD value into binary data
|
||||||
#
|
#
|
||||||
for Index in range(ValueLength):
|
for Index in range(ValueLength):
|
||||||
ByteList[ValueOffset + Index] = ValueNumber % 0x100
|
ByteList[ValueOffset + Index] = ValueNumber % 0x100
|
||||||
ValueNumber = ValueNumber / 0x100
|
ValueNumber = ValueNumber / 0x100
|
||||||
elif TypeName == 'VOID*':
|
elif TypeName == 'VOID*':
|
||||||
ValueString = SavedStr
|
ValueString = SavedStr
|
||||||
if ValueString.startswith('L"'):
|
if ValueString.startswith('L"'):
|
||||||
#
|
#
|
||||||
# Patch Unicode String
|
# Patch Unicode String
|
||||||
#
|
#
|
||||||
Index = 0
|
Index = 0
|
||||||
for ByteString in ValueString[2:-1]:
|
for ByteString in ValueString[2:-1]:
|
||||||
#
|
#
|
||||||
# Reserve zero as unicode tail
|
# Reserve zero as unicode tail
|
||||||
#
|
#
|
||||||
if Index + 2 >= ValueLength:
|
if Index + 2 >= ValueLength:
|
||||||
break
|
break
|
||||||
#
|
#
|
||||||
# Set string value one by one
|
# Set string value one by one
|
||||||
#
|
#
|
||||||
ByteList[ValueOffset + Index] = ord(ByteString)
|
ByteList[ValueOffset + Index] = ord(ByteString)
|
||||||
Index = Index + 2
|
Index = Index + 2
|
||||||
elif ValueString.startswith("{") and ValueString.endswith("}"):
|
elif ValueString.startswith("{") and ValueString.endswith("}"):
|
||||||
#
|
#
|
||||||
# Patch {0x1, 0x2, ...} byte by byte
|
# Patch {0x1, 0x2, ...} byte by byte
|
||||||
#
|
#
|
||||||
ValueList = ValueString[1 : len(ValueString) - 1].split(', ')
|
ValueList = ValueString[1 : len(ValueString) - 1].split(', ')
|
||||||
Index = 0
|
Index = 0
|
||||||
try:
|
try:
|
||||||
for ByteString in ValueList:
|
for ByteString in ValueList:
|
||||||
if ByteString.upper().startswith('0X'):
|
if ByteString.upper().startswith('0X'):
|
||||||
ByteValue = int(ByteString, 16)
|
ByteValue = int(ByteString, 16)
|
||||||
else:
|
else:
|
||||||
ByteValue = int(ByteString)
|
ByteValue = int(ByteString)
|
||||||
ByteList[ValueOffset + Index] = ByteValue % 0x100
|
ByteList[ValueOffset + Index] = ByteValue % 0x100
|
||||||
Index = Index + 1
|
Index = Index + 1
|
||||||
if Index >= ValueLength:
|
if Index >= ValueLength:
|
||||||
break
|
break
|
||||||
except:
|
except:
|
||||||
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string array." %(ValueString)
|
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string array." %(ValueString)
|
||||||
else:
|
else:
|
||||||
#
|
#
|
||||||
# Patch ascii string
|
# Patch ascii string
|
||||||
#
|
#
|
||||||
Index = 0
|
Index = 0
|
||||||
for ByteString in ValueString[1:-1]:
|
for ByteString in ValueString[1:-1]:
|
||||||
#
|
#
|
||||||
# Reserve zero as string tail
|
# Reserve zero as string tail
|
||||||
#
|
#
|
||||||
if Index + 1 >= ValueLength:
|
if Index + 1 >= ValueLength:
|
||||||
break
|
break
|
||||||
#
|
#
|
||||||
# Set string value one by one
|
# Set string value one by one
|
||||||
#
|
#
|
||||||
ByteList[ValueOffset + Index] = ord(ByteString)
|
ByteList[ValueOffset + Index] = ord(ByteString)
|
||||||
Index = Index + 1
|
Index = Index + 1
|
||||||
#
|
#
|
||||||
# Update new data into input file.
|
# Update new data into input file.
|
||||||
#
|
#
|
||||||
if ByteList != OrigByteList:
|
if ByteList != OrigByteList:
|
||||||
ByteArray = array.array('B')
|
ByteArray = array.array('B')
|
||||||
ByteArray.fromlist(ByteList)
|
ByteArray.fromlist(ByteList)
|
||||||
FileHandle = open (FileName, 'wb')
|
FileHandle = open (FileName, 'wb')
|
||||||
ByteArray.tofile(FileHandle)
|
ByteArray.tofile(FileHandle)
|
||||||
FileHandle.close()
|
FileHandle.close()
|
||||||
return 0, "Patch Value into File %s successfully." %(FileName)
|
return 0, "Patch Value into File %s successfully." %(FileName)
|
||||||
|
|
||||||
## Parse command line options
|
## Parse command line options
|
||||||
#
|
#
|
||||||
# Using standard Python module optparse to parse command line option of this tool.
|
# Using standard Python module optparse to parse command line option of this tool.
|
||||||
#
|
#
|
||||||
# @retval Options A optparse.Values object containing the parsed options
|
# @retval Options A optparse.Values object containing the parsed options
|
||||||
# @retval InputFile Path of file to be trimmed
|
# @retval InputFile Path of file to be trimmed
|
||||||
#
|
#
|
||||||
def Options():
|
def Options():
|
||||||
OptionList = [
|
OptionList = [
|
||||||
make_option("-f", "--offset", dest="PcdOffset", action="store", type="int",
|
make_option("-f", "--offset", dest="PcdOffset", action="store", type="int",
|
||||||
help="Start offset to the image is used to store PCD value."),
|
help="Start offset to the image is used to store PCD value."),
|
||||||
make_option("-u", "--value", dest="PcdValue", action="store",
|
make_option("-u", "--value", dest="PcdValue", action="store",
|
||||||
help="PCD value will be updated into the image."),
|
help="PCD value will be updated into the image."),
|
||||||
make_option("-t", "--type", dest="PcdTypeName", action="store",
|
make_option("-t", "--type", dest="PcdTypeName", action="store",
|
||||||
help="The name of PCD data type may be one of VOID*,BOOLEAN, UINT8, UINT16, UINT32, UINT64."),
|
help="The name of PCD data type may be one of VOID*,BOOLEAN, UINT8, UINT16, UINT32, UINT64."),
|
||||||
make_option("-s", "--maxsize", dest="PcdMaxSize", action="store", type="int",
|
make_option("-s", "--maxsize", dest="PcdMaxSize", action="store", type="int",
|
||||||
help="Max size of data buffer is taken by PCD value.It must be set when PCD type is VOID*."),
|
help="Max size of data buffer is taken by PCD value.It must be set when PCD type is VOID*."),
|
||||||
make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE,
|
make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE,
|
||||||
help="Run verbosely"),
|
help="Run verbosely"),
|
||||||
make_option("-d", "--debug", dest="LogLevel", type="int",
|
make_option("-d", "--debug", dest="LogLevel", type="int",
|
||||||
help="Run with debug information"),
|
help="Run with debug information"),
|
||||||
make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET,
|
make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET,
|
||||||
help="Run quietly"),
|
help="Run quietly"),
|
||||||
make_option("-?", action="help", help="show this help message and exit"),
|
make_option("-?", action="help", help="show this help message and exit"),
|
||||||
]
|
]
|
||||||
|
|
||||||
# use clearer usage to override default usage message
|
# use clearer usage to override default usage message
|
||||||
UsageString = "%prog -f Offset -u Value -t Type [-s MaxSize] <input_file>"
|
UsageString = "%prog -f Offset -u Value -t Type [-s MaxSize] <input_file>"
|
||||||
|
|
||||||
Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString)
|
Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString)
|
||||||
Parser.set_defaults(LogLevel=EdkLogger.INFO)
|
Parser.set_defaults(LogLevel=EdkLogger.INFO)
|
||||||
|
|
||||||
Options, Args = Parser.parse_args()
|
Options, Args = Parser.parse_args()
|
||||||
|
|
||||||
# error check
|
# error check
|
||||||
if len(Args) == 0:
|
if len(Args) == 0:
|
||||||
EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData=Parser.get_usage())
|
EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData=Parser.get_usage())
|
||||||
|
|
||||||
InputFile = Args[len(Args) - 1]
|
InputFile = Args[len(Args) - 1]
|
||||||
return Options, InputFile
|
return Options, InputFile
|
||||||
|
|
||||||
## Entrance method
|
## Entrance method
|
||||||
#
|
#
|
||||||
# This method mainly dispatch specific methods per the command line options.
|
# This method mainly dispatch specific methods per the command line options.
|
||||||
# If no error found, return zero value so the caller of this tool can know
|
# If no error found, return zero value so the caller of this tool can know
|
||||||
# if it's executed successfully or not.
|
# if it's executed successfully or not.
|
||||||
#
|
#
|
||||||
# @retval 0 Tool was successful
|
# @retval 0 Tool was successful
|
||||||
# @retval 1 Tool failed
|
# @retval 1 Tool failed
|
||||||
#
|
#
|
||||||
def Main():
|
def Main():
|
||||||
try:
|
try:
|
||||||
#
|
#
|
||||||
# Check input parameter
|
# Check input parameter
|
||||||
#
|
#
|
||||||
EdkLogger.Initialize()
|
EdkLogger.Initialize()
|
||||||
CommandOptions, InputFile = Options()
|
CommandOptions, InputFile = Options()
|
||||||
if CommandOptions.LogLevel < EdkLogger.DEBUG_9:
|
if CommandOptions.LogLevel < EdkLogger.DEBUG_9:
|
||||||
EdkLogger.SetLevel(CommandOptions.LogLevel + 1)
|
EdkLogger.SetLevel(CommandOptions.LogLevel + 1)
|
||||||
else:
|
else:
|
||||||
EdkLogger.SetLevel(CommandOptions.LogLevel)
|
EdkLogger.SetLevel(CommandOptions.LogLevel)
|
||||||
if not os.path.exists (InputFile):
|
if not os.path.exists (InputFile):
|
||||||
EdkLogger.error("PatchPcdValue", FILE_NOT_FOUND, ExtraData=InputFile)
|
EdkLogger.error("PatchPcdValue", FILE_NOT_FOUND, ExtraData=InputFile)
|
||||||
return 1
|
return 1
|
||||||
if CommandOptions.PcdOffset == None or CommandOptions.PcdValue == None or CommandOptions.PcdTypeName == None:
|
if CommandOptions.PcdOffset == None or CommandOptions.PcdValue == None or CommandOptions.PcdTypeName == None:
|
||||||
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdOffset or PcdValue of PcdTypeName is not specified.")
|
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdOffset or PcdValue of PcdTypeName is not specified.")
|
||||||
return 1
|
return 1
|
||||||
if CommandOptions.PcdTypeName.upper() not in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64", "VOID*"]:
|
if CommandOptions.PcdTypeName.upper() not in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64", "VOID*"]:
|
||||||
EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." %(CommandOptions.PcdTypeName))
|
EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." %(CommandOptions.PcdTypeName))
|
||||||
return 1
|
return 1
|
||||||
if CommandOptions.PcdTypeName.upper() == "VOID*" and CommandOptions.PcdMaxSize == None:
|
if CommandOptions.PcdTypeName.upper() == "VOID*" and CommandOptions.PcdMaxSize == None:
|
||||||
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdMaxSize is not specified for VOID* type PCD.")
|
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdMaxSize is not specified for VOID* type PCD.")
|
||||||
return 1
|
return 1
|
||||||
#
|
#
|
||||||
# Patch value into binary image.
|
# Patch value into binary image.
|
||||||
#
|
#
|
||||||
ReturnValue, ErrorInfo = PatchBinaryFile (InputFile, CommandOptions.PcdOffset, CommandOptions.PcdTypeName, CommandOptions.PcdValue, CommandOptions.PcdMaxSize)
|
ReturnValue, ErrorInfo = PatchBinaryFile (InputFile, CommandOptions.PcdOffset, CommandOptions.PcdTypeName, CommandOptions.PcdValue, CommandOptions.PcdMaxSize)
|
||||||
if ReturnValue != 0:
|
if ReturnValue != 0:
|
||||||
EdkLogger.error("PatchPcdValue", ReturnValue, ExtraData=ErrorInfo)
|
EdkLogger.error("PatchPcdValue", ReturnValue, ExtraData=ErrorInfo)
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
except:
|
except:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
r = Main()
|
r = Main()
|
||||||
sys.exit(r)
|
sys.exit(r)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -17,4 +17,4 @@
|
|||||||
Build version information
|
Build version information
|
||||||
'''
|
'''
|
||||||
|
|
||||||
gBUILD_VERSION = "Build 2640"
|
gBUILD_VERSION = "Build 2649"
|
||||||
|
@@ -1,20 +1,20 @@
|
|||||||
## @file
|
## @file
|
||||||
# Python 'Library' package initialization file.
|
# Python 'Library' package initialization file.
|
||||||
#
|
#
|
||||||
# This file is required to make Python interpreter treat the directory
|
# This file is required to make Python interpreter treat the directory
|
||||||
# as containing package.
|
# as containing package.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available
|
# This program and the accompanying materials are licensed and made available
|
||||||
# under the terms and conditions of the BSD License which accompanies this
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
# distribution. The full text of the license may be found at
|
# distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Core init file
|
Core init file
|
||||||
'''
|
'''
|
@@ -1,20 +1,20 @@
|
|||||||
## @file
|
## @file
|
||||||
# Python 'Library' package initialization file.
|
# Python 'Library' package initialization file.
|
||||||
#
|
#
|
||||||
# This file is required to make Python interpreter treat the directory
|
# This file is required to make Python interpreter treat the directory
|
||||||
# as containing package.
|
# as containing package.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available
|
# This program and the accompanying materials are licensed and made available
|
||||||
# under the terms and conditions of the BSD License which accompanies this
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
# distribution. The full text of the license may be found at
|
# distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
'''
|
'''
|
||||||
GenMetaFile
|
GenMetaFile
|
||||||
'''
|
'''
|
@@ -93,7 +93,7 @@ class _ExprBase:
|
|||||||
|
|
||||||
## IsCurrentOp
|
## IsCurrentOp
|
||||||
#
|
#
|
||||||
# @param OpList: option list
|
# @param OpList: option list
|
||||||
#
|
#
|
||||||
def IsCurrentOp(self, OpList):
|
def IsCurrentOp(self, OpList):
|
||||||
self.SkipWhitespace()
|
self.SkipWhitespace()
|
||||||
|
@@ -1,99 +1,99 @@
|
|||||||
## @file
|
## @file
|
||||||
# This file is used to define common static strings and global data used by UPT
|
# This file is used to define common static strings and global data used by UPT
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available
|
# This program and the accompanying materials are licensed and made available
|
||||||
# under the terms and conditions of the BSD License which accompanies this
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
# distribution. The full text of the license may be found at
|
# distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
GlobalData
|
GlobalData
|
||||||
'''
|
'''
|
||||||
|
|
||||||
#
|
#
|
||||||
# The workspace directory
|
# The workspace directory
|
||||||
#
|
#
|
||||||
gWORKSPACE = '.'
|
gWORKSPACE = '.'
|
||||||
|
|
||||||
#
|
#
|
||||||
# INF module directory
|
# INF module directory
|
||||||
#
|
#
|
||||||
gINF_MODULE_DIR = "."
|
gINF_MODULE_DIR = "."
|
||||||
gINF_MODULE_NAME = ''
|
gINF_MODULE_NAME = ''
|
||||||
|
|
||||||
#
|
#
|
||||||
# the directory to holds upt related files
|
# the directory to holds upt related files
|
||||||
#
|
#
|
||||||
gUPT_DIR = r"Conf/upt/"
|
gUPT_DIR = r"Conf/upt/"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Log file for invalid meta-data files during force removing
|
# Log file for invalid meta-data files during force removing
|
||||||
#
|
#
|
||||||
gINVALID_MODULE_FILE = gUPT_DIR + r"Invalid_Modules.log"
|
gINVALID_MODULE_FILE = gUPT_DIR + r"Invalid_Modules.log"
|
||||||
|
|
||||||
#
|
#
|
||||||
# File name for content zip file in the distribution
|
# File name for content zip file in the distribution
|
||||||
#
|
#
|
||||||
gCONTENT_FILE = "dist.content"
|
gCONTENT_FILE = "dist.content"
|
||||||
|
|
||||||
#
|
#
|
||||||
# File name for XML file in the distibution
|
# File name for XML file in the distibution
|
||||||
#
|
#
|
||||||
gDESC_FILE = 'dist.pkg'
|
gDESC_FILE = 'dist.pkg'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Case Insensitive flag
|
# Case Insensitive flag
|
||||||
#
|
#
|
||||||
gCASE_INSENSITIVE = ''
|
gCASE_INSENSITIVE = ''
|
||||||
|
|
||||||
#
|
#
|
||||||
# All Files dictionary
|
# All Files dictionary
|
||||||
#
|
#
|
||||||
gALL_FILES = {}
|
gALL_FILES = {}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Database instance
|
# Database instance
|
||||||
#
|
#
|
||||||
gDB = None
|
gDB = None
|
||||||
|
|
||||||
#
|
#
|
||||||
# list for files that are found in module level but not in INF files,
|
# list for files that are found in module level but not in INF files,
|
||||||
# items are (File, ModulePath), all these should be relative to $(WORKSPACE)
|
# items are (File, ModulePath), all these should be relative to $(WORKSPACE)
|
||||||
#
|
#
|
||||||
gMISS_FILE_IN_MODLIST = []
|
gMISS_FILE_IN_MODLIST = []
|
||||||
|
|
||||||
#
|
#
|
||||||
# Global Current Line
|
# Global Current Line
|
||||||
#
|
#
|
||||||
gINF_CURRENT_LINE = None
|
gINF_CURRENT_LINE = None
|
||||||
|
|
||||||
#
|
#
|
||||||
# Global pkg list
|
# Global pkg list
|
||||||
#
|
#
|
||||||
gWSPKG_LIST = []
|
gWSPKG_LIST = []
|
||||||
|
|
||||||
#
|
#
|
||||||
# Flag used to take WARN as ERROR.
|
# Flag used to take WARN as ERROR.
|
||||||
# By default, only ERROR message will break the tools execution.
|
# By default, only ERROR message will break the tools execution.
|
||||||
#
|
#
|
||||||
gWARNING_AS_ERROR = False
|
gWARNING_AS_ERROR = False
|
||||||
|
|
||||||
#
|
#
|
||||||
# Used to specify the temp directory to hold the unpacked distribution files
|
# Used to specify the temp directory to hold the unpacked distribution files
|
||||||
#
|
#
|
||||||
gUNPACK_DIR = None
|
gUNPACK_DIR = None
|
||||||
|
|
||||||
#
|
#
|
||||||
# Flag used to mark whether the INF file is Binary INF or not.
|
# Flag used to mark whether the INF file is Binary INF or not.
|
||||||
#
|
#
|
||||||
gIS_BINARY_INF = False
|
gIS_BINARY_INF = False
|
||||||
#
|
#
|
||||||
# Used by Library instance parser
|
# Used by Library instance parser
|
||||||
# {FilePath: FileObj}
|
# {FilePath: FileObj}
|
||||||
#
|
#
|
||||||
gLIBINSTANCEDICT = {}
|
gLIBINSTANCEDICT = {}
|
File diff suppressed because it is too large
Load Diff
@@ -1,20 +1,20 @@
|
|||||||
## @file
|
## @file
|
||||||
# Python 'Library' package initialization file.
|
# Python 'Library' package initialization file.
|
||||||
#
|
#
|
||||||
# This file is required to make Python interpreter treat the directory
|
# This file is required to make Python interpreter treat the directory
|
||||||
# as containing package.
|
# as containing package.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available
|
# This program and the accompanying materials are licensed and made available
|
||||||
# under the terms and conditions of the BSD License which accompanies this
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
# distribution. The full text of the license may be found at
|
# distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Xml
|
Xml
|
||||||
'''
|
'''
|
@@ -1,20 +1,20 @@
|
|||||||
## @file
|
## @file
|
||||||
# Python 'Library' package initialization file.
|
# Python 'Library' package initialization file.
|
||||||
#
|
#
|
||||||
# This file is required to make Python interpreter treat the directory
|
# This file is required to make Python interpreter treat the directory
|
||||||
# as containing package.
|
# as containing package.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available
|
# This program and the accompanying materials are licensed and made available
|
||||||
# under the terms and conditions of the BSD License which accompanies this
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
# distribution. The full text of the license may be found at
|
# distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Library
|
Library
|
||||||
'''
|
'''
|
@@ -1,325 +1,325 @@
|
|||||||
## @file
|
## @file
|
||||||
# This file implements the log mechanism for Python tools.
|
# This file implements the log mechanism for Python tools.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available
|
# This program and the accompanying materials are licensed and made available
|
||||||
# under the terms and conditions of the BSD License which accompanies this
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
# distribution. The full text of the license may be found at
|
# distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Logger
|
Logger
|
||||||
'''
|
'''
|
||||||
|
|
||||||
## Import modules
|
## Import modules
|
||||||
from sys import argv
|
from sys import argv
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
from sys import stderr
|
from sys import stderr
|
||||||
import os.path
|
import os.path
|
||||||
from os import remove
|
from os import remove
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from logging import Formatter
|
from logging import Formatter
|
||||||
from logging import StreamHandler
|
from logging import StreamHandler
|
||||||
from logging import FileHandler
|
from logging import FileHandler
|
||||||
from traceback import extract_stack
|
from traceback import extract_stack
|
||||||
|
|
||||||
from Logger.ToolError import FatalError
|
from Logger.ToolError import FatalError
|
||||||
from Logger.ToolError import WARNING_AS_ERROR
|
from Logger.ToolError import WARNING_AS_ERROR
|
||||||
from Logger.ToolError import gERROR_MESSAGE
|
from Logger.ToolError import gERROR_MESSAGE
|
||||||
from Logger.ToolError import UNKNOWN_ERROR
|
from Logger.ToolError import UNKNOWN_ERROR
|
||||||
from Library import GlobalData
|
from Library import GlobalData
|
||||||
|
|
||||||
#
|
#
|
||||||
# Log level constants
|
# Log level constants
|
||||||
#
|
#
|
||||||
DEBUG_0 = 1
|
DEBUG_0 = 1
|
||||||
DEBUG_1 = 2
|
DEBUG_1 = 2
|
||||||
DEBUG_2 = 3
|
DEBUG_2 = 3
|
||||||
DEBUG_3 = 4
|
DEBUG_3 = 4
|
||||||
DEBUG_4 = 5
|
DEBUG_4 = 5
|
||||||
DEBUG_5 = 6
|
DEBUG_5 = 6
|
||||||
DEBUG_6 = 7
|
DEBUG_6 = 7
|
||||||
DEBUG_7 = 8
|
DEBUG_7 = 8
|
||||||
DEBUG_8 = 9
|
DEBUG_8 = 9
|
||||||
DEBUG_9 = 10
|
DEBUG_9 = 10
|
||||||
VERBOSE = 15
|
VERBOSE = 15
|
||||||
INFO = 20
|
INFO = 20
|
||||||
WARN = 30
|
WARN = 30
|
||||||
QUIET = 40
|
QUIET = 40
|
||||||
QUIET_1 = 41
|
QUIET_1 = 41
|
||||||
ERROR = 50
|
ERROR = 50
|
||||||
SILENT = 60
|
SILENT = 60
|
||||||
|
|
||||||
IS_RAISE_ERROR = True
|
IS_RAISE_ERROR = True
|
||||||
SUPRESS_ERROR = False
|
SUPRESS_ERROR = False
|
||||||
|
|
||||||
#
|
#
|
||||||
# Tool name
|
# Tool name
|
||||||
#
|
#
|
||||||
_TOOL_NAME = os.path.basename(argv[0])
|
_TOOL_NAME = os.path.basename(argv[0])
|
||||||
#
|
#
|
||||||
# For validation purpose
|
# For validation purpose
|
||||||
#
|
#
|
||||||
_LOG_LEVELS = [DEBUG_0, DEBUG_1, DEBUG_2, DEBUG_3, DEBUG_4, DEBUG_5, DEBUG_6, \
|
_LOG_LEVELS = [DEBUG_0, DEBUG_1, DEBUG_2, DEBUG_3, DEBUG_4, DEBUG_5, DEBUG_6, \
|
||||||
DEBUG_7, DEBUG_8, DEBUG_9, VERBOSE, WARN, INFO, ERROR, QUIET, \
|
DEBUG_7, DEBUG_8, DEBUG_9, VERBOSE, WARN, INFO, ERROR, QUIET, \
|
||||||
QUIET_1, SILENT]
|
QUIET_1, SILENT]
|
||||||
#
|
#
|
||||||
# For DEBUG level (All DEBUG_0~9 are applicable)
|
# For DEBUG level (All DEBUG_0~9 are applicable)
|
||||||
#
|
#
|
||||||
_DEBUG_LOGGER = getLogger("tool_debug")
|
_DEBUG_LOGGER = getLogger("tool_debug")
|
||||||
_DEBUG_FORMATTER = Formatter("[%(asctime)s.%(msecs)d]: %(message)s", \
|
_DEBUG_FORMATTER = Formatter("[%(asctime)s.%(msecs)d]: %(message)s", \
|
||||||
datefmt="%H:%M:%S")
|
datefmt="%H:%M:%S")
|
||||||
#
|
#
|
||||||
# For VERBOSE, INFO, WARN level
|
# For VERBOSE, INFO, WARN level
|
||||||
#
|
#
|
||||||
_INFO_LOGGER = getLogger("tool_info")
|
_INFO_LOGGER = getLogger("tool_info")
|
||||||
_INFO_FORMATTER = Formatter("%(message)s")
|
_INFO_FORMATTER = Formatter("%(message)s")
|
||||||
#
|
#
|
||||||
# For ERROR level
|
# For ERROR level
|
||||||
#
|
#
|
||||||
_ERROR_LOGGER = getLogger("tool_error")
|
_ERROR_LOGGER = getLogger("tool_error")
|
||||||
_ERROR_FORMATTER = Formatter("%(message)s")
|
_ERROR_FORMATTER = Formatter("%(message)s")
|
||||||
|
|
||||||
#
|
#
|
||||||
# String templates for ERROR/WARN/DEBUG log message
|
# String templates for ERROR/WARN/DEBUG log message
|
||||||
#
|
#
|
||||||
_ERROR_MESSAGE_TEMPLATE = \
|
_ERROR_MESSAGE_TEMPLATE = \
|
||||||
('\n\n%(tool)s...\n%(file)s(%(line)s): error %(errorcode)04X: %(msg)s\n\t%(extra)s')
|
('\n\n%(tool)s...\n%(file)s(%(line)s): error %(errorcode)04X: %(msg)s\n\t%(extra)s')
|
||||||
|
|
||||||
__ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE = \
|
__ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE = \
|
||||||
'\n\n%(tool)s...\n : error %(errorcode)04X: %(msg)s\n\t%(extra)s'
|
'\n\n%(tool)s...\n : error %(errorcode)04X: %(msg)s\n\t%(extra)s'
|
||||||
|
|
||||||
_WARNING_MESSAGE_TEMPLATE = '%(tool)s...\n%(file)s(%(line)s): warning: %(msg)s'
|
_WARNING_MESSAGE_TEMPLATE = '%(tool)s...\n%(file)s(%(line)s): warning: %(msg)s'
|
||||||
_WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE = '%(tool)s: : warning: %(msg)s'
|
_WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE = '%(tool)s: : warning: %(msg)s'
|
||||||
_DEBUG_MESSAGE_TEMPLATE = '%(file)s(%(line)s): debug: \n %(msg)s'
|
_DEBUG_MESSAGE_TEMPLATE = '%(file)s(%(line)s): debug: \n %(msg)s'
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Log INFO message
|
# Log INFO message
|
||||||
#
|
#
|
||||||
#Info = _INFO_LOGGER.info
|
#Info = _INFO_LOGGER.info
|
||||||
|
|
||||||
def Info(msg, *args, **kwargs):
|
def Info(msg, *args, **kwargs):
|
||||||
_INFO_LOGGER.info(msg, *args, **kwargs)
|
_INFO_LOGGER.info(msg, *args, **kwargs)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Log information which should be always put out
|
# Log information which should be always put out
|
||||||
#
|
#
|
||||||
def Quiet(msg, *args, **kwargs):
|
def Quiet(msg, *args, **kwargs):
|
||||||
_ERROR_LOGGER.error(msg, *args, **kwargs)
|
_ERROR_LOGGER.error(msg, *args, **kwargs)
|
||||||
|
|
||||||
## Log debug message
|
## Log debug message
|
||||||
#
|
#
|
||||||
# @param Level DEBUG level (DEBUG0~9)
|
# @param Level DEBUG level (DEBUG0~9)
|
||||||
# @param Message Debug information
|
# @param Message Debug information
|
||||||
# @param ExtraData More information associated with "Message"
|
# @param ExtraData More information associated with "Message"
|
||||||
#
|
#
|
||||||
def Debug(Level, Message, ExtraData=None):
|
def Debug(Level, Message, ExtraData=None):
|
||||||
if _DEBUG_LOGGER.level > Level:
|
if _DEBUG_LOGGER.level > Level:
|
||||||
return
|
return
|
||||||
if Level > DEBUG_9:
|
if Level > DEBUG_9:
|
||||||
return
|
return
|
||||||
#
|
#
|
||||||
# Find out the caller method information
|
# Find out the caller method information
|
||||||
#
|
#
|
||||||
CallerStack = extract_stack()[-2]
|
CallerStack = extract_stack()[-2]
|
||||||
TemplateDict = {
|
TemplateDict = {
|
||||||
"file" : CallerStack[0],
|
"file" : CallerStack[0],
|
||||||
"line" : CallerStack[1],
|
"line" : CallerStack[1],
|
||||||
"msg" : Message,
|
"msg" : Message,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ExtraData != None:
|
if ExtraData != None:
|
||||||
LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict + "\n %s" % ExtraData
|
LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict + "\n %s" % ExtraData
|
||||||
else:
|
else:
|
||||||
LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict
|
LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict
|
||||||
|
|
||||||
_DEBUG_LOGGER.log(Level, LogText)
|
_DEBUG_LOGGER.log(Level, LogText)
|
||||||
|
|
||||||
## Log verbose message
|
## Log verbose message
|
||||||
#
|
#
|
||||||
# @param Message Verbose information
|
# @param Message Verbose information
|
||||||
#
|
#
|
||||||
def Verbose(Message):
|
def Verbose(Message):
|
||||||
return _INFO_LOGGER.log(VERBOSE, Message)
|
return _INFO_LOGGER.log(VERBOSE, Message)
|
||||||
|
|
||||||
## Log warning message
|
## Log warning message
|
||||||
#
|
#
|
||||||
# Warning messages are those which might be wrong but won't fail the tool.
|
# Warning messages are those which might be wrong but won't fail the tool.
|
||||||
#
|
#
|
||||||
# @param ToolName The name of the tool. If not given, the name of caller
|
# @param ToolName The name of the tool. If not given, the name of caller
|
||||||
# method will be used.
|
# method will be used.
|
||||||
# @param Message Warning information
|
# @param Message Warning information
|
||||||
# @param File The name of file which caused the warning.
|
# @param File The name of file which caused the warning.
|
||||||
# @param Line The line number in the "File" which caused the warning.
|
# @param Line The line number in the "File" which caused the warning.
|
||||||
# @param ExtraData More information associated with "Message"
|
# @param ExtraData More information associated with "Message"
|
||||||
#
|
#
|
||||||
def Warn(ToolName, Message, File=None, Line=None, ExtraData=None):
|
def Warn(ToolName, Message, File=None, Line=None, ExtraData=None):
|
||||||
if _INFO_LOGGER.level > WARN:
|
if _INFO_LOGGER.level > WARN:
|
||||||
return
|
return
|
||||||
#
|
#
|
||||||
# if no tool name given, use caller's source file name as tool name
|
# if no tool name given, use caller's source file name as tool name
|
||||||
#
|
#
|
||||||
if ToolName == None or ToolName == "":
|
if ToolName == None or ToolName == "":
|
||||||
ToolName = os.path.basename(extract_stack()[-2][0])
|
ToolName = os.path.basename(extract_stack()[-2][0])
|
||||||
|
|
||||||
if Line == None:
|
if Line == None:
|
||||||
Line = "..."
|
Line = "..."
|
||||||
else:
|
else:
|
||||||
Line = "%d" % Line
|
Line = "%d" % Line
|
||||||
|
|
||||||
TemplateDict = {
|
TemplateDict = {
|
||||||
"tool" : ToolName,
|
"tool" : ToolName,
|
||||||
"file" : File,
|
"file" : File,
|
||||||
"line" : Line,
|
"line" : Line,
|
||||||
"msg" : Message,
|
"msg" : Message,
|
||||||
}
|
}
|
||||||
|
|
||||||
if File != None:
|
if File != None:
|
||||||
LogText = _WARNING_MESSAGE_TEMPLATE % TemplateDict
|
LogText = _WARNING_MESSAGE_TEMPLATE % TemplateDict
|
||||||
else:
|
else:
|
||||||
LogText = _WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict
|
LogText = _WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict
|
||||||
|
|
||||||
if ExtraData != None:
|
if ExtraData != None:
|
||||||
LogText += "\n %s" % ExtraData
|
LogText += "\n %s" % ExtraData
|
||||||
|
|
||||||
_INFO_LOGGER.log(WARN, LogText)
|
_INFO_LOGGER.log(WARN, LogText)
|
||||||
#
|
#
|
||||||
# Raise an execption if indicated
|
# Raise an execption if indicated
|
||||||
#
|
#
|
||||||
if GlobalData.gWARNING_AS_ERROR == True:
|
if GlobalData.gWARNING_AS_ERROR == True:
|
||||||
raise FatalError(WARNING_AS_ERROR)
|
raise FatalError(WARNING_AS_ERROR)
|
||||||
|
|
||||||
## Log ERROR message
|
## Log ERROR message
|
||||||
#
|
#
|
||||||
# Once an error messages is logged, the tool's execution will be broken by
|
# Once an error messages is logged, the tool's execution will be broken by
|
||||||
# raising an execption. If you don't want to break the execution later, you
|
# raising an execption. If you don't want to break the execution later, you
|
||||||
# can give "RaiseError" with "False" value.
|
# can give "RaiseError" with "False" value.
|
||||||
#
|
#
|
||||||
# @param ToolName The name of the tool. If not given, the name of caller
|
# @param ToolName The name of the tool. If not given, the name of caller
|
||||||
# method will be used.
|
# method will be used.
|
||||||
# @param ErrorCode The error code
|
# @param ErrorCode The error code
|
||||||
# @param Message Warning information
|
# @param Message Warning information
|
||||||
# @param File The name of file which caused the error.
|
# @param File The name of file which caused the error.
|
||||||
# @param Line The line number in the "File" which caused the warning.
|
# @param Line The line number in the "File" which caused the warning.
|
||||||
# @param ExtraData More information associated with "Message"
|
# @param ExtraData More information associated with "Message"
|
||||||
# @param RaiseError Raise an exception to break the tool's executuion if
|
# @param RaiseError Raise an exception to break the tool's executuion if
|
||||||
# it's True. This is the default behavior.
|
# it's True. This is the default behavior.
|
||||||
#
|
#
|
||||||
def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \
|
def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \
|
||||||
ExtraData=None, RaiseError=IS_RAISE_ERROR):
|
ExtraData=None, RaiseError=IS_RAISE_ERROR):
|
||||||
if ToolName:
|
if ToolName:
|
||||||
pass
|
pass
|
||||||
if Line == None:
|
if Line == None:
|
||||||
Line = "..."
|
Line = "..."
|
||||||
else:
|
else:
|
||||||
Line = "%d" % Line
|
Line = "%d" % Line
|
||||||
|
|
||||||
if Message == None:
|
if Message == None:
|
||||||
if ErrorCode in gERROR_MESSAGE:
|
if ErrorCode in gERROR_MESSAGE:
|
||||||
Message = gERROR_MESSAGE[ErrorCode]
|
Message = gERROR_MESSAGE[ErrorCode]
|
||||||
else:
|
else:
|
||||||
Message = gERROR_MESSAGE[UNKNOWN_ERROR]
|
Message = gERROR_MESSAGE[UNKNOWN_ERROR]
|
||||||
|
|
||||||
if ExtraData == None:
|
if ExtraData == None:
|
||||||
ExtraData = ""
|
ExtraData = ""
|
||||||
|
|
||||||
TemplateDict = {
|
TemplateDict = {
|
||||||
"tool" : _TOOL_NAME,
|
"tool" : _TOOL_NAME,
|
||||||
"file" : File,
|
"file" : File,
|
||||||
"line" : Line,
|
"line" : Line,
|
||||||
"errorcode" : ErrorCode,
|
"errorcode" : ErrorCode,
|
||||||
"msg" : Message,
|
"msg" : Message,
|
||||||
"extra" : ExtraData
|
"extra" : ExtraData
|
||||||
}
|
}
|
||||||
|
|
||||||
if File != None:
|
if File != None:
|
||||||
LogText = _ERROR_MESSAGE_TEMPLATE % TemplateDict
|
LogText = _ERROR_MESSAGE_TEMPLATE % TemplateDict
|
||||||
else:
|
else:
|
||||||
LogText = __ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict
|
LogText = __ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict
|
||||||
|
|
||||||
if not SUPRESS_ERROR:
|
if not SUPRESS_ERROR:
|
||||||
_ERROR_LOGGER.log(ERROR, LogText)
|
_ERROR_LOGGER.log(ERROR, LogText)
|
||||||
if RaiseError:
|
if RaiseError:
|
||||||
raise FatalError(ErrorCode)
|
raise FatalError(ErrorCode)
|
||||||
|
|
||||||
|
|
||||||
## Initialize log system
|
## Initialize log system
|
||||||
#
|
#
|
||||||
def Initialize():
|
def Initialize():
|
||||||
#
|
#
|
||||||
# Since we use different format to log different levels of message into
|
# Since we use different format to log different levels of message into
|
||||||
# different place (stdout or stderr), we have to use different "Logger"
|
# different place (stdout or stderr), we have to use different "Logger"
|
||||||
# objects to do this.
|
# objects to do this.
|
||||||
#
|
#
|
||||||
# For DEBUG level (All DEBUG_0~9 are applicable)
|
# For DEBUG level (All DEBUG_0~9 are applicable)
|
||||||
_DEBUG_LOGGER.setLevel(INFO)
|
_DEBUG_LOGGER.setLevel(INFO)
|
||||||
_DebugChannel = StreamHandler(stdout)
|
_DebugChannel = StreamHandler(stdout)
|
||||||
_DebugChannel.setFormatter(_DEBUG_FORMATTER)
|
_DebugChannel.setFormatter(_DEBUG_FORMATTER)
|
||||||
_DEBUG_LOGGER.addHandler(_DebugChannel)
|
_DEBUG_LOGGER.addHandler(_DebugChannel)
|
||||||
#
|
#
|
||||||
# For VERBOSE, INFO, WARN level
|
# For VERBOSE, INFO, WARN level
|
||||||
#
|
#
|
||||||
_INFO_LOGGER.setLevel(INFO)
|
_INFO_LOGGER.setLevel(INFO)
|
||||||
_InfoChannel = StreamHandler(stdout)
|
_InfoChannel = StreamHandler(stdout)
|
||||||
_InfoChannel.setFormatter(_INFO_FORMATTER)
|
_InfoChannel.setFormatter(_INFO_FORMATTER)
|
||||||
_INFO_LOGGER.addHandler(_InfoChannel)
|
_INFO_LOGGER.addHandler(_InfoChannel)
|
||||||
#
|
#
|
||||||
# For ERROR level
|
# For ERROR level
|
||||||
#
|
#
|
||||||
_ERROR_LOGGER.setLevel(INFO)
|
_ERROR_LOGGER.setLevel(INFO)
|
||||||
_ErrorCh = StreamHandler(stderr)
|
_ErrorCh = StreamHandler(stderr)
|
||||||
_ErrorCh.setFormatter(_ERROR_FORMATTER)
|
_ErrorCh.setFormatter(_ERROR_FORMATTER)
|
||||||
_ERROR_LOGGER.addHandler(_ErrorCh)
|
_ERROR_LOGGER.addHandler(_ErrorCh)
|
||||||
|
|
||||||
|
|
||||||
## Set log level
|
## Set log level
|
||||||
#
|
#
|
||||||
# @param Level One of log level in _LogLevel
|
# @param Level One of log level in _LogLevel
|
||||||
#
|
#
|
||||||
def SetLevel(Level):
|
def SetLevel(Level):
|
||||||
if Level not in _LOG_LEVELS:
|
if Level not in _LOG_LEVELS:
|
||||||
Info("Not supported log level (%d). Use default level instead." % \
|
Info("Not supported log level (%d). Use default level instead." % \
|
||||||
Level)
|
Level)
|
||||||
Level = INFO
|
Level = INFO
|
||||||
_DEBUG_LOGGER.setLevel(Level)
|
_DEBUG_LOGGER.setLevel(Level)
|
||||||
_INFO_LOGGER.setLevel(Level)
|
_INFO_LOGGER.setLevel(Level)
|
||||||
_ERROR_LOGGER.setLevel(Level)
|
_ERROR_LOGGER.setLevel(Level)
|
||||||
|
|
||||||
## Get current log level
|
## Get current log level
|
||||||
#
|
#
|
||||||
def GetLevel():
|
def GetLevel():
|
||||||
return _INFO_LOGGER.getEffectiveLevel()
|
return _INFO_LOGGER.getEffectiveLevel()
|
||||||
|
|
||||||
## Raise up warning as error
|
## Raise up warning as error
|
||||||
#
|
#
|
||||||
def SetWarningAsError():
|
def SetWarningAsError():
|
||||||
GlobalData.gWARNING_AS_ERROR = True
|
GlobalData.gWARNING_AS_ERROR = True
|
||||||
|
|
||||||
## Specify a file to store the log message as well as put on console
|
## Specify a file to store the log message as well as put on console
|
||||||
#
|
#
|
||||||
# @param LogFile The file path used to store the log message
|
# @param LogFile The file path used to store the log message
|
||||||
#
|
#
|
||||||
def SetLogFile(LogFile):
|
def SetLogFile(LogFile):
|
||||||
if os.path.exists(LogFile):
|
if os.path.exists(LogFile):
|
||||||
remove(LogFile)
|
remove(LogFile)
|
||||||
|
|
||||||
_Ch = FileHandler(LogFile)
|
_Ch = FileHandler(LogFile)
|
||||||
_Ch.setFormatter(_DEBUG_FORMATTER)
|
_Ch.setFormatter(_DEBUG_FORMATTER)
|
||||||
_DEBUG_LOGGER.addHandler(_Ch)
|
_DEBUG_LOGGER.addHandler(_Ch)
|
||||||
|
|
||||||
_Ch = FileHandler(LogFile)
|
_Ch = FileHandler(LogFile)
|
||||||
_Ch.setFormatter(_INFO_FORMATTER)
|
_Ch.setFormatter(_INFO_FORMATTER)
|
||||||
_INFO_LOGGER.addHandler(_Ch)
|
_INFO_LOGGER.addHandler(_Ch)
|
||||||
|
|
||||||
_Ch = FileHandler(LogFile)
|
_Ch = FileHandler(LogFile)
|
||||||
_Ch.setFormatter(_ERROR_FORMATTER)
|
_Ch.setFormatter(_ERROR_FORMATTER)
|
||||||
_ERROR_LOGGER.addHandler(_Ch)
|
_ERROR_LOGGER.addHandler(_Ch)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,177 +1,177 @@
|
|||||||
## @file
|
## @file
|
||||||
# Standardized Error Hanlding infrastructures.
|
# Standardized Error Hanlding infrastructures.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available
|
# This program and the accompanying materials are licensed and made available
|
||||||
# under the terms and conditions of the BSD License which accompanies this
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
# distribution. The full text of the license may be found at
|
# distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
'''
|
'''
|
||||||
ToolError
|
ToolError
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import Logger.StringTable as ST
|
import Logger.StringTable as ST
|
||||||
|
|
||||||
FILE_OPEN_FAILURE = 1
|
FILE_OPEN_FAILURE = 1
|
||||||
FILE_WRITE_FAILURE = 2
|
FILE_WRITE_FAILURE = 2
|
||||||
FILE_PARSE_FAILURE = 3
|
FILE_PARSE_FAILURE = 3
|
||||||
FILE_READ_FAILURE = 4
|
FILE_READ_FAILURE = 4
|
||||||
FILE_CREATE_FAILURE = 5
|
FILE_CREATE_FAILURE = 5
|
||||||
FILE_CHECKSUM_FAILURE = 6
|
FILE_CHECKSUM_FAILURE = 6
|
||||||
FILE_COMPRESS_FAILURE = 7
|
FILE_COMPRESS_FAILURE = 7
|
||||||
FILE_DECOMPRESS_FAILURE = 8
|
FILE_DECOMPRESS_FAILURE = 8
|
||||||
FILE_MOVE_FAILURE = 9
|
FILE_MOVE_FAILURE = 9
|
||||||
FILE_DELETE_FAILURE = 10
|
FILE_DELETE_FAILURE = 10
|
||||||
FILE_COPY_FAILURE = 11
|
FILE_COPY_FAILURE = 11
|
||||||
FILE_POSITIONING_FAILURE = 12
|
FILE_POSITIONING_FAILURE = 12
|
||||||
FILE_ALREADY_EXIST = 13
|
FILE_ALREADY_EXIST = 13
|
||||||
FILE_NOT_FOUND = 14
|
FILE_NOT_FOUND = 14
|
||||||
FILE_TYPE_MISMATCH = 15
|
FILE_TYPE_MISMATCH = 15
|
||||||
FILE_CASE_MISMATCH = 16
|
FILE_CASE_MISMATCH = 16
|
||||||
FILE_DUPLICATED = 17
|
FILE_DUPLICATED = 17
|
||||||
FILE_UNKNOWN_ERROR = 0x0FFF
|
FILE_UNKNOWN_ERROR = 0x0FFF
|
||||||
|
|
||||||
OPTION_UNKNOWN = 0x1000
|
OPTION_UNKNOWN = 0x1000
|
||||||
OPTION_MISSING = 0x1001
|
OPTION_MISSING = 0x1001
|
||||||
OPTION_CONFLICT = 0x1002
|
OPTION_CONFLICT = 0x1002
|
||||||
OPTION_VALUE_INVALID = 0x1003
|
OPTION_VALUE_INVALID = 0x1003
|
||||||
OPTION_DEPRECATED = 0x1004
|
OPTION_DEPRECATED = 0x1004
|
||||||
OPTION_NOT_SUPPORTED = 0x1005
|
OPTION_NOT_SUPPORTED = 0x1005
|
||||||
OPTION_UNKNOWN_ERROR = 0x1FFF
|
OPTION_UNKNOWN_ERROR = 0x1FFF
|
||||||
|
|
||||||
PARAMETER_INVALID = 0x2000
|
PARAMETER_INVALID = 0x2000
|
||||||
PARAMETER_MISSING = 0x2001
|
PARAMETER_MISSING = 0x2001
|
||||||
PARAMETER_UNKNOWN_ERROR = 0x2FFF
|
PARAMETER_UNKNOWN_ERROR = 0x2FFF
|
||||||
|
|
||||||
FORMAT_INVALID = 0x3000
|
FORMAT_INVALID = 0x3000
|
||||||
FORMAT_NOT_SUPPORTED = 0x3001
|
FORMAT_NOT_SUPPORTED = 0x3001
|
||||||
FORMAT_UNKNOWN = 0x3002
|
FORMAT_UNKNOWN = 0x3002
|
||||||
FORMAT_UNKNOWN_ERROR = 0x3FFF
|
FORMAT_UNKNOWN_ERROR = 0x3FFF
|
||||||
|
|
||||||
RESOURCE_NOT_AVAILABLE = 0x4000
|
RESOURCE_NOT_AVAILABLE = 0x4000
|
||||||
RESOURCE_ALLOCATE_FAILURE = 0x4001
|
RESOURCE_ALLOCATE_FAILURE = 0x4001
|
||||||
RESOURCE_FULL = 0x4002
|
RESOURCE_FULL = 0x4002
|
||||||
RESOURCE_OVERFLOW = 0x4003
|
RESOURCE_OVERFLOW = 0x4003
|
||||||
RESOURCE_UNDERRUN = 0x4004
|
RESOURCE_UNDERRUN = 0x4004
|
||||||
RESOURCE_UNKNOWN_ERROR = 0x4FFF
|
RESOURCE_UNKNOWN_ERROR = 0x4FFF
|
||||||
|
|
||||||
ATTRIBUTE_NOT_AVAILABLE = 0x5000
|
ATTRIBUTE_NOT_AVAILABLE = 0x5000
|
||||||
ATTRIBUTE_GET_FAILURE = 0x5001
|
ATTRIBUTE_GET_FAILURE = 0x5001
|
||||||
ATTRIBUTE_SET_FAILURE = 0x5002
|
ATTRIBUTE_SET_FAILURE = 0x5002
|
||||||
ATTRIBUTE_UPDATE_FAILURE = 0x5003
|
ATTRIBUTE_UPDATE_FAILURE = 0x5003
|
||||||
ATTRIBUTE_ACCESS_DENIED = 0x5004
|
ATTRIBUTE_ACCESS_DENIED = 0x5004
|
||||||
ATTRIBUTE_RETRIEVE_FAILURE = 0x5005
|
ATTRIBUTE_RETRIEVE_FAILURE = 0x5005
|
||||||
ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF
|
ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF
|
||||||
ATTRIBUTE_RETRIEVE_FAILURE = 0x5F00
|
ATTRIBUTE_RETRIEVE_FAILURE = 0x5F00
|
||||||
|
|
||||||
IO_NOT_READY = 0x6000
|
IO_NOT_READY = 0x6000
|
||||||
IO_BUSY = 0x6001
|
IO_BUSY = 0x6001
|
||||||
IO_TIMEOUT = 0x6002
|
IO_TIMEOUT = 0x6002
|
||||||
IO_UNKNOWN_ERROR = 0x6FFF
|
IO_UNKNOWN_ERROR = 0x6FFF
|
||||||
|
|
||||||
COMMAND_FAILURE = 0x7000
|
COMMAND_FAILURE = 0x7000
|
||||||
|
|
||||||
CODE_ERROR = 0xC0DE
|
CODE_ERROR = 0xC0DE
|
||||||
|
|
||||||
AUTOGEN_ERROR = 0xF000
|
AUTOGEN_ERROR = 0xF000
|
||||||
PARSER_ERROR = 0xF001
|
PARSER_ERROR = 0xF001
|
||||||
BUILD_ERROR = 0xF002
|
BUILD_ERROR = 0xF002
|
||||||
GENFDS_ERROR = 0xF003
|
GENFDS_ERROR = 0xF003
|
||||||
ECC_ERROR = 0xF004
|
ECC_ERROR = 0xF004
|
||||||
EOT_ERROR = 0xF005
|
EOT_ERROR = 0xF005
|
||||||
DDC_ERROR = 0xF009
|
DDC_ERROR = 0xF009
|
||||||
WARNING_AS_ERROR = 0xF006
|
WARNING_AS_ERROR = 0xF006
|
||||||
MIGRATION_ERROR = 0xF010
|
MIGRATION_ERROR = 0xF010
|
||||||
EDK1_INF_ERROR = 0xF011
|
EDK1_INF_ERROR = 0xF011
|
||||||
ABORT_ERROR = 0xFFFE
|
ABORT_ERROR = 0xFFFE
|
||||||
UNKNOWN_ERROR = 0xFFFF
|
UNKNOWN_ERROR = 0xFFFF
|
||||||
|
|
||||||
UPT_ALREADY_INSTALLED_ERROR = 0xD000
|
UPT_ALREADY_INSTALLED_ERROR = 0xD000
|
||||||
UPT_ENVIRON_MISSING_ERROR = 0xD001
|
UPT_ENVIRON_MISSING_ERROR = 0xD001
|
||||||
UPT_REPKG_ERROR = 0xD002
|
UPT_REPKG_ERROR = 0xD002
|
||||||
UPT_ALREADY_RUNNING_ERROR = 0xD003
|
UPT_ALREADY_RUNNING_ERROR = 0xD003
|
||||||
UPT_MUL_DEC_ERROR = 0xD004
|
UPT_MUL_DEC_ERROR = 0xD004
|
||||||
UPT_DB_UPDATE_ERROR = 0xD005
|
UPT_DB_UPDATE_ERROR = 0xD005
|
||||||
UPT_INI_PARSE_ERROR = 0xE000
|
UPT_INI_PARSE_ERROR = 0xE000
|
||||||
|
|
||||||
## Error message of each error code
|
## Error message of each error code
|
||||||
#
|
#
|
||||||
gERROR_MESSAGE = {
|
gERROR_MESSAGE = {
|
||||||
FILE_NOT_FOUND : ST.ERR_FILE_NOT_FOUND,
|
FILE_NOT_FOUND : ST.ERR_FILE_NOT_FOUND,
|
||||||
FILE_OPEN_FAILURE : ST.ERR_FILE_OPEN_FAILURE,
|
FILE_OPEN_FAILURE : ST.ERR_FILE_OPEN_FAILURE,
|
||||||
FILE_WRITE_FAILURE : ST.ERR_FILE_WRITE_FAILURE,
|
FILE_WRITE_FAILURE : ST.ERR_FILE_WRITE_FAILURE,
|
||||||
FILE_PARSE_FAILURE : ST.ERR_FILE_PARSE_FAILURE,
|
FILE_PARSE_FAILURE : ST.ERR_FILE_PARSE_FAILURE,
|
||||||
FILE_READ_FAILURE : ST.ERR_FILE_READ_FAILURE,
|
FILE_READ_FAILURE : ST.ERR_FILE_READ_FAILURE,
|
||||||
FILE_CREATE_FAILURE : ST.ERR_FILE_CREATE_FAILURE,
|
FILE_CREATE_FAILURE : ST.ERR_FILE_CREATE_FAILURE,
|
||||||
FILE_CHECKSUM_FAILURE : ST.ERR_FILE_CHECKSUM_FAILURE,
|
FILE_CHECKSUM_FAILURE : ST.ERR_FILE_CHECKSUM_FAILURE,
|
||||||
FILE_COMPRESS_FAILURE : ST.ERR_FILE_COMPRESS_FAILURE,
|
FILE_COMPRESS_FAILURE : ST.ERR_FILE_COMPRESS_FAILURE,
|
||||||
FILE_DECOMPRESS_FAILURE : ST.ERR_FILE_DECOMPRESS_FAILURE,
|
FILE_DECOMPRESS_FAILURE : ST.ERR_FILE_DECOMPRESS_FAILURE,
|
||||||
FILE_MOVE_FAILURE : ST.ERR_FILE_MOVE_FAILURE,
|
FILE_MOVE_FAILURE : ST.ERR_FILE_MOVE_FAILURE,
|
||||||
FILE_DELETE_FAILURE : ST.ERR_FILE_DELETE_FAILURE,
|
FILE_DELETE_FAILURE : ST.ERR_FILE_DELETE_FAILURE,
|
||||||
FILE_COPY_FAILURE : ST.ERR_FILE_COPY_FAILURE,
|
FILE_COPY_FAILURE : ST.ERR_FILE_COPY_FAILURE,
|
||||||
FILE_POSITIONING_FAILURE: ST.ERR_FILE_POSITIONING_FAILURE,
|
FILE_POSITIONING_FAILURE: ST.ERR_FILE_POSITIONING_FAILURE,
|
||||||
FILE_ALREADY_EXIST : ST.ERR_FILE_ALREADY_EXIST,
|
FILE_ALREADY_EXIST : ST.ERR_FILE_ALREADY_EXIST,
|
||||||
FILE_TYPE_MISMATCH : ST.ERR_FILE_TYPE_MISMATCH ,
|
FILE_TYPE_MISMATCH : ST.ERR_FILE_TYPE_MISMATCH ,
|
||||||
FILE_CASE_MISMATCH : ST.ERR_FILE_CASE_MISMATCH,
|
FILE_CASE_MISMATCH : ST.ERR_FILE_CASE_MISMATCH,
|
||||||
FILE_DUPLICATED : ST.ERR_FILE_DUPLICATED,
|
FILE_DUPLICATED : ST.ERR_FILE_DUPLICATED,
|
||||||
FILE_UNKNOWN_ERROR : ST.ERR_FILE_UNKNOWN_ERROR,
|
FILE_UNKNOWN_ERROR : ST.ERR_FILE_UNKNOWN_ERROR,
|
||||||
|
|
||||||
OPTION_UNKNOWN : ST.ERR_OPTION_UNKNOWN,
|
OPTION_UNKNOWN : ST.ERR_OPTION_UNKNOWN,
|
||||||
OPTION_MISSING : ST.ERR_OPTION_MISSING,
|
OPTION_MISSING : ST.ERR_OPTION_MISSING,
|
||||||
OPTION_CONFLICT : ST.ERR_OPTION_CONFLICT,
|
OPTION_CONFLICT : ST.ERR_OPTION_CONFLICT,
|
||||||
OPTION_VALUE_INVALID : ST.ERR_OPTION_VALUE_INVALID,
|
OPTION_VALUE_INVALID : ST.ERR_OPTION_VALUE_INVALID,
|
||||||
OPTION_DEPRECATED : ST.ERR_OPTION_DEPRECATED,
|
OPTION_DEPRECATED : ST.ERR_OPTION_DEPRECATED,
|
||||||
OPTION_NOT_SUPPORTED : ST.ERR_OPTION_NOT_SUPPORTED,
|
OPTION_NOT_SUPPORTED : ST.ERR_OPTION_NOT_SUPPORTED,
|
||||||
OPTION_UNKNOWN_ERROR : ST.ERR_OPTION_UNKNOWN_ERROR,
|
OPTION_UNKNOWN_ERROR : ST.ERR_OPTION_UNKNOWN_ERROR,
|
||||||
|
|
||||||
PARAMETER_INVALID : ST.ERR_PARAMETER_INVALID,
|
PARAMETER_INVALID : ST.ERR_PARAMETER_INVALID,
|
||||||
PARAMETER_MISSING : ST.ERR_PARAMETER_MISSING,
|
PARAMETER_MISSING : ST.ERR_PARAMETER_MISSING,
|
||||||
PARAMETER_UNKNOWN_ERROR : ST.ERR_PARAMETER_UNKNOWN_ERROR,
|
PARAMETER_UNKNOWN_ERROR : ST.ERR_PARAMETER_UNKNOWN_ERROR,
|
||||||
|
|
||||||
FORMAT_INVALID : ST.ERR_FORMAT_INVALID,
|
FORMAT_INVALID : ST.ERR_FORMAT_INVALID,
|
||||||
FORMAT_NOT_SUPPORTED : ST.ERR_FORMAT_NOT_SUPPORTED,
|
FORMAT_NOT_SUPPORTED : ST.ERR_FORMAT_NOT_SUPPORTED,
|
||||||
FORMAT_UNKNOWN : ST.ERR_FORMAT_UNKNOWN,
|
FORMAT_UNKNOWN : ST.ERR_FORMAT_UNKNOWN,
|
||||||
FORMAT_UNKNOWN_ERROR : ST.ERR_FORMAT_UNKNOWN_ERROR,
|
FORMAT_UNKNOWN_ERROR : ST.ERR_FORMAT_UNKNOWN_ERROR,
|
||||||
|
|
||||||
RESOURCE_NOT_AVAILABLE : ST.ERR_RESOURCE_NOT_AVAILABLE,
|
RESOURCE_NOT_AVAILABLE : ST.ERR_RESOURCE_NOT_AVAILABLE,
|
||||||
RESOURCE_ALLOCATE_FAILURE : ST.ERR_RESOURCE_ALLOCATE_FAILURE,
|
RESOURCE_ALLOCATE_FAILURE : ST.ERR_RESOURCE_ALLOCATE_FAILURE,
|
||||||
RESOURCE_FULL : ST.ERR_RESOURCE_FULL,
|
RESOURCE_FULL : ST.ERR_RESOURCE_FULL,
|
||||||
RESOURCE_OVERFLOW : ST.ERR_RESOURCE_OVERFLOW,
|
RESOURCE_OVERFLOW : ST.ERR_RESOURCE_OVERFLOW,
|
||||||
RESOURCE_UNDERRUN : ST.ERR_RESOURCE_UNDERRUN,
|
RESOURCE_UNDERRUN : ST.ERR_RESOURCE_UNDERRUN,
|
||||||
RESOURCE_UNKNOWN_ERROR : ST.ERR_RESOURCE_UNKNOWN_ERROR,
|
RESOURCE_UNKNOWN_ERROR : ST.ERR_RESOURCE_UNKNOWN_ERROR,
|
||||||
|
|
||||||
ATTRIBUTE_NOT_AVAILABLE : ST.ERR_ATTRIBUTE_NOT_AVAILABLE,
|
ATTRIBUTE_NOT_AVAILABLE : ST.ERR_ATTRIBUTE_NOT_AVAILABLE,
|
||||||
ATTRIBUTE_RETRIEVE_FAILURE : ST.ERR_ATTRIBUTE_RETRIEVE_FAILURE,
|
ATTRIBUTE_RETRIEVE_FAILURE : ST.ERR_ATTRIBUTE_RETRIEVE_FAILURE,
|
||||||
ATTRIBUTE_SET_FAILURE : ST.ERR_ATTRIBUTE_SET_FAILURE,
|
ATTRIBUTE_SET_FAILURE : ST.ERR_ATTRIBUTE_SET_FAILURE,
|
||||||
ATTRIBUTE_UPDATE_FAILURE: ST.ERR_ATTRIBUTE_UPDATE_FAILURE,
|
ATTRIBUTE_UPDATE_FAILURE: ST.ERR_ATTRIBUTE_UPDATE_FAILURE,
|
||||||
ATTRIBUTE_ACCESS_DENIED : ST.ERR_ATTRIBUTE_ACCESS_DENIED,
|
ATTRIBUTE_ACCESS_DENIED : ST.ERR_ATTRIBUTE_ACCESS_DENIED,
|
||||||
ATTRIBUTE_UNKNOWN_ERROR : ST.ERR_ATTRIBUTE_UNKNOWN_ERROR,
|
ATTRIBUTE_UNKNOWN_ERROR : ST.ERR_ATTRIBUTE_UNKNOWN_ERROR,
|
||||||
|
|
||||||
COMMAND_FAILURE : ST.ERR_COMMAND_FAILURE,
|
COMMAND_FAILURE : ST.ERR_COMMAND_FAILURE,
|
||||||
|
|
||||||
IO_NOT_READY : ST.ERR_IO_NOT_READY,
|
IO_NOT_READY : ST.ERR_IO_NOT_READY,
|
||||||
IO_BUSY : ST.ERR_IO_BUSY,
|
IO_BUSY : ST.ERR_IO_BUSY,
|
||||||
IO_TIMEOUT : ST.ERR_IO_TIMEOUT,
|
IO_TIMEOUT : ST.ERR_IO_TIMEOUT,
|
||||||
IO_UNKNOWN_ERROR : ST.ERR_IO_UNKNOWN_ERROR,
|
IO_UNKNOWN_ERROR : ST.ERR_IO_UNKNOWN_ERROR,
|
||||||
|
|
||||||
UNKNOWN_ERROR : ST.ERR_UNKNOWN_ERROR,
|
UNKNOWN_ERROR : ST.ERR_UNKNOWN_ERROR,
|
||||||
|
|
||||||
UPT_ALREADY_INSTALLED_ERROR : ST.ERR_UPT_ALREADY_INSTALLED_ERROR,
|
UPT_ALREADY_INSTALLED_ERROR : ST.ERR_UPT_ALREADY_INSTALLED_ERROR,
|
||||||
UPT_ENVIRON_MISSING_ERROR : ST.ERR_UPT_ENVIRON_MISSING_ERROR,
|
UPT_ENVIRON_MISSING_ERROR : ST.ERR_UPT_ENVIRON_MISSING_ERROR,
|
||||||
UPT_REPKG_ERROR : ST.ERR_UPT_REPKG_ERROR,
|
UPT_REPKG_ERROR : ST.ERR_UPT_REPKG_ERROR,
|
||||||
UPT_ALREADY_RUNNING_ERROR : ST.ERR_UPT_ALREADY_RUNNING_ERROR,
|
UPT_ALREADY_RUNNING_ERROR : ST.ERR_UPT_ALREADY_RUNNING_ERROR,
|
||||||
UPT_MUL_DEC_ERROR : ST.ERR_MUL_DEC_ERROR,
|
UPT_MUL_DEC_ERROR : ST.ERR_MUL_DEC_ERROR,
|
||||||
UPT_INI_PARSE_ERROR : ST.ERR_UPT_INI_PARSE_ERROR,
|
UPT_INI_PARSE_ERROR : ST.ERR_UPT_INI_PARSE_ERROR,
|
||||||
}
|
}
|
||||||
|
|
||||||
## Exception indicating a fatal error
|
## Exception indicating a fatal error
|
||||||
#
|
#
|
||||||
class FatalError(Exception):
|
class FatalError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@@ -1,20 +1,20 @@
|
|||||||
## @file
|
## @file
|
||||||
# Python 'Library' package initialization file.
|
# Python 'Library' package initialization file.
|
||||||
#
|
#
|
||||||
# This file is required to make Python interpreter treat the directory
|
# This file is required to make Python interpreter treat the directory
|
||||||
# as containing package.
|
# as containing package.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made available
|
# This program and the accompanying materials are licensed and made available
|
||||||
# under the terms and conditions of the BSD License which accompanies this
|
# under the terms and conditions of the BSD License which accompanies this
|
||||||
# distribution. The full text of the license may be found at
|
# distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Xml
|
Xml
|
||||||
'''
|
'''
|
File diff suppressed because it is too large
Load Diff
@@ -1811,7 +1811,7 @@ class InfBuildData(ModuleBuildClassObject):
|
|||||||
else:
|
else:
|
||||||
Tool = ToolList[0]
|
Tool = ToolList[0]
|
||||||
ToolChain = "*_*_*_%s_FLAGS" % Tool
|
ToolChain = "*_*_*_%s_FLAGS" % Tool
|
||||||
ToolChainFamily = ''
|
ToolChainFamily = 'MSFT' # Edk.x only support MSFT tool chain
|
||||||
#ignore not replaced macros in value
|
#ignore not replaced macros in value
|
||||||
ValueList = GetSplitList(' ' + Value, '/D')
|
ValueList = GetSplitList(' ' + Value, '/D')
|
||||||
Dummy = ValueList[0]
|
Dummy = ValueList[0]
|
||||||
|
@@ -1,19 +1,19 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
import sys
|
import sys
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
if sys.platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
DefaultLocal = locale.getdefaultlocale()[1]
|
DefaultLocal = locale.getdefaultlocale()[1]
|
||||||
if DefaultLocal is None:
|
if DefaultLocal is None:
|
||||||
DefaultLocal = 'UTF8'
|
DefaultLocal = 'UTF8'
|
||||||
sys.setdefaultencoding(DefaultLocal)
|
sys.setdefaultencoding(DefaultLocal)
|
||||||
|
|
||||||
|
@@ -1,35 +1,35 @@
|
|||||||
## @file
|
## @file
|
||||||
# Unit tests for C based BaseTools
|
# Unit tests for C based BaseTools
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import TianoCompress
|
import TianoCompress
|
||||||
modules = (
|
modules = (
|
||||||
TianoCompress,
|
TianoCompress,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def TheTestSuite():
|
def TheTestSuite():
|
||||||
suites = map(lambda module: module.TheTestSuite(), modules)
|
suites = map(lambda module: module.TheTestSuite(), modules)
|
||||||
return unittest.TestSuite(suites)
|
return unittest.TestSuite(suites)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
allTests = TheTestSuite()
|
allTests = TheTestSuite()
|
||||||
unittest.TextTestRunner().run(allTests)
|
unittest.TextTestRunner().run(allTests)
|
||||||
|
|
||||||
|
@@ -1,74 +1,74 @@
|
|||||||
## @file
|
## @file
|
||||||
# Unit tests for checking syntax of Python source code
|
# Unit tests for checking syntax of Python source code
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import py_compile
|
import py_compile
|
||||||
|
|
||||||
import TestTools
|
import TestTools
|
||||||
|
|
||||||
class Tests(TestTools.BaseToolsTest):
|
class Tests(TestTools.BaseToolsTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
TestTools.BaseToolsTest.setUp(self)
|
TestTools.BaseToolsTest.setUp(self)
|
||||||
|
|
||||||
def SingleFileTest(self, filename):
|
def SingleFileTest(self, filename):
|
||||||
try:
|
try:
|
||||||
py_compile.compile(filename, doraise=True)
|
py_compile.compile(filename, doraise=True)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.fail('syntax error: %s, Error is %s' % (filename, str(e)))
|
self.fail('syntax error: %s, Error is %s' % (filename, str(e)))
|
||||||
|
|
||||||
def MakePythonSyntaxCheckTests():
|
def MakePythonSyntaxCheckTests():
|
||||||
def GetAllPythonSourceFiles():
|
def GetAllPythonSourceFiles():
|
||||||
pythonSourceFiles = []
|
pythonSourceFiles = []
|
||||||
for (root, dirs, files) in os.walk(TestTools.PythonSourceDir):
|
for (root, dirs, files) in os.walk(TestTools.PythonSourceDir):
|
||||||
for filename in files:
|
for filename in files:
|
||||||
if filename.lower().endswith('.py'):
|
if filename.lower().endswith('.py'):
|
||||||
pythonSourceFiles.append(
|
pythonSourceFiles.append(
|
||||||
os.path.join(root, filename)
|
os.path.join(root, filename)
|
||||||
)
|
)
|
||||||
return pythonSourceFiles
|
return pythonSourceFiles
|
||||||
|
|
||||||
def MakeTestName(filename):
|
def MakeTestName(filename):
|
||||||
assert filename.lower().endswith('.py')
|
assert filename.lower().endswith('.py')
|
||||||
name = filename[:-3]
|
name = filename[:-3]
|
||||||
name = name.replace(TestTools.PythonSourceDir, '')
|
name = name.replace(TestTools.PythonSourceDir, '')
|
||||||
name = name.replace(os.path.sep, '_')
|
name = name.replace(os.path.sep, '_')
|
||||||
return 'test' + name
|
return 'test' + name
|
||||||
|
|
||||||
def MakeNewTest(filename):
|
def MakeNewTest(filename):
|
||||||
test = MakeTestName(filename)
|
test = MakeTestName(filename)
|
||||||
newmethod = lambda self: self.SingleFileTest(filename)
|
newmethod = lambda self: self.SingleFileTest(filename)
|
||||||
setattr(
|
setattr(
|
||||||
Tests,
|
Tests,
|
||||||
test,
|
test,
|
||||||
newmethod
|
newmethod
|
||||||
)
|
)
|
||||||
|
|
||||||
for filename in GetAllPythonSourceFiles():
|
for filename in GetAllPythonSourceFiles():
|
||||||
MakeNewTest(filename)
|
MakeNewTest(filename)
|
||||||
|
|
||||||
MakePythonSyntaxCheckTests()
|
MakePythonSyntaxCheckTests()
|
||||||
del MakePythonSyntaxCheckTests
|
del MakePythonSyntaxCheckTests
|
||||||
|
|
||||||
TheTestSuite = TestTools.MakeTheTestSuite(locals())
|
TheTestSuite = TestTools.MakeTheTestSuite(locals())
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
allTests = TheTestSuite()
|
allTests = TheTestSuite()
|
||||||
unittest.TextTestRunner().run(allTests)
|
unittest.TextTestRunner().run(allTests)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,32 +1,32 @@
|
|||||||
## @file
|
## @file
|
||||||
# Unit tests for Python based BaseTools
|
# Unit tests for Python based BaseTools
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
def TheTestSuite():
|
def TheTestSuite():
|
||||||
suites = []
|
suites = []
|
||||||
import CheckPythonSyntax
|
import CheckPythonSyntax
|
||||||
suites.append(CheckPythonSyntax.TheTestSuite())
|
suites.append(CheckPythonSyntax.TheTestSuite())
|
||||||
return unittest.TestSuite(suites)
|
return unittest.TestSuite(suites)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
allTests = TheTestSuite()
|
allTests = TheTestSuite()
|
||||||
unittest.TextTestRunner().run(allTests)
|
unittest.TextTestRunner().run(allTests)
|
||||||
|
|
||||||
|
@@ -1,40 +1,40 @@
|
|||||||
## @file
|
## @file
|
||||||
# Unit tests for BaseTools utilities
|
# Unit tests for BaseTools utilities
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import TestTools
|
import TestTools
|
||||||
|
|
||||||
sys.path.append(TestTools.PythonSourceDir)
|
sys.path.append(TestTools.PythonSourceDir)
|
||||||
|
|
||||||
def GetCTestSuite():
|
def GetCTestSuite():
|
||||||
import CToolsTests
|
import CToolsTests
|
||||||
return CToolsTests.TheTestSuite()
|
return CToolsTests.TheTestSuite()
|
||||||
|
|
||||||
def GetPythonTestSuite():
|
def GetPythonTestSuite():
|
||||||
import PythonToolsTests
|
import PythonToolsTests
|
||||||
return PythonToolsTests.TheTestSuite()
|
return PythonToolsTests.TheTestSuite()
|
||||||
|
|
||||||
def GetAllTestsSuite():
|
def GetAllTestsSuite():
|
||||||
return unittest.TestSuite([GetCTestSuite(), GetPythonTestSuite()])
|
return unittest.TestSuite([GetCTestSuite(), GetPythonTestSuite()])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
allTests = GetAllTestsSuite()
|
allTests = GetAllTestsSuite()
|
||||||
unittest.TextTestRunner(verbosity=2).run(allTests)
|
unittest.TextTestRunner(verbosity=2).run(allTests)
|
||||||
|
|
||||||
|
@@ -1,179 +1,179 @@
|
|||||||
## @file
|
## @file
|
||||||
# Utility functions and classes for BaseTools unit tests
|
# Utility functions and classes for BaseTools unit tests
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
TestsDir = os.path.realpath(os.path.split(sys.argv[0])[0])
|
TestsDir = os.path.realpath(os.path.split(sys.argv[0])[0])
|
||||||
BaseToolsDir = os.path.realpath(os.path.join(TestsDir, '..'))
|
BaseToolsDir = os.path.realpath(os.path.join(TestsDir, '..'))
|
||||||
CSourceDir = os.path.join(BaseToolsDir, 'Source', 'C')
|
CSourceDir = os.path.join(BaseToolsDir, 'Source', 'C')
|
||||||
PythonSourceDir = os.path.join(BaseToolsDir, 'Source', 'Python')
|
PythonSourceDir = os.path.join(BaseToolsDir, 'Source', 'Python')
|
||||||
TestTempDir = os.path.join(TestsDir, 'TestTempDir')
|
TestTempDir = os.path.join(TestsDir, 'TestTempDir')
|
||||||
|
|
||||||
def MakeTheTestSuite(localItems):
|
def MakeTheTestSuite(localItems):
|
||||||
tests = []
|
tests = []
|
||||||
for name, item in localItems.iteritems():
|
for name, item in localItems.iteritems():
|
||||||
if isinstance(item, types.TypeType):
|
if isinstance(item, types.TypeType):
|
||||||
if issubclass(item, unittest.TestCase):
|
if issubclass(item, unittest.TestCase):
|
||||||
tests.append(unittest.TestLoader().loadTestsFromTestCase(item))
|
tests.append(unittest.TestLoader().loadTestsFromTestCase(item))
|
||||||
elif issubclass(item, unittest.TestSuite):
|
elif issubclass(item, unittest.TestSuite):
|
||||||
tests.append(item())
|
tests.append(item())
|
||||||
return lambda: unittest.TestSuite(tests)
|
return lambda: unittest.TestSuite(tests)
|
||||||
|
|
||||||
def GetBaseToolsPaths():
|
def GetBaseToolsPaths():
|
||||||
if sys.platform in ('win32', 'win64'):
|
if sys.platform in ('win32', 'win64'):
|
||||||
return [ os.path.join(BaseToolsDir, 'Bin', sys.platform.title()) ]
|
return [ os.path.join(BaseToolsDir, 'Bin', sys.platform.title()) ]
|
||||||
else:
|
else:
|
||||||
uname = os.popen('uname -sm').read().strip()
|
uname = os.popen('uname -sm').read().strip()
|
||||||
for char in (' ', '/'):
|
for char in (' ', '/'):
|
||||||
uname = uname.replace(char, '-')
|
uname = uname.replace(char, '-')
|
||||||
return [
|
return [
|
||||||
os.path.join(BaseToolsDir, 'Bin', uname),
|
os.path.join(BaseToolsDir, 'Bin', uname),
|
||||||
os.path.join(BaseToolsDir, 'BinWrappers', uname),
|
os.path.join(BaseToolsDir, 'BinWrappers', uname),
|
||||||
os.path.join(BaseToolsDir, 'BinWrappers', 'PosixLike')
|
os.path.join(BaseToolsDir, 'BinWrappers', 'PosixLike')
|
||||||
]
|
]
|
||||||
|
|
||||||
BaseToolsBinPaths = GetBaseToolsPaths()
|
BaseToolsBinPaths = GetBaseToolsPaths()
|
||||||
|
|
||||||
class BaseToolsTest(unittest.TestCase):
|
class BaseToolsTest(unittest.TestCase):
|
||||||
|
|
||||||
def cleanOutDir(self, dir):
|
def cleanOutDir(self, dir):
|
||||||
for dirItem in os.listdir(dir):
|
for dirItem in os.listdir(dir):
|
||||||
if dirItem in ('.', '..'): continue
|
if dirItem in ('.', '..'): continue
|
||||||
dirItem = os.path.join(dir, dirItem)
|
dirItem = os.path.join(dir, dirItem)
|
||||||
self.RemoveFileOrDir(dirItem)
|
self.RemoveFileOrDir(dirItem)
|
||||||
|
|
||||||
def CleanUpTmpDir(self):
|
def CleanUpTmpDir(self):
|
||||||
if os.path.exists(self.testDir):
|
if os.path.exists(self.testDir):
|
||||||
self.cleanOutDir(self.testDir)
|
self.cleanOutDir(self.testDir)
|
||||||
|
|
||||||
def HandleTreeDeleteError(self, function, path, excinfo):
|
def HandleTreeDeleteError(self, function, path, excinfo):
|
||||||
os.chmod(path, stat.S_IWRITE)
|
os.chmod(path, stat.S_IWRITE)
|
||||||
function(path)
|
function(path)
|
||||||
|
|
||||||
def RemoveDir(self, dir):
|
def RemoveDir(self, dir):
|
||||||
shutil.rmtree(dir, False, self.HandleTreeDeleteError)
|
shutil.rmtree(dir, False, self.HandleTreeDeleteError)
|
||||||
|
|
||||||
def RemoveFileOrDir(self, path):
|
def RemoveFileOrDir(self, path):
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
return
|
return
|
||||||
elif os.path.isdir(path):
|
elif os.path.isdir(path):
|
||||||
self.RemoveDir(path)
|
self.RemoveDir(path)
|
||||||
else:
|
else:
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
|
||||||
def DisplayBinaryData(self, description, data):
|
def DisplayBinaryData(self, description, data):
|
||||||
print description, '(base64 encoded):'
|
print description, '(base64 encoded):'
|
||||||
b64data = base64.b64encode(data)
|
b64data = base64.b64encode(data)
|
||||||
print b64data
|
print b64data
|
||||||
|
|
||||||
def DisplayFile(self, fileName):
|
def DisplayFile(self, fileName):
|
||||||
sys.stdout.write(self.ReadTmpFile(fileName))
|
sys.stdout.write(self.ReadTmpFile(fileName))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def FindToolBin(self, toolName):
|
def FindToolBin(self, toolName):
|
||||||
for binPath in BaseToolsBinPaths:
|
for binPath in BaseToolsBinPaths:
|
||||||
bin = os.path.join(binPath, toolName)
|
bin = os.path.join(binPath, toolName)
|
||||||
if os.path.exists(bin):
|
if os.path.exists(bin):
|
||||||
break
|
break
|
||||||
assert os.path.exists(bin)
|
assert os.path.exists(bin)
|
||||||
return bin
|
return bin
|
||||||
|
|
||||||
def RunTool(self, *args, **kwd):
|
def RunTool(self, *args, **kwd):
|
||||||
if 'toolName' in kwd: toolName = kwd['toolName']
|
if 'toolName' in kwd: toolName = kwd['toolName']
|
||||||
else: toolName = None
|
else: toolName = None
|
||||||
if 'logFile' in kwd: logFile = kwd['logFile']
|
if 'logFile' in kwd: logFile = kwd['logFile']
|
||||||
else: logFile = None
|
else: logFile = None
|
||||||
|
|
||||||
if toolName is None: toolName = self.toolName
|
if toolName is None: toolName = self.toolName
|
||||||
bin = self.FindToolBin(toolName)
|
bin = self.FindToolBin(toolName)
|
||||||
if logFile is not None:
|
if logFile is not None:
|
||||||
logFile = open(os.path.join(self.testDir, logFile), 'w')
|
logFile = open(os.path.join(self.testDir, logFile), 'w')
|
||||||
popenOut = logFile
|
popenOut = logFile
|
||||||
else:
|
else:
|
||||||
popenOut = subprocess.PIPE
|
popenOut = subprocess.PIPE
|
||||||
|
|
||||||
args = [toolName] + list(args)
|
args = [toolName] + list(args)
|
||||||
|
|
||||||
Proc = subprocess.Popen(
|
Proc = subprocess.Popen(
|
||||||
args, executable=bin,
|
args, executable=bin,
|
||||||
stdout=popenOut, stderr=subprocess.STDOUT
|
stdout=popenOut, stderr=subprocess.STDOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
if logFile is None:
|
if logFile is None:
|
||||||
Proc.stdout.read()
|
Proc.stdout.read()
|
||||||
|
|
||||||
return Proc.wait()
|
return Proc.wait()
|
||||||
|
|
||||||
def GetTmpFilePath(self, fileName):
|
def GetTmpFilePath(self, fileName):
|
||||||
return os.path.join(self.testDir, fileName)
|
return os.path.join(self.testDir, fileName)
|
||||||
|
|
||||||
def OpenTmpFile(self, fileName, mode = 'r'):
|
def OpenTmpFile(self, fileName, mode = 'r'):
|
||||||
return open(os.path.join(self.testDir, fileName), mode)
|
return open(os.path.join(self.testDir, fileName), mode)
|
||||||
|
|
||||||
def ReadTmpFile(self, fileName):
|
def ReadTmpFile(self, fileName):
|
||||||
f = open(self.GetTmpFilePath(fileName), 'r')
|
f = open(self.GetTmpFilePath(fileName), 'r')
|
||||||
data = f.read()
|
data = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def WriteTmpFile(self, fileName, data):
|
def WriteTmpFile(self, fileName, data):
|
||||||
f = open(self.GetTmpFilePath(fileName), 'w')
|
f = open(self.GetTmpFilePath(fileName), 'w')
|
||||||
f.write(data)
|
f.write(data)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def GenRandomFileData(self, fileName, minlen = None, maxlen = None):
|
def GenRandomFileData(self, fileName, minlen = None, maxlen = None):
|
||||||
if maxlen is None: maxlen = minlen
|
if maxlen is None: maxlen = minlen
|
||||||
f = self.OpenTmpFile(fileName, 'w')
|
f = self.OpenTmpFile(fileName, 'w')
|
||||||
f.write(self.GetRandomString(minlen, maxlen))
|
f.write(self.GetRandomString(minlen, maxlen))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def GetRandomString(self, minlen = None, maxlen = None):
|
def GetRandomString(self, minlen = None, maxlen = None):
|
||||||
if minlen is None: minlen = 1024
|
if minlen is None: minlen = 1024
|
||||||
if maxlen is None: maxlen = minlen
|
if maxlen is None: maxlen = minlen
|
||||||
return ''.join(
|
return ''.join(
|
||||||
[chr(random.randint(0,255))
|
[chr(random.randint(0,255))
|
||||||
for x in xrange(random.randint(minlen, maxlen))
|
for x in xrange(random.randint(minlen, maxlen))
|
||||||
])
|
])
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.savedEnvPath = os.environ['PATH']
|
self.savedEnvPath = os.environ['PATH']
|
||||||
self.savedSysPath = sys.path[:]
|
self.savedSysPath = sys.path[:]
|
||||||
|
|
||||||
for binPath in BaseToolsBinPaths:
|
for binPath in BaseToolsBinPaths:
|
||||||
os.environ['PATH'] = \
|
os.environ['PATH'] = \
|
||||||
os.path.pathsep.join((os.environ['PATH'], binPath))
|
os.path.pathsep.join((os.environ['PATH'], binPath))
|
||||||
|
|
||||||
self.testDir = TestTempDir
|
self.testDir = TestTempDir
|
||||||
if not os.path.exists(self.testDir):
|
if not os.path.exists(self.testDir):
|
||||||
os.mkdir(self.testDir)
|
os.mkdir(self.testDir)
|
||||||
else:
|
else:
|
||||||
self.cleanOutDir(self.testDir)
|
self.cleanOutDir(self.testDir)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.RemoveFileOrDir(self.testDir)
|
self.RemoveFileOrDir(self.testDir)
|
||||||
|
|
||||||
os.environ['PATH'] = self.savedEnvPath
|
os.environ['PATH'] = self.savedEnvPath
|
||||||
sys.path = self.savedSysPath
|
sys.path = self.savedSysPath
|
||||||
|
|
||||||
|
@@ -1,74 +1,74 @@
|
|||||||
## @file
|
## @file
|
||||||
# Unit tests for TianoCompress utility
|
# Unit tests for TianoCompress utility
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import TestTools
|
import TestTools
|
||||||
|
|
||||||
class Tests(TestTools.BaseToolsTest):
|
class Tests(TestTools.BaseToolsTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
TestTools.BaseToolsTest.setUp(self)
|
TestTools.BaseToolsTest.setUp(self)
|
||||||
self.toolName = 'TianoCompress'
|
self.toolName = 'TianoCompress'
|
||||||
|
|
||||||
def testHelp(self):
|
def testHelp(self):
|
||||||
result = self.RunTool('--help', logFile='help')
|
result = self.RunTool('--help', logFile='help')
|
||||||
#self.DisplayFile('help')
|
#self.DisplayFile('help')
|
||||||
self.assertTrue(result == 0)
|
self.assertTrue(result == 0)
|
||||||
|
|
||||||
def compressionTestCycle(self, data):
|
def compressionTestCycle(self, data):
|
||||||
path = self.GetTmpFilePath('input')
|
path = self.GetTmpFilePath('input')
|
||||||
self.WriteTmpFile('input', data)
|
self.WriteTmpFile('input', data)
|
||||||
result = self.RunTool(
|
result = self.RunTool(
|
||||||
'-e',
|
'-e',
|
||||||
'-o', self.GetTmpFilePath('output1'),
|
'-o', self.GetTmpFilePath('output1'),
|
||||||
self.GetTmpFilePath('input')
|
self.GetTmpFilePath('input')
|
||||||
)
|
)
|
||||||
self.assertTrue(result == 0)
|
self.assertTrue(result == 0)
|
||||||
result = self.RunTool(
|
result = self.RunTool(
|
||||||
'-d',
|
'-d',
|
||||||
'-o', self.GetTmpFilePath('output2'),
|
'-o', self.GetTmpFilePath('output2'),
|
||||||
self.GetTmpFilePath('output1')
|
self.GetTmpFilePath('output1')
|
||||||
)
|
)
|
||||||
self.assertTrue(result == 0)
|
self.assertTrue(result == 0)
|
||||||
start = self.ReadTmpFile('input')
|
start = self.ReadTmpFile('input')
|
||||||
finish = self.ReadTmpFile('output2')
|
finish = self.ReadTmpFile('output2')
|
||||||
startEqualsFinish = start == finish
|
startEqualsFinish = start == finish
|
||||||
if not startEqualsFinish:
|
if not startEqualsFinish:
|
||||||
print
|
print
|
||||||
print 'Original data did not match decompress(compress(data))'
|
print 'Original data did not match decompress(compress(data))'
|
||||||
self.DisplayBinaryData('original data', start)
|
self.DisplayBinaryData('original data', start)
|
||||||
self.DisplayBinaryData('after compression', self.ReadTmpFile('output1'))
|
self.DisplayBinaryData('after compression', self.ReadTmpFile('output1'))
|
||||||
self.DisplayBinaryData('after decomression', finish)
|
self.DisplayBinaryData('after decomression', finish)
|
||||||
self.assertTrue(startEqualsFinish)
|
self.assertTrue(startEqualsFinish)
|
||||||
|
|
||||||
def testRandomDataCycles(self):
|
def testRandomDataCycles(self):
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
data = self.GetRandomString(1024, 2048)
|
data = self.GetRandomString(1024, 2048)
|
||||||
self.compressionTestCycle(data)
|
self.compressionTestCycle(data)
|
||||||
self.CleanUpTmpDir()
|
self.CleanUpTmpDir()
|
||||||
|
|
||||||
TheTestSuite = TestTools.MakeTheTestSuite(locals())
|
TheTestSuite = TestTools.MakeTheTestSuite(locals())
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
allTests = TheTestSuite()
|
allTests = TheTestSuite()
|
||||||
unittest.TextTestRunner().run(allTests)
|
unittest.TextTestRunner().run(allTests)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
To use GCC with the BaseTools project for edk2 based development purposes,
|
To use GCC with the BaseTools project for edk2 based development purposes,
|
||||||
you will need to build a GCC based cross-compiler (in addition to binutils).
|
you will need to build a GCC based cross-compiler (in addition to binutils).
|
||||||
|
|
||||||
Instructions for building GCC for this purpose can be found under the
|
Instructions for building GCC for this purpose can be found under the
|
||||||
BaseTools source tree. (In addition to the instructions, you will also
|
BaseTools source tree. (In addition to the instructions, you will also
|
||||||
find scripts to help automate the build process.)
|
find scripts to help automate the build process.)
|
||||||
|
|
||||||
If you do not have a tianocore.org account, you can make use of the 'guest'
|
If you do not have a tianocore.org account, you can make use of the 'guest'
|
||||||
account with an empty password.
|
account with an empty password.
|
||||||
|
|
||||||
In a web browser, you can 'browse' the relavent source at this location:
|
In a web browser, you can 'browse' the relavent source at this location:
|
||||||
http://sourceforge.net/p/edk2-buildtools/code/HEAD/tree/trunk/BaseTools/gcc
|
http://sourceforge.net/p/edk2-buildtools/code/HEAD/tree/trunk/BaseTools/gcc
|
||||||
|
|
||||||
Or, with subversion, you can download the relavent source with this command:
|
Or, with subversion, you can download the relavent source with this command:
|
||||||
svn co https://svn.code.sf.net/p/edk2-buildtools/code/trunk/BaseTools/gcc
|
svn co https://svn.code.sf.net/p/edk2-buildtools/code/trunk/BaseTools/gcc
|
||||||
|
Reference in New Issue
Block a user