various updates, mostly to the scripts

This commit is contained in:
morrownr 2024-02-21 01:41:49 -06:00
parent 30756eef26
commit 05849235bf
5 changed files with 51 additions and 42 deletions

View File

@ -21,6 +21,7 @@ EXTRA_CFLAGS += -Wno-implicit-fallthrough
#EXTRA_CFLAGS += -Wno-discarded-qualifiers
EXTRA_CFLAGS += -Wno-missing-prototypes
EXTRA_CFLAGS += -Wno-missing-declarations
# Activates Concurrent Mode if uncommented
#EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
@ -2538,7 +2539,8 @@ sign:
@mokutil --import MOK.der
@$(KSRC)/scripts/sign-file sha256 MOK.priv MOK.der 88x2bu.ko
sign-install: sign install
sign-install:
sign install
backup_rtlwifi:
@echo "Making backup rtlwifi drivers"

View File

@ -1,7 +1,7 @@
PACKAGE_NAME="rtl88x2bu"
PACKAGE_VERSION="5.13.1"
BUILT_MODULE_NAME[0]="88x2bu"
MAKE="./dkms-make.sh"
MAKE="kernelver=$kernelver ./dkms-make.sh"
CLEAN="'make' clean"
DEST_MODULE_LOCATION[0]="/updates/dkms"
AUTOINSTALL="yes"

View File

@ -16,6 +16,10 @@
#
# $ sudo sh install-driver.sh
#
# To check for errors and to check that this script does not require bash:
#
# $ shellcheck remove-driver.sh
#
# Copyright(c) 2023 Nick Morrow
#
# This program is free software; you can redistribute it and/or modify
@ -28,7 +32,7 @@
# GNU General Public License for more details.
SCRIPT_NAME="install-driver.sh"
SCRIPT_VERSION="20231115"
SCRIPT_VERSION="20240129"
MODULE_NAME="88x2bu"
@ -202,7 +206,7 @@ if command -v mokutil >/dev/null 2>&1; then
*) echo ": This system doesn't support Secure Boot" ;;
esac
else
echo ": mokutil not installed"
echo ": mokutil not installed (Secure Boot status unknown)"
fi
echo ": ---------------------------"
@ -226,6 +230,7 @@ fi
# check for and remove non-dkms installations
# with rtl added to module name (PClinuxOS)
# Dear PCLinuxOS devs, the driver name uses rtl, the module name does not.
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
@ -241,7 +246,6 @@ 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
@ -254,20 +258,25 @@ if [ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODU
echo "Removal complete."
fi
# check for and remove all dkms installations with MODULE_NAME in DRV_NAME
# check for and remove dkms installations
#
if command -v dkms >/dev/null 2>&1; then
dkms status | while IFS="/, " read -r modname modver kerver _dummy; do
case "$modname" in *${MODULE_NAME})
echo "--> ${modname} ${modver} ${kerver}"
dkms remove -m "${modname}" -v "${modver}" -k "${kerver}" -c "/usr/src/${modname}-${modver}/dkms.conf"
dkms status | while IFS="/,: " read -r drvname drvver kerver _dummy; do
case "$drvname" in *${MODULE_NAME})
if [ "${kerver}" = "added" ]; then
dkms remove -m "${drvname}" -v "${drvver}" --all
else
dkms remove -m "${drvname}" -v "${drvver}" -k "${kerver}" -c "/usr/src/${drvname}-${drvver}/dkms.conf"
fi
esac
done
if [ -f /etc/modprobe.d/${OPTIONS_FILE} ]; then
rm -f /etc/modprobe.d/${OPTIONS_FILE}
echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d"
rm /etc/modprobe.d/${OPTIONS_FILE}
fi
if [ -f /usr/src/${DRV_NAME}-${DRV_VERSION} ]; then
rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION}
if [ -d /usr/src/${DRV_NAME}-${DRV_VERSION} ]; then
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
rm -r /usr/src/${DRV_NAME}-${DRV_VERSION}
fi
fi
@ -330,9 +339,7 @@ else
# the dkms add command requires source in /usr/src/${DRV_NAME}-${DRV_VERSION}
echo "Copying source files to /usr/src/${DRV_NAME}-${DRV_VERSION}"
cp -rf "${DRV_DIR}" /usr/src/${DRV_NAME}-${DRV_VERSION}
# echo "${DRV_DIR}"
# echo "/usr/src/${DRV_NAME}-${DRV_VERSION}"
cp -r "${DRV_DIR}" /usr/src/${DRV_NAME}-${DRV_VERSION}
dkms add -m ${DRV_NAME} -v ${DRV_VERSION} -k "${KVER}/${KARCH}" -c "/usr/src/${DRV_NAME}-${DRV_VERSION}/dkms.conf"
RESULT=$?
@ -403,8 +410,10 @@ echo "$ sudo sh install-driver.sh"
echo
echo "Note: Updates to this driver SHOULD be performed before distro"
echo " upgrades such as Ubuntu 23.10 to 24.04."
echo "Note: Updates to this driver SHOULD be performed before major"
echo " upgrades such as kernel 6.5 to 6.6."
echo "Note: Updates can be performed as often as you like. It is"
echo " recommended to update at least every 2 months."
echo " recommended to update at least every 3 months."
echo "Note: Work on this driver, like the Linux kernel, is continuous."
echo
echo "Enjoy!"

