Skip to contentSkip to conversation

rpi-userland: Fix vcfiled startup

PATCH New Benoît Thébaudeau 4 participants 4 messages Aug 7, 2014 – Sep 28, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 rpi-userland: Fix vcfiled startup

The VideoCore file server daemon startup script installed from this package is not compatible with BuildRoot (because of its naming and other Debian dependencies), which prevented vcfiled from starting. Hence, prevent this package from installing its vcfiled startup script, and add a configuration option to install a vcfiled SysV init script suitable for BuildRoot.

---

Changes in v4:
- Use /var/run/vcfiled.pid instead of /var/run/vcfiled/vcfiled for vcfiled's PID file path.

Changes in v3:
- Add a config option to start this daemon.

Changes in v2:
- Indent .mk rules with tabs.
- Simplify the new vcfiled startup script.
- Rename S97vcfiled to S94vcfiled for a better integration with existing init scripts.

---
 package/rpi-userland/Config.in       |  7 ++++++
 package/rpi-userland/S94vcfiled      | 47 ++++++++++++++++++++++++++++++++++++
 package/rpi-userland/rpi-userland.mk | 13 +++++++++-
 3 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100755 package/rpi-userland/S94vcfiled
package/rpi-userland/Config.in +7 -0
index aeee5e1..89e99e0 100644
@@ -31,6 +31,13 @@ config BR2_PACKAGE_PROVIDES_LIBOPENVG
 config BR2_PACKAGE_PROVIDES_LIBOPENMAX
 	default "rpi-userland"
 
+config BR2_PACKAGE_RPI_USERLAND_START_VCFILED
+	bool "Start vcfiled"
+	depends on BR2_INIT_SYSV || BR2_INIT_BUSYBOX
+	help
+	  vcfiled is a daemon serving files to VideoCore from the host filing
+	  system.
+
 endif
 
 comment "rpi-userland needs a toolchain w/ C++, largefile, threads"
package/rpi-userland/S94vcfiled new file +47 -0

47 lines not on this page · raw message

package/rpi-userland/rpi-userland.mk +12 -1
index 81ed95c..74a0056 100644
@@ -9,11 +9,22 @@ RPI_USERLAND_SITE = $(call github,raspberrypi,userland,$(RPI_USERLAND_VERSION))
 RPI_USERLAND_LICENSE = BSD-3c
 RPI_USERLAND_LICENSE_FILES = LICENCE
 RPI_USERLAND_INSTALL_STAGING = YES
-RPI_USERLAND_CONF_OPT = -DVMCS_INSTALL_PREFIX=/usr
+RPI_USERLAND_CONF_OPT = -DVMCS_INSTALL_PREFIX=/usr \
+	-DCMAKE_C_FLAGS="-DVCFILED_LOCKFILE=\\\"/var/run/vcfiled.pid\\\""
 
 RPI_USERLAND_PROVIDES = libegl libgles libopenmax libopenvg
 
+ifeq ($(BR2_PACKAGE_RPI_USERLAND_START_VCFILED),y)
+define RPI_USERLAND_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/rpi-userland/S94vcfiled \
+			$(TARGET_DIR)/etc/init.d/S94vcfiled
+endef
+endif
+
 define RPI_USERLAND_POST_TARGET_CLEANUP
+	rm -f $(TARGET_DIR)/etc/init.d/vcfiled
+	rm -f $(TARGET_DIR)/usr/share/install/vcfiled
+	rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/install
 	rm -Rf $(TARGET_DIR)/usr/src
 endef
 RPI_USERLAND_POST_INSTALL_TARGET_HOOKS += RPI_USERLAND_POST_TARGET_CLEANUP
Signature · 1 line
1.9.1
#1 lore raw

PATCH v4 1/1 rpi-userland: Fix vcfiled startup

Benoit, All,

On 2014-08-07 17:24 +0200, Beno?t Th?baudeau spake thusly:

Quoted 7 lines

The VideoCore file server daemon startup script installed from this package is not compatible with BuildRoot (because of its naming and other Debian dependencies), which prevented vcfiled from starting. Hence, prevent this package from installing its vcfiled startup script, and add a configuration option to install a vcfiled SysV init script suitable for BuildRoot.

A small comment, below.

Quoted 26 lines

---

Changes in v4:
- Use /var/run/vcfiled.pid instead of /var/run/vcfiled/vcfiled for vcfiled's PID file path.

Changes in v3:
- Add a config option to start this daemon.

Changes in v2:
- Indent .mk rules with tabs.
- Simplify the new vcfiled startup script.
- Rename S97vcfiled to S94vcfiled for a better integration with existing init scripts.

---
 package/rpi-userland/Config.in       |  7 ++++++
 package/rpi-userland/S94vcfiled      | 47 ++++++++++++++++++++++++++++++++++++
 package/rpi-userland/rpi-userland.mk | 13 +++++++++-
 3 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100755 package/rpi-userland/S94vcfiled
package/rpi-userland/Config.in +0 -0
index aeee5e1..89e99e0 100644

package/rpi-userland/Config.in config BR2_PACKAGE_PROVIDES_LIBOPENVG · line 39

