Use absolute path for Stitching zip

This patch will change the code to always use absolute path
for stitching zip file, if relative path is provide, code will
convert it to absolute path.

Signed-off-by: Raghava Gudla <raghava.gudla@intel.com>
This commit is contained in:
Raghava Gudla 2019-09-16 11:20:57 -07:00 committed by Maurice Ma
parent 8a019c7758
commit 8607b31ef0
1 changed files with 5 additions and 4 deletions

View File

@ -89,6 +89,7 @@ def get_config ():
'fitinput' : 'Output/input', 'fitinput' : 'Output/input',
'ifwiname' : 'SBL_IFWI', 'ifwiname' : 'SBL_IFWI',
'fit' : 'CSE/FIT/fit%s' % ('.exe' if os.name == 'nt' else ''), 'fit' : 'CSE/FIT/fit%s' % ('.exe' if os.name == 'nt' else ''),
'vsccommn' : 'CSE/FIT/vsccommn.bin',
'openssl' : 'Openssl/openssl.exe' if os.name == 'nt' else '/usr/bin/openssl', 'openssl' : 'Openssl/openssl.exe' if os.name == 'nt' else '/usr/bin/openssl',
'cseimg' : 'CSE/Silicon/cse_image.bin', 'cseimg' : 'CSE/Silicon/cse_image.bin',
'acm' : 'ACM/acm.bin', 'acm' : 'ACM/acm.bin',
@ -490,6 +491,9 @@ def stitch (stitch_dir, stitch_zip, btg_profile, spi_quad_mode, platform_data, p
cfg_var = get_config () cfg_var = get_config ()
print ("\nUnpack files from stitching zip file ...") print ("\nUnpack files from stitching zip file ...")
if not os.path.isabs(stitch_zip):
stitch_zip = os.path.join(os.environ['SBL_SOURCE'], stitch_zip)
zf = zipfile.ZipFile(stitch_zip, 'r', zipfile.ZIP_DEFLATED) zf = zipfile.ZipFile(stitch_zip, 'r', zipfile.ZIP_DEFLATED)
zf.extractall(os.path.join(stitch_dir, cfg_var['fitinput'])) zf.extractall(os.path.join(stitch_dir, cfg_var['fitinput']))
zf.close() zf.close()
@ -507,7 +511,7 @@ def stitch (stitch_dir, stitch_zip, btg_profile, spi_quad_mode, platform_data, p
fd.close() fd.close()
print ("\nChecking and copying components ...") print ("\nChecking and copying components ...")
copy_list = ['cseimg', 'pmc', 'gbe', 'ec', 'ecptr', 'acm', 'fit'] copy_list = ['cseimg', 'pmc', 'gbe', 'ec', 'ecptr', 'acm', 'fit', 'vsccommn']
for each in ['fit', 'openssl'] + copy_list: for each in ['fit', 'openssl'] + copy_list:
if not os.path.exists(cfg_var[each]): if not os.path.exists(cfg_var[each]):
raise Exception ("Could not find file '%s' !" % cfg_var[each]) raise Exception ("Could not find file '%s' !" % cfg_var[each])
@ -515,9 +519,6 @@ def stitch (stitch_dir, stitch_zip, btg_profile, spi_quad_mode, platform_data, p
for each in copy_list: for each in copy_list:
shutil.copy (cfg_var[each], cfg_var['fitinput']) shutil.copy (cfg_var[each], cfg_var['fitinput'])
fit_dir = stitch_dir + '/' + os.path.dirname(cfg_var['fit'])
shutil.copy (os.path.join(fit_dir, 'vsccommn.bin'), cfg_var['fitinput'])
gen_xml_file(stitch_dir, cfg_var, btg_profile, spi_quad_mode, platform) gen_xml_file(stitch_dir, cfg_var, btg_profile, spi_quad_mode, platform)
print ("Run fit tool to generate ifwi.........") print ("Run fit tool to generate ifwi.........")