Skip to content

Commit 2ca6162

Browse files
committed
bfb-install: Convert to flat BFB for runtime upgrade
This commit converts bundle BFB to flat BFB during runtime upgrade. RM #4449636
1 parent 26c7410 commit 2ca6162

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

scripts/bfb-install

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -644,12 +644,12 @@ if [ $? != 0 ]; then echo "Command line error" >&2; exit 1; fi
644644
eval set -- $options
645645
while [ "$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 ;;
@@ -802,6 +802,12 @@ fi
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.
806812
if [ -n "${pldm}" ]; then
807813
if [ $mode == "remote" ] ; then
@@ -859,9 +865,33 @@ 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=${TMP_DIR}/bfb/$(basename "${bfb}")/${psid}/flat.bfb
891+
fi
862892
fi
863893

864-
# Check if bfb file exists
894+
# Check again if bfb file exists
865895
if [ ! -e "${bfb}" ]; then
866896
echo "Error: ${bfb} not found."
867897
exit 1
@@ -952,12 +982,6 @@ if [ -z "${pv}" ]; then
952982
echo "Warn: 'pv' command not found. Continue without showing BFB progress."
953983
fi
954984

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-
961985
if [ ${nic_mode} -eq 1 -a -n "${pcie_bd}" -a ${runtime} -eq 0 ]; then
962986
# Set BREADCRUMB.BIT32 to indicate NIC mode.
963987
breadcrumb1=$(${BF_REG} $(basename ${rshim_node}) ${RSH_BREADCRUMB1}.64 | awk '{print $3}')

0 commit comments

Comments
 (0)