Skip to contentSkip to conversation

xbmc: new package

PATCH Superseded Yann E. MORIN 4 participants 6 messages Mar 26, 2014 – Apr 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v11 1/1 xbmc: new package

From: Maxime Hadjinlian <[email protected]>

XBMC is an award-winning free and open source (GPL) software media player and entertainment hub for digital media.

We do provide a sub-option for each major feature we support, to avoid letting the user hunt-down required libraries, since the dependency is not always obvious and straightforward.

We also provide our own wrapper script, because the ones bundled in XBMC are not suitable to all platforms. We need such a wrapper script because XBMC exits with different exit codes, depending on how the user quit XBMC: 0 is normal exit, 64 is for halt, and 66 is for reboot. So we can't simply call the real XBMC binary from the startup script, or we would lose this information. So, we provide a wrapper script that takes appropriate action according to the above exit codes.

When run as root from a startup script, there is no HOME set, so XBMC defaults to saving its configuration in /.xbmc (yes, at the root of the rootfs). Since this does not play well with read-only filesystems (and is inherently ugly anyway), and sicne there is no real clean way to tell XBMC where to store its configuration, just provide a symlink to a better
place: /.xbmc -> /var/xbmc (note: the only location _guaranteed_ to be writable is /tmp, but we want the configuration to survive a reboot. So, /var/xbmc looks a better place than /var/run/xbmc. and the user will have to take action to ensure /var/xbmc be writable.) (note: for this reason, we do not want to set $HOME to /root either, even if it is root running XBMC.)

Some of XBMC sub-options select libraries that depend on toolchain options, such as IPv6. But those are already covered, being also implicit dependencies of XBMC, as XBMC can only be used on an (e)glibc toolchain anyway. When^WIf XBMC is one day buildable under uClibc/musl, this will be time to revisit those dependencies.

This package was originally found at : https://github.com/huceke/buildroot-rbp
By gimli <[email protected]>

---
Chamges v10 -> v11:
- better document Buildroot specificities in the commit log (Peter)
- typo in our wrapper script (Peter)
- small fixup nit in the startup script
Chamges v9 -> v10: (Yann)
- further cleanup in dependencies
- don't check for pre-existing startup script or systemd unit before installing therm
- provide our own br-xbmc wrapper script
- move XBMC's runtime config to a saner place
Changes v8 -> v9:
- Include patch from Yann E. Morin (See commit log below)
- Fix startup script (Martin Bark)
- Cleanup dependencies (Yann E. Morin)
- Remove RaspberryPi specific patch, most of them are now useless anyway.
Changes v7 -> v8:
- Fix comments and dependencies on components (Thomas Petazzoni)
- Change name for options (Thomas Petazzoni)
- Remove depends on external toolchain (Martin Bark)
- Fix various indent issues (Thomas Petazzoni)
- Fix hook placement (Thomas Petazzoni)
- Add host-gperf (Martin Bark)
Changes v6 -> v7:
- Fix various capitalization issue (Thomas De Schampheleire)
- Changes depends on !uclibc to a depends on glibc (Thomas De Schampheleire)
- Remove TIFF being selected twice (Jerzy Grzegorek)
Changes v5 -> v6:
- Fix missing depends on OpenGL (Yann E. Morin)
- Remove LIBCEC_RBP Config option (Yann E. Morin)
- Fix dependency that were, in the end, not optionnal (Martin Bark)
- Fix OpenGL check (Martin Bark)
- Uses BR2_HOST_NEEDS_JAVA (Martin Bark)
Changes v4 -> v5:
- Remove MAKE1, seems to work fine with parallel build.
Changes v3 -> v4:
- Rework init script
- Add systemd startup service
Changes v2 -> v3:
- Fix indent
- Change librtmp to rtmpdump
Changes v1 -> v2:
- Fix header (Yann E. Morin)
- Fix comment on toolchain option (Peter Korsgaard)
---
package/xbmc: background XBMC and store PID in startup script

