commit 466c1ea1297fdade91983f735066823498783328
Author: Nicolas Viéville <nicolas.vieville(a)uphf.fr>
Date: Mon Jun 6 18:12:23 2022 +0200
Reworked SPEC file to build for RHEL 7.x, RHEL 8.x and RHEL 9.x
Updated URLs to new Broadcom WEB site
Add patch for kernel >= 5.18
wl-kmod-022_kernel_5.18_adaptation.patch | 101 +++++++++++++++++++++++++++++++
wl-kmod.spec | 63 ++++++++++++++++++-
2 files changed, 162 insertions(+), 2 deletions(-)
---
diff --git a/wl-kmod-022_kernel_5.18_adaptation.patch
b/wl-kmod-022_kernel_5.18_adaptation.patch
new file mode 100644
index 0000000..1b1cb4d
--- /dev/null
+++ b/wl-kmod-022_kernel_5.18_adaptation.patch
@@ -0,0 +1,101 @@
+diff -Naur hybrid-v35_64-nodebug-pcoem-6_30_223_271.orig/src/shared/linux_osl.c
hybrid-v35_64-nodebug-pcoem-6_30_223_271-022_kernel_5.18_adaptation/src/shared/linux_osl.c
+--- hybrid-v35_64-nodebug-pcoem-6_30_223_271.orig/src/shared/linux_osl.c 2020-12-29
18:29:39.434940249 +0100
++++
hybrid-v35_64-nodebug-pcoem-6_30_223_271-022_kernel_5.18_adaptation/src/shared/linux_osl.c 2022-06-06
17:14:25.587543256 +0200
+@@ -48,7 +48,11 @@
+ struct osl_info {
+ osl_pubinfo_t pub;
+ uint magic;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ struct pci_dev *pdev;
++#else
+ void *pdev;
++#endif
+ atomic_t malloced;
+ atomic_t pktalloced;
+ uint failed;
+@@ -600,8 +604,12 @@
+ if (va)
+ *pap = (ulong)__virt_to_phys(va);
+ #else
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ va = dma_alloc_coherent(&osh->pdev->dev, size, (dma_addr_t *)pap,
GFP_ATOMIC);
++#else
+ va = pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap);
+ #endif
++#endif
+ return va;
+ }
+
+@@ -613,8 +621,12 @@
+ #ifdef __ARM_ARCH_7A__
+ kfree(va);
+ #else
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ dma_free_coherent(&osh->pdev->dev, size, va, (dma_addr_t)pa);
++#else
+ pci_free_consistent(osh->pdev, size, va, (dma_addr_t)pa);
+ #endif
++#endif
+ }
+
+ uint BCMFASTPATH
+@@ -623,7 +635,11 @@
+ int dir;
+
+ ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ dir = (direction == DMA_TX)? DMA_TO_DEVICE : DMA_FROM_DEVICE;
++#else
+ dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
++#endif
+
+ #if defined(__ARM_ARCH_7A__) && defined(BCMDMASGLISTOSL)
+ if (dmah != NULL) {
+@@ -635,13 +651,21 @@
+ if (skb_is_nonlinear(skb)) {
+ nsegs = skb_to_sgvec(skb, sg, 0, PKTLEN(osh, skb));
+ ASSERT((nsegs > 0) && (totsegs + nsegs <= MAX_DMA_SEGS));
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ dma_map_sg(&osh->pdev->dev, sg, nsegs, dir);
++#else
+ pci_map_sg(osh->pdev, sg, nsegs, dir);
++#endif
+ } else {
+ nsegs = 1;
+ ASSERT(totsegs + nsegs <= MAX_DMA_SEGS);
+ sg->page_link = 0;
+ sg_set_buf(sg, PKTDATA(osh, skb), PKTLEN(osh, skb));
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ dma_map_single(&osh->pdev->dev, PKTDATA(osh, skb), PKTLEN(osh, skb),
dir);
++#else
+ pci_map_single(osh->pdev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir);
++#endif
+ }
+ totsegs += nsegs;
+ totlen += PKTLEN(osh, skb);
+@@ -656,7 +680,11 @@
+ }
+ #endif
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ return (dma_map_single(&osh->pdev->dev, va, size, dir));
++#else
+ return (pci_map_single(osh->pdev, va, size, dir));
++#endif
+ }
+
+ void BCMFASTPATH
+@@ -665,8 +693,13 @@
+ int dir;
+
+ ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ dir = (direction == DMA_TX)? DMA_TO_DEVICE : DMA_FROM_DEVICE;
++ dma_unmap_single(&osh->pdev->dev, (uint32)pa, size, dir);
++#else
+ dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
+ pci_unmap_single(osh->pdev, (uint32)pa, size, dir);
++#endif
+ }
+
+ #if defined(BCMDBG_ASSERT)
diff --git a/wl-kmod.spec b/wl-kmod.spec
index a56103c..d5da85a 100644
--- a/wl-kmod.spec
+++ b/wl-kmod.spec
@@ -10,11 +10,11 @@
Name: wl-kmod
Version: 6.30.223.271
-Release: 41%{?dist}
+Release: 42%{?dist}
Summary: Kernel module for Broadcom wireless devices
Group: System Environment/Kernel
License: Redistributable, no modification permitted
-URL:
https://www.broadcom.com/support/download-search?pg=&pf=Wireless+LAN/...
+URL:
https://www.broadcom.com/support/download-search?pg=Legacy+Products&p...
Source0:
https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/hybrid-v35-no...
Source1:
https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/hybrid-v35_64...
Source11: wl-kmod-kmodtool-excludekernel-filterfile
@@ -39,6 +39,7 @@ Patch17: wl-kmod-018_kernel_5.6_adaptations.patch
Patch18: wl-kmod-019_kernel_5.9_segment_eq_removed.patch
Patch19: wl-kmod-020_kernel_5.10_get_set_fs_removed.patch
Patch20: wl-kmod-021_kernel_5.17_adaptation.patch
+Patch21: wl-kmod-022_kernel_5.18_adaptation.patch
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: i686 x86_64
@@ -100,6 +101,7 @@ pushd %{name}-%{version}-src
%patch18 -p1 -b .kernel_5.9_segment_eq_removed
%patch19 -p1 -b .kernel_5.10_get_set_fs_removed
%patch20 -p1 -b .kernel_5.17_adaptation
+%patch21 -p1 -b .kernel_5.18_adaptation
# Manual patching to build for RHEL - inspired by CentOS wl-kmod.spec
# Actually works for RHEL 6.x and 7.x
@@ -238,6 +240,18 @@ pushd %{name}-%{version}-src
# Apply to EL 7.6 point release and later
# > No changes currently needed for EL 7.6 point release
%endif
+ %if %{kvr} >= 1062
+ # Apply to EL 7.7 point release and later
+ %{__sed} -i -e 's@__attribute__((__fallthrough__));.*(a)/* fall through */@g'
src/wl/sys/wl_cfg80211_hybrid.c
+ %endif
+ %if %{kvr} >= 1127
+ # Apply to EL 7.8 point release and later
+ # > No changes currently needed for EL 7.8 point release
+ %endif
+ %if %{kvr} >= 1160
+ # Apply to EL 7.9 point release and later
+ # > No changes currently needed for EL 7.9 point release
+ %endif
%endif
%endif
%if 0%{?rhel} == 8
@@ -258,6 +272,46 @@ pushd %{name}-%{version}-src
# Apply to EL 8.0 point release and later
# > No changes currently needed for EL 8.0 point release
%endif
+ %if %{kvr} >= 147
+ # Apply to EL 8.1 point release and later
+ # > No changes currently needed for EL 8.1 point release
+ %endif
+ %if %{kvr} >= 193
+ # Apply to EL 8.2 point release and later
+ # > No changes currently needed for EL 8.2 point release
+ %endif
+ %if %{kvr} >= 240
+ # Apply to EL 8.3 point release and later
+ # > No changes currently needed for EL 8.3 point release
+ %endif
+ %if %{kvr} >= 305
+ # Apply to EL 8.4 point release and later
+ # > No changes currently needed for EL 8.4 point release
+ %endif
+ %if %{kvr} >= 348
+ # Apply to EL 8.5 point release and later
+ # > No changes currently needed for EL 8.5 point release
+ %endif
+ %endif
+%endif
+%if 0%{?rhel} == 9
+ # Define kvl (linux) & kvr (release) for use in "patching" logical
+ %define kvl %(echo %{kernel_versions} | cut -d"-" -f1)
+ %define kvr %(echo %{kernel_versions} | cut -d"-" -f2 | cut -d"."
-f1)
+
+ # Perform "patching" edits to the src/wl/sys/wl_cfg80211_hybrid.c file.
+ # Note: Using this method, as opposed to making a patch, allows
+ # the src.rpm to be compiled under various point release kernels.
+ # Note: Use [ >][>=] where both >= & > are present
+ %if "%{kvl}" == "5.14.0"
+ %if %{kvr} == 70
+ # Only apply to EL 9.0 point release
+ # > No changes currently needed for EL 9.0 point release
+ %endif
+ %if %{kvr} >= 70
+ # Apply to EL 9.0 point release and later
+ # > No changes currently needed for EL 9.0 point release
+ %endif
%endif
%endif
popd
@@ -289,6 +343,11 @@ chmod 0755
$RPM_BUILD_ROOT%{kmodinstdir_prefix}*%{kmodinstdir_postfix}/* || :
rm -rf $RPM_BUILD_ROOT
%changelog
+* Mon Jun 06 2022 Nicolas Viéville <nicolas.vieville(a)uphf.fr> - 6.30.223.271-42
+- Reworked SPEC file to build for RHEL 7.x, RHEL 8.x and RHEL 9.x
+- Updated URLs to new Broadcom WEB site
+- Add patch for kernel >= 5.18
+
* Fri Apr 01 2022 Nicolas Viéville <nicolas.vieville(a)uphf.fr> - 6.30.223.271-41
- Add patch for kernel >= 5.17 - fixes RFBZ#6260