88x2bu-20210702/dkms-make.sh

24 lines
652 B
Bash
Raw Normal View History

2023-01-27 10:16:08 -06:00
#!/bin/sh
2023-06-28 01:07:09 -05:00
# Warning: Do not run this script in a terminal. It is designed to be
# run from another script.
2023-01-27 10:16:08 -06:00
# 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)
2023-09-18 14:05:22 -05:00
# avoid Out of Memory condition in low-RAM systems by limiting core usage
2023-01-27 10:16:08 -06:00
if [ "$sproc" -gt 1 ]; then
if [ "$SMEM" -lt 1400000 ]; then
sproc=2
fi
2023-06-28 01:07:09 -05:00
if [ "$SMEM" -lt 700000 ]; then
sproc=1
fi
2023-01-27 10:16:08 -06:00
fi
kernelver=${kernelver:-$(uname -r)}
make "-j$sproc" "KVER=$kernelver" "KSRC=/lib/modules/$kernelver/build"