@@ -644,12 +644,12 @@ if [ $? != 0 ]; then echo "Command line error" >&2; exit 1; fi
644644eval set -- $options
645645while [ " $1 " != -- ]; do
646646 case $1 in
647- --bfb|-b) shift ; bfb=$1 num_bfb=$(( num_bfb + 1 )) ;;
647+ --bfb|-b) shift ; bfb=$( readlink -f $1 ) num_bfb=$(( num_bfb + 1 )) ;;
648648 --config|-c) shift ; cfg=$1 ;;
649649 --rootfs|-f) shift ; rootfs=$1 ;;
650650 --help|-h) usage; exit 0 ;;
651651 --keep-log|-k) clear_on_read=0 ;;
652- --pldm|-p) shift ; pldm=$1 ;;
652+ --pldm|-p) shift ; pldm=$( readlink -f $1 ) ;;
653653 --remote-mode|-m) shift ; remote_mode=$1 ;;
654654 --rshim|-r) shift ; rshim=$1 num_rshim=$(( num_rshim + 1 )) ;;
655655 --reverse-nc|-R) reverse_nc=1 ;;
802802
803803# Setup checks
804804
805+ # Check BF chip version and adjust register offsets.
806+ apply_chip_settings
807+
808+ # Check NIC mode and unbind mlx5_core driver in NIC mode.
809+ check_nic_mode
810+
805811# Check PLDM and convert it into BFB.
806812if [ -n " ${pldm} " ]; then
807813 if [ $mode == " remote" ] ; then
@@ -859,9 +865,40 @@ if [ -n "${pldm}" ]; then
859865
860866 pldm=" "
861867 bfb=" ${TMP_DIR} /pldm/pldm.bfb"
868+ elif [ ${runtime} -eq 1 ]; then
869+ if [ ! -e " ${bfb} " ]; then
870+ echo " Error: ${bfb} not found."
871+ exit 1
872+ fi
873+
874+ # Convert bundle BFB to flat BFB if needed.
875+ # This conversion is only supported on PCIe host.
876+ is_bundle=$( mlx-mkbfb -d " ${bfb} " | grep " In-memory filesystem" )
877+ if [ -n " ${is_bundle} " -a -n " $pcie_bd " ]; then
878+ echo " Convert $( basename " ${bfb} " ) to flat format for runtime upgrade"
879+ psid=$( flint -d " $pcie_bd " .0 q | grep PSID | awk ' {print $2}' )
880+ if [ -z " ${psid} " ]; then
881+ echo " Error: failed to get PSID."
882+ exit 1
883+ fi
884+ mkdir ${TMP_DIR} /bfb
885+ bfb-tool repack --bfb " ${bfb} " --psid ${psid} \
886+ --output-dir ${TMP_DIR} /bfb --output-format flat \
887+ --output-bfb flat.bfb
888+ bfb=$( basename " ${bfb} " )
889+ bfb=${bfb% .* }
890+ bfb_path=${TMP_DIR} /bfb/" ${bfb} " /${psid}
891+ bfb=" ${bfb_path} " /flat.bfb
892+
893+ # Replace config file if provided.
894+ if [ -n " ${cfg} " -a -e " ${cfg} " ]; then
895+ mlx-mkbfb --boot-args ${cfg} ${bfb} " ${bfb_path} " /flat-cfg.bfb
896+ bfb=" ${bfb_path} " /flat-cfg.bfb
897+ fi
898+ fi
862899fi
863900
864- # Check if bfb file exists
901+ # Check again if bfb file exists
865902if [ ! -e " ${bfb} " ]; then
866903 echo " Error: ${bfb} not found."
867904 exit 1
@@ -952,12 +989,6 @@ if [ -z "${pv}" ]; then
952989 echo " Warn: 'pv' command not found. Continue without showing BFB progress."
953990fi
954991
955- # Check BF chip version and adjust register offsets.
956- apply_chip_settings
957-
958- # Check NIC mode and unbind mlx5_core driver in NIC mode.
959- check_nic_mode
960-
961992if [ ${nic_mode} -eq 1 -a -n " ${pcie_bd} " -a ${runtime} -eq 0 ]; then
962993 # Set BREADCRUMB.BIT32 to indicate NIC mode.
963994 breadcrumb1=$( ${BF_REG} $( basename ${rshim_node} ) ${RSH_BREADCRUMB1} .64 | awk ' {print $3}' )
0 commit comments