mirror of
https://github.com/morrownr/8821cu-20210916.git
synced 2024-11-22 21:44:59 +00:00
Compare commits
No commits in common. "2b48616df2c519f49cacd63f8acf2043cdd5ee27" and "fdbb62727c1526778e408da928d8c3760cce0fa1" have entirely different histories.
2b48616df2
...
fdbb62727c
9
Makefile
9
Makefile
@ -32,12 +32,6 @@ EXTRA_CFLAGS += -DCONFIG_LED_ENABLE
|
|||||||
EXTRA_CFLAGS += -Wno-address
|
EXTRA_CFLAGS += -Wno-address
|
||||||
EXTRA_CFLAGS += -Wframe-larger-than=1648
|
EXTRA_CFLAGS += -Wframe-larger-than=1648
|
||||||
|
|
||||||
# gcc-13
|
|
||||||
EXTRA_CFLAGS += -Wno-enum-int-mismatch
|
|
||||||
EXTRA_CFLAGS += -Wno-stringop-overread
|
|
||||||
EXTRA_CFLAGS += -Wno-enum-conversion
|
|
||||||
EXTRA_CFLAGS += -Wno-int-in-bool-context
|
|
||||||
|
|
||||||
GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
|
GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
|
||||||
ifeq ($(GCC_VER_49),1)
|
ifeq ($(GCC_VER_49),1)
|
||||||
EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later
|
EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later
|
||||||
@ -2510,8 +2504,7 @@ sign:
|
|||||||
@mokutil --import MOK.der
|
@mokutil --import MOK.der
|
||||||
@$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der 8821cu.ko
|
@$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der 8821cu.ko
|
||||||
|
|
||||||
sign-install:
|
sign-install: sign install
|
||||||
sign install
|
|
||||||
|
|
||||||
backup_rtlwifi:
|
backup_rtlwifi:
|
||||||
@echo "Making backup rtlwifi drivers"
|
@echo "Making backup rtlwifi drivers"
|
||||||
|
@ -65,7 +65,7 @@ the hardware to test the above.
|
|||||||
### Compatible Kernels
|
### Compatible Kernels
|
||||||
|
|
||||||
- Kernels: 4.19 - 5.11 (Realtek)
|
- Kernels: 4.19 - 5.11 (Realtek)
|
||||||
- Kernels: 5.12 - 6.7 (community support)
|
- Kernels: 5.12 - 6.6 (community support)
|
||||||
|
|
||||||
Note: Kernels earlier than 4.19 may work but are not tested or
|
Note: Kernels earlier than 4.19 may work but are not tested or
|
||||||
supported.
|
supported.
|
||||||
@ -311,9 +311,6 @@ sudo apt install -y build-essential dkms git iw
|
|||||||
|
|
||||||
- Option for Fedora
|
- Option for Fedora
|
||||||
|
|
||||||
Note: Fedora users should also install `openssl` if secure boot is
|
|
||||||
active.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo dnf -y install git dkms kernel-devel
|
sudo dnf -y install git dkms kernel-devel
|
||||||
```
|
```
|
||||||
@ -391,17 +388,13 @@ compile the kernel that is in use:
|
|||||||
|
|
||||||
Example of bad situation:
|
Example of bad situation:
|
||||||
|
|
||||||
```
|
|
||||||
gcc 12.1 (used to compile the kernel)
|
gcc 12.1 (used to compile the kernel)
|
||||||
gcc 10.3 (version of gcc in use)
|
gcc 10.3 (version of gcc in use)
|
||||||
```
|
|
||||||
|
|
||||||
Example of good situation:
|
Example of good situation:
|
||||||
|
|
||||||
```
|
|
||||||
gcc 12.2 (used to compile the kernel)
|
gcc 12.2 (used to compile the kernel)
|
||||||
gcc 12.1 (version of gcc in use)
|
gcc 12.1 (version of gcc in use)
|
||||||
```
|
|
||||||
|
|
||||||
To determine the values:
|
To determine the values:
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# run from another script.
|
# run from another script.
|
||||||
|
|
||||||
# SMEM needs to be set here if dkms build is not initiated by install-driver.sh
|
# SMEM needs to be set here if dkms build is not initiated by install-driver.sh
|
||||||
SMEM=$(LC_ALL=C free | awk '/Mem:/ { print $2 }')
|
SMEM=$(LANG=C free | awk '/Mem:/ { print $2 }')
|
||||||
|
|
||||||
# sproc needs to be set here if dkms build is not initiated by install-driver.sh
|
# sproc needs to be set here if dkms build is not initiated by install-driver.sh
|
||||||
sproc=$(nproc)
|
sproc=$(nproc)
|
||||||
|
@ -28,15 +28,12 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
SCRIPT_NAME="install-driver.sh"
|
SCRIPT_NAME="install-driver.sh"
|
||||||
SCRIPT_VERSION="20231115"
|
SCRIPT_VERSION="20230830"
|
||||||
|
|
||||||
MODULE_NAME="8821cu"
|
|
||||||
|
|
||||||
DRV_NAME="rtl8821cu"
|
DRV_NAME="rtl8821cu"
|
||||||
DRV_VERSION="5.12.0.4"
|
DRV_VERSION="5.12.0.4"
|
||||||
DRV_DIR="$(pwd)"
|
MODULE_NAME="8821cu"
|
||||||
|
|
||||||
OPTIONS_FILE="${MODULE_NAME}.conf"
|
|
||||||
|
|
||||||
#KARCH="$(uname -m)"
|
#KARCH="$(uname -m)"
|
||||||
if [ -z "${KARCH+1}" ]; then
|
if [ -z "${KARCH+1}" ]; then
|
||||||
@ -48,13 +45,16 @@ if [ -z "${KVER+1}" ]; then
|
|||||||
KVER="$(uname -r)"
|
KVER="$(uname -r)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
|
||||||
|
|
||||||
#GARCH="$(uname -m | sed -e "s/i.86/i386/; s/ppc/powerpc/; s/armv.l/arm/; s/aarch64/arm64/; s/riscv.*/riscv/;")"
|
#GARCH="$(uname -m | sed -e "s/i.86/i386/; s/ppc/powerpc/; s/armv.l/arm/; s/aarch64/arm64/; s/riscv.*/riscv/;")"
|
||||||
if [ -z "${GARCH+1}" ]; then
|
if [ -z "${GARCH+1}" ]; then
|
||||||
GARCH="$(uname -m | sed -e "s/i.86/i386/; s/ppc/powerpc/; s/armv.l/arm/; s/aarch64/arm64/; s/riscv.*/riscv/;")"
|
GARCH="$(uname -m | sed -e "s/i.86/i386/; s/ppc/powerpc/; s/armv.l/arm/; s/aarch64/arm64/; s/riscv.*/riscv/;")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DRV_DIR="$(pwd)"
|
||||||
|
|
||||||
|
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
||||||
|
OPTIONS_FILE="${MODULE_NAME}.conf"
|
||||||
|
|
||||||
# check to ensure sudo or su - was used to start the script
|
# check to ensure sudo or su - was used to start the script
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "You must run this script with superuser (root) privileges."
|
echo "You must run this script with superuser (root) privileges."
|
||||||
@ -151,13 +151,15 @@ echo ": ---------------------------"
|
|||||||
# displays script name and version
|
# displays script name and version
|
||||||
echo ": ${SCRIPT_NAME} v${SCRIPT_VERSION}"
|
echo ": ${SCRIPT_NAME} v${SCRIPT_VERSION}"
|
||||||
|
|
||||||
|
# information that helps with bug reports
|
||||||
|
|
||||||
# display kernel architecture
|
# display kernel architecture
|
||||||
echo ": ${KARCH} (kernel architecture)"
|
echo ": ${KARCH} (kernel architecture)"
|
||||||
|
|
||||||
# display architecture to send to gcc
|
# display architecture to send to gcc
|
||||||
echo ": ${GARCH} (architecture to send to gcc)"
|
echo ": ${GARCH} (architecture to send to gcc)"
|
||||||
|
|
||||||
SMEM=$(LC_ALL=C free | awk '/Mem:/ { print $2 }')
|
SMEM=$(LANG=C free | awk '/Mem:/ { print $2 }')
|
||||||
sproc=$(nproc)
|
sproc=$(nproc)
|
||||||
# avoid Out of Memory condition in low-RAM systems by limiting core usage
|
# avoid Out of Memory condition in low-RAM systems by limiting core usage
|
||||||
if [ "$sproc" -gt 1 ]; then
|
if [ "$sproc" -gt 1 ]; then
|
||||||
@ -194,16 +196,34 @@ if command -v dkms >/dev/null 2>&1; then
|
|||||||
echo ": ""${dkms_ver}"
|
echo ": ""${dkms_ver}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# display Secure Boot status
|
# display secure mode status
|
||||||
if command -v mokutil >/dev/null 2>&1; then
|
if command -v mokutil >/dev/null 2>&1; then
|
||||||
case $(mokutil --sb-state 2>&1) in
|
if mokutil --sb-state | grep -i enabled >/dev/null 2>&1; then
|
||||||
*enabled*) echo ": SecureBoot enabled" ;;
|
echo ": SecureBoot enabled"
|
||||||
*disabled*) echo ": SecureBoot disabled" ;;
|
fi
|
||||||
*) echo ": This system doesn't support Secure Boot" ;;
|
if mokutil --sb-state | grep -i disabled >/dev/null 2>&1; then
|
||||||
esac
|
echo ": SecureBoot disabled"
|
||||||
|
fi
|
||||||
|
if mokutil --sb-state | grep -i EFI >/dev/null 2>&1; then
|
||||||
|
echo ": EFI variables are not supported on this system"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo ": mokutil not installed"
|
echo ": mokutil not installed"
|
||||||
fi
|
fi
|
||||||
|
# need to fix the following
|
||||||
|
#: ---------------------------
|
||||||
|
#: install-driver.sh v20230718
|
||||||
|
#: x86_64 (system architecture)
|
||||||
|
#: x86_64 (gcc architecture)
|
||||||
|
#: 4/4 (in-use/total processing units)
|
||||||
|
#: 16283584 (total system memory)
|
||||||
|
#: 5.19.0-50-generic (kernel version)
|
||||||
|
#: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
|
||||||
|
#: dkms-2.8.7
|
||||||
|
#This system doesn't support Secure Boot
|
||||||
|
#This system doesn't support Secure Boot
|
||||||
|
#This system doesn't support Secure Boot
|
||||||
|
#: ---------------------------
|
||||||
|
|
||||||
echo ": ---------------------------"
|
echo ": ---------------------------"
|
||||||
echo
|
echo
|
||||||
@ -254,7 +274,21 @@ if [ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODU
|
|||||||
echo "Removal complete."
|
echo "Removal complete."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for and remove all dkms installations with MODULE_NAME in DRV_NAME
|
# check for and remove all dkms installations with DRV_NAME
|
||||||
|
#
|
||||||
|
# dkms status [module/module-version] [-k kernel/arch]
|
||||||
|
#
|
||||||
|
# $ dkms status
|
||||||
|
#
|
||||||
|
# nvidia/535.86.05, 6.2.0-27-generic, x86_64: installed
|
||||||
|
# nvidia/535.86.05, 6.5.0-060500rc5-generic, x86_64: installed
|
||||||
|
# rtl8852bu/1.19.3, 6.2.0-27-generic, x86_64: installed
|
||||||
|
# rtl8852bu/1.19.3, 6.5.0-060500rc5-generic, x86_64: installed
|
||||||
|
# rtl8852bu/1.15.2, 6.5.0-060500rc5-generic, x86_64: installed
|
||||||
|
#
|
||||||
|
# dkms remove [module/module-version] [-k kernel/arch] [--all]
|
||||||
|
#
|
||||||
|
# $ dkms remove "${modname}/${modver}" -c "/usr/src/${modname}-${modver}/dkms.conf" --all
|
||||||
#
|
#
|
||||||
if command -v dkms >/dev/null 2>&1; then
|
if command -v dkms >/dev/null 2>&1; then
|
||||||
dkms status | while IFS="/, " read -r modname modver kerver _dummy; do
|
dkms status | while IFS="/, " read -r modname modver kerver _dummy; do
|
||||||
@ -360,9 +394,9 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v /usr/bin/time >/dev/null 2>&1; then
|
if command -v /usr/bin/time >/dev/null 2>&1; then
|
||||||
/usr/bin/time -f "Compile time: %U seconds" dkms build -m ${DRV_NAME} -v ${DRV_VERSION} -k "${KVER}/${KARCH}" -c "/usr/src/${DRV_NAME}-${DRV_VERSION}/dkms.conf" --force
|
/usr/bin/time -f "Compile time: %U seconds" dkms build -m ${DRV_NAME} -v ${DRV_VERSION} -k "${KVER}/${KARCH}" -c "/usr/src/${DRV_NAME}-${DRV_VERSION}/dkms.conf"
|
||||||
else
|
else
|
||||||
dkms build -m ${DRV_NAME} -v ${DRV_VERSION} -k "${KVER}/${KARCH}" -c "/usr/src/${DRV_NAME}-${DRV_VERSION}/dkms.conf" --force
|
dkms build -m ${DRV_NAME} -v ${DRV_VERSION} -k "${KVER}/${KARCH}" -c "/usr/src/${DRV_NAME}-${DRV_VERSION}/dkms.conf"
|
||||||
fi
|
fi
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
@ -378,7 +412,7 @@ else
|
|||||||
echo ": ---------------------------"
|
echo ": ---------------------------"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dkms install -m ${DRV_NAME} -v ${DRV_VERSION} -k "${KVER}/${KARCH}" -c "/usr/src/${DRV_NAME}-${DRV_VERSION}/dkms.conf" --force
|
dkms install -m ${DRV_NAME} -v ${DRV_VERSION} -k "${KVER}/${KARCH}" -c "/usr/src/${DRV_NAME}-${DRV_VERSION}/dkms.conf"
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
if [ "$RESULT" != "0" ]; then
|
if [ "$RESULT" != "0" ]; then
|
||||||
|
@ -5326,11 +5326,8 @@ static int cfg80211_rtw_add_beacon(struct wiphy *wiphy, struct net_device *ndev,
|
|||||||
}
|
}
|
||||||
rtw_mi_scan_abort(adapter, _TRUE);
|
rtw_mi_scan_abort(adapter, _TRUE);
|
||||||
rtw_mi_buddy_set_scan_deny(adapter, 300);
|
rtw_mi_buddy_set_scan_deny(adapter, 300);
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0))
|
|
||||||
ret = rtw_add_beacon(adapter, ap->beacon.head, ap->beacon.head_len, ap->beacon.tail, ap->beacon.tail_len);
|
|
||||||
#else
|
|
||||||
ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
|
ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
|
||||||
#endif
|
|
||||||
exit:
|
exit:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -5452,11 +5449,7 @@ exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
|
static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0))
|
|
||||||
struct cfg80211_ap_update *ap)
|
|
||||||
#else
|
|
||||||
struct cfg80211_beacon_data *info)
|
struct cfg80211_beacon_data *info)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
_adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
|
_adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
|
||||||
@ -5476,11 +5469,7 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd
|
|||||||
if (info->assocresp_ies_len > 0)
|
if (info->assocresp_ies_len > 0)
|
||||||
rtw_cfg80211_set_assocresp_ies(ndev, info->assocresp_ies, info->assocresp_ies_len);
|
rtw_cfg80211_set_assocresp_ies(ndev, info->assocresp_ies, info->assocresp_ies_len);
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0))
|
|
||||||
ret = rtw_add_beacon(adapter, ap->beacon.head, ap->beacon.head_len, ap->beacon.tail, ap->beacon.tail_len);
|
|
||||||
#else
|
|
||||||
ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
|
ret = rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -28,14 +28,11 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
SCRIPT_NAME="remove-driver.sh"
|
SCRIPT_NAME="remove-driver.sh"
|
||||||
SCRIPT_VERSION="20231118"
|
SCRIPT_VERSION="20230830"
|
||||||
|
|
||||||
MODULE_NAME="8821cu"
|
|
||||||
|
|
||||||
DRV_NAME="rtl8821cu"
|
DRV_NAME="rtl8821cu"
|
||||||
DRV_VERSION="5.12.0.4"
|
DRV_VERSION="5.12.0.4"
|
||||||
|
MODULE_NAME="8821cu"
|
||||||
OPTIONS_FILE="${MODULE_NAME}.conf"
|
|
||||||
|
|
||||||
#KARCH="$(uname -m)"
|
#KARCH="$(uname -m)"
|
||||||
if [ -z "${KARCH+1}" ]; then
|
if [ -z "${KARCH+1}" ]; then
|
||||||
@ -48,6 +45,7 @@ if [ -z "${KVER+1}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
||||||
|
OPTIONS_FILE="${MODULE_NAME}.conf"
|
||||||
|
|
||||||
# check to ensure sudo or su - was used to start the script
|
# check to ensure sudo or su - was used to start the script
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
@ -118,6 +116,10 @@ fi
|
|||||||
|
|
||||||
# check for and remove all dkms installations with DRV_NAME
|
# check for and remove all dkms installations with DRV_NAME
|
||||||
#
|
#
|
||||||
|
# dkms status [module/module-version] [-k kernel/arch]
|
||||||
|
#
|
||||||
|
# $ dkms status
|
||||||
|
#
|
||||||
if command -v dkms >/dev/null 2>&1; then
|
if command -v dkms >/dev/null 2>&1; then
|
||||||
dkms status | while IFS="/, " read -r modname modver kerver _dummy; do
|
dkms status | while IFS="/, " read -r modname modver kerver _dummy; do
|
||||||
case "$modname" in *${MODULE_NAME})
|
case "$modname" in *${MODULE_NAME})
|
||||||
@ -126,6 +128,7 @@ if command -v dkms >/dev/null 2>&1; then
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
# echo "Result=${RESULT}"
|
||||||
|
|
||||||
# RESULT will be 3 if there are no instances of module to remove
|
# RESULT will be 3 if there are no instances of module to remove
|
||||||
# however we still need to remove various files or the install script
|
# however we still need to remove various files or the install script
|
||||||
|
37
save-log.sh
Executable file
37
save-log.sh
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Purpose: Save a log file with RTW lines only.
|
||||||
|
#
|
||||||
|
# To make this file executable:
|
||||||
|
#
|
||||||
|
# $ chmod +x save-log.sh
|
||||||
|
#
|
||||||
|
# To execute this file:
|
||||||
|
#
|
||||||
|
# $ sudo ./save-log.sh
|
||||||
|
#
|
||||||
|
# or
|
||||||
|
#
|
||||||
|
# $ sudo sh save-log.sh
|
||||||
|
|
||||||
|
SCRIPT_NAME="save-log.sh"
|
||||||
|
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
echo "You must run this script with superuser (root) privileges."
|
||||||
|
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# deletes existing log
|
||||||
|
rm -f -- rtw.log
|
||||||
|
|
||||||
|
dmesg | cut -d"]" -f2- | grep "RTW" >> rtw.log
|
||||||
|
RESULT=$?
|
||||||
|
|
||||||
|
if [ "$RESULT" != "0" ]; then
|
||||||
|
echo "An error occurred while running: ${SCRIPT_NAME}"
|
||||||
|
echo "Did you set a log level > 0 ?"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "rtw.log saved successfully."
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user