From fab5b361b29b20defc9a668c58fb2637bc186a76 Mon Sep 17 00:00:00 2001 From: gpunathilell Date: Thu, 19 Mar 2026 17:45:06 +0000 Subject: [PATCH] exit if firmware fails --- .../nvidia-bluefield/installer/install.sh.j2 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/platform/nvidia-bluefield/installer/install.sh.j2 b/platform/nvidia-bluefield/installer/install.sh.j2 index faf8c5755d8..0a04fb22f51 100755 --- a/platform/nvidia-bluefield/installer/install.sh.j2 +++ b/platform/nvidia-bluefield/installer/install.sh.j2 @@ -48,6 +48,18 @@ run_bash_session() { /bin/bash /dev/ttyAMA0 2>&1 } +# Run command like ex(); on failure start an interactive bash session for debugging +ex_or_bash_session() { + echo "Executing command: $@" > /dev/ttyAMA0 + local rc=0 + $@ 2>&1 > /dev/ttyAMA0 + rc=$? + if [[ $rc -ne 0 ]]; then + echo "RC: $rc" > /dev/ttyAMA0 + log "Command failed (exit $rc), starting debug bash session" + run_bash_session + fi +} rshim_log() { @@ -265,10 +277,10 @@ if [[ $SKIP_FIRMWARE_UPGRADE != "true" ]]; then fi ex chroot $sonic_fs_mountpoint mst start - ex chroot $sonic_fs_mountpoint /usr/local/bin/mlnx-fw-manager --nosyslog --verbose + ex_or_bash_session chroot $sonic_fs_mountpoint /usr/local/bin/mlnx-fw-manager --nosyslog --verbose if [[ $FORCE_FW_CONFIG_RESET == "true" ]]; then - ex chroot $sonic_fs_mountpoint /usr/local/bin/mlnx-fw-manager --reset --nosyslog --verbose + ex_or_bash_session chroot $sonic_fs_mountpoint /usr/local/bin/mlnx-fw-manager --reset --nosyslog --verbose fi ex umount $sonic_fs_mountpoint/host