#!/bin/sh "Use source to invoke this script" # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # $Source: src/build/vpo/Setup_Env $ # # IBM CONFIDENTIAL # # COPYRIGHT International Business Machines Corp. 2012,2013 # # p1 # # Object Code Only (OCO) source materials # Licensed Internal Code Source Materials # IBM HostBoot Licensed Internal Code # # The source code for this program is not published or otherwise # divested of its trade secrets, irrespective of what has been # deposited with the U.S. Copyright Office. # # Origin: 30 # # IBM_PROLOG_END_TAG ################################################################################ # # Setup intialization source script for HostBoot Sprint Release VPO/VBU model # testing with cronus tools # # # Version 1.0 Copy from Jim's on 03/21/2012, tested on VBU & VPO # Version 1.1 04-16-2012 Update to run with sprint 11 image # Sync with Jim's version. # Version 1.2 05-09-2012 Pick-up Jim's latest changes as of 05-09-2012 # Update default Cronus version to newer level # Update default HB_TOOLS level # Increase simclock cycles to 5000000 per loop # # Version 1.3 06-11-2012 Change "-c3" to "-cft" (first avail core) # Update to Cronus rel.20120611, HBTOOLS rel.20120611 # Build hb0606a_1219.810 # Add m_3_a Murano model # # Version 1.4 07-10-2012 Default HB_TOOLS to rel.20120710 # Update for new m_4_a model, default to new checkpoint # Load SPD data # # Version 1.5 10-09-2012 Added m_9_g/m_10_g/m_10_h models # # Version 1.6 01-03-2012 Updated for m_10_b, m_11_a ################################################################################ # Define useful pointers to automated tests/scripts export JP=/gsa/pokgsa/home/m/c/mcguirej/public export JR=$JP/auto/rel export JD=$JP/auto/dev export JT=$JP/auto/tmp export JS=$JP/HBI/scripts # Process arguments so they can be passed down to automated tools . $JR/autotest.args # Pick up any user specified command, otherwise default to no test export AUTOVBU_USER_CMD="`echo \"$my_arg_list\" | sed -n -e 's/[ ]*-- / -|- /' -e 's/.* -|- //p'`" test "$AUTOVBU_USER_CMD" = "" && AUTOVBU_USER_CMD=NO_TEST # Local values used in this script AUTOVBU_HBRELEASE_BASEDIR=/gsa/ausgsa/projects/h/hostboot/release AUTOVBU_HBTOOLS_BASEDIR=/afs/apd.pok.ibm.com/u/thi/hbtools AUTOVBU_HBVBUTOOLS_BASEDIR=/gsa/ausgsa/projects/h/hostboot/vbutools # Remove any previous test definitions for HostBoot values - force everything to default if not set # by Setup_MyEnv function or user specifed argument(s) unset HB_IMGDIR HB_RELDIR HB_VBUTOOLS DEFAULT_LEVEL unset AWAN_CONFIG AWAN_SCRIPT AUTOVBU_ECMD_VER unset AUTOVBU_START AUTOVBU_ISTEP_START AUTOVBU_ISTEP_LIST AUTOVBU_ISTEP_CHKPT unset ISTEP_ROOT ISTEP_ROOT_JIM unset HB_COUNT HB_COMMAND HB_SIMCLOCKS unset HB_VBUPNOR_ADDR HB_SYSMVPD_ADDR HB_SYSSPD_ADDR ################################################################################ # # User customizable environment setup function -- modify as desired for new test defaults # ################################################################################ Setup_MyEnv() { # Default Sprint release sprint=hb0107a_1250.810 # Initialize HostBoot environment/cronus/tools - note new naming convention export AUTOVBU_CRONUS_SIM=dev export ISTEP_ARCHIVE=archives/13.01.08 export GLOBAL_DEBUG=8.VW.Vc.dG.F3.0I.E8.V export HB_TOOLS=$AUTOVBU_HBTOOLS_BASEDIR/rel.20130110 # Select default model -- choose either VBU or VPO versions export VPO_MODEL=m_11_a; unset VBU_MODEL; VBUVPO=VPO # Default AWAN request time - shorter periods get AWAN faster export AWAN_TIME_REQ=-h24 # Default AWAN request server export ASUBMIT_SERVER=asubmit1.pok.ibm.com # Default sprint test case settings export AUTOVBU_CORE=-cft export AUTOVBU_SIMCLOCKS=5000000 export AUTOVBU_INITIAL_CHKPT=after_real_proc_sbe.chkpt export AUTOVBU_LOOPS=1200 export AUTOVBU_PRINTK_LINES=50 # Values used internally by automated tools export AUTOVPO_ROOTDIR=/afs/apd/func/awanng/vpo/vpo1/mur test "$MY_BSO_ID" = "" && echo "Warning: Set MY_BSO_ID to IBM intranet ID if BSO firewall required" return 0 } ################################################################################ # # End User Customizable section -- Please do not modify shell functions below # ################################################################################ # Parse any user specified arguments Setup_MyArgs() { # Set argument defaults get_awan= load_hb_img= # Argument parse loop while [ $# -gt 0 ] do case "$1" in -h|-help|--help) echo "Usage: source Setup_Env [-get_awan|--get_awan] \\" echo " [<-awan|--awan> ] \\" echo " [<-time|--time> ] \\" echo " [<-model|--model> ] \\" echo " [<-release|--release> ] \\" echo " [-load_hb_img|--load_hb_img] \\" echo " [<-ecmd_ver|--ecmd_ver> ] \\" echo " [<-cronus|--cronus> ] \\" echo " [--] [] []" return 1 ;; -get_awan|--get_awan) get_awan=YES ;; -awan|--awan) if [ $# -lt 2 ]; then echo "Missing/invalid AWAN configuation" return 1 fi export AWAN_CONFIG=$2 shift 1 ;; -load_hb_img|--load_hb_img) load_hb_img=YES ;; -model|--model) if [ $# -lt 2 ]; then echo "Missing/invalid model" return 1 fi export VPO_MODEL=$2 shift 1 ;; -release|--release) if [ $# -lt 2 ]; then echo "Missing/invalid release argument" return 1 fi sprint=$2 shift 1 ;; -cronus|--cronus) if [ $# -lt 2 ]; then echo "Missing/invalid cronus" return 1 fi export AUTOVBU_CRONUS_SIM=$2 shift 1 ;; -ecmd_ver|--ecmd_ver) if [ $# -lt 2 ]; then echo "Missing/invalid cronus version (cronusflex, p8s1)" return 1 fi export AUTOVBU_ECMD_VER=$2 shift 1 ;; -time|--time) if [ $# -lt 2 ]; then echo "Missing/invalid awan time" return 1 fi export AWAN_TIME_REQ="-$2" shift 1 ;; --) ;; *=*) # Add 'export' to each variable specified so it gets passed to test specific functions eval "export `echo \"$1\" | sed -e \"s/=/='/\" -e \"s/$/'/\"`" ;; *) ;; esac shift done } # Dynamically set/reset values based upon current model Setup_MyDynamic() { # Set remaining HostBoot variables now that we have all user supplied settings export HB_RELDIR=${HB_RELDIR-`echo $AUTOVBU_HBRELEASE_BASEDIR/*$sprint`} if [ ! -d "$HB_RELDIR" ]; then echo "Can not find Sprint Release directory: $HB_RELDIR" return 1 fi export HB_VBUTOOLS=${HB_VBUTOOLS-$AUTOVBU_HBVBUTOOLS_BASEDIR/$AUTOVBU_CRONUS_SIM} if [ ! -d "$HB_VBUTOOLS" ]; then echo "Can not find HB_VBUTOOLS directory for cronus version $AUTOVBU_CRONUS_SIM" return 1 fi export HB_IMGDIR=${HB_IMGDIR-$HB_RELDIR} # Set old names for backward compatibility export HBDIR=$HB_IMGDIR export HBRELDIR=$HB_RELDIR export HBTOOLS=$HB_TOOLS export VBUTOOLS=$HB_VBUTOOLS # Dynamically determine if specifed model is for VPO or VBU if [ "$VPO_MODEL" != "" ]; then if [ ! -d $AUTOVPO_ROOTDIR/$VPO_MODEL ]; then export VBU_MODEL=$VPO_MODEL; unset VPO_MODEL VBUVPO=VBU else VBUVPO=VPO; unset VBU_MODEL fi else VBUVPO=VBU fi # Set other defaults based upon MODEL case "$VPO_MODEL$VBU_MODEL" in s1_e8042_c0400_cen1_cen0*|m_10_b|s1_e8053_n8_p8_c0400_cen1_cen081_unopt_1|m_11_a) export AUTOVBU_ECMD_VER=${AUTOVBU_ECMD_VER-p8s1} export AWAN_CONFIG=${AWAN_CONFIG-star8b} unset DEFAULT_LEVEL ;; s1_e8052_nA_p8_c0400_cen1_cen081_unopt_1|s1_e8052_c0400_cen1_cen081_unopt_1|s1_e8050_c0400_cen1_cen081_unopt_1|s1_e8050_nA_p8_c0400_cen1_cen081_unopt_1|m_9_a|m_9_g|m_10_g) export AUTOVBU_ECMD_VER=${AUTOVBU_ECMD_VER-p8s1} export AWAN_CONFIG=${AWAN_CONFIG-star12b} unset DEFAULT_LEVEL ;; s1_e8052_nA_pC_c0400_cen1_cen081_unopt_1|s1_e8050_he_cen1_cen081_nA_pC_c0400_unopt_1|m_10_h) export AUTOVBU_ECMD_VER=${AUTOVBU_ECMD_VER-p8s1} export AWAN_CONFIG=${AWAN_CONFIG-star24b} unset DEFAULT_LEVEL ;; *) export AUTOVBU_ECMD_VER=${AUTOVBU_ECMD_VER-p8s1} export AWAN_SCRIPT=${AWAN_SCRIPT-run_script_star8b} export AWAN_CONFIG=${AWAN_CONFIG-star8b} ;; esac if [ "$AUTOVBU_ECMD_VER" = "cronusflex" ]; then export AWAN_SCRIPT=${AWAN_SCRIPT-run_script_${AWAN_CONFIG}_flex} else export AWAN_SCRIPT=${AWAN_SCRIPT-run_script_${AWAN_CONFIG}} fi # Try to dynamically set istep list if user did not supply a value if [ "$AUTOVBU_ISTEP_LIST" = "" -a -f $HB_IMGDIR/isteplist.csv ]; then export AUTOVBU_ISTEP_LIST=`sort -s -t ',' -k 1,1n -k2,2n $HB_IMGDIR/isteplist.csv | cut -d',' -f3 | tr '\n' ' '` elif [ "$AUTOVBU_ISTEP_LIST" = "" -a -f $HB_TOOLS/isteplist.csv ]; then export AUTOVBU_ISTEP_LIST=`cut -d',' -f3 <$HB_TOOLS/isteplist.csv | tr '\n' ' '` fi # Adjust PATH -- we want our tools at the beginning of the path, release tools at the end echo $PATH | grep "$HB_RELDIR" >/dev/null 2>&1 if [ $? -ne 0 ]; then PATH=$PATH:$HB_RELDIR fi # Needed for hb-dump/hb-Trace/etc... to find fsp-trace echo $PATH | grep "$HB_TOOLS" >/dev/null 2>&1 if [ $? -ne 0 ]; then PATH=$HB_TOOLS:$PATH fi } # Get the AWAN if requested by the user Setup_MyAWAN() { # Allow testing with an Austin based VNC server, but we must run in POK and lower BSO firewall if [ `hostname -d` != "pok.ibm.com" ]; then echo "ERROR: This script must be sourced on a POK based Linux system (batchl004, vpopok2 or vpopok3)" return 1 fi # Make sure DISPLAY includes our host name test "`expr index "$DISPLAY" ':'`" = "1" && DISPLAY=`hostname`$DISPLAY # Force common DISPLAY format ":" DISPLAY=`echo $DISPLAY | sed -e 's/\(:[^\.]*\).*/\1/'` # Defines used for AWAN communication MY_AWAN_TARGET=/afs/apd.pok.ibm.com/u/${MY_AFS_USER-$USER}/awan/awan.target-$VBU_MODEL$VPO_MODEL-${MY_AWAN_DIR-${MY_AFS_USER-$USER}}-$DISPLAY MY_AWAN_HAVE=/afs/apd.pok.ibm.com/u/${MY_AFS_USER-$USER}/awan/awan.HAVE-$VBU_MODEL$VPO_MODEL-${MY_AWAN_DIR-${MY_AFS_USER-$USER}}-$DISPLAY MY_AWAN_INIT=/afs/apd.pok.ibm.com/u/${MY_AFS_USER-$USER}/awan/awan.init-$VBU_MODEL$VPO_MODEL-${MY_AWAN_DIR-${MY_AFS_USER-$USER}}-$DISPLAY MY_AWAN_KEEP=/afs/apd.pok.ibm.com/u/${MY_AFS_USER-$USER}/awan/awan.KEEP-$VBU_MODEL$VPO_MODEL-${MY_AWAN_DIR-${MY_AFS_USER-$USER}}-$DISPLAY if [ "$get_awan" = "YES" ]; then unset ECMD_TARGET # Add environmental definitions for automated test eval export P8_${VBUVPO}DD1_${VPO_MODEL}${VBU_MODEL}_AWAN_SCRIPT="$AWAN_SCRIPT" eval export P8_${VBUVPO}DD1_${VPO_MODEL}${VBU_MODEL}_AUTOVBU_ECMD_VER="$AUTOVBU_ECMD_VER" eval export P8_${VBUVPO}DD1_${VPO_MODEL}${VBU_MODEL}_AUTOVBU_CRONUS_SIM="$AUTOVBU_CRONUS_SIM" #export -p | egrep "P8_${VBUVPO}DD1_.*AWAN_SCRIPT"; echo ( # Check to see if we must lower BSO firewall echo $DISPLAY | egrep "pok.ibm.com|boeblingen.de.ibm.com" >/dev/null if [ $? -eq 0 ]; then # POK/BOE based VNC servers should not need BSO unset MY_BSO_ID elif [ "$MY_BSO_ID" = "" ]; then echo "ERROR: DISPLAY is set to a system not in the POK domain, but MY_BSO_ID is not set" echo echo " export MY_BSO_ID=" echo return 1 fi unset my_bso_cmd test "$MY_BSO_ID" != "" && my_bso_cmd="--lower_firewall $MY_BSO_ID" # Pick up SIMDISPATCH level used by this cronus, and pass it to the AWAN request if [ -f "$ECMD_EXE" ]; then cronus_dir=`dirname $ECMD_EXE` if [ -f "$cronus_dir/SIMDISP_RELEASE" ]; then export SIMDISP_RELEASE=`cat $cronus_dir/SIMDISP_RELEASE` else unset SIMDISP_RELEASE fi fi # Request AWAN and wait for it to initialize echo echo "AUTOVBU_USER_CMD=$AUTOVBU_USER_CMD" echo echo "Requesting an AWAN:" echo vbuvpo=`echo $VBUVPO | tr '[A-Z]' '[a-z]'` echo "$JR/auto${vbuvpo}test $my_bso_cmd --silent --keep_awan SIMDISP_RELEASE=$SIMDISP_RELEASE AUTOVBU_ECMD_VER=$AUTOVBU_ECMD_VER AUTOVBU_CRONUS_SIM=$AUTOVBU_CRONUS_SIM \\" echo " -- : $VBU_MODEL$VPO_MODEL:$AWAN_CONFIG:HBI=\\\$AUTOVBU_USER_CMD" echo $JR/auto${vbuvpo}test $my_bso_cmd --silent --keep_awan SIMDISP_RELEASE=$SIMDISP_RELEASE AUTOVBU_ECMD_VER=$AUTOVBU_ECMD_VER AUTOVBU_CRONUS_SIM=$AUTOVBU_CRONUS_SIM \ -- : $VBU_MODEL$VPO_MODEL:$AWAN_CONFIG:HBI=\$AUTOVBU_USER_CMD ) || return 1 fi } # Setup our cronus target if we used the automated tool to acquire the AWAN Setup_MyTarget() { # Check for AWAN using automated tools if [ -f "$MY_AWAN_HAVE" ]; then if [ ! -f "$MY_AWAN_TARGET" ]; then # Pause a while for target to initialize for i in 0 1 2 3 4 5 do test -f "$MY_AWAN_TARGET" && break echo "Waiting for $MY_AWAN_TARGET" sleep 30 done fi fi if [ -f $MY_AWAN_TARGET ]; then my_target=`cat $MY_AWAN_TARGET` touch $MY_AWAN_KEEP else # User is doing things on their own -- target must be set already # my_target=`target query 2>/dev/null | sed -n -e '/Current target/s/.*is "\(.*\)"/\1/p'` my_target=$ECMD_TARGET if [ "$my_target" = "" ]; then echo "*** ERROR: Cronus target has not been set" return 1 fi fi echo target $my_target if [ -f "$CRONUS_HOME/cnfgs/${my_target}_cnfg" ]; then # Update target cronus config file setconfig HW_PROCEDURE_PATH $HB_VBUTOOLS -quiet getconfig HW_PROCEDURE_PATH -quiet setconfig GLOBAL_DEBUG $GLOBAL_DEBUG -quiet getconfig GLOBAL_DEBUG -quiet else echo echo "*** WARNING: AWAN target config file was not found" c=`dirname $CRONUS_HOME` if [ "$AUTOVBU_ECMD_VER" != "cronusflex" -a -f $c/cronusflex/cnfgs/${my_target}_cnfg ]; then echo "ERROR: AWAN is running cronusflex instead of $AUTOVBU_ECMD_VER" elif [ "$AUTOVBU_ECMD_VER" != "p8s1" -a -f $c/p8s1/cnfgs/${my_target}_cnfg ]; then echo "ERROR: AWAN is running cronus p8s1 instead of $AUTOVBU_ECMD_VER" else echo "User must manually set cronus target and update config file" fi return 1 fi return 0 } # Load HostBoot image if requested Setup_MyHBImage() { # User requested option? if [ "$load_hb_img" = "YES" ]; then # Load initial checkpoint first set -x siminit ${AUTOVBU_INITIAL_CHKPT-after_proc_sbe} -quiet || return 1 $HB_VBUTOOLS/p8_load_l3 -l ${DEFAULT_LEVEL-rel} -f ${HB_IMGDIR}/hbicore${use_test}.bin -b ${AUTOVBU_CORE--cft} || return 1 $HB_VBUTOOLS/p8_load_l3 -l ${DEFAULT_LEVEL-rel} -f ${HB_IMGDIR}/vbu${use_test}.pnor -o ${HB_VBUPNOR_ADDR-0x480000} -b ${AUTOVBU_CORE--cft} || return 1 if [ -f ${HB_IMGDIR}/sysmvpd.dat ]; then $HB_VBUTOOLS/p8_load_l3 -l ${DEFAULT_LEVEL-rel} -f ${HB_IMGDIR}/sysmvpd.dat -o ${HB_SYSMVPD_ADDR-0x481000} -b ${CORE--cft} || return 1 $HB_VBUTOOLS/p8_load_l3 -l ${DEFAULT_LEVEL-rel} -f ${HB_IMGDIR}/sysspd.dat -o ${HB_SYSSPD_ADDR-0x4C1000} -b ${CORE--cft} || return 1 fi putscom pu.ex 10013284 FAC0FAC0FAC0FAC0 -p0 -call -quiet set +x fi return 0 } # Define a shell function to clean up and release the AWAN AWAN_EXIT() { rm -f "$MY_AWAN_KEEP" my_target=`target query 2>/dev/null | sed -n -e '/Current target/s/.*is "\(.*\)"/\1/p'` if [ "$my_target" != "" -a -f "$CRONUS_HOME/cnfgs/${my_target}_cnfg" ]; then simexit -quiet echo "Delay for AWAN exit" sleep 60 fi } ################################################################################ # # Start performing environment setup # ################################################################################ # Include ECMD aliases if [ "$LABPS" != "" -a "$CTEPATH" != "" -a "$CTEUSRHOME" != "" ]; then source $CTEPATH/tools/ecmd/rel/bin/ecmdaliases.ksh else echo "ERROR: This script must be sourced while running in a p8lab window" return 1 fi # Perform user customizable setup Setup_MyEnv || return 1 # Now process any argument overrides eval Setup_MyArgs "`echo \"$my_arg_list\"`" || return 1 # Perform dynamic adjustments based upon current settings Setup_MyDynamic || return 1 # Print user banner of what we have setup echo echo "Performing HostBoot setup/initialization for $VBUVPO model $VBU_MODEL$VPO_MODEL" echo echo "Sprint Release directory: $HB_RELDIR" echo "Using HB_IMGDIR: $HB_IMGDIR" echo "Using ecmdsetup version: $AUTOVBU_ECMD_VER" echo "Using Cronus version: $AUTOVBU_CRONUS_SIM" echo "Using HB_VBUTOOLS version: `basename $HB_VBUTOOLS`" echo "Using HB_TOOLS version: `basename $HB_TOOLS`" echo sleep 2 # Setup ecmd/cronusflex ecmdsetup auto cro $AUTOVBU_ECMD_VER $AUTOVBU_CRONUS_SIM sim pok # Get an AWAN if requested, or reuse an existing connection if found Setup_MyAWAN || return 1 Setup_MyTarget || return 1 Setup_MyHBImage || return 1 echo echo "Current Settings" echo env | egrep "^AUTO|^AWAN|^HB_|^VPO|^VBU|^PGM_DIR|^ISTEP_|^J[PRS]=" | sort echo echo "To gracefully terminate your AWAN session enter: AWAN_EXIT" echo