tweaks to low mem fix

pull/55/head
morrownr 2023-01-17 09:49:57 -06:00
parent 25a173f403
commit de16766d03
3 changed files with 16 additions and 12 deletions

View File

@ -1,21 +1,21 @@
#!/bin/sh
#!/bin/bash
# SMEM needs to be set here if dkms build is not initiated by install-driver.sh
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=$(nproc)
# sproc needs to be set here if dkms build is not initiated by install-driver.sh
sproc=$(nproc)
# Avoid Out of Memory condition in low-RAM systems by limiting core usage.
if [ "$SPROC" -gt 1 ]
if [ "$sproc" -gt 1 ]
then
if [ "$SMEM" -lt 1400000 ]
then
SPROC=2
sproc=2
fi
fi
kernelver=${kernelver:-$(uname -r)}
make "-j$SPROC" "KVER=$kernelver" "KSRC=/lib/modules/$kernelver/build"
make "-j$sproc" "KVER=$kernelver" "KSRC=/lib/modules/$kernelver/build"
exit 0

View File

@ -16,7 +16,7 @@
# GNU General Public License for more details.
SCRIPT_NAME="install-driver.sh"
SCRIPT_VERSION="20230114"
SCRIPT_VERSION="20230116"
MODULE_NAME="8821cu"
DRV_VERSION="5.12.0.4"
@ -29,7 +29,7 @@ DRV_DIR="$(pwd)"
OPTIONS_FILE="${MODULE_NAME}.conf"
SMEM=$(LANG=C free | awk '/Mem:/ { print $2 }')
SPROC=$(nproc)
sproc=$(nproc)
# check to ensure sudo was used
if [[ $EUID -ne 0 ]]
@ -116,6 +116,8 @@ do
shift
done
echo ": ---------------------------"
# displays script name and version
echo ": ${SCRIPT_NAME} v${SCRIPT_VERSION}"
@ -128,15 +130,15 @@ echo ": ${KARCH} (ARCH)"
echo ": ${SMEM} (SMEM)"
# Avoid Out of Memory condition in low-RAM systems by limiting core usage.
if [ "$SPROC" -gt 1 ]
if [ "$sproc" -gt 1 ]
then
if [ "$SMEM" -lt 1400000 ]
then
SPROC=2
sproc=2
fi
fi
# display total number of cpu cores / in use
echo ": ${SPROC}/$(nproc) (SPROC/NPROC)"
echo ": ${sproc}/$(nproc) (sproc/nproc)"
# display kernel version
echo ": ${KVER} (KVER)"
@ -159,6 +161,8 @@ then
echo ": "${sb_state}
fi
echo ": ---------------------------"
# display ISO 3166-1 alpha-2 Country Code
#a2_country_code=$(iw reg get | grep -i country)
#echo "Country: "${a2_country_code}

View File

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