diff options
Diffstat (limited to 'meta-xilinx/meta-xilinx-pynq/recipes-devtool/python')
6 files changed, 250 insertions, 0 deletions
diff --git a/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python-pynq.inc b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python-pynq.inc new file mode 100644 index 000000000..96303bdfd --- /dev/null +++ b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python-pynq.inc @@ -0,0 +1,53 @@ +SUMMARY = "Xilinx PYNQ Library" +HOMEPAGE = "http://pynq.io" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=b42e39ad2ddbad7e8ad47f3eee6feff5" + +SRC_URI[md5sum] = "9950894100c20293e921090b76ca9f17" +SRC_URI[sha256sum] = "4f719e2753093d1e79931755c624d160cf342c03af49e027d09abe75bdc8e8c5" + +RDEPENDS_${PN} += "\ + ${PYTHON_PN}-core \ + ${PYTHON_PN}-asyncio \ + ${PYTHON_PN}-cffi \ + ${PYTHON_PN}-json \ + ${PYTHON_PN}-math \ + ${PYTHON_PN}-mmap \ + ${PYTHON_PN}-multiprocessing \ + ${PYTHON_PN}-numpy \ + ${PYTHON_PN}-pycparser \ + ${PYTHON_PN}-resource \ + ${PYTHON_PN}-setuptools \ + ${PYTHON_PN}-threading \ + ${PYTHON_PN}-xml \ + ${PYTHON_PN}-audio \ + lmsensors-libsensors \ + libdrm \ + libcma \ + pynq-overlay \ + " + +inherit update-rc.d xilinx-pynq + +DEPENDS += " libdrm boost libcma" + +SRC_URI += "file://pl_server_init \ + file://0001-Fix-3.6-ism-in-Xlnk-class.patch \ + file://0002-Avoid-deleteing-notebooks.patch \ + file://0003-Use-sysroot-for-Displayport-library.patch \ +" + +FILESEXTRAPATHS_prepend := "${THISDIR}:" + +INITSCRIPT_PACKAGES = "${PN}" +INITSCRIPT_NAME = "pl_server_init" +INITSCRIPT_PARAMS = "start 99 S ." + +do_install_append() { + install -d ${D}${INIT_D_DIR} + install -m 755 ${WORKDIR}/pl_server_init ${D}${INIT_D_DIR}/pl_server_init + rm -rf ${D}${PYNQ_NOTEBOOK_DIR}_* +} + + +FILES_${PN} += " ${INIT_D_DIR}/pl_server_init " diff --git a/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/0001-Fix-3.6-ism-in-Xlnk-class.patch b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/0001-Fix-3.6-ism-in-Xlnk-class.patch new file mode 100644 index 000000000..d947a3a61 --- /dev/null +++ b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/0001-Fix-3.6-ism-in-Xlnk-class.patch @@ -0,0 +1,25 @@ +From 940acab94a60708a9a9092579af52c1195f23fae Mon Sep 17 00:00:00 2001 +From: Peter Ogden <ogden@xilinx.com> +Date: Tue, 3 Mar 2020 06:21:03 -0500 +Subject: [PATCH 1/3] Fix 3.6-ism in Xlnk class + +--- + pynq/xlnk.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pynq/xlnk.py b/pynq/xlnk.py +index c07f1e5..a25e0e3 100644 +--- a/pynq/xlnk.py ++++ b/pynq/xlnk.py +@@ -423,7 +423,7 @@ class Xlnk: + for l in f.readlines(): + m = re.match('CmaTotal:[\\s]+([0-9]+) kB', l) + if m: +- return int(m[1]) * 1024 ++ return int(m.group(1)) * 1024 + return 0 + + def flush(self, bo, offset, vaddr, nbytes): +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/0002-Avoid-deleteing-notebooks.patch b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/0002-Avoid-deleteing-notebooks.patch new file mode 100644 index 000000000..e67c80488 --- /dev/null +++ b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/0002-Avoid-deleteing-notebooks.patch @@ -0,0 +1,35 @@ +From 70b38f8748779d57117bca3e37441e2223372293 Mon Sep 17 00:00:00 2001 +From: Peter Ogden <ogden@xilinx.com> +Date: Tue, 3 Mar 2020 06:23:26 -0500 +Subject: [PATCH 2/3] Avoid deleteing notebooks + +--- + setup.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/setup.py b/setup.py +index df1dada..95479e3 100644 +--- a/setup.py ++++ b/setup.py +@@ -36,6 +36,7 @@ from setuptools.command.build_ext import build_ext + from distutils.dir_util import copy_tree + from distutils.file_util import copy_file, move_file + from shutil import rmtree ++import shutil + import glob + import re + import subprocess +@@ -322,8 +323,8 @@ class BuildExtension(build_ext): + for ol in overlay_dirs: + src = os.path.join(board_folder, ol) + dst = os.path.join(self.build_lib, "pynq/overlays", ol) +- exclude_file_or_folder('notebooks', src) +- copy_tree(src, dst) ++ if not os.path.isdir(dst): ++ shutil.copytree(src, dst, ignore=shutil.ignore_patterns('notebooks')) + + def run(self): + if CPU_ARCH == ZYNQ_ARCH: +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/0003-Use-sysroot-for-Displayport-library.patch b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/0003-Use-sysroot-for-Displayport-library.patch new file mode 100644 index 000000000..f250e4a24 --- /dev/null +++ b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/0003-Use-sysroot-for-Displayport-library.patch @@ -0,0 +1,25 @@ +From 65e1134505235a60013d91c8b03401b8b4062cde Mon Sep 17 00:00:00 2001 +From: Peter Ogden <ogden@xilinx.com> +Date: Tue, 3 Mar 2020 10:32:35 -0500 +Subject: [PATCH 3/3] Use sysroot for Displayport library + +--- + pynq/lib/_pynq/_displayport/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pynq/lib/_pynq/_displayport/Makefile b/pynq/lib/_pynq/_displayport/Makefile +index 5567e34..7f1f7b7 100644 +--- a/pynq/lib/_pynq/_displayport/Makefile ++++ b/pynq/lib/_pynq/_displayport/Makefile +@@ -2,7 +2,7 @@ CC ?= gcc + CXX ?= g++ + + OBJSC = displayport.o +-INC = -I${PYNQ_BUILD_ROOT}/usr/include/libdrm ++INC = -I=${PYNQ_BUILD_ROOT}/usr/include/libdrm + + all: + $(CXX) -fPIC $(INC) -c -g -std=c++11 displayport.cpp $(CFLAGS) +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init new file mode 100644 index 000000000..8b13ae1f1 --- /dev/null +++ b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init @@ -0,0 +1,109 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="" +cmd="start_pl_server.py" +user="" + +name="pl_server" +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && (ps -o"pid" | grep '^ '`get_pid`'$') > /dev/null 2>&1 +} + +install_overlay() { +if [ ! -e '/sys/kernel/config/device-tree/overlays/pynq' ]; then + modprobe uio_pdrv_genirq + if [ ! -e /proc/device-tree/__symbols__ ]; then + mkdir /sys/kernel/config/device-tree/overlays/pynq-symbols + cat /lib/firmware/pynq-symbols.dtbo > /sys/kernel/config/device-tree/overlays/pynq-symbols/dtbo + fi + mkdir /sys/kernel/config/device-tree/overlays/pynq + cat /lib/firmware/pynq.dtbo > /sys/kernel/config/device-tree/overlays/pynq/dtbo +fi +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + install_overlay + $cmd >> "$stdout_log" 2>> "$stderr_log" & + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in 1 2 3 4 5 6 7 8 9 10 + # for i in `seq 10` + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 + diff --git a/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq_2.5.1.bb b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq_2.5.1.bb new file mode 100644 index 000000000..5a904c8fa --- /dev/null +++ b/meta-xilinx/meta-xilinx-pynq/recipes-devtool/python/python3-pynq_2.5.1.bb @@ -0,0 +1,3 @@ +inherit pypi setuptools3 +require python-pynq.inc + |