fix low mem error

pull/55/head
morrownr 2023-01-13 21:59:06 -06:00
parent 6e027bf541
commit 0314109203
4 changed files with 32 additions and 7 deletions

25
dkms-make.sh 100755
View File

@ -0,0 +1,25 @@
#!/bin/sh
# SMEM needs to be set here if dkms build is not initiated by install-driver.sh
if [[ ! -z ${SMEM} ]]
then
SMEM=$(LANG=C free | awk '/Mem:/ { print $2 }')
fi
# SMEM needs to be set here if dkms build is not initiated by install-driver.sh
if [[ ! -z ${SPROC} ]]
then
SPROC=$(nproc)
fi
# Avoid Out of Memory condition in low-RAM systems by limiting core usage.
if [ "$SPROC" -gt 1 ]
then
if [ "$SMEM" -lt 1400000 ]
then
SPROC=2
fi
fi
kernelver=${kernelver:-$(uname -r)}
make "-j$SPROC" "KVER=$kernelver" "KSRC=/lib/modules/$kernelver/build"

View File

@ -1,7 +1,7 @@
PACKAGE_NAME="rtl8821cu"
PACKAGE_VERSION="5.12.0.4"
BUILT_MODULE_NAME[0]="8821cu"
MAKE="'make' -j${SPROC}"
MAKE="./dkms-make.sh"
CLEAN="'make' clean"
DEST_MODULE_LOCATION[0]="/updates/dkms"
AUTOINSTALL="YES"

View File

@ -16,19 +16,20 @@
# GNU General Public License for more details.
SCRIPT_NAME="install-driver.sh"
SCRIPT_VERSION="20230111"
SCRIPT_VERSION="20230114"
MODULE_NAME="8821cu"
DRV_VERSION="5.12.0.4"
KVER="$(uname -r)"
KARCH="$(uname -m)"
KSRC="/lib/modules/${KVER}/build"
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
DRV_NAME="rtl${MODULE_NAME}"
DRV_DIR="$(pwd)"
OPTIONS_FILE="${MODULE_NAME}.conf"
SMEM=$(LANG=C free | awk '/Mem:/ { print $2 }')
export SMEM=$(LANG=C free | awk '/Mem:/ { print $2 }')
export SPROC=$(nproc)
# check to ensure sudo was used
if [[ $EUID -ne 0 ]]
@ -126,8 +127,7 @@ echo ": ${KARCH} (ARCH)"
# display total system memory
echo ": ${SMEM} (SMEM)"
export SPROC=$(nproc)
# Avoid OOM in low-RAM systems.
# Avoid Out of Memory condition in low-RAM systems by limiting core usage.
if [ "$SPROC" -gt 1 ]
then
if [ "$SMEM" -lt 1400000 ]

View File

@ -16,7 +16,7 @@
# GNU General Public License for more details.
SCRIPT_NAME="remove-driver.sh"
SCRIPT_VERSION="20230109"
SCRIPT_VERSION="20230114"
MODULE_NAME="8821cu"
DRV_VERSION="5.12.0.4"