HowTo Compile MLNX_OFED Drivers  (mlnx-ofa_kernel example)

Version 3

    This post shows how to compile MLNX_OFED drivers. In this example we don't show how to compile all rpms but only mlnx-ofa_kernel.



    • MLNX_OFED User Manual



    Some features requires recompilation of the MLNX_OFED driver with special flags.



    In order to compile (or recompile) Mellanox drivers with a special flag, follow these steps:


    1. Download the MLNX_OFED driver and install it.

    2. Extract the source packages from the MLNX_OFED directory.

    # cd /tmp

    # tar xzf <path to MLNX_OFED package>/src/MLNX_OFED_SRC-3.2-

    # cd /tmp/MLNX_OFED_SRC-3.2-


    3. Get the configure options used to build the currently installed MLNX_OFED by running /etc/infiniband/info:

    # /etc/infiniband/info




    Configure options: --with-core-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-mthca-mod --with-mlx4-mod --with-mlx4_en-mod --with-mlx4_vnic-mod --with-mlx5-mod --with-cxgb3-mod --with-cxgb4-mod --with-nes-mod --with-ipoib-mod --with-amso1100-mod --with-sdp-mod --with-srp-mod --with-rds-mod --with-iser-mod --with-e_ipoib-mod --with-nfsrdma-mod --with-9pnet_rdma-mod --with-9p-mod --with-cxgb3i-mod --with-cxgb4i-mod


    4. Build the rpms using the rpmbuild command and pass the configure options. You can add special flags to enable some functionality that is disabled by default.

    This example builds mlnx-ofa_kernel:

    # rpmbuild --rebuild  --define "_topdir $PWD/kernel" --nodeps --define '_dist %{nil}' --define 'configure_options <options taken from /etc/infiniband/info + custom options if needed>' --define '_prefix /usr' SRPMS/mlnx-ofa_kernel-*.src.rpm


    For example:

    # rpmbuild --rebuild  --define "_topdir $PWD/kernel" --nodeps --define '_dist %{nil}' --define 'configure_options --with-core-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-mthca-mod --with-mlx4-mod --with-mlx4_en-mod --with-mlx4_vnic-mod --with-mlx5-mod --with-cxgb3-mod --with-cxgb4-mod --with-nes-mod --with-ipoib-mod --with-amso1100-mod --with-sdp-mod --with-srp-mod --with-rds-mod --with-iser-mod --with-e_ipoib-mod --with-nfsrdma-mod --with-9pnet_rdma-mod --with-9p-mod --with-cxgb3i-mod --with-cxgb4i-mod ' --define '_prefix /usr' SRPMS/mlnx-ofa_kernel-*.src.rpm

    Note: In this case, the rpms will be created under the following directory:



    5. Remove previously installed rpms:

    # rpm -e --nodeps $(rpm -qa | grep "mlnx-ofa_kernel")

    6. Install new rpms:

    # rpm  -ivh --nodeps --force /tmp/MLNX_OFED_SRC-3.2-*mlnx-ofa_kernel*


    7. Reload the driver:

    # /etc/init.d/openibd restart