-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup_respeaker.sh
executable file
·62 lines (46 loc) · 1.38 KB
/
setup_respeaker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Exit on error
# If something goes wrong just stop.
# it allows the user to see issues at once rather than having
# scroll back and figure out what went wrong.
set -e
echo "Configuring ReSpeaker drivers..."
# seeed-voicecard
ver="0.3"
marker="0.0.0"
git clone https://github.com/HinTak/seeed-voicecard
cd seeed-voicecard
git checkout v6.6
function install_respeaker {
local _i
src=$1
mod=$2
if [[ -d /var/lib/dkms/$mod/$ver/$marker ]]; then
rmdir /var/lib/dkms/$mod/$ver/$marker
fi
if [[ -e /usr/src/$mod-$ver || -e /var/lib/dkms/$mod/$ver ]]; then
dkms remove --force -m $mod -v $ver --all
rm -rf /usr/src/$mod-$ver
fi
mkdir -p /usr/src/$mod-$ver
cp -a $src/* /usr/src/$mod-$ver/
dkms add -m $mod -v $ver
for _i in "${kernels[@]}"; do
echo "Building for kernel $_i"
dkms build -k $_i -m $mod -v $ver && {
dkms install --force -k $_i -m $mod -v $ver
}
done
mkdir -p /var/lib/dkms/$mod/$ver/$marker
}
apt update -y
# Raspbian kernel packages
apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel
# Recent Raspbian has 64-bit kernel on 32-bit userspace
apt-get -y install gcc-aarch64-linux-gnu
# Ubuntu kernel packages
apt-get -y install dkms git i2c-tools libasound2-plugins
kernels=($(ls /boot/vmlinuz-* | sort -V | sed 's|/boot/vmlinuz-||'))
install_respeaker "./" "seeed-voicecard"
cd ..
rm -rf seeed-voicecard