Update Mellanox firmware under Ubuntu

Install

boot from Ubuntu Live CD
 
wget http://www.mellanox.com/downloads/MFT/mft-3.1.0-8.tgz -P /tmp
tar xzf /tmp/mft-*.tgz -C /tmp
 
apt-get update
apt-get install -y rpm2cpio
 
# compile kernel module
cd /tmp
rpm2cpio /tmp/mft-*/SRPMS/kernel-mft-*.src.rpm | cpio -i --make-directories
tar xzf /tmp/kernel-mft-*.tgz -C /tmp/
cd /tmp/kernel-mft-*
apt-get install -y linux-headers-$(uname -r)
apt-get install -y make
apt-get install gcc -y --no-install-recommends
make
mkdir /lib/modules/$(uname -r)/kernel/drivers/mft/
cp /tmp/kernel-mft-*/mst_pciconf.ko /lib/modules/$(uname -r)/kernel/drivers/mft/
cp /tmp/kernel-mft-*/mst_pci.ko /lib/modules/$(uname -r)/kernel/drivers/mft/
depmod -a
 
# extract programms
cd /tmp
rpm2cpio /tmp/mft-*/RPMS/mft-*.x86_64.rpm | cpio -i --make-directories
cp /tmp/usr/bin/minit /usr/bin/
cp /tmp/usr/bin/mcra /usr/bin/
 
# initialize
/tmp/etc/init.d/mst start
 
# get controller info
for MST in $(mst status | grep "mst" | cut -d" " -f1); do
    flint -d ${MST} query #| egrep "FW Version|UEFI|PSID"
    echo
done
 
Image type:      ConnectX
FW Version:      2.10.0
Rom Info:        type=PXE  version=3.3.420 devid=4099 proto=VPI
Device ID:       4099
Description:     Node             Port1            Port2            Sys image
GUIDs:           ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff 
MACs:                                 0002c9350000     0002c9351111
Board ID:         (MT_1080120023)
VSD:             
PSID:            MT_1080120023
 
# get board id for update
/tmp/usr/bin/flint -d /dev/mst/mt4099_pci_cr0 query | grep PSID | cut -d":" -f2 | tr -d ' '
http://www.mellanox.com/supportdownloader/
 
<strong>download firmware</strong>
wget http://www.mellanox.com/downloads/firmware/fw-ConnectX3-rel-2_34_5000-MCX311A-XCA_Ax-FlexBoot-3.4.521.bin.zip -P /tmp
#wget http://www.mellanox.com/downloads/firmware/fw-ConnectX3-rel-2_31_5050-MCX312A-XCB_A2-A6-FlexBoot-3.4.225_ETH.bin.zip -P /tmp
apt-get install -y unzip
unzip /tmp/fw-ConnectX3-rel-*-MCX312A-XCB_A2-A6-FlexBoot-*.bin.zip -d /tmp/
 
<strong>update firmware</strong>
#/tmp/usr/bin/flint -d /dev/mst/mt4099_pci_cr0 -i /tmp/fw-ConnectX3-rel-2_11_0500-MCX312A-XCB_A2-A5-Flexboot-3.4.000.bin b
/usr/bin/flint -d /dev/mst/mt4099_pci_cr0 -i /tmp/fw-ConnectX3-rel-2_31_5050-MCX312A-XCB_A2-A6-FlexBoot-3.4.225_ETH.bin b
    Note: Both the image file and the flash contain a ROM image.
          Select "yes" to use the ROM from the given image file.
          Select "no" to keep the existing ROM in the flash
    Current ROM info on flash: type=PXE  version=3.3.420 devid=4099 proto=VPI
    ROM info from image file : type=PXE  version=3.4.0 devid=4099 proto=VPI
 
 Use the ROM from the image file ? (y/n) [n] : y
 
    Current FW version on flash:  2.10.0
    New FW version:               2.11.500
 
Burning FW image without signatures  - OK  
Restoring signature                  - OK  
 
for MST in $(mst status | grep "mst" | cut -d" " -f1); do
    flint -d ${MST} query | grep PSID | cut -d":" -f2 | tr -d ' '
    echo
done

Links
http://www.mellanox.com/page/firmware_HCA_FW_identification - Firmware Support and Downloads - Identifying Adapter Cards
http://www.mellanox.com/page/firmware_table_IBM
http://www.mellanox.com/page/firmware_HCA_FW_update
http://www.mellanox.com/page/firmware_NIC_FW_update
http://www.mellanox.com/content/pages.php?pg=firmware_HCA_FW_update
http://www.mellanox.com/pdf/MFT/ESXi_bootable_mst_README.txt
http://www.mellanox.com/page/products_dyn?product_family=27
http://www.mellanox.com/page/products_dyn?product_family=26&mtag=linux_sw_drivers
http://www.mellanox.com/page/infiniband_cards_overview
http://www.mellanox.com/page/firmware_table_ConnectX2EN
http://www.mellanox.com/content/pages.php?pg=firmware_HCA_FW_identification
http://www.mellanox.com/content/pages.php?pg=management_tools&menu_section=34
http://packages.ubuntu.com/search?searchon=names&keywords=libmlx