diff options
-rw-r--r-- | BaseTools/Conf/build_rule.template | 14 | ||||
-rw-r--r-- | BaseTools/Source/Python/AutoGen/AutoGen.py | 15 | ||||
-rw-r--r-- | BaseTools/Source/Python/AutoGen/GenMake.py | 4 |
3 files changed, 27 insertions, 6 deletions
diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template index 3b054c4ddd..596d41d5f5 100644 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -66,6 +66,8 @@ # $(LIBS) Static library files of current module
# $(<tool>_FLAGS) Tools flags of current module
# $(MODULE_NAME) Current module name
+# $(MODULE_NAME_GUID) Current module name with module FILE_GUID if same $(MODULE_NAME) exists
+# in different modules, otherwise its value is same as $(MODULE_NAME)
# $(MODULE_TYPE) Current module type
# $(MODULE_GUID) Current module guid
# $(ARCH) Architecture of current module
@@ -334,7 +336,7 @@ <Command.MSFT, Command.INTEL, Command.RVCT, Command.ARMGCC, Command.ARMLINUXGCC>
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
$(CP) ${dst} $(OUTPUT_DIR)
- $(CP) ${dst} $(BIN_DIR)
+ $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
-$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
<Command.GCC>
@@ -345,11 +347,11 @@ #The below 2 lines are only needed for UNIXGCC tool chain, which genereates PE image directly
#
-$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
- -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug $(BIN_DIR)
+ -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
$(CP) ${dst} $(OUTPUT_DIR)
- $(CP) ${dst} $(BIN_DIR)
+ $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
<Command.XCODE>
@@ -359,7 +361,7 @@ -$(DSYMUTIL) ${src}
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
$(CP) ${dst} $(OUTPUT_DIR)
- $(CP) ${dst} $(BIN_DIR)
+ $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
[Dependency-Expression-File]
@@ -516,7 +518,7 @@ <Command>
"$(GENFW)" -o ${dst} -j $(MICROCODE_BINARY_FILES) $(GENFW_FLAGS)
- -$(CP) ${dst} $(BIN_DIR)
+ -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).bin
[EFI-Image-File]
<InputFile>
@@ -542,7 +544,7 @@ ?.efi, ?.EFI, ?.Efi
<OutputFile>
- $(BIN_DIR)(+)$(MODULE_NAME).rom
+ $(BIN_DIR)(+)$(MODULE_NAME_GUID).rom
<Command>
$(OPTROM) -i $(PCI_DEVICE_ID) -f $(PCI_VENDOR_ID) -l $(PCI_CLASS_CODE) -r $(PCI_REVISION) -o $dst $(OPTROM_FLAGS) $src
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index b2d9f6a8ef..d1ed0a65ab 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -17,6 +17,7 @@ import Common.LongFilePathOs as os import re
import os.path as path
import copy
+import uuid
import GenC
import GenMake
@@ -2285,12 +2286,26 @@ class ModuleAutoGen(AutoGen): return self._FixedAtBuildPcds
+ def _GetUniqueBaseName(self):
+ BaseName = self.Name
+ for Module in self.PlatformInfo.ModuleAutoGenList:
+ if Module.MetaFile == self.MetaFile:
+ continue
+ if Module.Name == self.Name:
+ EdkLogger.warn('build', 'Modules have same BaseName:\n %s\n %s' % (Module.MetaFile, self.MetaFile))
+ if uuid.UUID(Module.Guid) == uuid.UUID(self.Guid):
+ EdkLogger.error("build", FILE_DUPLICATED, 'Modules have same BaseName and FILE_GUID:\n'
+ ' %s\n %s' % (Module.MetaFile, self.MetaFile))
+ BaseName = '%s_%s' % (self.Name, self.Guid)
+ return BaseName
+
# Macros could be used in build_rule.txt (also Makefile)
def _GetMacros(self):
if self._Macro == None:
self._Macro = sdict()
self._Macro["WORKSPACE" ] = self.WorkspaceDir
self._Macro["MODULE_NAME" ] = self.Name
+ self._Macro["MODULE_NAME_GUID" ] = self._GetUniqueBaseName()
self._Macro["MODULE_GUID" ] = self.Guid
self._Macro["MODULE_VERSION" ] = self.Version
self._Macro["MODULE_TYPE" ] = self.ModuleType
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index edbf243987..1d49a0316d 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -241,6 +241,7 @@ PLATFORM_OUTPUT_DIR = ${platform_output_directory} #
MODULE_NAME = ${module_name}
MODULE_GUID = ${module_guid}
+MODULE_NAME_GUID = ${module_name_guid}
MODULE_VERSION = ${module_version}
MODULE_TYPE = ${module_type}
MODULE_FILE = ${module_file}
@@ -569,6 +570,7 @@ cleanlib: "module_name" : self._AutoGenObject.Name,
"module_guid" : self._AutoGenObject.Guid,
+ "module_name_guid" : self._AutoGenObject._GetUniqueBaseName(),
"module_version" : self._AutoGenObject.Version,
"module_type" : self._AutoGenObject.ModuleType,
"module_file" : self._AutoGenObject.MetaFile.Name,
@@ -846,6 +848,7 @@ PLATFORM_OUTPUT_DIR = ${platform_output_directory} #
MODULE_NAME = ${module_name}
MODULE_GUID = ${module_guid}
+MODULE_NAME_GUID = ${module_name_guid}
MODULE_VERSION = ${module_version}
MODULE_TYPE = ${module_type}
MODULE_FILE = ${module_file}
@@ -970,6 +973,7 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\ "module_name" : self._AutoGenObject.Name,
"module_guid" : self._AutoGenObject.Guid,
+ "module_name_guid" : self._AutoGenObject._GetUniqueBaseName(),
"module_version" : self._AutoGenObject.Version,
"module_type" : self._AutoGenObject.ModuleType,
"module_file" : self._AutoGenObject.MetaFile,
|