diff options
Diffstat (limited to 'sbe/build/tools/sbePrime.py')
-rwxr-xr-x | sbe/build/tools/sbePrime.py | 81 |
1 files changed, 59 insertions, 22 deletions
diff --git a/sbe/build/tools/sbePrime.py b/sbe/build/tools/sbePrime.py index d82d4215..021bad74 100755 --- a/sbe/build/tools/sbePrime.py +++ b/sbe/build/tools/sbePrime.py @@ -1,4 +1,28 @@ #!/usr/bin/python +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: sbe/build/tools/sbePrime.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# [+] International Business Machines Corp. +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# IBM_PROLOG_END_TAG ''' ########################################################### # @file sbePrime.py @@ -53,6 +77,8 @@ def main(): print " \t -i,--files = [ Optional ] Firmware Files coma ',' separated input file1,file2" print " \t Only the pre-define listed files bellow:" print " \t sbe_sp_intf.H,simics.tar,sbe_pibmem.bin,sbe_seeprom.bin" + print " \t -r,--rc_file = [ Optional ] The RC file for the sandbox (with absolute path)" + print " \t -n,--no_build = [ Optional ] Flag to determine if sbei component should be compiled" print " \t -h,--help = Help" print " ------------------------------------------------------------------------------------" @@ -85,11 +111,13 @@ def main(): sandbox_name = "None" path_name = "None" # PPE Repo file_name = "None" + rc_file = "None" + build = "1" #---------------------------- # Read command line args #---------------------------- - opts, args = getopt.getopt(sys.argv[1:],"p:s:i:h",['patch=', 'sb=', 'files=', 'help']) + opts, args = getopt.getopt(sys.argv[1:],"p:s:i:h:r:n",['patch=', 'sb=', 'files=', 'help', 'rc_file=', 'no_build']) for opt, arg in opts: if opt in ('-h', '--help'): usage() @@ -100,6 +128,10 @@ def main(): sandbox_name = arg elif opt in ('-i', '--files'): file_name = arg + elif opt in ('-r', '--rc_file'): + rc_file = arg + elif opt in ('--no_build'): + build = "0" else: usage() exit_main(errorcode.ERROR_EXIT) @@ -149,7 +181,8 @@ def main(): if sandbox_name == "None": sandbox_root = utilcode.utilFind_ENV_string("SANDBOXROOT").rstrip('\n') else: - sandbox_root = utilcode.utilFind_ENV_string("SANDBOXRC").rstrip('\n') +# sandbox_root = utilcode.utilFind_ENV_string("SANDBOXRC").rstrip('\n') + sandbox_root = utilcode.utilFind_sb_rc(sandbox_name).rstrip('\n') if sandbox_root == "None": print " ** [ ERROR ] Something Fishy about the ENV set -OR- Option used.. Please check manually ** " @@ -229,27 +262,31 @@ def main(): sb_name=os.path.basename(sandbox_path) print "\n Sandbox :",sb_name - #---------------------------------------- - # 5) Wite the hook file into shell file - #---------------------------------------- - # Write the compile shell hook on the fips sandbox location - hook_file = utilcode.utilWriteShell_hooks(sandbox_path) - - #---------------------------------------- - # 6) Compile the code - #---------------------------------------- - # Use the hook script to compile the code - if sandbox_name == "None": - compile_cmd="workon -m ppc " + sb_name + " -c " + hook_file + " -rc " + sandbox_root +"/sbesandboxrc" - else: - compile_cmd="workon -m ppc " + sb_name + " -c " + hook_file + " -rc " + sandbox_root +"/.sandboxrc" - - print "\n [ COMPILE ] Executing :%s \n"%compile_cmd - rc = os.system(compile_cmd) + if build == "1": + #---------------------------------------- + # 5) Wite the hook file into shell file + #---------------------------------------- + # Write the compile shell hook on the fips sandbox location + hook_file = utilcode.utilWriteShell_hooks(sandbox_path) - print " Compilation returned rc :",rc - if rc != 0: - exit_main(errorcode.ERROR_BUILD_FAILED) + #---------------------------------------- + # 6) Compile the code + #---------------------------------------- + # Use the hook script to compile the code + if sandbox_name == "None": + compile_cmd="workon -m ppc " + sb_name + " -c " + hook_file + " -rc " + sandbox_root +"/sbesandboxrc" + else: + if rc_file == "None": + compile_cmd="workon -m ppc " + sb_name + " -c " + hook_file + " -rc " + sandbox_root +"/.sandboxrc" + else: + print " getting rc file from user \n" + compile_cmd="workon -m ppc " + sb_name + " -c " + hook_file + " -rc " + rc_file + print "\n [ COMPILE ] Executing :%s \n"%compile_cmd + rc = os.system(compile_cmd) + + print " Compilation returned rc :",rc + if rc != 0: + exit_main(errorcode.ERROR_BUILD_FAILED) # Clean exit exit_main(errorcode.SUCCESS_EXIT) |