Enhance the tool

When BOARD_PKG_NAME_OVERRIDE is configured, the tool will firstly
search from BOARD_PKG_NAME_OVERRIDE, then search BOARD_PKG_NAME
for dlt and vbt files. It also uses BOARD_PKG_NAME_OVERRIDE for the
VerInfo file.

Signed-off-by: Guo Dong <guo.dong@intel.com>
This commit is contained in:
Guo Dong 2021-12-13 10:51:12 -07:00
parent e3cc5cacac
commit d0fac9b442
2 changed files with 25 additions and 5 deletions

View File

@ -532,7 +532,7 @@ def gen_flash_map_bin (flash_map_file, comp_list):
def copy_expanded_file (src, dst): def copy_expanded_file (src, dst):
gen_cfg_data ("GENDLT", src, dst) gen_cfg_data ("GENDLT", src, dst)
def gen_config_file (fv_dir, brd_name, platform_id, pri_key, cfg_db_size, cfg_size, cfg_int, cfg_ext, sign_scheme, hash_type, svn): def gen_config_file (fv_dir, brd_name_override, brd_name, platform_id, pri_key, cfg_db_size, cfg_size, cfg_int, cfg_ext, sign_scheme, hash_type, svn):
# Remove previous generated files # Remove previous generated files
for file in glob.glob(os.path.join(fv_dir, "CfgData*.*")): for file in glob.glob(os.path.join(fv_dir, "CfgData*.*")):
os.remove(file) os.remove(file)
@ -544,6 +544,8 @@ def gen_config_file (fv_dir, brd_name, platform_id, pri_key, cfg_db_size, cfg_si
# Generate CFG data # Generate CFG data
brd_name_dir = os.path.join(os.environ['PLT_SOURCE'], 'Platform', brd_name) brd_name_dir = os.path.join(os.environ['PLT_SOURCE'], 'Platform', brd_name)
if not os.path.exists(brd_name_dir):
brd_name_dir = os.path.join(os.environ['SBL_SOURCE'], 'Platform', brd_name)
comm_brd_dir = os.path.join(os.environ['SBL_SOURCE'], 'Platform', 'CommonBoardPkg') comm_brd_dir = os.path.join(os.environ['SBL_SOURCE'], 'Platform', 'CommonBoardPkg')
brd_cfg_dir = os.path.join(brd_name_dir, 'CfgData') brd_cfg_dir = os.path.join(brd_name_dir, 'CfgData')
com_brd_cfg_dir = os.path.join(comm_brd_dir, 'CfgData') com_brd_cfg_dir = os.path.join(comm_brd_dir, 'CfgData')
@ -558,6 +560,8 @@ def gen_config_file (fv_dir, brd_name, platform_id, pri_key, cfg_db_size, cfg_si
cfg_bin_int_file = os.path.join(fv_dir, "CfgDataInt.bin") #_INT_CFG_DATA_FILE settings cfg_bin_int_file = os.path.join(fv_dir, "CfgDataInt.bin") #_INT_CFG_DATA_FILE settings
cfg_bin_ext_file = os.path.join(fv_dir, "CfgDataExt.bin") #_EXT_CFG_DATA_FILE settings cfg_bin_ext_file = os.path.join(fv_dir, "CfgDataExt.bin") #_EXT_CFG_DATA_FILE settings
cfg_comb_dsc_file = os.path.join(fv_dir, 'CfgDataDef.' + file_ext) cfg_comb_dsc_file = os.path.join(fv_dir, 'CfgDataDef.' + file_ext)
if brd_name_override != '':
brd_cfg2_dir = os.path.join(os.environ['PLT_SOURCE'], 'Platform', brd_name_override, 'CfgData')
# Generate parsed result into pickle file to improve performance # Generate parsed result into pickle file to improve performance
if os.path.exists(cfg_dsc_dyn_file): if os.path.exists(cfg_dsc_dyn_file):
@ -578,7 +582,13 @@ def gen_config_file (fv_dir, brd_name, platform_id, pri_key, cfg_db_size, cfg_si
cfg_bin_list = [] cfg_bin_list = []
for dlt_file in cfg_file_list: for dlt_file in cfg_file_list:
cfg_dlt_file = ''
if brd_name_override != '':
cfg_dlt_file = os.path.join(brd_cfg2_dir, dlt_file)
if cfg_dlt_file == '' or not os.path.exists(cfg_dlt_file):
cfg_dlt_file = os.path.join(brd_cfg_dir, dlt_file) cfg_dlt_file = os.path.join(brd_cfg_dir, dlt_file)
if not os.path.exists(cfg_dlt_file): if not os.path.exists(cfg_dlt_file):
test_file = os.path.join(fv_dir, dlt_file) test_file = os.path.join(fv_dir, dlt_file)
if os.path.exists(test_file): if os.path.exists(test_file):
@ -625,6 +635,10 @@ def gen_config_file (fv_dir, brd_name, platform_id, pri_key, cfg_db_size, cfg_si
# copy delta files # copy delta files
dlt_list = cfg_int[1:] + cfg_ext dlt_list = cfg_int[1:] + cfg_ext
for dlt_file in dlt_list: for dlt_file in dlt_list:
src_dlt_file = ''
if brd_name_override != '':
src_dlt_file = os.path.join(brd_cfg2_dir, dlt_file)
if src_dlt_file == '' or not os.path.exists(src_dlt_file):
src_dlt_file = os.path.join (brd_cfg_dir, dlt_file) src_dlt_file = os.path.join (brd_cfg_dir, dlt_file)
if not os.path.exists(src_dlt_file): if not os.path.exists(src_dlt_file):
src_dlt_file = os.path.join (fv_dir, dlt_file) src_dlt_file = os.path.join (fv_dir, dlt_file)

View File

@ -1199,6 +1199,8 @@ class Build(object):
ver_info_name = 'VerInfo' ver_info_name = 'VerInfo'
ver_bin_file = os.path.join(self._fv_dir, ver_info_name + '.bin') ver_bin_file = os.path.join(self._fv_dir, ver_info_name + '.bin')
ver_txt_file = os.path.join(os.environ['PLT_SOURCE'], 'Platform', self._board.BOARD_PKG_NAME, ver_info_name + '.txt') ver_txt_file = os.path.join(os.environ['PLT_SOURCE'], 'Platform', self._board.BOARD_PKG_NAME, ver_info_name + '.txt')
if hasattr(self._board, 'BOARD_PKG_NAME_OVERRIDE'):
ver_txt_file = os.path.join(os.environ['PLT_SOURCE'], 'Platform', self._board.BOARD_PKG_NAME_OVERRIDE, ver_info_name + '.txt')
keys = ['VERINFO_IMAGE_ID', 'VERINFO_BUILD_DATE', 'VERINFO_PROJ_MINOR_VER', keys = ['VERINFO_IMAGE_ID', 'VERINFO_BUILD_DATE', 'VERINFO_PROJ_MINOR_VER',
'VERINFO_PROJ_MAJOR_VER', 'VERINFO_CORE_MINOR_VER', 'VERINFO_CORE_MAJOR_VER', 'VERINFO_PROJ_MAJOR_VER', 'VERINFO_CORE_MINOR_VER', 'VERINFO_CORE_MAJOR_VER',
@ -1215,6 +1217,9 @@ class Build(object):
# create VBT file # create VBT file
if self._board.HAVE_VBT_BIN: if self._board.HAVE_VBT_BIN:
if hasattr(self._board, 'BOARD_PKG_NAME_OVERRIDE'):
gen_vbt_file (self._board.BOARD_PKG_NAME_OVERRIDE, self._board._MULTI_VBT_FILE, os.path.join(self._fv_dir, 'Vbt.bin'))
else:
gen_vbt_file (self._board.BOARD_PKG_NAME, self._board._MULTI_VBT_FILE, os.path.join(self._fv_dir, 'Vbt.bin')) gen_vbt_file (self._board.BOARD_PKG_NAME, self._board._MULTI_VBT_FILE, os.path.join(self._fv_dir, 'Vbt.bin'))
# create platform include dsc file # create platform include dsc file
@ -1237,7 +1242,8 @@ class Build(object):
if self._board.CFGDATA_SIZE > 0: if self._board.CFGDATA_SIZE > 0:
svn = self._board.CFGDATA_SVN svn = self._board.CFGDATA_SVN
# create config data files # create config data files
gen_config_file (self._fv_dir, self._board.BOARD_PKG_NAME, self._board._PLATFORM_ID, board_override_name = getattr(self._board, 'BOARD_PKG_NAME_OVERRIDE', '')
gen_config_file (self._fv_dir, board_override_name, self._board.BOARD_PKG_NAME, self._board._PLATFORM_ID,
self._board._CFGDATA_PRIVATE_KEY, self._board.CFG_DATABASE_SIZE, self._board.CFGDATA_SIZE, self._board._CFGDATA_PRIVATE_KEY, self._board.CFG_DATABASE_SIZE, self._board.CFGDATA_SIZE,
self._board._CFGDATA_INT_FILE, self._board._CFGDATA_EXT_FILE, self._board._CFGDATA_INT_FILE, self._board._CFGDATA_EXT_FILE,
self._board._SIGNING_SCHEME, HASH_VAL_STRING[self._board.SIGN_HASH_TYPE], svn) self._board._SIGNING_SCHEME, HASH_VAL_STRING[self._board.SIGN_HASH_TYPE], svn)