Otherwise the startup script:
- hangs while XBMC is running,
- is not able to stop XBMC on shutdown.

---
package/xbmc: cleanup dependencies

XBMC needs an (e)glibc toolchain, which is only available on targets with an MMU, so there's no need to repeat it. Add missing dependency on threads.

Most of the required dependencies for sub-options are already matched, as they already apply to XBMC itself.

Better annotate dependencies inherited from a 'select' dependency.

Fix un-met depdendency comments to repeat the feature prompt (eg. 'libcec' -> 'hdmi cec', 'libnfs' -> 'nfs' ...)

Re-order top-of-file comments, so they are in a more meaningful order.

Cc Maxime Hadjinlian <[email protected]>

---
package/xbmc: further cleanup in sub-options dependencies

XBMC depends on a (e)glibc toolchain.

(e)glibc always has support for wide chars, IPv6, and largefiles.

So, sub-options of XBMC do not need to explicitly depend on those toolchain options.

Cc Maxime Hadjinlian <[email protected]>

---
package/xbmc: install startup script or systemd unit even if it exists

If the sysV init startup script (or the systemd unit) already exists, it is not installed.

This is an issue when working on tweaking the sysV inint startup script (or the systemd unit).

Always install it; don't check if it is already installed.

Cc Maxime Hadjinlian <[email protected]>

---
package/xbmc: add our own wrapper script

/usr/bin/xbmc is a wrapper script that calls to the real xbmc executable in /usr/lib/xbmc/xbmc.bin.

We can not use this script, as it does some checks that are not always valid. For example, it checks that it can run glxinfo, which is not always available, although the target does have GL extensions.

/usr/bin/xbmc-standlaone is basically a wrapper around that first wrapper above, so we can't use it any more.

On the other hand, directly calling the real xbmc executable from the startup script means we're loosing XBMC exit codes. Thos exit codes are important, since XBMC exits with:
- 0 : normal exit, no action required by user
- 64 : normal exit, power-off required by user
- 66 : normal exit, reboot required by user

Any other exit code is an error (save for 65, which I could not find the reason for).

So, provide our own simple wrapper that runs XBMC in a loop, until it exits with one of the above error codes. If xbmc exit with 64, the scripts calls 'halt' and stops the loop; with 66, it calls 'reboot' and stops the loop; with 0, it just breaks the loop; any other exit code just loop over after a 1 second pause.

This wrapper expects the path to the real xbmc executable as first argument, and calls it with the remaining arguments, if any.

Cc Maxime Hadjinlian <[email protected]>

---
package/xbmc: don't store runtime config in /.xbmc

When run from a startup script, XBMC has no $HOME where to store its configuration, so ends up storing it in /.xbmc (yes, at the root of the rootfs).

This is a problem for read-only filesystems, of course.

But we can't easily change that, so create /.xbmc as a symlink where we want the config to eventually be, ie. /var/xbmc

Cc Maxime Hadjinlian <[email protected]>
---
 package/Config.in                               |   1 +
 package/xbmc/Config.in                          | 161 +++++++++++++++++++++
 package/xbmc/S50xbmc                            |  39 ++++++
 package/xbmc/br-xbmc                            |  36 +++++
 package/xbmc/xbmc-0001-Fixup-include-path.patch |  81 +++++++++++
 package/xbmc/xbmc.mk                            | 178 ++++++++++++++++++++++++
 package/xbmc/xbmc.service                       |  12 ++
 7 files changed, 508 insertions(+)
 create mode 100644 package/xbmc/Config.in
 create mode 100755 package/xbmc/S50xbmc
 create mode 100755 package/xbmc/br-xbmc
 create mode 100644 package/xbmc/xbmc-0001-Fixup-include-path.patch
 create mode 100644 package/xbmc/xbmc.mk
 create mode 100644 package/xbmc/xbmc.service
package/Config.in +1 -0
index cfa53d3..ad75d9b 100644
@@ -27,6 +27,7 @@ source "package/tstools/Config.in"
 source "package/vlc/Config.in"
 source "package/vorbis-tools/Config.in"
 source "package/wavpack/Config.in"
