Skip to content

Commit

Permalink
Modify configuration files, add install script and rename daemon file
Browse files Browse the repository at this point in the history
Added install script for the project and modified the unit file and the
config files accordingly. Running the script loads the daemon and also
compiles the examples with the bindings
  • Loading branch information
MuneebMohammed committed Jun 10, 2018
1 parent b363d09 commit 24418f5
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 4 deletions.
66 changes: 66 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/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

}

if [ $# -eq 0 ]; then
pru_examples
systemd_service
fi

if [ "$1" == "--examples" ] ; then
pru_examples
fi

if [ "$1" == "--service" ] ; then
systemd_service
fi
2 changes: 2 additions & 0 deletions prussd/prussd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FIRMWARE=DIR/examples/firmware_examples
RPMSG_CHANNELS=
File renamed without changes.
10 changes: 6 additions & 4 deletions prussd/prussd.service
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[Unit]
Description = Service for PRU Access
Description=Daemon Service to serve PRU access requests for non-root processes
ConditionPathExists=|DIR

[Service]
Type=simple
ExecStart=/usr/bin/python3 /home/debian/PRUSS-Bindings/prussd/prudaemon.py
ExecStopPost=/bin/sh -c 'rm /tmp/prusocket'
WorkingDirectory=DIR/prussd
ExecStart=DIR/prussd/prussd.py
ExecStopPost=/bin/sh -c 'rm /tmp/prussd.sock'
Restart=on-failure
StandardOutput=null

[Install]
Expand Down

0 comments on commit 24418f5

Please sign in to comment.