mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-22 21:24:35 +02:00
IntelFsp2Pkg/GenCfgOpt: skip unnecessarily header/BSF recreating.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2967 When no change in FSP UPD DSC files, GenCfgOpt.py should skip recreating UPD header and BSF files. This patch added a check to handle this case. Cc: Maurice Ma <maurice.ma@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Star Zeng <star.zeng@intel.com> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com> Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
parent
ae511331e0
commit
cc942105ed
@ -810,6 +810,17 @@ EndList
|
|||||||
SubItem['value'] = valuestr
|
SubItem['value'] = valuestr
|
||||||
return Error
|
return Error
|
||||||
|
|
||||||
|
def NoDscFileChange (self, OutPutFile):
|
||||||
|
NoFileChange = True
|
||||||
|
if not os.path.exists(OutPutFile):
|
||||||
|
NoFileChange = False
|
||||||
|
else:
|
||||||
|
DscTime = os.path.getmtime(self._DscFile)
|
||||||
|
OutputTime = os.path.getmtime(OutPutFile)
|
||||||
|
if DscTime > OutputTime:
|
||||||
|
NoFileChange = False
|
||||||
|
return NoFileChange
|
||||||
|
|
||||||
def CreateSplitUpdTxt (self, UpdTxtFile):
|
def CreateSplitUpdTxt (self, UpdTxtFile):
|
||||||
GuidList = ['FSP_T_UPD_TOOL_GUID','FSP_M_UPD_TOOL_GUID','FSP_S_UPD_TOOL_GUID']
|
GuidList = ['FSP_T_UPD_TOOL_GUID','FSP_M_UPD_TOOL_GUID','FSP_S_UPD_TOOL_GUID']
|
||||||
SignatureList = ['0x545F', '0x4D5F','0x535F'] # _T, _M, and _S signature for FSPT, FSPM, FSPS
|
SignatureList = ['0x545F', '0x4D5F','0x535F'] # _T, _M, and _S signature for FSPT, FSPM, FSPS
|
||||||
@ -823,16 +834,7 @@ EndList
|
|||||||
if UpdTxtFile == '':
|
if UpdTxtFile == '':
|
||||||
UpdTxtFile = os.path.join(FvDir, self._MacroDict[GuidList[Index]] + '.txt')
|
UpdTxtFile = os.path.join(FvDir, self._MacroDict[GuidList[Index]] + '.txt')
|
||||||
|
|
||||||
ReCreate = False
|
if (self.NoDscFileChange (UpdTxtFile)):
|
||||||
if not os.path.exists(UpdTxtFile):
|
|
||||||
ReCreate = True
|
|
||||||
else:
|
|
||||||
DscTime = os.path.getmtime(self._DscFile)
|
|
||||||
TxtTime = os.path.getmtime(UpdTxtFile)
|
|
||||||
if DscTime > TxtTime:
|
|
||||||
ReCreate = True
|
|
||||||
|
|
||||||
if not ReCreate:
|
|
||||||
# DSC has not been modified yet
|
# DSC has not been modified yet
|
||||||
# So don't have to re-generate other files
|
# So don't have to re-generate other files
|
||||||
self.Error = 'No DSC file change, skip to create UPD TXT file'
|
self.Error = 'No DSC file change, skip to create UPD TXT file'
|
||||||
@ -1056,7 +1058,11 @@ EndList
|
|||||||
HeaderFile = os.path.join(FvDir, HeaderFileName)
|
HeaderFile = os.path.join(FvDir, HeaderFileName)
|
||||||
|
|
||||||
# Check if header needs to be recreated
|
# Check if header needs to be recreated
|
||||||
ReCreate = False
|
if (self.NoDscFileChange (HeaderFile)):
|
||||||
|
# DSC has not been modified yet
|
||||||
|
# So don't have to re-generate other files
|
||||||
|
self.Error = 'No DSC file change, skip to create UPD header file'
|
||||||
|
return 256
|
||||||
|
|
||||||
TxtBody = []
|
TxtBody = []
|
||||||
for Item in self._CfgItemList:
|
for Item in self._CfgItemList:
|
||||||
@ -1382,6 +1388,12 @@ EndList
|
|||||||
self.Error = "BSF output file '%s' is invalid" % BsfFile
|
self.Error = "BSF output file '%s' is invalid" % BsfFile
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
if (self.NoDscFileChange (BsfFile)):
|
||||||
|
# DSC has not been modified yet
|
||||||
|
# So don't have to re-generate other files
|
||||||
|
self.Error = 'No DSC file change, skip to create UPD BSF file'
|
||||||
|
return 256
|
||||||
|
|
||||||
Error = 0
|
Error = 0
|
||||||
OptionDict = {}
|
OptionDict = {}
|
||||||
BsfFd = open(BsfFile, "w")
|
BsfFd = open(BsfFile, "w")
|
||||||
@ -1467,7 +1479,7 @@ EndList
|
|||||||
|
|
||||||
|
|
||||||
def Usage():
|
def Usage():
|
||||||
print ("GenCfgOpt Version 0.55")
|
print ("GenCfgOpt Version 0.56")
|
||||||
print ("Usage:")
|
print ("Usage:")
|
||||||
print (" GenCfgOpt UPDTXT PlatformDscFile BuildFvDir [-D Macros]")
|
print (" GenCfgOpt UPDTXT PlatformDscFile BuildFvDir [-D Macros]")
|
||||||
print (" GenCfgOpt HEADER PlatformDscFile BuildFvDir InputHFile [-D Macros]")
|
print (" GenCfgOpt HEADER PlatformDscFile BuildFvDir InputHFile [-D Macros]")
|
||||||
@ -1529,13 +1541,25 @@ def Main():
|
|||||||
print ("ERROR: %s !" % (GenCfgOpt.Error))
|
print ("ERROR: %s !" % (GenCfgOpt.Error))
|
||||||
return Ret
|
return Ret
|
||||||
elif sys.argv[1] == "HEADER":
|
elif sys.argv[1] == "HEADER":
|
||||||
if GenCfgOpt.CreateHeaderFile(OutFile) != 0:
|
Ret = GenCfgOpt.CreateHeaderFile(OutFile)
|
||||||
print ("ERROR: %s !" % GenCfgOpt.Error)
|
if Ret != 0:
|
||||||
return 8
|
# No change is detected
|
||||||
|
if Ret == 256:
|
||||||
|
print ("INFO: %s !" % (GenCfgOpt.Error))
|
||||||
|
else :
|
||||||
|
print ("ERROR: %s !" % (GenCfgOpt.Error))
|
||||||
|
return 8
|
||||||
|
return Ret
|
||||||
elif sys.argv[1] == "GENBSF":
|
elif sys.argv[1] == "GENBSF":
|
||||||
if GenCfgOpt.GenerateBsfFile(OutFile) != 0:
|
Ret = GenCfgOpt.GenerateBsfFile(OutFile)
|
||||||
print ("ERROR: %s !" % GenCfgOpt.Error)
|
if Ret != 0:
|
||||||
return 9
|
# No change is detected
|
||||||
|
if Ret == 256:
|
||||||
|
print ("INFO: %s !" % (GenCfgOpt.Error))
|
||||||
|
else :
|
||||||
|
print ("ERROR: %s !" % (GenCfgOpt.Error))
|
||||||
|
return 9
|
||||||
|
return Ret
|
||||||
else:
|
else:
|
||||||
if argc < 5:
|
if argc < 5:
|
||||||
Usage()
|
Usage()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user