From c60b32c95e0551fecf35e9b74fe7f581f069a187 Mon Sep 17 00:00:00 2001 From: morrownr Date: Sat, 7 Jan 2023 18:04:58 -0600 Subject: [PATCH] install script now posts system ram --- 8821cu.conf | 18 +++++++- Makefile | 5 ++- install-driver.sh | 107 +++++++++++++++++++++++++++------------------- remove-driver.sh | 4 +- 4 files changed, 86 insertions(+), 48 deletions(-) diff --git a/8821cu.conf b/8821cu.conf index de05493..230abda 100644 --- a/8821cu.conf +++ b/8821cu.conf @@ -18,7 +18,7 @@ options 8821cu rtw_drv_log_level=1 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgn # After editing is complete, save this file (if using nano: Ctrl + x, y, Enter) # and reboot to activate the changes. # -# Warning: Some adapters based on the rtl8821cu chipset may require the +# Important: Some adapters based on the rtl8821cu chipset may require the # `rtw_RFE_type` option to be set. If wifi or bluetooth does not work # after driver installation, see the appropriate section in the below # documentation. This issue has not been seen on wifi only adapters. @@ -117,6 +117,22 @@ options 8821cu rtw_drv_log_level=1 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgn # # ----- # +# Wireless Mode options ( rtw_wireless_mode ) +# +# 1 = 2.4GHz 802.11b +# 2 = 2.4GHz 802.11g +# 3 = 2.4GHz 802.11b/g +# 4 = 5GHz 802.11a +# 8 = 2.4Hz 802.11n +# 11 = 2.4GHz 802.11b/g/n +# 16 = 5GHz 802.11n +# 20 = 5GHz 802.11a/n +# 64 = 5GHz 802.11ac +# 84 = 5GHz 802.11a/n/ac +# 95 = 2.4GHz 802.11b/g/n 5GHz 802.11a/n/ac (default) +# +# ----- +# # Select RFE type ( rtw_RFE_type ) # # 0 = (2-Ant, DPDT), (2G_WLG, iPA, iLNA, iSW), (5G, iPA, iLNA, iSW) diff --git a/Makefile b/Makefile index 98b36a1..33e7dd0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS) EXTRA_CFLAGS += -O1 +# --param ggc-min-expand=10 #EXTRA_CFLAGS += -O3 #EXTRA_CFLAGS += -Wall #EXTRA_CFLAGS += -Wextra @@ -122,7 +123,7 @@ CONFIG_RTW_DEBUG = y CONFIG_RTW_LOG_LEVEL = 0 # enable /proc/net/rtlxxxx/ debug interfaces -CONFIG_PROC_DEBUG = y +CONFIG_PROC_DEBUG = n ######################## Wake On Lan ########################## CONFIG_WOWLAN = n @@ -133,7 +134,7 @@ CONFIG_WOW_LPS_MODE = default CONFIG_SUSPEND_TYPE = 0 CONFIG_WOW_STA_MIX = n CONFIG_GPIO_WAKEUP = n -# Please contact with RTK support team first. After getting the agreement from RTK support team, +# Please contact with RTK support team first. After getting the agreement from RTK support team, # you are just able to modify the CONFIG_WAKEUP_GPIO_IDX with customized requirement. CONFIG_WAKEUP_GPIO_IDX = default CONFIG_HIGH_ACTIVE_DEV2HST = n diff --git a/install-driver.sh b/install-driver.sh index 1e3dea6..f14491c 100755 --- a/install-driver.sh +++ b/install-driver.sh @@ -4,7 +4,7 @@ # # Supports dkms and non-dkms installations. -# Copyright(c) 2022 Nick Morrow +# Copyright(c) 2023 Nick Morrow # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as @@ -16,7 +16,7 @@ # GNU General Public License for more details. SCRIPT_NAME="install-driver.sh" -SCRIPT_VERSION="20230101" +SCRIPT_VERSION="20230107" MODULE_NAME="8821cu" DRV_VERSION="5.12.0.4" @@ -117,47 +117,6 @@ done # displays script name and version echo "Script: ${SCRIPT_NAME} v${SCRIPT_VERSION}" -# check for and remove non-dkms installations -# standard naming -if [[ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]] -then - echo "Removing a non-dkms installation: ${MODDESTDIR}${MODULE_NAME}.ko" - rm -f ${MODDESTDIR}${MODULE_NAME}.ko - /sbin/depmod -a ${KVER} -fi - -# check for and remove non-dkms installations -# with rtl added to module name (PClinuxOS) -if [[ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]] -then - echo "Removing a non-dkms installation: ${MODDESTDIR}rtl${MODULE_NAME}.ko" - rm -f ${MODDESTDIR}rtl${MODULE_NAME}.ko - /sbin/depmod -a ${KVER} -fi - -# check for and remove non-dkms installations -# with compressed module in a unique non-standard location (Armbian) -# Example: /usr/lib/modules/5.15.80-rockchip64/kernel/drivers/net/wireless/rtl8821cu/8821cu.ko.xz -# Dear Armbiam, this is a really bad idea. -if [[ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" ]] -then - echo "Removing a non-dkms installation: /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" - rm -f /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz - /sbin/depmod -a ${KVER} -fi - -# check for existing dkms installations of any version of this driver -if command -v dkms >/dev/null 2>&1 -then - if dkms status | grep -i ${DRV_NAME}; then - echo "The above driver needs to be removed before the installation can be successfull." - echo "Example: $ sudo dkms remove ${DRV_NAME}/X.X.X.X --all" - echo "Please replace X.X.X.X by the driver version number shown above." - echo "Once the driver is removed, please run \"sudo ./${SCRIPT_NAME}\"" - exit 1 - fi -fi - # information that helps with bug reports # display kernel version @@ -166,6 +125,9 @@ echo "Kernel: ${KVER}" # display architecture echo "Arch : ${KARCH}" +# display total memory in system +grep MemTotal /proc/meminfo + # display gcc version gcc_ver=$(gcc --version | grep -i gcc) echo "gcc : "${gcc_ver} @@ -187,6 +149,64 @@ then mokutil --sb-state fi +# check for and remove non-dkms installations +# standard naming +if [[ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]] +then + echo "Removing a non-dkms installation: ${MODDESTDIR}${MODULE_NAME}.ko" + rm -f ${MODDESTDIR}${MODULE_NAME}.ko + /sbin/depmod -a ${KVER} + echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d" + rm -f /etc/modprobe.d/${OPTIONS_FILE} + echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}" + rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION} + make clean >/dev/null 2>&1 +fi + +# check for and remove non-dkms installations +# with rtl added to module name (PClinuxOS) +if [[ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]] +then + echo "Removing a non-dkms installation: ${MODDESTDIR}rtl${MODULE_NAME}.ko" + rm -f ${MODDESTDIR}rtl${MODULE_NAME}.ko + /sbin/depmod -a ${KVER} + echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d" + rm -f /etc/modprobe.d/${OPTIONS_FILE} + echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}" + rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION} + make clean >/dev/null 2>&1 +fi + +# check for and remove non-dkms installations +# with compressed module in a unique non-standard location (Armbian) +# Example: /usr/lib/modules/5.15.80-rockchip64/kernel/drivers/net/wireless/rtl8821cu/8821cu.ko.xz +# Dear Armbiam, this is a really bad idea. +if [[ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" ]] +then + echo "Removing a non-dkms installation: /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" + rm -f /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz + /sbin/depmod -a ${KVER} + echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d" + rm -f /etc/modprobe.d/${OPTIONS_FILE} + echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}" + rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION} + make clean >/dev/null 2>&1 +fi + +# check for and remove dkms installations +if command -v dkms >/dev/null 2>&1 +then + if dkms status | grep -i ${DRV_NAME} + then + echo "Removing a dkms installation: ${DRV_NAME}" + dkms remove -m ${DRV_NAME} -v ${DRV_VERSION} --all + echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d" + rm -f /etc/modprobe.d/${OPTIONS_FILE} + echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}" + rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION} + fi +fi + # sets module parameters (driver options) and blacklisted modules echo "Installing ${OPTIONS_FILE} to /etc/modprobe.d" cp -f ${OPTIONS_FILE} /etc/modprobe.d @@ -231,6 +251,7 @@ then exit $RESULT fi else + dkms --version echo "The dkms installation routines are in use." # the dkms add command requires source in /usr/src/${DRV_NAME}-${DRV_VERSION} diff --git a/remove-driver.sh b/remove-driver.sh index d2fe6b2..7f3b3ea 100755 --- a/remove-driver.sh +++ b/remove-driver.sh @@ -4,7 +4,7 @@ # # Supports dkms and non-dkms removals. -# Copyright(c) 2022 Nick Morrow +# Copyright(c) 2023 Nick Morrow # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as @@ -16,7 +16,7 @@ # GNU General Public License for more details. SCRIPT_NAME="remove-driver.sh" -SCRIPT_VERSION="20230101" +SCRIPT_VERSION="20230107" MODULE_NAME="8821cu" DRV_VERSION="5.12.0.4"