[packages/kernel-net-wl] add dkms support
glen
glen at pld-linux.org
Sun Oct 13 17:22:21 CEST 2013
commit b51b81d57a59d9798a0626304b20d4ebc664eeb1
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sun Sep 29 23:37:36 2013 +0300
add dkms support
dkms.conf | 14 +++++++++++++
kernel-net-wl.spec | 59 ++++++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 67 insertions(+), 6 deletions(-)
---
diff --git a/kernel-net-wl.spec b/kernel-net-wl.spec
index 6262ace..e33a23e 100644
--- a/kernel-net-wl.spec
+++ b/kernel-net-wl.spec
@@ -1,9 +1,11 @@
# Conditional build:
%bcond_without dist_kernel # allow non-distribution kernel
+%bcond_without kernel # don't build kernel modules
%bcond_with verbose # verbose build (V=1)
+%bcond_with dkms # build dkms package
%define rel 3
-%define pname wl
+%define modname wl
%define file_ver %(echo %{version} | tr . _)
Summary: Broadcom 802.11 a/b/g/n hybrid Linux networking device driver
Name: kernel%{_alt_kernel}-net-wl
@@ -17,6 +19,7 @@ Source1: http://www.broadcom.com/docs/linux_sta/hybrid-v35_64-nodebug-pcoem-%{fi
# Source1-md5: 039f33d2a3ff2890e42717092d1eb0c4
Source2: http://www.broadcom.com/docs/linux_sta/README.txt
# Source2-md5: 8a6e8708a5e00ab6d841cde51d70eb1b
+Source3: dkms.conf
Patch0: broadcom-sta-6.30.223.141-kernel-3.10.patch
URL: http://www.broadcom.com/support/802.11/linux_sta.php
%{?with_dist_kernel:BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
@@ -29,6 +32,7 @@ Requires(postun): %releq_kernel
ExclusiveArch: %{ix86} %{x8664}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# nothing to be placed to debuginfo package
%define _enable_debug_packages 0
%description
@@ -40,15 +44,31 @@ BCM43228-based hardware.
This is an Official Release of Broadcom's hybrid Linux driver for use
with Broadcom based hardware.
+%package -n dkms-%{modname}
+Summary: DKMS-ready driver for Broadcom WL driver
+Group: Base/Kernel
+Release: %{rel}
+Requires(pre): dkms
+Requires(post): dkms
+%if "%{_rpmversion}" >= "5"
+BuildArch: noarch
+%endif
+
+%description -n dkms-%{modname}
+This package contains a DKMS-ready driver for Broadcom WL driver.
+
%prep
%ifarch %{x8664}
%define src 1
%else
%define src 0
%endif
-%setup -c -T -q -n %{pname}-%{version} -b%{src}
+%setup -c -T -q -n %{modname}-%{version} -b%{src}
%patch0 -p2
+# cleanup backups after patching
+find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
+
cp -p %{SOURCE2} .
cat > Makefile << EOF
@@ -58,20 +78,31 @@ wl-objs += src/wl/sys/wl_linux.o
wl-objs += src/wl/sys/wl_iw.o
wl-objs += src/shared/linux_osl.o
-EXTRA_CFLAGS += -I%{_builddir}/%{pname}-%{version}/src/include
-EXTRA_CFLAGS += -I%{_builddir}/%{pname}-%{version}/src/common/include
-EXTRA_CFLAGS += -I%{_builddir}/%{pname}-%{version}/src/wl/sys
-EXTRA_CFLAGS += -I%{_builddir}/%{pname}-%{version}/src/shared/bcmwifi/include
+EXTRA_CFLAGS += -I%{_builddir}/%{modname}-%{version}/src/include
+EXTRA_CFLAGS += -I%{_builddir}/%{modname}-%{version}/src/common/include
+EXTRA_CFLAGS += -I%{_builddir}/%{modname}-%{version}/src/wl/sys
+EXTRA_CFLAGS += -I%{_builddir}/%{modname}-%{version}/src/shared/bcmwifi/include
EXTRA_LDFLAGS := $PWD/lib/wlc_hybrid.o_shipped
EOF
%build
+%if %{with kernel}
%build_kernel_modules -m wl
+%endif
%install
rm -rf $RPM_BUILD_ROOT
+%if %{with kernel}
%install_kernel_modules -m wl -d kernel/drivers/net/wireless
+%endif
+
+%if %{with dkms}
+install -d $RPM_BUILD_ROOT%{_usrsrc}/%{modname}-%{version}-%{rel}
+cp -a Makefile lib src $RPM_BUILD_ROOT%{_usrsrc}/%{modname}-%{version}-%{rel}
+sed -e 's|@MODNAME@|%{modname}|g' -e 's|@MODVERSION@|%{version}-%{rel}|g' \
+ %{SOURCE3} > $RPM_BUILD_ROOT%{_usrsrc}/%{modname}-%{version}-%{rel}/dkms.conf
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
@@ -88,7 +119,23 @@ EOF
%postun
%depmod %{_kernel_ver}
+%post -n dkms-%{modname}
+%{_sbindir}/dkms add -m %{modname} -v %{version}-%{rel} --rpm_safe_upgrade && \
+%{_sbindir}/dkms build -m %{modname} -v %{version}-%{rel} --rpm_safe_upgrade && \
+%{_sbindir}/dkms install -m %{modname} -v %{version}-%{rel} --rpm_safe_upgrade || :
+
+%preun -n dkms-%{modname}
+%{_sbindir}/dkms remove -m %{modname} -v %{version}-%{rel} --rpm_safe_upgrade --all || :
+
+%if %{with kernel}
%files
%defattr(644,root,root,755)
%doc lib/LICENSE.txt README.txt
/lib/modules/%{_kernel_ver}/kernel/drivers/net/wireless/*.ko*
+%endif
+
+%if %{with dkms}
+%files -n dkms-%{modname}
+%defattr(644,root,root,755)
+%{_usrsrc}/%{modname}-%{version}-%{rel}
+%endif
diff --git a/dkms.conf b/dkms.conf
new file mode 100644
index 0000000..bf25398
--- /dev/null
+++ b/dkms.conf
@@ -0,0 +1,14 @@
+DEST_MODULE_LOCATION[0]="/kernel/drivers/net/wireless"
+PACKAGE_NAME="@MODNAME@"
+PACKAGE_VERSION="@MODVERSION@"
+CLEAN="make -C ${kernel_source_dir} SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
+BUILT_MODULE_NAME[0]="${PACKAGE_NAME}"
+MODULES_CONF[0]="# Prevent conflicts with @MODNAME@"
+MODULES_CONF[1]="blacklist ssb"
+MODULES_CONF[2]="blacklist bcma"
+MODULES_CONF[3]="blacklist b43"
+MODULES_CONF[4]="blacklist brcmsmac"
+MODULES_CONF[5]="# End of entries added for @MODNAME@"
+MAKE[0]="make -C ${kernel_source_dir} SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules"
+REMAKE_INITRD="no"
+AUTOINSTALL="yes"
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/kernel-net-wl.git/commitdiff/b51b81d57a59d9798a0626304b20d4ebc664eeb1
More information about the pld-cvs-commit
mailing list