diff options
| author | Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> | 2019-09-09 12:13:21 -0700 |
|---|---|---|
| committer | Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> | 2019-12-09 11:03:47 -0800 |
| commit | c7ec582fbf118b29f21141b1ca41ea902fc8d256 (patch) | |
| tree | 801cacddc63d510c958c2b269a0c0899acbae142 /meta-xilinx-pynq/recipes-devtool/python/python3-pynq | |
| parent | 954f0edb632b525f4dd8f20539531d714fa51a6e (diff) | |
| download | meta-xilinx-c7ec582fbf118b29f21141b1ca41ea902fc8d256.tar.gz | |
meta-xilinx-pynq: Add layer to support PYNQ
This layer collects Yocto recipes required to build and run PYNQ based
examples using jupyter-notebooks on Zynq and ZU+ SoC's.
PYNQ is an open-source project from Xilinx that makes it easy to design
embedded systems with Zynq All Programmable Systems on Chips (APSoCs).
Using the Python language and libraries, designers can exploit the
benefits of programmable logic and microprocessors in Zynq to build more
capable and exciting embedded systems.
See https://github.com/Xilinx/PYNQ for more details and examples
Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
Signed-off-by: Peter Ogden <ogden@xilinx.com>
Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com>
Diffstat (limited to 'meta-xilinx-pynq/recipes-devtool/python/python3-pynq')
| -rw-r--r-- | meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init b/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init new file mode 100644 index 00000000..8b13ae1f --- /dev/null +++ b/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | ### BEGIN INIT INFO | ||
| 3 | # Provides: | ||
| 4 | # Required-Start: $remote_fs $syslog | ||
| 5 | # Required-Stop: $remote_fs $syslog | ||
| 6 | # Default-Start: 2 3 4 5 | ||
| 7 | # Default-Stop: 0 1 6 | ||
| 8 | # Short-Description: Start daemon at boot time | ||
| 9 | # Description: Enable service provided by daemon. | ||
| 10 | ### END INIT INFO | ||
| 11 | |||
| 12 | dir="" | ||
| 13 | cmd="start_pl_server.py" | ||
| 14 | user="" | ||
| 15 | |||
| 16 | name="pl_server" | ||
| 17 | pid_file="/var/run/$name.pid" | ||
| 18 | stdout_log="/var/log/$name.log" | ||
| 19 | stderr_log="/var/log/$name.err" | ||
| 20 | |||
| 21 | get_pid() { | ||
| 22 | cat "$pid_file" | ||
| 23 | } | ||
| 24 | |||
| 25 | is_running() { | ||
| 26 | [ -f "$pid_file" ] && (ps -o"pid" | grep '^ '`get_pid`'$') > /dev/null 2>&1 | ||
| 27 | } | ||
| 28 | |||
| 29 | install_overlay() { | ||
| 30 | if [ ! -e '/sys/kernel/config/device-tree/overlays/pynq' ]; then | ||
| 31 | modprobe uio_pdrv_genirq | ||
| 32 | if [ ! -e /proc/device-tree/__symbols__ ]; then | ||
| 33 | mkdir /sys/kernel/config/device-tree/overlays/pynq-symbols | ||
| 34 | cat /lib/firmware/pynq-symbols.dtbo > /sys/kernel/config/device-tree/overlays/pynq-symbols/dtbo | ||
| 35 | fi | ||
| 36 | mkdir /sys/kernel/config/device-tree/overlays/pynq | ||
| 37 | cat /lib/firmware/pynq.dtbo > /sys/kernel/config/device-tree/overlays/pynq/dtbo | ||
| 38 | fi | ||
| 39 | } | ||
| 40 | |||
| 41 | case "$1" in | ||
| 42 | start) | ||
| 43 | if is_running; then | ||
| 44 | echo "Already started" | ||
| 45 | else | ||
| 46 | echo "Starting $name" | ||
| 47 | cd "$dir" | ||
| 48 | install_overlay | ||
| 49 | $cmd >> "$stdout_log" 2>> "$stderr_log" & | ||
| 50 | echo $! > "$pid_file" | ||
| 51 | if ! is_running; then | ||
| 52 | echo "Unable to start, see $stdout_log and $stderr_log" | ||
| 53 | exit 1 | ||
| 54 | fi | ||
| 55 | fi | ||
| 56 | ;; | ||
| 57 | stop) | ||
| 58 | if is_running; then | ||
| 59 | echo -n "Stopping $name.." | ||
| 60 | kill `get_pid` | ||
| 61 | for i in 1 2 3 4 5 6 7 8 9 10 | ||
| 62 | # for i in `seq 10` | ||
| 63 | do | ||
| 64 | if ! is_running; then | ||
| 65 | break | ||
| 66 | fi | ||
| 67 | |||
| 68 | echo -n "." | ||
| 69 | sleep 1 | ||
| 70 | done | ||
| 71 | echo | ||
| 72 | |||
| 73 | if is_running; then | ||
| 74 | echo "Not stopped; may still be shutting down or shutdown may have failed" | ||
| 75 | exit 1 | ||
| 76 | else | ||
| 77 | echo "Stopped" | ||
| 78 | if [ -f "$pid_file" ]; then | ||
| 79 | rm "$pid_file" | ||
| 80 | fi | ||
| 81 | fi | ||
| 82 | else | ||
| 83 | echo "Not running" | ||
| 84 | fi | ||
| 85 | ;; | ||
| 86 | restart) | ||
| 87 | $0 stop | ||
| 88 | if is_running; then | ||
| 89 | echo "Unable to stop, will not attempt to start" | ||
| 90 | exit 1 | ||
| 91 | fi | ||
| 92 | $0 start | ||
| 93 | ;; | ||
| 94 | status) | ||
| 95 | if is_running; then | ||
| 96 | echo "Running" | ||
| 97 | else | ||
| 98 | echo "Stopped" | ||
| 99 | exit 1 | ||
| 100 | fi | ||
| 101 | ;; | ||
| 102 | *) | ||
| 103 | echo "Usage: $0 {start|stop|restart|status}" | ||
| 104 | exit 1 | ||
| 105 | ;; | ||
| 106 | esac | ||
| 107 | |||
| 108 | exit 0 | ||
| 109 | |||
