diff --git a/platform/mellanox/sonic-bfb-installer.sh b/platform/mellanox/sonic-bfb-installer.sh index 8f25f11acd3..523ec6ee302 100755 --- a/platform/mellanox/sonic-bfb-installer.sh +++ b/platform/mellanox/sonic-bfb-installer.sh @@ -279,11 +279,15 @@ bfb_install_call() { fi remove_cx_pci_device "$rshim" "$dpu" - # Construct bfb-install command - local cmd="timeout ${timeout_secs}s bfb-install -b $bfb -r $rshim" + # Create config file with NPU time for DPU time synchronization + local config_file=$(mktemp "${WORK_DIR}/bf_cfg.XXXXX") if [ -n "$appendix" ]; then - cmd="$cmd -c $appendix" + cat "$appendix" > "$config_file" fi + echo "NPU_TIME=$(date +%s)" >> "$config_file" + + # Construct bfb-install command + local cmd="timeout ${timeout_secs}s bfb-install -b $bfb -r $rshim -c $config_file" log_info "Installing bfb image on DPU connected to $rshim using $cmd" # Run installation with progress monitoring @@ -307,6 +311,8 @@ bfb_install_call() { cat "$result_file" fi + rm -f "$config_file" + # Stop rshim application and reset DPU stop_rshim_daemon "$rid" log_info "$rid: Resetting DPU $dpu" diff --git a/platform/nvidia-bluefield/installer/install.sh.j2 b/platform/nvidia-bluefield/installer/install.sh.j2 index 34732d13a2e..0772fb3c1e2 100755 --- a/platform/nvidia-bluefield/installer/install.sh.j2 +++ b/platform/nvidia-bluefield/installer/install.sh.j2 @@ -98,6 +98,15 @@ if [ -e /etc/bf.cfg ]; then . /etc/bf.cfg fi +if [ -n "$NPU_TIME" ]; then + log "Setting system time from NPU: $NPU_TIME" + date -s "@$NPU_TIME" + log "System time set to: $(date)" + if [ -e /dev/rtc0 ]; then + hwclock --systohc --utc + log "Hardware clock synced from system time" +fi + # Flags that can be overwritten by the bf.cfg declare -r SKIP_FIRMWARE_UPGRADE="${SKIP_FIRMWARE_UPGRADE:-false}" declare -r FORCE_FW_CONFIG_RESET="${FORCE_FW_CONFIG_RESET:-false}"