+source "package/xbmc/Config.in"
 source "package/yavta/Config.in"
 endmenu
 
package/xbmc/Config.in new file +161 -0

161 lines not on this page · raw message

package/xbmc/S50xbmc new file +39 -0
new file mode 100755
index 0000000..312452b
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# Starts XBMC.
+#
+
+BIN=/usr/bin/br-xbmc
+XBMC=/usr/lib/xbmc/xbmc.bin
+XBMC_ARGS="--standalone -fs -n"
+PIDFILE=/var/run/xbmc.pid
+
+start() {
+	echo -n "Starting XBMC: "
+	start-stop-daemon -S -q -b -m -p $PIDFILE --exec $BIN -- $XBMC $XBMC_ARGS
+	[ $? == 0 ] && echo "OK" || echo "FAIL"
+}
+stop() {
+	echo -n "Stopping XBMC: "
+	start-stop-daemon -K -q -p $PIDFILE
+	[ $? == 0 ] && echo "OK" || echo "FAIL"
+}
+restart() {
+	stop
+	start
+}
+
+case "$1" in
+	start)
+		start
+	;;
+	stop)
+		stop
+	;;
+	restart|reload)
+		restart
+	;;
+	*)
+		echo "Usage: $0 {start|stop|restart}"
+	exit 1
+esac
package/xbmc/br-xbmc new file +36 -0
new file mode 100755
index 0000000..2a62b31
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# We're called with the real XBMC executable as
+# first argument, followed by any XBMC extra args
+XBMC="${1}"
+shift
+
+# In case someone asked we terminate, just kill
+# the XBMC process
+trap_kill() {
+    LOOP=0
+    killall "${XBMC##*/}"
+}
+trap trap_kill INT QUIT TERM
+
+LOOP=1
+while [ ${LOOP} -eq 1 ]; do
+    # Hack: Busybox ash does not catch signals while a non-builtin
+    # is running, and only catches the signal when the non-builtin
+    # command ends. So, we just background the XBMC binary, and wait
+    # for it. But Busybox' ash's wait builtin does not return the
+    # exit code even if there was only one job (which is correct
+    # for POSIX). So we explicitly wait for the XBMC job
+    "${XBMC}" "${@}" &
+    wait %1
+    ret=$?
+    case "${ret}" in
+        0)  ;;
+        64) halt;   LOOP=0;;
+        66) reboot; LOOP=0;;
+        *)  # Crash
+            sleep 1
+            ;;
+    esac
+done
+exit ${ret}
package/xbmc/xbmc-0001-Fixup-include-path.patch new file +81 -0

81 lines not on this page · raw message

package/xbmc/xbmc.mk new file +178 -0

178 lines not on this page · raw message

package/xbmc/xbmc.service new file +12 -0
new file mode 100644
index 0000000..3fe5895
@@ -0,0 +1,12 @@
+[Unit]
+Description = XBMC media center
+After = network.target
+
+[Service]
+Type = simple
+ExecStart = /usr/lib/xbmc/xbmc.bin --standalone -fs -n
+Restart = on-failure
+
+[Install]
+WantedBy = multi-user.target
+
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v11 1/1 xbmc: new package

Quoted 39 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: Maxime Hadjinlian <[email protected]> XBMC is an award-winning free and open source (GPL) software media player and entertainment hub for digital media.

We do provide a sub-option for each major feature we support, to avoid letting the user hunt-down required libraries, since the dependency is not always obvious and straightforward.

We also provide our own wrapper script, because the ones bundled in XBMC are not suitable to all platforms. We need such a wrapper script because XBMC exits with different exit codes, depending on how the user quit XBMC: 0 is normal exit, 64 is for halt, and 66 is for reboot. So we can't simply call the real XBMC binary from the startup script, or we would lose this information. So, we provide a wrapper script that takes appropriate action according to the above exit codes.

