Sync EDKII BaseTools to BaseTools project r1903.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10123 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
##
|
||||
# Import Modules
|
||||
#
|
||||
from struct import *
|
||||
import Section
|
||||
from GenFdsGlobalVariable import GenFdsGlobalVariable
|
||||
import subprocess
|
||||
@ -24,6 +25,7 @@ from CommonDataClass.FdfClass import EfiSectionClassObject
|
||||
import shutil
|
||||
from Common import EdkLogger
|
||||
from Common.BuildToolError import *
|
||||
from Common.Misc import PeImageClass
|
||||
|
||||
## generate rule section
|
||||
#
|
||||
@ -78,6 +80,12 @@ class EfiSection (EfiSectionClassObject):
|
||||
FileList = []
|
||||
if Filename != None:
|
||||
Filename = GenFdsGlobalVariable.MacroExtend(Filename, Dict)
|
||||
# check if the path is absolute or relative
|
||||
if os.path.isabs(Filename):
|
||||
Filename = os.path.normpath(Filename)
|
||||
else:
|
||||
Filename = os.path.normpath(os.path.join(FfsInf.EfiOutputPath, Filename))
|
||||
|
||||
if not self.Optional:
|
||||
FileList.append(Filename)
|
||||
elif os.path.exists(Filename):
|
||||
@ -121,7 +129,6 @@ class EfiSection (EfiSectionClassObject):
|
||||
f = open(File, 'r')
|
||||
VerString = f.read()
|
||||
f.close()
|
||||
# VerTuple = ('-n', '"' + VerString + '"')
|
||||
BuildNum = VerString
|
||||
if BuildNum != None and BuildNum != '':
|
||||
BuildNumTuple = ('-j', BuildNum)
|
||||
@ -131,11 +138,6 @@ class EfiSection (EfiSectionClassObject):
|
||||
OutputFileList.append(OutputFile)
|
||||
|
||||
else:
|
||||
# if StringData != None and len(StringData) > 0:
|
||||
# VerTuple = ('-n', '"' + StringData + '"')
|
||||
# else:
|
||||
# VerTuple = tuple()
|
||||
# VerString = ' ' + ' '.join(VerTuple)
|
||||
BuildNum = StringData
|
||||
if BuildNum != None and BuildNum != '':
|
||||
BuildNumTuple = ('-j', BuildNum)
|
||||
@ -221,6 +223,15 @@ class EfiSection (EfiSectionClassObject):
|
||||
Num = '%s.%d' %(SecNum , Index)
|
||||
OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
|
||||
File = GenFdsGlobalVariable.MacroExtend(File, Dict)
|
||||
|
||||
#Get PE Section alignment when align is set to AUTO
|
||||
if self.Alignment == 'Auto' and (SectionType == 'PE32' or SectionType == 'TE'):
|
||||
ImageObj = PeImageClass (File)
|
||||
if ImageObj.SectionAlignment < 0x400:
|
||||
self.Alignment = str (ImageObj.SectionAlignment)
|
||||
else:
|
||||
self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'
|
||||
|
||||
if File[(len(File)-4):] == '.efi':
|
||||
MapFile = File.replace('.efi', '.map')
|
||||
if os.path.exists(MapFile):
|
||||
@ -237,24 +248,25 @@ class EfiSection (EfiSectionClassObject):
|
||||
StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped')
|
||||
GenFdsGlobalVariable.GenerateFirmwareImage(
|
||||
StrippedFile,
|
||||
[GenFdsGlobalVariable.MacroExtend(File, Dict)],
|
||||
[File],
|
||||
Strip=True
|
||||
)
|
||||
File = StrippedFile
|
||||
|
||||
"""For TE Section call GenFw to generate TE image"""
|
||||
|
||||
if SectionType == 'TE':
|
||||
TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')
|
||||
GenFdsGlobalVariable.GenerateFirmwareImage(
|
||||
TeFile,
|
||||
[GenFdsGlobalVariable.MacroExtend(File, Dict)],
|
||||
[File],
|
||||
Type='te'
|
||||
)
|
||||
File = TeFile
|
||||
|
||||
"""Call GenSection"""
|
||||
GenFdsGlobalVariable.GenerateSection(OutputFile,
|
||||
[GenFdsGlobalVariable.MacroExtend(File)],
|
||||
[File],
|
||||
Section.Section.SectionType.get (SectionType)
|
||||
)
|
||||
OutputFileList.append(OutputFile)
|
||||
|
Reference in New Issue
Block a user