Quoted 9 lines
package/rpi-userland/Config.in +6 -0
@@ -31,6 +31,13 @@ config BR2_PACKAGE_PROVIDES_LIBOPENVG
 config BR2_PACKAGE_PROVIDES_LIBOPENMAX
 	default "rpi-userland"
 
+config BR2_PACKAGE_RPI_USERLAND_START_VCFILED
+	bool "Start vcfiled"
+	depends on BR2_INIT_SYSV || BR2_INIT_BUSYBOX
+	help
+	  vcfiled is a daemon serving files to VideoCore from the host filing
+	  system.

s/filing system/filesystem/ but that can be done by whoever applies the patch, no need to resend just for that.

Otherwise:

Thank you for your persistence! :-)

Regards,
Yann E. MORIN.

Quoted 92 lines
package/rpi-userland/Config.in +1 -0
+
 endif
 
 comment "rpi-userland needs a toolchain w/ C++, largefile, threads"
package/rpi-userland/S94vcfiled new file +47 -0
new file mode 100755
index 0000000..9a3e523
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+NAME=vcfiled
+DESC="VideoCore file server daemon $NAME"
+DAEMON="/usr/sbin/$NAME"
+DAEMON_ARGS=""
+CFGFILE="/etc/default/$NAME"
+PIDFILE="/var/run/$NAME.pid"
+
+# Read configuration variable file if it is present
+[ -r "$CFGFILE" ] && . "$CFGFILE"
+
+do_start()
+{
+	echo -n "Starting $DESC: "
+	start-stop-daemon -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS &&
+			echo "done" || echo "failed"
+}
+
+do_stop()
+{
+	echo -n "Stopping $DESC: "
+	if start-stop-daemon -K -q -R TERM/30/KILL/5 -p "$PIDFILE" -n "$NAME"; then
+		# This daemon does not remove its PID file when it exits.
+		rm -f "$PIDFILE"
+		echo "done"
+	else
+		echo "failed"
+	fi
+}
+
+case "$1" in
+	start)
+		do_start
+		;;
+	stop)
+		do_stop
+		;;
+	restart|reload)
+		do_stop
+		do_start
+		;;
+	*)
+		echo "Usage: $0 {start|stop|restart|reload}" >&2
+		exit 1
+		;;
+esac
package/rpi-userland/rpi-userland.mk +12 -1
index 81ed95c..74a0056 100644
@@ -9,11 +9,22 @@ RPI_USERLAND_SITE = $(call github,raspberrypi,userland,$(RPI_USERLAND_VERSION))
 RPI_USERLAND_LICENSE = BSD-3c
 RPI_USERLAND_LICENSE_FILES = LICENCE
 RPI_USERLAND_INSTALL_STAGING = YES
-RPI_USERLAND_CONF_OPT = -DVMCS_INSTALL_PREFIX=/usr
+RPI_USERLAND_CONF_OPT = -DVMCS_INSTALL_PREFIX=/usr \
+	-DCMAKE_C_FLAGS="-DVCFILED_LOCKFILE=\\\"/var/run/vcfiled.pid\\\""
 
 RPI_USERLAND_PROVIDES = libegl libgles libopenmax libopenvg
 
+ifeq ($(BR2_PACKAGE_RPI_USERLAND_START_VCFILED),y)
+define RPI_USERLAND_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/rpi-userland/S94vcfiled \
+			$(TARGET_DIR)/etc/init.d/S94vcfiled
+endef
+endif
+
 define RPI_USERLAND_POST_TARGET_CLEANUP
+	rm -f $(TARGET_DIR)/etc/init.d/vcfiled
+	rm -f $(TARGET_DIR)/usr/share/install/vcfiled
+	rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/install
 	rm -Rf $(TARGET_DIR)/usr/src
 endef
 RPI_USERLAND_POST_INSTALL_TARGET_HOOKS += RPI_USERLAND_POST_TARGET_CLEANUP
Signature · 6 lines
1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v4 1/1 rpi-userland: Fix vcfiled startup

In reply to Benoît Thébaudeau

Hi Benoit, Yann, all,

Quoted 105 lines · Beno?t Th?baudeau

The VideoCore file server daemon startup script installed from this package is not compatible with BuildRoot (because of its naming and other Debian dependencies), which prevented vcfiled from starting. Hence, prevent this package from installing its vcfiled startup script, and add a configuration option to install a vcfiled SysV init script suitable for BuildRoot.

---

Changes in v4:
- Use /var/run/vcfiled.pid instead of /var/run/vcfiled/vcfiled for vcfiled's PID file path.

Changes in v3:
- Add a config option to start this daemon.

Changes in v2:
- Indent .mk rules with tabs.
- Simplify the new vcfiled startup script.
- Rename S97vcfiled to S94vcfiled for a better integration with existing init scripts.

---
 package/rpi-userland/Config.in       |  7 ++++++
 package/rpi-userland/S94vcfiled      | 47 ++++++++++++++++++++++++++++++++++++
 package/rpi-userland/rpi-userland.mk | 13 +++++++++-
 3 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100755 package/rpi-userland/S94vcfiled