When run as root from a startup script, there is no HOME set, so XBMC defaults to saving its configuration in /.xbmc (yes, at the root of the rootfs). Since this does not play well with read-only filesystems (and is inherently ugly anyway), and sicne there is no real clean way to tell XBMC where to store its configuration, just provide a symlink to a better
place: /.xbmc -> /var/xbmc (note: the only location _guaranteed_ to be writable is /tmp, but we want the configuration to survive a reboot. So, /var/xbmc looks a better place than /var/run/xbmc. and the user will have to take action to ensure /var/xbmc be writable.) (note: for this reason, we do not want to set $HOME to /root either, even if it is root running XBMC.)

Some of XBMC sub-options select libraries that depend on toolchain options, such as IPv6. But those are already covered, being also implicit dependencies of XBMC, as XBMC can only be used on an (e)glibc toolchain anyway. When^WIf XBMC is one day buildable under uClibc/musl, this will be time to revisit those dependencies.

This package was originally found at : https://github.com/huceke/buildroot-rbp
By gimli <[email protected]>

Quoted 6 lines

---
Chamges v10 -> v11:

Heh ;)

Committed, thanks both!

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH v11 1/1 xbmc: new package

Hurray !

Quoted 19 lines · Peter Korsgaard
Quoted 18 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

"Yann" == Yann E MORIN <[email protected]> writes:

From: Maxime Hadjinlian <[email protected]> XBMC is an award-winning free and open source (GPL) software media player and entertainment hub for digital media.

We do provide a sub-option for each major feature we support, to avoid letting the user hunt-down required libraries, since the dependency is not always obvious and straightforward.

We also provide our own wrapper script, because the ones bundled in XBMC are not suitable to all platforms. We need such a wrapper script because XBMC exits with different exit codes, depending on how the user quit XBMC: 0 is normal exit, 64 is for halt, and 66 is for reboot. So we can't simply call the real XBMC binary from the startup script, or we would lose this information. So, we provide a wrapper script that takes appropriate action according to the above exit codes.

Quoted 4 lines
Quoted 4 lines

When run as root from a startup script, there is no HOME set, so XBMC defaults to saving its configuration in /.xbmc (yes, at the root of the rootfs). Since this does not play well with read-only filesystems (and is inherently ugly anyway), and sicne there is no real clean way to

tell

Quoted 1 line
Quoted 1 line

XBMC where to store its configuration, just provide a symlink to a

better

Quoted 2 lines
Quoted 2 lines

place: /.xbmc -> /var/xbmc (note: the only location _guaranteed_ to be writable is /tmp, but we want the configuration to survive a reboot.

So,

Quoted 6 lines
Quoted 6 lines

/var/xbmc looks a better place than /var/run/xbmc. and the user will have to take action to ensure /var/xbmc be writable.) (note: for this reason, we do not want to set $HOME to /root either, even if it is root running XBMC.)

Some of XBMC sub-options select libraries that depend on toolchain

options,

Quoted 3 lines
Quoted 3 lines

such as IPv6. But those are already covered, being also implicit dependencies of XBMC, as XBMC can only be used on an (e)glibc toolchain anyway. When^WIf XBMC is one day buildable under uClibc/musl, this

will be

Quoted 3 lines
Quoted 3 lines

time to revisit those dependencies.

This package was originally found at :

https://github.com/huceke/buildroot-rbp

Quoted 9 lines
Quoted 8 lines

By gimli <[email protected]>

---
Chamges v10 -> v11:

Quoted 3 lines

Heh ;)

Committed, thanks both!

Hurray !!

Thanks Peter !

Quoted 7 lines

--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140327/d4bd3391/attachment.html>

#3 lore raw

PATCH v11 1/1 xbmc: new package

In reply to Yann E. MORIN

"Yann E. MORIN" <[email protected]> wrote in news:1395875160-14253-1-git-send-email-yann.morin.1998 at free.fr:

