[Buildroot] [PATCH] package/rtl8723b: fix build faillure with Linux 6.1

Giulio Benetti giulio.benetti at benettiengineering.com
Wed Dec 28 17:17:45 UTC 2022


Add 2 local patches pending upstream[1] to fix build failure with Linux 6.1

[1]: https://github.com/lwfinger/rtl8723bu/pull/194

Fixes:
http://autobuild.buildroot.net/results/cc84b5f62ca59572f0f52086f157acc0409c03f5/

Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
---
 ...vice.c-fix-missing-prandom_u32-with-.patch | 34 +++++++++
 ...80211.c-fix-build-failure-on-Linux-6.patch | 74 +++++++++++++++++++
 2 files changed, 108 insertions(+)
 create mode 100644 package/rtl8723bu/0002-os_dep-osdep_service.c-fix-missing-prandom_u32-with-.patch
 create mode 100644 package/rtl8723bu/0003-os_dep-ioctl_cfg80211.c-fix-build-failure-on-Linux-6.patch

diff --git a/package/rtl8723bu/0002-os_dep-osdep_service.c-fix-missing-prandom_u32-with-.patch b/package/rtl8723bu/0002-os_dep-osdep_service.c-fix-missing-prandom_u32-with-.patch
new file mode 100644
index 0000000000..6198500f02
--- /dev/null
+++ b/package/rtl8723bu/0002-os_dep-osdep_service.c-fix-missing-prandom_u32-with-.patch
@@ -0,0 +1,34 @@
+From 509f24ce9fb24a9647b4295c9e9eb35efa8baa23 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti at benettiengineering.com>
+Date: Wed, 28 Dec 2022 17:49:29 +0100
+Subject: [PATCH] os_dep/osdep_service.c: fix missing prandom_u32() with Linux
+ >= 6.1.0
+
+prandom_u32() previously was only calling get_random_u32() so it's been
+dropped with Linux 6.1.0. So let's directly call get_random_u32() if Linux
+version >= 6.1.0.
+
+[Upstream status: https://github.com/lwfinger/rtl8723bu/pull/194]
+Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
+---
+ os_dep/osdep_service.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c
+index 545d00d..87266e0 100644
+--- a/os_dep/osdep_service.c
++++ b/os_dep/osdep_service.c
+@@ -1016,7 +1016,9 @@ u64 rtw_division64(u64 x, u64 y)
+ 
+ inline u32 rtw_random32(void)
+ {
+-	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
++	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0))
++	return get_random_u32();
++	#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+ 	return prandom_u32();
+ 	#elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18))
+ 	u32 random_int;
+-- 
+2.34.1
+
diff --git a/package/rtl8723bu/0003-os_dep-ioctl_cfg80211.c-fix-build-failure-on-Linux-6.patch b/package/rtl8723bu/0003-os_dep-ioctl_cfg80211.c-fix-build-failure-on-Linux-6.patch
new file mode 100644
index 0000000000..7926d305b3
--- /dev/null
+++ b/package/rtl8723bu/0003-os_dep-ioctl_cfg80211.c-fix-build-failure-on-Linux-6.patch
@@ -0,0 +1,74 @@
+From 5b7ddfe0eab3a29847a8eb5e9563ef6059d744a5 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti at benettiengineering.com>
+Date: Wed, 28 Dec 2022 18:05:34 +0100
+Subject: [PATCH] os_dep/ioctl_cfg80211.c: fix build failure on Linux >= 6.1
+ because of cfg80211 api change
+
+Starting from Linux 6.1 some 80211 api requires 'int link_id' argument, so
+let's add it according to Linux version used.
+
+[Upstream status: https://github.com/lwfinger/rtl8723bu/pull/194]
+Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
+---
+ os_dep/ioctl_cfg80211.c | 24 +++++++++++++++++-------
+ 1 file changed, 17 insertions(+), 7 deletions(-)
+
+diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c
+index 0e38a66..4c9c954 100644
+--- a/os_dep/ioctl_cfg80211.c
++++ b/os_dep/ioctl_cfg80211.c
+@@ -1429,7 +1429,9 @@ exit:
+ }
+ 
+ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)) || defined(COMPAT_KERNEL_RELEASE)
++				int link_id, u8 key_index, bool pairwise, const u8 *mac_addr,
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ 				u8 key_index, bool pairwise, const u8 *mac_addr,
+ #else	// (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ 				u8 key_index, const u8 *mac_addr,
+@@ -1566,7 +1568,9 @@ addkey_end:
+ }
+ 
+ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)) || defined(COMPAT_KERNEL_RELEASE)
++				int link_id, u8 key_index, bool pairwise, const u8 *mac_addr,
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ 				u8 key_index, bool pairwise, const u8 *mac_addr,
+ #else	// (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ 				u8 key_index, const u8 *mac_addr,
+@@ -1580,7 +1584,9 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev,
+ }
+ 
+ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)) || defined(COMPAT_KERNEL_RELEASE)
++				int link_id, u8 key_index, bool pairwise, const u8 *mac_addr)
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
+ 				u8 key_index, bool pairwise, const u8 *mac_addr)
+ #else	// (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ 				u8 key_index, const u8 *mac_addr)
+@@ -1601,10 +1607,14 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
+ }
+ 
+ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
+-	struct net_device *ndev, u8 key_index
+-	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
+-	, bool unicast, bool multicast
+-	#endif
++					struct net_device *ndev,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)) || defined(COMPAT_KERNEL_RELEASE)
++					int link_id,
++#endif
++					u8 key_index,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
++					bool unicast, bool multicast
++#endif
+ 	)
+ {
+ 	_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
+-- 
+2.34.1
+
-- 
2.34.1




More information about the buildroot mailing list