## @file
# process rule section generation
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# 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
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
# Import Modules
#
from struct import *
import Section
import subprocess
import os
import shutil
from Common.BuildToolError import *
## generate rule section
#
#
## The constructor
#
# @param self The object pointer
#
## GenSection() method
#
# Generate rule section
#
# @param self The object pointer
# @param OutputPath Where to place output file
# @param ModuleName Which module this section belongs to
# @param SecNum Index of section
# @param KeyStringList Filter for inputs of section generation
# @param FfsInf FfsInfStatement object that contains this section data
# @param Dict dictionary contains macro and its value
# @retval tuple (Generated file name list, section alignment)
#
"""Prepare the parameter of GenSection"""
if FfsInf != None :
elif FfsInf.KeepRelocFromRule != None:
elif FfsInf.ShadowFromInfFile != None:
else:
"""If the file name was pointed out, add it in FileList"""
FileList = []
if Filename != None:
# check if the path is absolute or relative
else:
else:
if IsSect :
Index = 0
""" If Section type is 'VERSION'"""
OutputFileList = []
if SectionType == 'VERSION':
#StringData = FfsInf.Version
#VerTuple = ('-n', '"' + StringData + '"')
else:
BuildNumTuple = tuple()
OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
#Ui=StringData,
elif FileList != []:
OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
f.close()
#Ui=VerString,
else:
else:
BuildNumTuple = tuple()
#if VerString == '' and
if BuildNumString == '':
return [], None
else:
OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
#Ui=VerString,
#
# If Section Type is 'UI'
#
elif SectionType == 'UI':
OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
elif FileList != []:
OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
f.close()
else:
else:
return '', None
else:
OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))
else:
"""If File List is empty"""
if FileList == [] :
return [], None
else:
EdkLogger.error("GenFds", GENFDS_ERROR, "Output file for %s section could not be found for %s" % (SectionType, InfFileName))
else:
"""Convert the File to Section file one by one """
""" Copy Map file to FFS output path """
OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))
#Get PE Section alignment when align is set to AUTO
else:
if not NoStrip:
[File],
)
"""For TE Section call GenFw to generate TE image"""
if SectionType == 'TE':
[File],
Type='te'
)
"""Call GenSection"""
[File],
)