Skip to content

Commit

Permalink
Adjust compile threads for low memory boards
Browse files Browse the repository at this point in the history
  • Loading branch information
tannisroot committed Jun 22, 2024
1 parent 41f1075 commit 2b39450
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion etc/install-respeaker-drivers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,18 @@ mod='seeed-voicecard'
src='./'
kernel="$(uname -r)"
marker='0.0.0'
threads="$(getconf _NPROCESSORS_ONLN)"
memory="$(LANG=C free -m|awk '/^Mem:/{print $2}')"

if [ "$memory" -le 512 ] && [ "$threads" -gt 2 ]; then
threads=2
fi

mkdir -p "/usr/src/${mod}-${ver}"
cp -a "${src}"/* "/usr/src/${mod}-${ver}/"

dkms add -m "${mod}" -v "${ver}"
dkms build -k "${kernel}" -m "${mod}" -v "${ver}" && {
dkms build -k "${kernel}" -m "${mod}" -v "${ver}" -j "${threads}" && {
dkms install --force -k "${kernel}" -m "${mod}" -v "${ver}"
}

Expand Down

0 comments on commit 2b39450

Please sign in to comment.