@@ -800,6 +800,17 @@ if [ $verbose -eq 1 ]; then
800800 echo " RSHIM Device Node: $rshim_node "
801801fi
802802
803+ # Root access check.
804+ check_root_cmd=" [ \$ (id -u) -eq 0 ]"
805+ echo " Checking if local host has root access..."
806+ if ! eval " $check_root_cmd " ; then
807+ echo " Warning: No host root access. Trying sudo"
808+ sudo_prefix=" sudo"
809+ fi
810+
811+ # rshim is ready to use.
812+ run_cmd_local_ready=1
813+
803814# Setup checks
804815
805816# Check BF chip version and adjust register offsets.
@@ -876,6 +887,10 @@ elif [ ${runtime} -eq 1 ]; then
876887 is_bundle=$( mlx-mkbfb -d " ${bfb} " | grep " In-memory filesystem" )
877888 if [ -n " ${is_bundle} " -a -n " $pcie_bd " ]; then
878889 echo " Convert $( basename " ${bfb} " ) to flat format for runtime upgrade"
890+ if ! which flint & > /dev/null; then
891+ echo " Error: flint not found."
892+ exit 1
893+ fi
879894 psid=$( flint -d " $pcie_bd " .0 q | grep PSID | awk ' {print $2}' )
880895 if [ -z " ${psid} " ]; then
881896 echo " Error: failed to get PSID."
@@ -916,15 +931,6 @@ if [ -n "${cfg}" ] && [ ! -e "${cfg}" ]; then
916931 exit 1
917932fi
918933
919- check_root_cmd=" [ \$ (id -u) -eq 0 ]"
920- echo " Checking if local host has root access..."
921- if ! eval " $check_root_cmd " ; then
922- echo " Warning: No host root access. Trying sudo"
923- sudo_prefix=" sudo"
924- fi
925-
926- run_cmd_local_ready=1
927-
928934rshim_check_cmd=" [ -e ${rshim_node} /boot ]"
929935
930936if [ $mode == " local" ]; then
0 commit comments