pi-blaster: Added recipe

This project enables PWM on the GPIO pins you request of a Raspberry Pi.
The technique used is extremely efficient: does not use the CPU and gives
very stable pulses

Patches have been provided to build pi-blaster using autotools, and to
remove startup script dependencies on the lsb.

Change-Id: Ie1bec0702e4520d24e4f024aafff14ddef825589
Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
This commit is contained in:
Alex J Lennon 2014-05-20 15:56:18 +01:00
parent f3a8693f08
commit 25fd817f62
4 changed files with 179 additions and 0 deletions

View File

@ -0,0 +1,77 @@
Add autotools configuration files to simplify cross-compilation
Upstream-Status: Submitted [https://github.com/sarfata/pi-blaster/pull/25]
Signed-off-by: Alex Lennon <ajlennon@dynamicdevices.co.uk>
diff -Nur git.org/Makefile git.new/Makefile
--- git.org/Makefile 2014-06-11 15:42:26.490930706 +0100
+++ git.new/Makefile 1970-01-01 01:00:00.000000000 +0100
@@ -1,23 +0,0 @@
-.PHONY: all
-all: pi-blaster
-
-REVISION=$(shell egrep -q '000f$$' /proc/cpuinfo && echo 2 || echo 1)
-
-pi-blaster: pi-blaster.c
- gcc -Wall -g -O2 -o $@ $< -DREVISION=$(REVISION)
-
-clean:
- rm -f pi-blaster
-
-install: pi-blaster
- cp -f pi-blaster.boot.sh /etc/init.d/pi-blaster
- chmod +x /etc/init.d/pi-blaster
- cp -f pi-blaster /usr/sbin/pi-blaster
- update-rc.d pi-blaster defaults
- /etc/init.d/pi-blaster start
-
-uninstall:
- -/etc/init.d/pi-blaster stop
- rm /usr/sbin/pi-blaster
- rm /etc/init.d/pi-blaster
- update-rc.d pi-blaster remove
diff -Nur git.org/Makefile.am git.new/Makefile.am
--- git.org/Makefile.am 1970-01-01 01:00:00.000000000 +0100
+++ git.new/Makefile.am 2014-06-11 15:40:16.562930372 +0100
@@ -0,0 +1,9 @@
+AUTOMAKE_OPTIONS = foreign
+
+CFLAGS = -Wall -pedantic
+
+sbin_PROGRAMS = pi-blaster
+pi_blaster_SOURCES = pi-blaster.c
+
+init_ddir = $(sysconfdir)/init.d
+init_d_SCRIPTS = pi-blaster.boot.sh
diff -Nur git.org/autogen.sh git.new/autogen.sh
--- git.org/autogen.sh 1970-01-01 01:00:00.000000000 +0100
+++ git.new/autogen.sh 2014-06-11 15:35:57.798929684 +0100
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+echo "Generating configure files... may take a while."
+
+autoreconf --install --force && \
+ echo "Preparing was successful if there was no error messages above." && \
+ echo "Now type:" && \
+ echo " ./configure && make" && \
+ echo "Run './configure --help' for more information"
diff -Nur git.org/configure.ac git.new/configure.ac
--- git.org/configure.ac 1970-01-01 01:00:00.000000000 +0100
+++ git.new/configure.ac 2014-06-11 15:35:53.154929717 +0100
@@ -0,0 +1,14 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT(pi-blaster, 0.1.0)
+AC_CONFIG_SRCDIR([pi-blaster.c])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE
+
+# Checks for programs.
+AC_PROG_CC
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT

View File

@ -0,0 +1,77 @@
Remove dependencies on LSB functions
Upstream-Status: Inappropriate [configuration]
Signed-off-by: Alex Lennon <ajlennon@dynamicdevices.co.uk>
diff -ur git.org/pi-blaster.boot.sh git/pi-blaster.boot.sh
--- git.org/pi-blaster.boot.sh 2014-05-20 14:49:44.378582168 +0100
+++ git/pi-blaster.boot.sh 2014-05-20 14:51:08.330582386 +0100
@@ -28,12 +28,12 @@
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
+#. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
-. /lib/lsb/init-functions
+#. /lib/lsb/init-functions
#
# Function that starts the daemon/service
@@ -77,48 +77,23 @@
case "$1" in
start)
- [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME"
do_start
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
;;
stop)
- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME"
do_stop
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- status)
- status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
- log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
- case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
- esac
- ;;
- *)
- # Failed to stop
- log_end_msg 1
- ;;
- esac
+ do_start
;;
*)
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 3
;;
esac

View File

@ -0,0 +1,22 @@
DESCRIPTION = "This project enables PWM on the GPIO pins you request of a Raspberry Pi."
HOMEPAGE = "https://github.com/sarfata/pi-blaster/"
SECTION = "devel/libs"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://README.md;beginline=138;endline=151;md5=e0f0f92050a87a160939707c60940307"
SRC_URI = "git://github.com/sarfata/pi-blaster \
file://enable-autotools-support.patch \
file://remove-initscript-lsb-dependency.patch \
"
S = "${WORKDIR}/git"
inherit update-rc.d autotools
INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME_${PN} = "${PN}.boot.sh"
INITSCRIPT_PARAMS_${PN} = "defaults 15 85"
COMPATIBLE_MACHINE = "raspberrypi"
PACKAGE_ARCH = "${MACHINE_ARCH}"

View File

@ -0,0 +1,3 @@
require pi-blaster.inc
SRCREV = "177cef81774d6df5c6284c198ff818515281db14"