broadcom-wl-dkms 差分(2022-04-02)(Manjaro Linux)

Manjaro LinuxのISOを作成する際に、linux517-broadcom-wlパッケージの作成に必要な、broadcom-wl-dkmsに修正が必要だったので、その差分を書き置きしておきます。

https://gitlab.manjaro.org/packages/extra/broadcom-wl-dkms

```diff
diff --git a/PKGBUILD b/PKGBUILD
index e8cb882..c0a92f9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,7 +6,7 @@
 
 pkgname=broadcom-wl-dkms
 pkgver=6.30.223.271
-pkgrel=25
+pkgrel=29
 pkgdesc='Broadcom 802.11 Linux STA wireless driver'
 arch=('x86_64')
 url="https://www.broadcom.com/support/download-search/?pf=Wireless+LAN+Infrastructure"
@@ -28,10 +28,13 @@ source=("https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/hybrid-v35_
         '009-fix_mac_profile_discrepancy.patch'
         '010-linux56.patch'
         '011-linux59.patch'
-        '012-linux510.patch')
+        '012-linux510.patch'
+        '013-linux517.patch'
+        '014-Makefile.patch'
+        '015-brcm-wlan-ifname.patch')
 sha256sums=('5f79774d5beec8f7636b59c0fb07a03108eef1e3fd3245638b20858c714144be'
             'b97bc588420d1542f73279e71975ccb5d81d75e534e7b5717e01d6e6adf6a283'
-            'f11b7ff3d175d0c3b90a2b387d71a2ab523eefb5ff3400b3d08f91c0d76e337e'
+            'a4c8d0fd2556bd3c3d19108b6e176b1e92d8c9b92271668c075ff5334ed1b44c'
             '32e505a651fdb9fd5e4870a9d6de21dd703dead768c2b3340a2ca46671a5852f'
             '4ea03f102248beb8963ad00bd3e36e67519a90fa39244db065e74038c98360dd'
             '30ce1d5e8bf78aee487d0f3ac76756e1060777f70ed1a9cf95215c3a52cfbe2e'
@@ -43,17 +46,14 @@ sha256sums=('5f79774d5beec8f7636b59c0fb07a03108eef1e3fd3245638b20858c714144be'
             '4e73e50653bb612946edd34bf31ca5a0b80f632d47a08766ae6042880927c98d'
             'f1300bcce93363088481671150ff2bbd6957e12ba11098980b9f428c7a171812'
             '8983c8ae73ad5853a37d98aa42bed1c52a2bd27d0d4991283cf92010cab22212'
-            '138187813d86239b633defeb102a665e1eaa0b95d23abeada4bbecfc07050dee')
+            '138187813d86239b633defeb102a665e1eaa0b95d23abeada4bbecfc07050dee'
+            'cf118da7d7a091dc6be01e9dc4b5302c81c416b2e147e87d37c9dd4c6dc1b6bd'
+            '965c7075afc7cdec61dc6555122a745f9f4e13260343a8eea51feffe4283996b'
+            'c5916f5e5c18b36b3a6507b4f111cacc4f34c727b29b99615f76405354521da0')
 
 prepare() {
-  sed -i -e '/BRCM_WLAN_IFNAME/s/eth/wlan/' src/wl/sys/wl_linux.c
-  sed -i -e "/EXTRA_LDFLAGS/s|\$(src)/lib|/usr/lib/$pkgname|" Makefile
   sed -e "s/@PACKAGE_VERSION@/$pkgver/" dkms.conf.in > dkms.conf
   sed -n -e '/Copyright/,/SOFTWARE\./{s/^ \* //;p}' src/wl/sys/wl_linux.c
-  sed -i 's/segment_eq(get_fs(), KERNEL_DS)/uaccess_kernel()/g' src/wl/sys/wl_linux.c
-  sed -i '/GE_49 :=/s|:= .*|:= 1|' Makefile
-  find src -name "*.c" -type f -exec sed -i 's/ioremap_nocache/ioremap_cache/g' {} \;
-
 }
 
 package() {
diff --git a/dkms.conf.in b/dkms.conf.in
index 6a80324..8072d15 100644
--- a/dkms.conf.in
+++ b/dkms.conf.in
@@ -13,4 +13,7 @@ PATCH[7]="008-linux415.patch"
 PATCH[8]="010-linux56.patch"
 PATCH[9]="011-linux59.patch"
 PATCH[10]="012-linux510.patch"
+PATCH[11]="013-linux517.patch"
+PATCH[12]="014-Makefile.patch"
+PATCH[13]="015-brcm-wlan-ifname.patch"
 AUTOINSTALL="yes"
diff --git a/013-linux517.patch b/013-linux517.patch
new file mode 100644
index 0000000..8c69beb
--- /dev/null
+++ b/013-linux517.patch
@@ -0,0 +1,55 @@
+diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
+index e491df7..e4614fb 100644
+--- a/src/wl/sys/wl_linux.c
++++ b/src/wl/sys/wl_linux.c
+@@ -93,6 +93,10 @@ struct iw_statistics *wl_get_wireless_stats(struct net_device *dev);
+ 
+ #include <wlc_wowl.h>
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
++#define PDE_DATA pde_data
++#endif
++
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+ static void wl_timer(struct timer_list *tl);
+ #else
+@@ -490,6 +494,12 @@ wl_if_setup(struct net_device *dev)
+ #endif
+ }
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
++static inline void eth_hw_addr_set(struct net_device *dev, const void *addr) {
++	memcpy(dev->dev_addr, addr, ETHER_ADDR_LEN);
++}
++#endif
++
+ static wl_info_t *
+ wl_attach(uint16 vendor, uint16 device, ulong regs,
+ 	uint bustype, void *btparam, uint irq, uchar* bar1_addr, uint32 bar1_size)
+@@ -634,7 +644,7 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
+ 			WL_ERROR(("wl%d: Error setting MAC ADDRESS\n", unit));
+ 	}
+ #endif 
+-	bcopy(&wl->pub->cur_etheraddr, dev->dev_addr, ETHER_ADDR_LEN);
++	eth_hw_addr_set(dev, wl->pub->cur_etheraddr.octet);
+ 
+ 	online_cpus = 1;
+ 
+@@ -1835,7 +1845,7 @@ wl_set_mac_address(struct net_device *dev, void *addr)
+ 
+ 	WL_LOCK(wl);
+ 
+-	bcopy(sa->sa_data, dev->dev_addr, ETHER_ADDR_LEN);
++	eth_hw_addr_set(dev, sa->sa_data);
+ 	err = wlc_iovar_op(wl->wlc, "cur_etheraddr", NULL, 0, sa->sa_data, ETHER_ADDR_LEN,
+ 		IOV_SET, (WL_DEV_IF(dev))->wlcif);
+ 	WL_UNLOCK(wl);
+@@ -3010,7 +3020,7 @@ _wl_add_monitor_if(wl_task_t *task)
+ 	else
+ 		dev->type = ARPHRD_IEEE80211_RADIOTAP;
+ 
+-	bcopy(wl->dev->dev_addr, dev->dev_addr, ETHER_ADDR_LEN);
++	eth_hw_addr_set(dev, wl->dev->dev_addr);
+ 
+ #if defined(WL_USE_NETDEV_OPS)
+ 	dev->netdev_ops = &wl_netdev_monitor_ops;
diff --git a/014-Makefile.patch b/014-Makefile.patch
new file mode 100644
index 0000000..8b3554b
--- /dev/null
+++ b/014-Makefile.patch
@@ -0,0 +1,21 @@
+diff -u a/Makefile b/Makefile
+--- a/Makefile	2015-09-19 07:47:30.000000000 +0900
++++ b/Makefile	2022-03-31 20:57:21.559720910 +0900
+@@ -115,7 +115,7 @@
+ GCCVERSION := $(subst $(space),$(empty),$(GCCVERSION))
+ # Crop the version number to 3 decimals.
+ GCCVERSION := $(shell expr `echo $(GCCVERSION)` | cut -b1-3)
+-GE_49 := $(shell expr `echo $(GCCVERSION)` \>= 490)
++GE_49 := 1
+ 
+ EXTRA_CFLAGS :=
+ 
+@@ -145,7 +145,7 @@
+ EXTRA_CFLAGS       += -Wno-date-time
+ endif
+ 
+-EXTRA_LDFLAGS      := $(src)/lib/wlc_hybrid.o_shipped
++EXTRA_LDFLAGS      := /usr/lib/broadcom-wl-dkms/wlc_hybrid.o_shipped
+ 
+ KBASE              ?= /lib/modules/`uname -r`
+ KBUILD_DIR         ?= $(KBASE)/build
diff --git a/015-brcm-wlan-ifname.patch b/015-brcm-wlan-ifname.patch
new file mode 100644
index 0000000..83cd96e
--- /dev/null
+++ b/015-brcm-wlan-ifname.patch
@@ -0,0 +1,12 @@
+diff -ur a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
+--- a/src/wl/sys/wl_linux.c	2015-09-19 07:47:30.000000000 +0900
++++ b/src/wl/sys/wl_linux.c	2022-03-31 20:57:21.533054244 +0900
+@@ -217,7 +217,7 @@
+ #define to_str(s) #s
+ #define quote_str(s) to_str(s)
+ 
+-#define BRCM_WLAN_IFNAME eth%d
++#define BRCM_WLAN_IFNAME wlan%d
+ 
+ static char intf_name[IFNAMSIZ] = quote_str(BRCM_WLAN_IFNAME);
+ 
```