Search
j0ke.net Open Build Service
>
Projects
>
OFED
>
ofa_kernel
> ofa_kernel.spec
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File ofa_kernel.spec of Package ofa_kernel
# # Copyright (c) 2006 Mellanox Technologies. All rights reserved. # # This Software is licensed under one of the following licenses: # # 1) under the terms of the "Common Public License 1.0" a copy of which is # available from the Open Source Initiative, see # http://www.opensource.org/licenses/cpl.php. # # 2) under the terms of the "The BSD License" a copy of which is # available from the Open Source Initiative, see # http://www.opensource.org/licenses/bsd-license.php. # # 3) under the terms of the "GNU General Public License (GPL) Version 2" a # copy of which is available from the Open Source Initiative, see # http://www.opensource.org/licenses/gpl-license.php. # # Licensee has the right to choose one of the above licenses. # # Redistributions of source code must retain the above copyright # notice and one of the license notices. # # Redistributions in binary form must reproduce both the above copyright # notice, one of the license notices in the documentation # and/or other materials provided with the distribution. # # %{!?configure_options: %define configure_options %{nil}} # %{!?MEMTRACK: %define MEMTRACK 0} %define MEMTRACK %(if ( echo %{configure_options} | grep "with-memtrack" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define MADEYE %(if ( echo %{configure_options} | grep "with-madeye-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %{!?KVERSION: %define KVERSION %(uname -r)} %define krelver %(echo -n %{KVERSION} | sed -e 's/-/_/g') %{!?build_kernel_ib: %define build_kernel_ib 0} %{!?build_kernel_ib_devel: %define build_kernel_ib_devel 0} # Select packages to build %{!?include_ipoib_conf: %define include_ipoib_conf %(if ( echo %{configure_options} | grep "without-ipoibconf" > /dev/null ); then echo -n '0'; else echo -n '1'; fi)} %{!?modprobe_update: %define modprobe_update %(if ( echo %{configure_options} | grep "without-modprobe" > /dev/null ); then echo -n '0'; else echo -n '1'; fi)} # Kernel module packages to be included into kernel-ib %define build_mthca %(if ( echo %{configure_options} | grep "with-mthca-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_ipath %(if ( echo %{configure_options} | grep "with-ipath_inf-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_ehca %(if ( echo %{configure_options} | grep "with-ehca-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_ipoib %(if ( echo %{configure_options} | grep "with-ipoib-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_sdp %(if ( echo %{configure_options} | grep "with-sdp-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_srp %(if ( echo %{configure_options} | grep "with-srp-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_srpt %(if ( echo %{configure_options} | grep "with-srp-target-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_iser %(if ( echo %{configure_options} | grep "with-iser-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_rds %(if ( echo %{configure_options} | grep "with-rds-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_cxgb3 %(if ( echo %{configure_options} | grep "with-cxgb3-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_nes %(if ( echo %{configure_options} | grep "with-nes-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_mlx4 %(if ( echo %{configure_options} | grep "with-mlx4-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %define build_qlgc_vnic %(if ( echo %{configure_options} | grep "with-qlgc_vnic-mod" > /dev/null ); then echo -n '1'; else echo -n '0'; fi) %{!?LIB_MOD_DIR: %define LIB_MOD_DIR /lib/modules/%{KVERSION}/updates} %define LIB_MOD_DIR_INF %{LIB_MOD_DIR}/kernel/drivers/infiniband %define LIB_MOD_DIR_NET %{LIB_MOD_DIR}/kernel/drivers/net %define LIB_MOD_DIR_SCSI %{LIB_MOD_DIR}/kernel/drivers/scsi %define LIB_MOD_DIR_KERNEL_NET %{LIB_MOD_DIR}/kernel/net %{!?NETWORK_CONF_DIR: %define NETWORK_CONF_DIR /etc/infiniband} %{!?IB_CONF_DIR: %define IB_CONF_DIR /etc/infiniband} %define K_SRC /lib/modules/%{KVERSION}/build %{!?KSRC: %define KSRC %{K_SRC}} %{!?KERNEL_SOURCES: %define KERNEL_SOURCES /lib/modules/%{KVERSION}/source} # Do not include srp.h if it exist in the kernel %define include_srp_h %(if [ -e %{KERNEL_SOURCES}/include/scsi/srp.h ]; then echo -n 0; else echo -n 1; fi ) %define include_rdma %(if [ -d %{KERNEL_SOURCES}/include/rdma ]; then echo -n 1; else echo -n 0; fi ) %define include_udev_rules %(eval `grep udev_rules /etc/udev/udev.conf | grep -v '^#'` ; if test -d $udev_rules; then echo -n 1; else echo -n 0; fi) # Disable debugging %define debug_package %{nil} %define __check_files %{nil} # Disable brp-lib64-linux %ifarch x86_64 ia64 %define __arch_install_post %{nil} %endif %{!?_name: %define _name ofa_kernel} %{!?_version: %define _version 1.3} %{!?_release: %define _release ofed1.3} Summary: Infiniband HCA Driver Prereq: /sbin/ldconfig Name: %{_name} Version: %{_version} Release: %{_release} License: GPL/BSD Url: http://openib.org/ Group: System Environment/Base Source: %{_name}-%{_version}.tgz BuildRoot: %{?build_root:%{build_root}}%{!?build_root:/var/tmp/OFED} Vendor: OpenFabrics %description InfiniBand "verbs", Access Layer and ULPs BuildRequires: sysfsutils-devel %package -n kernel-ib Version: %{_version} Release: %{krelver} Summary: Infiniband Driver and ULPs kernel modules Group: System Environment/Libraries %description -n kernel-ib Core, HW and ULPs kernel modules %package -n kernel-ib-devel Version: %{_version} Release: %{krelver} Summary: Infiniband Driver and ULPs kernel modules sources Group: System Environment/Libraries %description -n kernel-ib-devel Core, HW and ULPs kernel modules sources ################################################################################################################################# %prep %setup -n %{_name}-%{_version} ### ### build ### %build rm -rf $RPM_BUILD_ROOT cd $RPM_BUILD_DIR/%{_name}-%{_version} # Save clean sources mkdir -p $RPM_BUILD_ROOT/%{_prefix}/src cp -a $RPM_BUILD_DIR/%{_name}-%{_version} $RPM_BUILD_ROOT/%{_prefix}/src ./configure --prefix=%{_prefix} --kernel-version %{KVERSION} --kernel-sources %{KSRC} --modules-dir %{LIB_MOD_DIR} %{configure_options} # Copy InfniBand include files after applying backport patches (if required) install -d $RPM_BUILD_ROOT/%{_prefix}/src/%{_name} cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/include/ $RPM_BUILD_ROOT/%{_prefix}/src/%{_name} cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/configure.mk.kernel $RPM_BUILD_ROOT/%{_prefix}/src/%{_name} # Support external modules include dir like in previous versions cd $RPM_BUILD_ROOT/%{_prefix}/src/ ln -s %{_name} openib cd - %if %{build_kernel_ib} make kernel # MODULES_DIR=/lib/modules/%{KVERSION} DESTDIR=$RPM_BUILD_ROOT %endif ### ### install ### %install %if %{build_kernel_ib} make install_kernel MODULES_DIR=%{LIB_MOD_DIR} DESTDIR=$RPM_BUILD_ROOT modsyms=`find $RPM_BUILD_DIR/%{_name}-%{_version} -name Module.symvers -o -name Modules.symvers` for modsym in $modsyms do cat $modsym >> $RPM_BUILD_ROOT/%{_prefix}/src/%{_name}/Module.symvers done %endif ################################## Handle kernel modules ################################## # Fix kernel modules path in case that modules were installed under 'extra' directory # Infiniband install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/debug install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/util install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/mthca install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/ipath install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/ehca install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/cxgb3 install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/nes install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/mlx4 install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/ipoib install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/sdp install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/srp install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/srpt install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/qlgc_vnic install -d $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/iser # Core modules test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_addr.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_addr.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_at.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_at.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_cm.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_cm.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/iw_cm.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/iw_cm.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_core.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_core.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_mad.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_mad.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_ping.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_ping.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_sa.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_sa.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_uat.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_uat.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_ucm.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_ucm.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_umad.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_umad.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_uverbs.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_uverbs.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/rdma_cm.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/rdma_cm.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/rdma_ucm.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/rdma_ucm.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_local_sa.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_local_sa.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/findex.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/findex.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_multicast.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_multicast.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/stream.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/stream.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/core # MEMTRACK module test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/memtrack.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/memtrack.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/debug # MADEYE module test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_madeye.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_madeye.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/util # HW modules test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_mthca.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_mthca.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/mthca test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_ipath.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_ipath.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/ipath test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_ehca.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_ehca.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/ehca test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/iw_cxgb3.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/iw_cxgb3.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/cxgb3 test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/iw_nes.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/iw_nes.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/nes test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/mlx4_ib.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/mlx4_ib.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/hw/mlx4 # ULP modules test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_ipoib.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_ipoib.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/ipoib test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_sdp.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_sdp.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/sdp test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_iser.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_iser.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/iser test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_srp.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_srp.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/srp test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_srpt.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ib_srpt.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/srpt test -e $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/qlgc_vnic.ko && mv $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/qlgc_vnic.ko $RPM_BUILD_ROOT%{LIB_MOD_DIR_INF}/ulp/qlgc_vnic ################################## END Handle kernel modules ################################## INFO=${RPM_BUILD_ROOT}%{IB_CONF_DIR}/info /bin/rm -f ${INFO} mkdir -p ${RPM_BUILD_ROOT}%{IB_CONF_DIR} touch ${INFO} cat >> ${INFO} << EOFINFO #!/bin/bash echo prefix=%{_prefix} echo Kernel=%{KVERSION} echo echo "Configure options: %{configure_options}" echo EOFINFO chmod +x ${INFO} > /dev/null 2>&1 # Copy infiniband configuration install -d $RPM_BUILD_ROOT/%{IB_CONF_DIR} install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/openib.conf $RPM_BUILD_ROOT/%{IB_CONF_DIR} %if %{build_ipoib} install -d $RPM_BUILD_ROOT/%{NETWORK_CONF_DIR} DEVICES="ib0 ib1" for DEVICE in $DEVICES do if [ -f /etc/SuSE-release ]; then echo BOOTPROTO=\'dhcp\' >> $RPM_BUILD_ROOT/%{NETWORK_CONF_DIR}/ifcfg-${DEVICE} echo REMOTE_IPADDR=\'\' >> $RPM_BUILD_ROOT/%{NETWORK_CONF_DIR}/ifcfg-${DEVICE} echo STARTMODE=\'onboot\' >> $RPM_BUILD_ROOT/%{NETWORK_CONF_DIR}/ifcfg-${DEVICE} echo WIRELESS=\'no\' >> $RPM_BUILD_ROOT/%{NETWORK_CONF_DIR}/ifcfg-${DEVICE} else echo DEVICE=${DEVICE} >> $RPM_BUILD_ROOT/%{NETWORK_CONF_DIR}/ifcfg-${DEVICE} echo BOOTPROTO=dhcp >> $RPM_BUILD_ROOT/%{NETWORK_CONF_DIR}/ifcfg-${DEVICE} echo ONBOOT=yes >> $RPM_BUILD_ROOT/%{NETWORK_CONF_DIR}/ifcfg-${DEVICE} fi done %endif # Install openib service script install -d $RPM_BUILD_ROOT/etc/init.d install -m 0755 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/openibd $RPM_BUILD_ROOT/etc/init.d %if %{include_udev_rules} install -d $RPM_BUILD_ROOT/etc/udev/rules.d install -m 0644 $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/90-ib.rules $RPM_BUILD_ROOT/etc/udev/rules.d case "$(udevinfo -V 2> /dev/null | awk '{print $NF}' 2> /dev/null)" in 0[1-4]*) sed -i -e 's/KERNEL==/KERNEL=/g' $RPM_BUILD_ROOT/etc/udev/rules.d/90-ib.rules ;; esac %endif %clean #Remove installed driver after rpm build finished rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_DIR/%{_name}-%{_version} ### ### pre section ### %pre -n kernel-ib %pre -n kernel-ib-devel ### ### post section ### %post -n kernel-ib if [ $1 = 1 ]; then # 1 : This package is being installed for the first time count_ib_ports() { local cnt=0 local tmp_cnt=0 tmp_cnt=$(/sbin/lspci -n | grep "15b3:6282" | wc -l | tr -d '[:space:]') # Arbel mode cnt=$[ $cnt + 2*${tmp_cnt} ] tmp_cnt=$(/sbin/lspci -n | grep -E "15b3:5e8c|15b3:6274" | wc -l | tr -d '[:space:]') # Sinai cnt=$[ $cnt + ${tmp_cnt} ] tmp_cnt=$(/sbin/lspci -n | grep -E "15b3:5a44|15b3:6278" | wc -l | tr -d '[:space:]') # Tavor mode cnt=$[ $cnt + 2*${tmp_cnt} ] return $cnt } count_ib_ports ports_num=$? # Set default number of ports to 2 if no HCAs found if [ $ports_num -eq 0 ]; then ports_num=2 fi ############################################################################################################# # Modules configuration # ############################################################################################################# # Update /etc/modprobe.conf # Remove previous configuration if exist perl -ni -e 'if (/\#\# BEGIN OpenIB \#\#$/) { $filter = 1 }' -e 'if (!$filter) { print }' -e 'if (/\#\# END OpenIB \#\#$/){ $filter = 0 }' /etc/modprobe.conf %if ! %{include_udev_rules} if [ -e /etc/udev/udev.rules ]; then perl -ni -e 'if (/\# Infiniband devices \#$/) { $filter = 1 }' -e 'if (!$filter) { print }' -e 'if (/\# End Infiniband devices \#$/){ $filter = 0 }' /etc/udev/udev.rules cat >> /etc/udev/udev.rules << EOF # Infiniband devices # KERNEL="umad*", NAME="infiniband/%k" KERNEL="issm*", NAME="infiniband/%k" KERNEL="ucm*", NAME="infiniband/%k", MODE="0666" KERNEL="uverbs*", NAME="infiniband/%k", MODE="0666" KERNEL="uat", NAME="infiniband/%k", MODE="0666" KERNEL="ucma", NAME="infiniband/%k", MODE="0666" KERNEL="rdma_cm", NAME="infiniband/%k", MODE="0666" # End Infiniband devices # EOF fi %endif %if %{modprobe_update} %if %{build_ipoib} for (( i=0 ; i < $ports_num ; i++ )) do cat >> /etc/modprobe.conf << EOF alias ib${i} ib_ipoib EOF done %endif %if %{build_sdp} cat >> /etc/modprobe.conf << EOF alias net-pf-27 ib_sdp EOF %endif %endif /sbin/depmod -r -ae %{KVERSION} ############################################################################################################# if [[ -f /etc/redhat-release || -f /etc/rocks-release ]]; then perl -i -ne 'if (m@^#!/bin/bash@) { print q@#!/bin/bash # # Bring up/down openib # # chkconfig: 2345 15 85 # description: Activates/Deactivates InfiniBand Driver to \ # start at boot time. # ### BEGIN INIT INFO # Provides: openibd ### END INIT INFO @; } else { print; }' /etc/init.d/openibd if ! ( /sbin/chkconfig --del openibd > /dev/null 2>&1 ); then true fi if ! ( /sbin/chkconfig --add openibd > /dev/null 2>&1 ); then true fi fi if [ -f /etc/SuSE-release ]; then local_fs='$local_fs' network='$network' openiscsi='' %if %{build_iser} openiscsi='open-iscsi' %endif perl -i -ne "if (m@^#!/bin/bash@) { print q@#!/bin/bash ### BEGIN INIT INFO # Provides: openibd # Required-Start: $local_fs $network # Required-Stop: opensmd $openiscsi # Default-Start: 2 3 5 # Default-Stop: 0 1 2 6 # Description: Activates/Deactivates InfiniBand Driver to \ # start at boot time. ### END INIT INFO @; } else { print; }" /etc/init.d/openibd if ! ( /sbin/insserv openibd > /dev/null 2>&1 ); then true fi fi %if %{build_kernel_ib} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load UCM module" >> %{IB_CONF_DIR}/openib.conf echo "UCM_LOAD=no" >> %{IB_CONF_DIR}/openib.conf echo >> %{IB_CONF_DIR}/openib.conf echo "# Load RDMA_CM module" >> %{IB_CONF_DIR}/openib.conf echo "RDMA_CM_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf echo >> %{IB_CONF_DIR}/openib.conf echo "# Load RDMA_UCM module" >> %{IB_CONF_DIR}/openib.conf echo "RDMA_UCM_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf echo >> %{IB_CONF_DIR}/openib.conf echo "# Increase ib_mad thread priority" >> %{IB_CONF_DIR}/openib.conf echo "RENICE_IB_MAD=no" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_mthca} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load MTHCA" >> %{IB_CONF_DIR}/openib.conf echo "MTHCA_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_ipath} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load IPATH" >> %{IB_CONF_DIR}/openib.conf echo "IPATH_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_ehca} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load eHCA" >> %{IB_CONF_DIR}/openib.conf echo "EHCA_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_mlx4} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load MLX4 modules" >> %{IB_CONF_DIR}/openib.conf echo "MLX4_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_cxgb3} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load CXGB3 modules" >> %{IB_CONF_DIR}/openib.conf echo "CXGB3_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_ipoib} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load IPoIB" >> %{IB_CONF_DIR}/openib.conf echo "IPOIB_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf echo >> %{IB_CONF_DIR}/openib.conf echo "# Enable IPoIB Connected Mode" >> %{IB_CONF_DIR}/openib.conf echo "SET_IPOIB_CM=yes" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_sdp} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load SDP module" >> %{IB_CONF_DIR}/openib.conf echo "SDP_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_srp} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load SRP module" >> %{IB_CONF_DIR}/openib.conf echo "SRP_LOAD=no" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_srpt} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load SRP Target module" >> %{IB_CONF_DIR}/openib.conf echo "SRPT_LOAD=no" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_iser} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load ISER module" >> %{IB_CONF_DIR}/openib.conf echo "ISER_LOAD=no" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_rds} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load RDS module" >> %{IB_CONF_DIR}/openib.conf echo "RDS_LOAD=no" >> %{IB_CONF_DIR}/openib.conf %endif %if %{build_qlgc_vnic} echo >> %{IB_CONF_DIR}/openib.conf echo "# Load QLogic VNIC module" >> %{IB_CONF_DIR}/openib.conf echo "QLGC_VNIC_LOAD=yes" >> %{IB_CONF_DIR}/openib.conf %endif fi # 1 : closed # END of post -n kernel-ib %post -n kernel-ib-devel ### ### preun section ### %preun -n kernel-ib if [ $1 = 0 ]; then # 1 : Erase, not upgrade if [[ -f /etc/redhat-release || -f /etc/rocks-release ]]; then if ! ( /sbin/chkconfig --del openibd > /dev/null 2>&1 ); then true fi fi if [ -f /etc/SuSE-release ]; then if ! ( /sbin/insserv -r openibd > /dev/null 2>&1 ); then true fi fi fi ### ### post uninstall section ### %postun -n kernel-ib if [ $1 = 0 ]; then # 1 : Erase, not upgrade # Clean /etc/modprobe.conf # Remove previous configuration if exist perl -ni -e "print unless (/ib_ipoib/)" /etc/modprobe.conf perl -ni -e "print unless (/ib_sdp/)" /etc/modprobe.conf perl -ni -e 'if (/\#\# BEGIN OpenIB \#\#$/) { $filter = 1 }' -e 'if (!$filter) { print }' -e 'if (/\#\# END OpenIB \#\#$/){ $filter = 0 }' /etc/modprobe.conf /sbin/depmod -r -ae %{KVERSION} # Clean udev.rules %if ! %{include_udev_rules} if [ -e /etc/udev/udev.rules ]; then perl -ni -e 'if (/\# Infiniband devices \#$/) { $filter = 1 }' -e 'if (!$filter) { print }' -e 'if (/\# End Infiniband devices \#$/){ $filter = 0 }' /etc/udev/udev.rules fi %endif fi %postun -n kernel-ib-devel ### ### Files ### %if %{build_kernel_ib} %files -n kernel-ib %defattr(-,root,root,-) %dir %{LIB_MOD_DIR_INF} %{LIB_MOD_DIR_INF}/core %dir %{LIB_MOD_DIR_INF}/hw %dir %{LIB_MOD_DIR_INF}/ulp %if %{build_mthca} %{LIB_MOD_DIR_INF}/hw/mthca %endif %if %{build_ipath} %{LIB_MOD_DIR_INF}/hw/ipath %endif %if %{build_ehca} %{LIB_MOD_DIR_INF}/hw/ehca %endif %if %{MEMTRACK} %{LIB_MOD_DIR_INF}/debug/memtrack.ko %endif %if %{MADEYE} %{LIB_MOD_DIR_INF}/util/ib_madeye.ko %endif %if %{build_ipoib} && %{include_ipoib_conf} %dir %{NETWORK_CONF_DIR} %config(noreplace) %{NETWORK_CONF_DIR}/ifcfg-ib*[0-9] %endif %dir %{IB_CONF_DIR} %config(noreplace) %{IB_CONF_DIR}/openib.conf %{IB_CONF_DIR}/info /etc/init.d/openibd %if %{include_udev_rules} /etc/udev/rules.d/90-ib.rules %endif %if %{build_ipoib} %{LIB_MOD_DIR_INF}/ulp/ipoib %endif %if %{build_sdp} %{LIB_MOD_DIR_INF}/ulp/sdp %endif %if %{build_srp} %{LIB_MOD_DIR_INF}/ulp/srp %endif %if %{build_srpt} %{LIB_MOD_DIR_INF}/ulp/srpt %endif %if %{build_iser} %{LIB_MOD_DIR_INF}/ulp/iser %{LIB_MOD_DIR_SCSI}/iscsi_tcp.ko %{LIB_MOD_DIR_SCSI}/libiscsi.ko %{LIB_MOD_DIR_SCSI}/scsi_transport_iscsi.ko %endif %if %{build_qlgc_vnic} %{LIB_MOD_DIR_INF}/ulp/qlgc_vnic %endif %if %{build_rds} %{LIB_MOD_DIR_KERNEL_NET}/rds %endif %if %{build_cxgb3} %{LIB_MOD_DIR_NET}/cxgb3 %{LIB_MOD_DIR_INF}/hw/cxgb3 %endif %if %{build_nes} %{LIB_MOD_DIR_INF}/hw/nes %endif %if %{build_mlx4} %{LIB_MOD_DIR_NET}/mlx4 %{LIB_MOD_DIR_INF}/hw/mlx4 %endif %endif %if %{build_kernel_ib_devel} %files -n kernel-ib-devel %defattr(-,root,root,-) %dir %{_prefix}/src %{_prefix}/src/%{_name}-%{_version} %{_prefix}/src/%{_name} %{_prefix}/src/openib %endif # END Files %changelog * Tue Aug 21 2007 Vladimir Sokolovsky <vlad@mellanox.co.il> - Added %build macro * Sun Jan 28 2007 Vladimir Sokolovsky <vlad@mellanox.co.il> - Created spec file for kernel-ib