# norootforbuild # nodebuginfo %define _name ofa_kernel %define _version 1.4 %define _release 3 %define KVERSION %(uname -r) %define krelver %(echo -n %{KVERSION} | sed -e 's/-/_/g') %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 %define LIB_MOD_DIR_KERNEL_FS %{LIB_MOD_DIR}/kernel/fs %define IB_CONF_DIR /etc/infiniband %define MLXNET_CONF_DIR /etc/mlxethernet %define K_SRC /lib/modules/%{KVERSION}/build %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) %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-cxgb3-mod --with-nes-mod --with-ipath_inf-mod --with-ipoib-mod --with-sdp-mod --with-srp-mod --with-rds-mod --with-qlgc_vnic-mod --with-iser-mod' Name: %{_name} Group: System/Base Summary: Infiniband Kernel Modules Version: %{_version} Release: %{_release} Source: %{_name}-%{_version}.tgz Url: http://www.openfabrics.org License: GPL v2 or later BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: kernel-source kernel-syms module-init-tools PreReq: %fillup_prereq %insserv_prereq PreReq: coreutils #PreReq: kernel Prereq: pciutils Prereq: grep Prereq: perl Prereq: procps Prereq: module-init-tools %description This package contains infiniband kernel modules built from the OpenFabrics Enterprise Distribution (OFED). %suse_kernel_module_package xen kdump debug default %package devel Summary: OFED documentation Group: System/Kernel PreReq: coreutils #PreReq: kernel Prereq: pciutils %description devel OpenFabrics devel stuff %package KMP Summary: Infiniband Kernel Modules Group: System/Base %description KMP This package contains infiniband kernel modules built from the OpenFabrics Enterprise Distribution (OFED). %prep %setup -n %{_name}-%{_version} #%setup -n ofa_kernel-1.4 %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 %{K_SRC} --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}/kernel_addons/ $RPM_BUILD_ROOT/%{_prefix}/src/%{_name} cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/configure.mk.kernel $RPM_BUILD_ROOT/%{_prefix}/src/%{_name} cp -a $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_patch.mk $RPM_BUILD_ROOT/%{_prefix}/src/%{_name} sed -i -e "s@\${CWD}@%{_prefix}/src/%{_name}@g" $RPM_BUILD_ROOT/%{_prefix}/src/%{_name}/ofed_patch.mk # Support external modules include dir like in previous versions cd $RPM_BUILD_ROOT/%{_prefix}/src/ ln -s %{_name} openib cd - # build modules make kernel # MODULES_DIR=/lib/modules/%{KVERSION} DESTDIR=$RPM_BUILD_ROOT %install 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 ################################## 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} ## insert here the stuff for the info file # 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} # install the UDEV rules install -D $RPM_BUILD_DIR/%{_name}-%{_version}/ofed_scripts/90-ib.rules $RPM_BUILD_ROOT/etc/udev/rules.d/90-ib.rules #update the openib config cat >> $RPM_BUILD_ROOT/%{IB_CONF_DIR}/openib.conf << EOFOIBCONF # Load UCM module UCM_LOAD=no # Load RDMA_CM module RDMA_CM_LOAD=yes # Load RDMA_UCM module RDMA_UCM_LOAD=yes # Increase ib_mad thread priority RENICE_IB_MAD=no # Load MTHCA MTHCA_LOAD=yes # Load IPATH IPATH_LOAD=yes # Load MLX4 modules MLX4_LOAD=yes # Load CXGB3 modules CXGB3_LOAD=yes # Load IPoIB IPOIB_LOAD=yes # Enable IPoIB Connected Mode SET_IPOIB_CM=yes # Load SDP module SDP_LOAD=yes # Load SRP module SRP_LOAD=no # Load ISER module ISER_LOAD=no # Load RDS module RDS_LOAD=no # Load QLogic VNIC module QLGC_VNIC_LOAD=no # Enable SRP High Availability daemon SRPHA_ENABLE=no SRP_DAEMON_ENABLE=no EOFOIBCONF # 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 %clean #Remove installed driver after rpm build finished rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_DIR/%{_name}-%{_version} %files %defattr(-,root,root,-) %dir %{IB_CONF_DIR} %config(noreplace) %{IB_CONF_DIR}/openib.conf %{IB_CONF_DIR}/info /etc/init.d/openibd /etc/udev/rules.d/90-ib.rules %files devel %defattr(-,root,root,-) %dir %{_prefix}/src %{_prefix}/src/%{_name}-%{_version} %{_prefix}/src/%{_name} %{_prefix}/src/openib %changelog * Thu Mar 2 2009 mbozzore@platform.com - added udev rules * Wed Mar 1 2009 mbozzore@platform.com - initial package for ofed 1.4