mirror of
https://github.com/morrownr/8821cu-20210916.git
synced 2024-10-02 05:33:41 +00:00
26 lines
566 B
Bash
26 lines
566 B
Bash
|
#!/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"
|