Quoted 6 lines
(quoted diff) +4 -0
+ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
+XBMC_DEPENDENCIES += rpi-userland
+XBMC_CONF_OPT += --with-platform=raspberry-pi --enable-player=omxplayer
+XBMC_CONF_ENV +=

INCLUDES="-I$(STAGING_DIR)/usr/include/interface/vcos/pthreads \ + -I$(STAGING_DIR)/usr/include/interface/vmcs_host/linux" +endif

Hi,

while testing Gotham beta3 using configs/raspberrypi_defconfig I stumbled across this part of xbmc.mk. The defconfig does not enable the BR2 _PACKAGE_RPI_USERLAND package, so xbmc is configured without its special raspberry platform option. Changing the above if-clause to check for package BR2_PACKAGE_RPI_FIRMWARE, which is used in raspberrypi_defconfig, seems to work better, at least Gotham beta3 is compiled without errors.

I have to add that I do not own a Raspberry system, this was the first time ever I compiled code for it ;) What do you think about this patch?

package/xbmc/xbmc.mk +1 -1
index 9169698..e1885fc 100644
@@ -43,7 +43,7 @@ XBMC_CONF_OPT +=  \
        --disable-rsxs \
        --enable-optimizations
 
-ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
+ifeq ($(BR2_PACKAGE_RPI_FIRMWARE),y)
 XBMC_DEPENDENCIES += rpi-userland
 XBMC_CONF_OPT += --with-platform=raspberry-pi --enable-player=omxplayer
 XBMC_CONF_ENV += INCLUDES="-I

$(STAGING_DIR)/usr/include/interface/vcos/pthreads \

Regards, Bernd

#4 lore raw

PATCH v11 1/1 xbmc: new package

Bernd, All,

On 2014-04-10 20:08 +0200, Bernd Kuhls spake thusly:

Quoted 3 lines

while testing Gotham beta3 using configs/raspberrypi_defconfig I stumbled across this part of xbmc.mk. The defconfig does not enable the BR2 _PACKAGE_RPI_USERLAND package,

Yes, this is expected. The defconfig files are the minimum to get the system up-n-running up to a shell prompt. rpi-userland is not part of what is required for that, so it is explicitly not enabled.

Quoted 2 lines

so xbmc is configured without its special
raspberry platform option.

This should not be possible, since XBMC depends on an OpenGL ES and EGL backend to be selected, and rpi-suerland is such a provider for EGL and GLES.

If you managed to be able to select XBMC without selecting rpi-userland, that's because you enabled another OpenGL es and EGL provider. If no provider for OpenGL ES and EGL is selected, then XBMC should not be visible.

Quoted 3 lines

Changing the above if-clause to check for package BR2_PACKAGE_RPI_FIRMWARE, which is used in raspberrypi_defconfig, seems to work better, at least Gotham beta3 is compiled without errors.

That's wrong, because rpi-firmware is not an OpenGL ES and EGL provider. rpi-firmware only provides the boot files for the RPi.

package/xbmc/xbmc.mk XBMC_CONF_OPT += \ · line 46

Quoted 13 lines

I have to add that I do not own a Raspberry system, this was the first time ever I compiled code for it ;) What do you think about this patch?

package/xbmc/xbmc.mk +1 -1
index 9169698..e1885fc 100644
@@ -43,7 +43,7 @@ XBMC_CONF_OPT +=  \
        --disable-rsxs \
        --enable-optimizations
 
-ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
+ifeq ($(BR2_PACKAGE_RPI_FIRMWARE),y)

This is incorrect, as I said above: the real dependency is on rpi-userland.

At worst, this is because you have *another* OpenGL ES and EGL provider selected in the menuconfig (see above).

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH v11 1/1 xbmc: new package

"Yann E. MORIN" <[email protected]> wrote in news:20140410203202.GA4037 at free.fr:

Quoted 2 lines

At worst, this is because you have *another* OpenGL ES and EGL provider selected in the menuconfig (see above).

Hi,

correct, I selected mesa3d as opengl provider using your new patchset.

Regards, Bernd