You are not logged in.

#1 2020-05-03 09:05:30

benjamin007
Member
Registered: 2019-07-24
Posts: 18

dkms Install error after rolling back to LTS kernel

I was using arch kernel 5.6.6 and just rolled back to 5.4 LTS kernel. Installation was successful. After reboot, I install kernel LTS headers. Then, dkms has thrown make error for my rtl WiFi module.
var/lib/dkms/rtlwifi_new/r297.4727028/build/make.log says;

`var/lib/dkms/rtlwifi_new/r297.4727028/build/rc.c:336:11: error: initialization of ‘void * (*)(struct ieee80211_hw *)’ from incompatible pointer type ‘void * (*)(struct ieee80211_hw *, struct dentry *)’ [-Werror=incompatible-pointer-types]
  336 |  .alloc = rtl_rate_alloc,
      |           ^~~~~~~~~~~~~~
/var/lib/dkms/rtlwifi_new/r297.4727028/build/rc.c:336:11: note: (near initialization for ‘rtl_rate_ops.alloc’)
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:266: /var/lib/dkms/rtlwifi_new/r297.4727028/build/rc.o] Error 1
make[1]: *** Waiting for unfinished jobs....`

Last edited by benjamin007 (2020-05-03 09:05:58)

Offline

#2 2020-05-03 11:03:06

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 1,985
Website

Re: dkms Install error after rolling back to LTS kernel

You can either manually edit the source code and remove the second argument or downgrade the dkms package to a version compatible with the older kernel.

Last edited by schard (2020-05-03 11:04:17)


macro_rules! yolo { { $($tokens:tt)* } => { unsafe { $($tokens)* } }; }

Offline

#3 2020-05-03 13:32:30

loqs
Member
Registered: 2014-03-06
Posts: 17,369

Re: dkms Install error after rolling back to LTS kernel

What about

diff --git a/PKGBUILD b/PKGBUILD
index 656eeed..8b557e1 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,24 +2,32 @@
 
 pkgname=rtlwifi_new-dkms
 _pkgname=rtlwifi_new
-pkgver=r221.01cbe67
-pkgrel=2
+pkgver=r286.b8063e9
+pkgrel=1
 pkgdesc='Newest Realtek rtlwifi codes'
 arch=('i686' 'x86_64')
 url='https://github.com/lwfinger/rtlwifi_new'
 depends=('dkms')
 makedepends=('git')
-install=${pkgname}.install
-source=("git+https://github.com/lwfinger/rtlwifi_new.git" "dkms.conf" "blacklist-rtlwifi_new-dkms.conf")
+source=("git+https://github.com/lwfinger/rtlwifi_new.git"
+        "dkms.conf"
+        "blacklist-rtlwifi_new-dkms.conf"
+        "stable.patch")
 sha1sums=('SKIP'
           'ad47c1491db43fa7390a6db380d21bac6a56b5f9'
-          '524ea363adee44fb9f2293bde3838b5e235193da')
+          '524ea363adee44fb9f2293bde3838b5e235193da'
+          '2af56381c52671facd2858d8a4c884e32ddfd5a7')
 
 pkgver() {
 	cd "${_pkgname}"
 	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
 }
 
+prepare() {
+	cd "${_pkgname}"
+	patch -p1 -i ../stable.patch
+}
+
 package() {
 	install -dm 755 "${pkgdir}/usr/src"
 	cp -dr --no-preserve=ownership "${_pkgname}" "${pkgdir}/usr/src/${_pkgname}-${pkgver}"
diff --git a/rtlwifi_new-dkms.install b/rtlwifi_new-dkms.install
deleted file mode 100644
index 7e6c585..0000000
--- a/rtlwifi_new-dkms.install
+++ /dev/null
@@ -1,24 +0,0 @@
-post_install() {
-	dkms install -m rtlwifi_new -v ${1%%-*}
-	local version=${1%%-*}
-	dkms=$(which dkms)
-	echo -e "\n"
-	echo "#####################################"
-	echo -e "\n"
-	echo "To avoid conflict with the original modules provided by the kernel, the dkms modules were renamed to '<module_name>_dkms'."
-	echo "Should you need to manually load the module, use 'modprobe <module_name>_dkms'."
-	echo "To remove the modules, use 'rmmod <module_name>' instead."
-	echo -e "\n"
-}
-
-pre_upgrade() {
-	pre_remove $2
-}
-
-post_upgrade() {
-	post_install $1
-}
-
-pre_remove() {
-	dkms remove -m rtlwifi_new -v ${1%%-*} --all
-}
diff --git a/stable.patch b/stable.patch
new file mode 100644
index 0000000..08f38f7
--- /dev/null
+++ b/stable.patch
@@ -0,0 +1,26 @@
+diff --git a/rc.c b/rc.c
+index e3a2803..8327db8 100644
+--- a/rc.c
++++ b/rc.c
+@@ -245,10 +245,11 @@ static void rtl_rate_update(void *ppriv,
+ {
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 8) || LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 36)
+ static void *rtl_rate_alloc(struct ieee80211_hw *hw)
+-/* Change the preceeding line to
++#else
+ static void *rtl_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
+-*/
++#endif
+ {
+ 	struct rtl_priv *rtlpriv = rtl_priv(hw);
+ 	return rtlpriv;
+@@ -283,7 +284,6 @@ static void rtl_rate_free_sta(void *rtlpriv,
+ 	kfree(rate_priv);
+ }
+ 
+-/* If you get a failure here, then follow the instructions at function rtl_rate_alloc */
+ static struct rate_control_ops rtl_rate_ops = {
+ 	.name = "rtl_rc",
+ 	.alloc = rtl_rate_alloc,

Offline

Board footer

Powered by FluxBB