Add basic pre-build check for OpenSSL/NASM

Signed-off-by: Matt Borgerson <matthew.a.borgerson@intel.com>
This commit is contained in:
Matt Borgerson 2019-03-05 18:27:14 -08:00 committed by Maurice Ma
parent cc21783e0d
commit 90e61539bb
2 changed files with 26 additions and 0 deletions

View File

@ -819,6 +819,29 @@ def gen_ver_info_txt (ver_file, ver_info):
h_file.write('Dirty = %d\n' % ver_info.ImageVersion.Dirty)
h_file.close()
def check_for_openssl():
'''
Verify OpenSSL executable is available
'''
cmdline = os.path.join(os.environ.get('OPENSSL_PATH', ''), 'openssl')
try:
version = subprocess.check_output([cmdline, 'version'])
except:
print 'ERROR: OpenSSL not available. Please set OPENSSL_PATH.'
sys.exit(1)
return version
def check_for_nasm():
'''
Verify NASM executable is available
'''
cmdline = os.path.join(os.environ.get('NASM_PREFIX', ''), 'nasm')
try:
version = subprocess.check_output([cmdline, '-v'])
except:
print 'ERROR: NASM not available. Please set NASM_PREFIX.'
sys.exit(1)
return version
def rsa_sign_file (priv_key, pub_key, in_file, out_file, inc_dat = False, inc_key = False):
cmdline = os.path.join(os.environ.get ('OPENSSL_PATH', ''), 'openssl')

View File

@ -105,6 +105,9 @@ def prep_env ():
print "Unsupported operating system !"
sys.exit(1)
check_for_openssl()
check_for_nasm()
# Update Environment vars
os.environ['SBL_SOURCE'] = sblsource
os.environ['EDK_TOOLS_PATH'] = os.path.join(sblsource, 'BaseTools')