package/rpi-userland/Config.in +7 -0
index aeee5e1..89e99e0 100644
@@ -31,6 +31,13 @@ config BR2_PACKAGE_PROVIDES_LIBOPENVG
 config BR2_PACKAGE_PROVIDES_LIBOPENMAX
        default "rpi-userland"
 
+config BR2_PACKAGE_RPI_USERLAND_START_VCFILED
+       bool "Start vcfiled"
+       depends on BR2_INIT_SYSV || BR2_INIT_BUSYBOX
+       help
+         vcfiled is a daemon serving files to VideoCore from the host filing
+         system.
+
 endif
 
 comment "rpi-userland needs a toolchain w/ C++, largefile, threads"
package/rpi-userland/S94vcfiled new file +47 -0
new file mode 100755
index 0000000..9a3e523
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+NAME=vcfiled
+DESC="VideoCore file server daemon $NAME"
+DAEMON="/usr/sbin/$NAME"
+DAEMON_ARGS=""
+CFGFILE="/etc/default/$NAME"
+PIDFILE="/var/run/$NAME.pid"
+
+# Read configuration variable file if it is present
+[ -r "$CFGFILE" ] && . "$CFGFILE"
+
+do_start()
+{
+       echo -n "Starting $DESC: "
+       start-stop-daemon -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS &&
+                       echo "done" || echo "failed"
+}
+
+do_stop()
+{
+       echo -n "Stopping $DESC: "
+       if start-stop-daemon -K -q -R TERM/30/KILL/5 -p "$PIDFILE" -n "$NAME"; then
+               # This daemon does not remove its PID file when it exits.
+               rm -f "$PIDFILE"
+               echo "done"
+       else
+               echo "failed"
+       fi
+}
+
+case "$1" in
+       start)
+               do_start
+               ;;
+       stop)
+               do_stop
+               ;;
+       restart|reload)
+               do_stop
+               do_start
+               ;;
+       *)
+               echo "Usage: $0 {start|stop|restart|reload}" >&2
+               exit 1
+               ;;
+esac
package/rpi-userland/rpi-userland.mk +0 -0
index 81ed95c..74a0056 100644

package/rpi-userland/rpi-userland.mk RPI_USERLAND_SITE = $(call github,raspberrypi,userland,$(RPI_USERLAND_VERSION)) · line 13

Quoted 6 lines
package/rpi-userland/rpi-userland.mk +2 -1
@@ -9,11 +9,22 @@ RPI_USERLAND_SITE = $(call github,raspberrypi,userland,$(RPI_USERLAND_VERSION))
 RPI_USERLAND_LICENSE = BSD-3c
 RPI_USERLAND_LICENSE_FILES = LICENCE
 RPI_USERLAND_INSTALL_STAGING = YES
-RPI_USERLAND_CONF_OPT = -DVMCS_INSTALL_PREFIX=/usr
+RPI_USERLAND_CONF_OPT = -DVMCS_INSTALL_PREFIX=/usr \
+       -DCMAKE_C_FLAGS="-DVCFILED_LOCKFILE=\\\"/var/run/vcfiled.pid\\\""
[only about the CMake part, on the Yann's request]

For the record:
This kind of assignation can be fragile because the CMake code may mess up with the variable (e.g. overriding it).
But here, it is ok because none of the toolchainfile.cmake generated by BR, nor the rpi-userland CMake code override the CMAKE_C_FLAGS variable, they just append or prepend stuff to it.

Quoted 20 lines
package/rpi-userland/rpi-userland.mk +10 -1
 RPI_USERLAND_PROVIDES = libegl libgles libopenmax libopenvg
 
+ifeq ($(BR2_PACKAGE_RPI_USERLAND_START_VCFILED),y)
+define RPI_USERLAND_INSTALL_INIT_SYSV
+       $(INSTALL) -m 0755 -D package/rpi-userland/S94vcfiled \
+                       $(TARGET_DIR)/etc/init.d/S94vcfiled
+endef
+endif
+
 define RPI_USERLAND_POST_TARGET_CLEANUP
+       rm -f $(TARGET_DIR)/etc/init.d/vcfiled
+       rm -f $(TARGET_DIR)/usr/share/install/vcfiled
+       rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/install
        rm -Rf $(TARGET_DIR)/usr/src
 endef
 RPI_USERLAND_POST_INSTALL_TARGET_HOOKS += RPI_USERLAND_POST_TARGET_CLEANUP
--

1.9.1

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Cheers,

Signature · 1 line
Samuel
#3 lore raw

PATCH v4 1/1 rpi-userland: Fix vcfiled startup

In reply to Benoît Thébaudeau
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Beno?t" == Beno?t Th?baudeau <[email protected]> writes:

The VideoCore file server daemon startup script installed from this package is not compatible with BuildRoot (because of its naming and other Debian dependencies), which prevented vcfiled from starting. Hence, prevent this package from installing its vcfiled startup script, and add a configuration option to install a vcfiled SysV init script suitable for BuildRoot.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard