forked from MuneebMohammed/PRUSS-Bindings
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
93 lines (66 loc) · 2.11 KB
/
install.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Install script for prussd daemon service
# To be run on the BeagleBone, from the cloned PRUSS-Bindings
# git repository
DIR=$(cd `dirname $BASH_SOURCE[0]` && pwd -P)
pru_examples() {
#paths needed to compile PRU firmware examples
if [ ! -d /usr/share/ti/cgt-pru/bin ] ;
then
ln -s /usr/bin/ /usr/share/ti/cgt-pru/bin
fi
export PRU_CGT=/usr/share/ti/cgt-pru
#run compilation scripts
bash "${DIR}/examples/run.sh" blinky
bash "${DIR}/examples/run.sh" rpmsg_echo
bash "${DIR}/examples/run.sh" pru_pin_state_reader
bash "${DIR}/examples/run.sh" pru1_to_pru0_to_arm
bash "${DIR}/examples/run.sh" multi_threaded
}
systemd_service() {
#copy the systemd unit configuration file
cp -v "${DIR}/prussd/prussd.service" "/lib/systemd/system/prussd.service"
#copy the config file
cp -v "${DIR}/prussd/prussd.conf" "/etc/default/prussd.conf"
#edit the unit file to replace DIR by the actual path
sed -i -e "s:DIR:${DIR}:" "/lib/systemd/system/prussd.service"
#edit the config file to include paths to firmware_examples
sed -i -e "s:DIR:${DIR}:" "/etc/default/prussd.conf"
#mark the daemon script as executable
chmod a+x "${DIR}/prussd/prussd.py"
#enable the service
systemctl enable prussd.service
#reload the systemctl daemons
systemctl daemon-reload
#start the prussd daemon
systemctl start prussd.service
}
kernel_driver() {
#Install the kernel driver present in drivers/ directory to /lib/modules/$(uname -r) in order to install it
cp ./drivers/pruss_api.ko /lib/modules/$(uname -r)/
echo "Copying pruss_api.ko to /lib/modules/$(uname -r)"
depmod -ae
echo "Installed the pruss_api driver"
}
cpp_bindings() {
#Install the headers present in cpp-bindings/ directory to /usr/local/include in order to install it
cp "./cpp-bindings/pruss.h" "/usr/local/include/"
echo "Copying pruss.h to /usr/local/include"
}
if [ $# -eq 0 ]; then
systemd_service
kernel_driver
cpp_bindings
fi
if [ "$1" == "--examples" ] ; then
pru_examples
fi
if [ "$1" == "--service" ] ; then
systemd_service
fi
if [ "$1" == "--driver" ] ; then
kernel_driver
fi
if [ "$1" == "--library" ] ; then
cpp_bindings
fi