File ofed.spec of Package ofed

#
# spec file for package ofed (Version 1.4)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild
# nodebuginfo


Name:           ofed
Group:          System/Base
Summary:        Infiniband Kernel Modules
Version:        1.4
Release:        21.<RELEASE16>
Source:         ofa_kernel-%{version}.tar.bz2
Source1:        conf.modutils
Source2:        conf.ifcfg
Source3:        conf.sysconfig
Source4:        info
Source5:        ofed-docs-%{version}.tar.bz2
Source6:        Module.supported
Source7:        t3fw-7.0.0.bin.bz2
Patch1:         ofed-1.4_openibd_lsb_header.patch
Patch2:         ofed-1.4-blk_eh_timer_return.patch
Url:            http://www.openfabrics.org
License:        GPL v2 or later
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  kernel-syms module-init-tools quilt
PreReq:         %fillup_prereq %insserv_prereq
ExclusiveArch:  %ix86 x86_64 ppc ia64 ppc64
%suse_kernel_module_package um xen xenpae iseries64 ec2

%description
This package contains infiniband kernel modules built from the
OpenFabrics Enterprise Distribution (OFED).



%package doc
License:        GPL v2 or later
Summary:        OFED documentation
Group:          System/Kernel

%description doc
OpenFabrics documentation



%package KMP
License:        GPL v2 or later
Summary:        Infiniband Kernel Modules
Group:          System/Base
Requires:       cxgb3-firmware

%description KMP
This package contains infiniband kernel modules built from the
OpenFabrics Enterprise Distribution (OFED).



%package -n cxgb3-firmware
License:        Any commercial; "CHELSIO COMMUNICATIONS, INC. SOFTWARE LICENSE AGREEMENT ..."
Summary:        Firmware files for the Chelsio cxgb3 adapter
Group:          Hardware/Other

%description -n cxgb3-firmware
Firmware files for the Adaptec AIC94xx (Razor) Series of SAS HBA
Adapters.



%prep
%setup -q -n ofa_kernel-%{version} -a 5
# Some of the doc files are executable.  Remove that permission.
chmod a-x ofed-docs-%{version}/*.txt
set -- *
mkdir source
mv "$@" source/
mkdir obj
cp %{S:1} %{S:2} %{S:3} %{S:4} .
cp %{S:6} source/
%patch1
%patch2

%build
%define kver %(echo `rpm -q --queryformat '%{VERSION}-%{RELEASE}' kernel-source`|sed 's/_/-/g;')
for flavor in %flavors_to_build; do
    rm -rf obj/$flavor
    cp -ar source obj/$flavor
    pushd obj/$flavor
    ./configure --with-core-mod --with-ipoib-mod --with-ipoib-cm --with-sdp-mod \
		--with-srp-mod --with-user_mad-mod --with-user_access-mod \
		--with-addr_trans-mod --with-mthca-mod --with-mlx4-mod --with-mlx4_core-mod --with-mlx4_inf-mod \
		--with-iser-mod --with-rds-mod --with-madeye-mod --with-qlgc_vnic-mod \
		--with-qlgc_vnic_stats-mod --with-cxgb3-mod --with-nes-mod \
		$([ "$flavor" == "ppc64" ] && echo '--with-ehca-mod') \
		$([ "$flavor" == "ppc64" -o "$flavor" == "x86_64" ] && echo '--with-ipath_inf-mod') \
		--kernel-version=%kver-$flavor --kernel-sources=/usr/src/linux-obj/%_target_cpu/$flavor
    make
    popd
done

%install
export NO_BRP_STALE_LINK_ERROR=yes
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
     make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
        M=$PWD/obj/$flavor
done
# install the modutils configuration
install -m a=r,u+w -D conf.modutils ${RPM_BUILD_ROOT}%_sysconfdir/modprobe.d/infiniband
# install the UDEV rules
install -m a=r,u+w -D source/ofed_scripts/90-ib.rules ${RPM_BUILD_ROOT}%_sysconfdir/udev/rules.d/90-ib.rules
# install the ifup network configurations
install -m a=r,u+w -D conf.ifcfg ${RPM_BUILD_ROOT}%_sysconfdir/sysconfig/network/ifcfg-ib0 
install -m a=r,u+w -D conf.ifcfg ${RPM_BUILD_ROOT}%_sysconfdir/sysconfig/network/ifcfg-ib1 
# install the sysconfig file and make a compat link
install -m a=r,u+w -D conf.sysconfig ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.infiniband
install -d ${RPM_BUILD_ROOT}/%_sysconfdir/infiniband
ln -s %_sysconfdir/sysconfig/infiniband ${RPM_BUILD_ROOT}/%_sysconfdir/infiniband/openib.conf
# install the init script
install -m 755 -D source/ofed_scripts/openibd ${RPM_BUILD_ROOT}%_sysconfdir/init.d/openibd
# install the info script
sed 's/VERSION/%kver/' info > ${RPM_BUILD_ROOT}/%_sysconfdir/infiniband/info
chmod 755 ${RPM_BUILD_ROOT}/%_sysconfdir/infiniband/info
# Install the cxgb3 firmware
install -m a=r,u+w -D %{S:7} ${RPM_BUILD_ROOT}/lib/firmware/t3fw-7.0.0.bin.bz2
bunzip2 ${RPM_BUILD_ROOT}/lib/firmware/t3fw-7.0.0.bin.bz2

%clean
rm -rf %buildroot

%post
%{fillup_and_insserv -n -y infiniband openibd}

%postun
%restart_on_update openibd
%insserv_cleanup

%preun
%stop_on_removal openibd

%files
%defattr(-, root, root)
%_sysconfdir/infiniband
%config %_sysconfdir/modprobe.d/infiniband
%config %_sysconfdir/udev
%config %_sysconfdir/sysconfig/network/ifcfg-ib*
/var/adm/fillup-templates/sysconfig.infiniband
%_sysconfdir/init.d/openibd

%files -n cxgb3-firmware
%defattr(-, root, root)
/lib/firmware/t3fw-7.0.0.bin

%files doc
%defattr(-, root, root)
%doc source/ofed-docs-%{version}/*

%changelog
openSUSE Build Service is sponsored by