summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/AutoGen
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python/AutoGen')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenC.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 8089e3aae3..de6eb0ee78 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1639,6 +1639,7 @@ def CreateIdfFileCode(Info, AutoGenC, StringH, IdfGenCFlag, IdfGenBinBuffer):
PaletteBuffer = pack('x')
BufferStr = ''
PaletteStr = ''
+ FileDict = {}
for Idf in ImageFiles.ImageFilesDict:
if ImageFiles.ImageFilesDict[Idf]:
for FileObj in ImageFiles.ImageFilesDict[Idf]:
@@ -1663,6 +1664,19 @@ def CreateIdfFileCode(Info, AutoGenC, StringH, IdfGenCFlag, IdfGenBinBuffer):
else:
Line = DEFINE_STR + ' ' + ID + ' ' * (ValueStartPtr - len(DEFINE_STR + ID)) + DecToHexStr(Index, 4) + '\n'
+ if File not in FileDict:
+ FileDict[File] = Index
+ else:
+ DuplicateBlock = pack('B', EFI_HII_IIBT_DUPLICATE)
+ DuplicateBlock += pack('H', FileDict[File])
+ ImageBuffer += DuplicateBlock
+ BufferStr = WriteLine(BufferStr, '// %s: %s: %s' % (DecToHexStr(Index, 4), ID, DecToHexStr(Index, 4)))
+ TempBufferList = AscToHexList(DuplicateBlock)
+ BufferStr = WriteLine(BufferStr, CreateArrayItem(TempBufferList, 16) + '\n')
+ StringH.Append(Line)
+ Index += 1
+ continue
+
TmpFile = open(File.Path, 'rb')
Buffer = TmpFile.read()
TmpFile.close()