View File

@ -16,6 +16,10 @@
#
# $ sudo sh remove-driver.sh
#
# To check for errors and to check that this script does not require bash:
#
# $ shellcheck remove-driver.sh
#
# Copyright(c) 2023 Nick Morrow
#
# This program is free software; you can redistribute it and/or modify
@ -28,7 +32,7 @@
# GNU General Public License for more details.
SCRIPT_NAME="remove-driver.sh"
SCRIPT_VERSION="20231118"
SCRIPT_VERSION="20240129"
MODULE_NAME="88x2bu"
@ -100,6 +104,7 @@ fi
# check for and remove non-dkms installations
# with rtl added to module name (PClinuxOS)
# Dear PCLinuxOS devs, the driver name uses rtl, the module name does not.
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
@ -109,42 +114,35 @@ 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 and remove all dkms installations with DRV_NAME
# check for and remove dkms installations
#
if command -v dkms >/dev/null 2>&1; then
dkms status | while IFS="/, " read -r modname modver kerver _dummy; do
case "$modname" in *${MODULE_NAME})
echo "--> ${modname} ${modver} ${kerver}"
dkms remove -m "${modname}" -v "${modver}" -k "${kerver}" -c "/usr/src/${modname}-${modver}/dkms.conf"
dkms status | while IFS="/,: " read -r drvname drvver kerver _dummy; do
case "$drvname" in *${MODULE_NAME})
if [ "${kerver}" = "added" ]; then
dkms remove -m "${drvname}" -v "${drvver}" --all
else
dkms remove -m "${drvname}" -v "${drvver}" -k "${kerver}" -c "/usr/src/${drvname}-${drvver}/dkms.conf"
fi
esac
done
RESULT=$?
# 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
# may complain.
if [ "$RESULT" = "0" ] || [ "$RESULT" = "3" ]; then
if [ "$RESULT" = "0" ]; then
echo "${DRV_NAME}/${DRV_VERSION} has been removed"
fi
else
echo "An error occurred. dkms remove error: ${RESULT}"
echo "Please report this error."
exit $RESULT
if [ -f /etc/modprobe.d/${OPTIONS_FILE} ]; then
echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d"
rm /etc/modprobe.d/${OPTIONS_FILE}
fi
if [ -d /usr/src/${DRV_NAME}-${DRV_VERSION} ]; then
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
rm -r /usr/src/${DRV_NAME}-${DRV_VERSION}
fi
fi
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}
# ensure the driver directory is clean in case driver was manually compiled
make clean >/dev/null 2>&1
echo "The driver was removed successfully."
echo "You may now delete the driver directory if desired."