• 1
  • 19
  • 20
  • 21(current)
  • 22
  • 23
  • 35
HOW-TO Compile Tvheadend & HDHomerun on Synology NAS
(2014-02-12, 23:28)aisman Wrote: @Cassiel
more than well Smile I have DS with intel, and can t0 install tvh from repo, or build install master with gcc 4.8.2 Smile I can't say exactly, but intel-machines have very weak glibc (even more weak then it on armv5, sic) and gcc, because this developer of tvh has to make changes to the code to compile although somehow. I recently compared the work spk package and work of Debian on DS411j - I can definitely say, in Debian all is easier and less CPU usage. On the intel I did not even try to build spk - don't see any sense in it, when there is Debian Smile I use Debian on two DS - intel and armadaxp, although armhf spk compiles fine, I didn't do this and just using debian for tvh, and other programs.

@schumi2004, thank you for info, I'll try it soon. Maybe I again need your lessons Smile
So using debian chroot is less resource hungry (High CPU usage) even on ARM?
I cross compiled 3.9.381 for ARM DS211 and it works perfect, even HD channels.
Only thing i have is when opening settings page a popup saying FAILED but still works fine.
Not sure if i want to switch to debian chroot yet.
Reply
(2014-02-13, 11:34)schumi2004 Wrote: Only thing i have is when opening settings page a popup saying FAILED but still works fine.
Not sure if i want to switch to debian chroot yet.

I told about it, to solve this "FAILED" you should to compile with curl Smile Post: #178

As for the HD channels, it are different, a little bit-rate channels broadcast normally, but I have the channels with a bitrate of ~ 20 Mb/s, here is just beginning a serious CPU loading. On Debian I could see with no errors, but with spk picture was crumbled. On Debian CPU usage - 86% on spk - 99-100.
Reply
(2014-02-13, 13:58)aisman Wrote:
(2014-02-13, 11:34)schumi2004 Wrote: Only thing i have is when opening settings page a popup saying FAILED but still works fine.
Not sure if i want to switch to debian chroot yet.

I told about it, to solve this "FAILED" you should to compile with curl Smile Post: #178

As for the HD channels, it are different, a little bit-rate channels broadcast normally, but I have the channels with a bitrate of ~ 20 Mb/s, here is just beginning a serious CPU loading. On Debian I could see with no errors, but with spk picture was crumbled. On Debian CPU usage - 86% on spk - 99-100.

Ah i missed that FAILED part, sorry. Will compile newer version.
Can you point me to your post about debian setup? 14% degrease in CPU is pretty much.
Reply
Yes, a can, mate! But I'll do it later today, ok? Now begins the Olympic ice-hockey for Russia Smile
Reply
(2014-02-13, 14:11)aisman Wrote: Yes, a can, mate! But I'll do it later today, ok? Now begins the Olympic ice-hockey for Russia Smile

Cool, thanks. I'm going to check Olympics myself Wink
Edit:
i think i found Debian Chroot instructions http://forum.xbmc.org/showthread.php?tid...pid1564641 needed to go more pages back Wink
Only thing missing is how to create/update *-syno-armel.deb package mentioned in post.

For who wants to compile tvheadend using spksrc,
- git clone https://github.com/SynoCommunity/spksrc.git
- download this package https://www.dropbox.com/s/9cycu5lc13y2rf...end.tar.gz
It has all the needed fixes and patches to compile it with spksrc
- extract and replace it in folder spksrc
- compile: ~/spksrc$ make ARCH=88f6281 tvheadend
- Wait and your package should be ready in a few minutes.
Reply
(2014-02-13, 14:34)schumi2004 Wrote:
(2014-02-13, 14:11)aisman Wrote: Yes, a can, mate! But I'll do it later today, ok? Now begins the Olympic ice-hockey for Russia Smile

Cool, thanks. I'm going to check Olympics myself Wink
Edit:
i think i found Debian Chroot instructions http://forum.xbmc.org/showthread.php?tid...pid1564641 needed to go more pages back Wink

For who wants to compile tvheadend using spksrc,
- git clone https://github.com/SynoCommunity/spksrc.git
- download this package https://www.dropbox.com/s/9cycu5lc13y2rf...end.tar.gz
It has all the needed fixes and patches to compile it with spksrc
- extract and replace it in folder spksrc
- compile: ~/spksrc$ make ARCH=88f6281 tvheadend
- Wait and your package should be ready in a few minutes.

Cool thanks. Will have a look at it. Would like to know how to compile it myself. Never tried it before. :-)
Reply
(2014-02-13, 14:39)Smiggel Wrote:
(2014-02-13, 14:34)schumi2004 Wrote:
(2014-02-13, 14:11)aisman Wrote: Yes, a can, mate! But I'll do it later today, ok? Now begins the Olympic ice-hockey for Russia Smile

Cool, thanks. I'm going to check Olympics myself Wink
Edit:
i think i found Debian Chroot instructions http://forum.xbmc.org/showthread.php?tid...pid1564641 needed to go more pages back Wink

For who wants to compile tvheadend using spksrc,
- git clone https://github.com/SynoCommunity/spksrc.git
- download this package https://www.dropbox.com/s/9cycu5lc13y2rf...end.tar.gz
It has all the needed fixes and patches to compile it with spksrc
- extract and replace it in folder spksrc
- compile: ~/spksrc$ make ARCH=88f6281 tvheadend
- Wait and your package should be ready in a few minutes.

Cool thanks. Will have a look at it. Would like to know how to compile it myself. Never tried it before. :-)
Really easy. I used a Ubuntu VM for it but switched to Linux by default now.
Just follow instructions on how to setup spksrc here https://github.com/SynoCommunity/spksrc/...README.rst
Replace files from file i previously posted and start making like i instructed.
That's it.
Reply
@schumi2004

I don't think we should install DC from SynoCommunity. Before, it will require to install the python, but we don't need python Smile We do not need an extra load on the processor, right?

1. Go to your ubuntu VM.
2.
Code:
wget http://ftp.de.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.67_all.deb

3.
Code:
sudo dpkg -i debootstrap_1.0.67_all.deb

4.
Code:
sudo debootstrap --foreign --arch armel wheezy debian "http://ftp.de.debian.org/debian"
(armel -- 88f628x; armhf --armada370, armadaxp; amd64 -- intel)

5.
Code:
sudo tar -czf debian.tar.gz debian

6. put this archive to /volume1 at DSM
7. go to DSM

Code:
cd /volume1

8.
Code:
gzip -c -d debian.tar.gz | tar -xf -


9.
Code:
chroot debian /debootstrap/debootstrap --second-stage

10.
Code:
cp /etc/resolv.conf debian/etc/
11.
Code:
hostname > debian/etc/hostname
12.
Code:
mount -o bind /proc debian/proc

13. edit file /volume1/debian/etc/apt/sources.list

Code:
deb http://ftp.debian.org/debian/ wheezy main contrib non-free
deb http://mirror.yandex.ru/debian/ testing main contrib non-free

14. create file /usr/syno/etc.defaults/rc.d/S99debian.sh

for user aisman in debian

Code:
#!/bin/sh

grep -q /volume1/debian/proc /proc/mounts || mount -t proc proc /volume1/debian/proc
grep -q /volume1/debian/sys /proc/mounts || mount -t sysfs sys /volume1/debian/sys
grep -q /volume1/debian/dev /proc/mounts || mount -o bind /dev /volume1/debian/dev
grep -q /volume1/debian/dev/pts /proc/mounts || mount -o bind /dev/pts /volume1/debian/dev/pts

chroot /volume1/debian/ /root/runapps.sh &

mount -o bind /volume1/debian/home/aisman/Recordings /volume1/Recordings
chmod 777 -R /volume1/debian/home/aisman/Recordings

Code:
cmod +x /usr/syno/etc.defaults/rc.d/S99debian.sh
15. create file /volume1/debian/root/runapps.sh

Code:
#!/bin/bash

/etc/init.d/ssh start

sleep 40

/etc/init.d/tvheadend start

Code:
chmod +x /volume1/debian/root/runapps.sh

16.
Code:
cd /volume1

Code:
chroot debian /bin/bash

if you want to install latest libs and gcc you have to install it with " -t testing" (apt get install -t testing blah-blah-blah)

for "stables" libs it should do it without this key:

17.
Code:
apt-get update

Code:
apt-get install sudo mc locales openssh-server xterm build-essential automake autopoint python ncurses-dev libssl-dev pkg-config zlib1g-dev gettext git curl libgc-dev libcurl4-openssl-dev -y

to creating user aisman: (you may create user hts)

18.
Code:
adduser aisman

set password

Code:
adduser aisman sudo

19. you are in debian, create file /etc/default/tvheadend, note: if you user isn't "hts" change TVH_USER="hts"
Code:
#
# Default configuration for tvheadend
#

# TVH_ENABLED
#   set to 0 to disable upstart job
TVH_ENABLED=1

# TVH_USER
#   if set to "" will run as root
TVH_USER="hts"

# TVH_GROUP
#   if set to "" will run as root
TVH_GROUP="video"

# TVH_CONF_DIR
#   if set to "" will use ~TVH_USER/.hts/tvheadend
TVH_CONF_DIR=""

# TVH_ADAPTERS
#   if set to "" will use all available adapters
#   for select adapters use comma seperated list of adapter
#   numbers, i.e. to use /dev/dvb/adapter0 and /dev/dvb/adapter1 only
#   set as "0,1"
TVH_ADAPTERS=""

# TVH_IPV6
#   if set to 1 will enable IPv6 support
TVH_IPV6=0

# TVH_HTTP_PORT
#   if set to "" will use binary default
TVH_HTTP_PORT=""

# TVH_HTTP_ROOT
#   if set to "" will use binary default
#   else will change the webui root context, useful for proxied
#   servers
TVH_HTTP_ROOT=""

# TVH_HTSP_PORT
#   if set to "" will use binary default
TVH_HTSP_PORT=""

# TVH_DEBUG
#   if set to 1 will output debug to syslog
TVH_DEBUG=0

# TVH_ARGS
#   add any other arguments
TVH_ARGS=""

20. you are still in debian, create file /etc/init.d/tvheadend
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides:          tvheadend
# Required-Start:    $local_fs $remote_fs udev
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO

# Author: Andreas Öman

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="Tvheadend"
NAME=tvheadend
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Configure command line options
[ "$TVH_ENABLED" = "1" ] || exit 0

ARGS="-f"
[ -z "$TVH_USER"      ] || ARGS="$ARGS -u $TVH_USER"
[ -z "$TVH_GROUP"     ] || ARGS="$ARGS -g $TVH_GROUP"
[ -z "$TVH_CONF_DIR"  ] || ARGS="$ARGS -c $TVH_CONF_DIR"
[ -z "$TVH_ADAPTERS"  ] || ARGS="$ARGS -a $TVH_ADAPTERS"
[ "$TVH_IPV6" = "1"   ] && ARGS="$ARGS -6"
[ -z "$TVH_HTTP_PORT" ] || ARGS="$ARGS --http_port $TVH_HTTP_PORT"
[ -z "$TVH_HTTP_ROOT" ] || ARGS="$ARGS --http_root $TVH_HTTP_ROOT"
[ -z "$TVH_HTSP_PORT" ] || ARGS="$ARGS --htsp_port $TVH_HTSP_PORT"
[ -z "$TVH_ARGS"      ] || ARGS="$ARGS $TVH_ARGS"
[ "$TVH_DEBUG" = "1"  ] && ARGS="$ARGS -s"

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
do_start()
{
        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started
        udevadm settle
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --te
                || return 1
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
                $ARGS \
                || return 2
}

#
# Function that stops the daemon/service
#
do_stop()
{
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFI
        RETVAL="$?"
        [ "$RETVAL" = 2 ] && return 2
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
        return "$RETVAL"
}


case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "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"
        do_stop
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  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
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac

21. to going via ssh change port 22 to 2222 in openssh-server at file /etc/ssh/sshd_config

22. reboot NAS

23. go via ssh and login into your user (you vill be at you /home/your-user folder) and do

Code:
git clone https://github.com/tvheadend/tvheadend

Code:
cd tvheadend

Code:
./configure --prefix=/usr --disable-avahi
Code:
make
Code:
sudo make install

important: do

Code:
tvheadend -C

set access

create folder to recordings (see s99debian.sh) and set it in tvh-GUI

reboot
Reply
(2014-02-13, 17:56)aisman Wrote: @schumi2004

I don't think we should install DC from SynoCommunity. Before, it will require to install the python, but we don't need python Smile We do not need an extra load on the processor, right?

<.....>
Extra load isn't wanted indeed but i needed Python anyways for other packages Wink
If we do use DC from SynoCommunity which steps can we skip then?
Reply
no skip, other file S99 and find in this thread about file preferences Smile Also python available in DC Smile
Reply
(2014-02-13, 18:27)aisman Wrote: no skip, other file S99 and find in this thread about file preferences Smile Also python available in DC Smile

I think i'm doing it your way, i actually already did Wink
Last question. How do you start tvheadend? Just with tvheadend -C and nothing more?
I'm asking this because the SynoCommunity way is like this /usr/local/tvheadend/bin/tvheadend -f -u tvheadend -c /usr/local/tvheadend/var -p /usr/local/tvheadend/var/tvheadend.pid

It's important for my HDHomerun driver package, i think i just modify package to fit my needs.
Reply
Hello
I have a TV by DVB-T tuner. In Tvheadend v3.4 i have a option named IDLE SCAN. This option scan my muxes and search new channel which i have not on my list map. In version TVHeadend 3.9 i have not this option IDLE SCAN. My provide add new channel. How i can search my new channel on select all muxes ? How i can enabled option IDLE SCAN ? This function is very good in v3.4

I think about this option:
Idle scanning
When nothing else happens Tvheadend will continuously rotate among all muxes and tune to them to verify that they are still working. If your adapter have problems with lots of tuning, try to disable this.

Please help me.
Reply
@schumi2004

tvh runs from file /etc/init.d/tvheadend. This is line at the file /root/runapps.sh

tvheadend -C need to run only once to set the user and password Smile
Reply
Thank you very much for your great Howto. But I'm having some problems with my ds213j. If I follow your guide it causes my synology to run into "crash mode". The web interface is still responsive but I can't access volume1 anymore.

I think I found some errors, but I am not sure:

14.

Code:
grep -q /volume1/debian/sys /proc/mounts || mount -t sysfs sys /volume1/debian/sys
grep -q /volume1/debian/dev /proc/mounts || mount -o bind /dev /volume1/debian/dev

Is the path correct ? Ist the option grep -q correct, or should it be something else, e.g. -r ?

and here should it be ?

20. you are still in debian, create file /etc/init.d/tvheadend

and the file is truncated at some points (e.g. line 62)
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: tvheadend
# Required-Start: $local_fs $remote_fs udev
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO

# Author: Andreas Öman

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="Tvheadend"
NAME=tvheadend
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Configure command line options
[ "$TVH_ENABLED" = "1" ] || exit 0

ARGS="-f"
[ -z "$TVH_USER" ] || ARGS="$ARGS -u $TVH_USER"
[ -z "$TVH_GROUP" ] || ARGS="$ARGS -g $TVH_GROUP"
[ -z "$TVH_CONF_DIR" ] || ARGS="$ARGS -c $TVH_CONF_DIR"
[ -z "$TVH_ADAPTERS" ] || ARGS="$ARGS -a $TVH_ADAPTERS"
[ "$TVH_IPV6" = "1" ] && ARGS="$ARGS -6"
[ -z "$TVH_HTTP_PORT" ] || ARGS="$ARGS --http_port $TVH_HTTP_PORT"
[ -z "$TVH_HTTP_ROOT" ] || ARGS="$ARGS --http_root $TVH_HTTP_ROOT"
[ -z "$TVH_HTSP_PORT" ] || ARGS="$ARGS --htsp_port $TVH_HTSP_PORT"
[ -z "$TVH_ARGS" ] || ARGS="$ARGS $TVH_ARGS"
[ "$TVH_DEBUG" = "1" ] && ARGS="$ARGS -s"

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
        udevadm settle
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$ARGS \
|| return 2
}

#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}


case "$1" in
  start)
[ "$VERBOSE" != no ] && log_daemon_msg "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"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
  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
;;
  *)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac

:
Reply
There is defintivily something wrong with your mount points. Executing them as you described here, causes the ds213j to crash. I think you made a mistake when copy and paste (if you have a look at them, they are all the same length...I think the rest was truncated). The only way to recover is to set up the DSM completely new...

Code:
grep -q /volume1/debian/proc /proc/mounts || mount -t proc proc /volume1/debian/
grep -q /volume1/debian/sys /proc/mounts || mount -t sysfs sys /volume1/debian/s
grep -q /volume1/debian/dev /proc/mounts || mount -o bind /dev /volume1/debian/d
grep -q /volume1/debian/dev/pts /proc/mounts || mount -o bind /dev/pts /volume1/

I think I figured it out myself....?

Code:
grep -q /volume1/debian/proc /proc/mounts || mount -t proc proc /volume1/debian/proc
grep -q /volume1/debian/sys /proc/mounts || mount -t sysfs sys /volume1/debian/sys
grep -q /volume1/debian/dev /proc/mounts || mount -o bind /dev /volume1/debian/dev
grep -q /volume1/debian/dev/pts /proc/mounts || mount -o bind /dev/pts /volume1/debian/dev/pts
Reply
  • 1
  • 19
  • 20
  • 21(current)
  • 22
  • 23
  • 35

Logout Mark Read Team Forum Stats Members Help
HOW-TO Compile Tvheadend & HDHomerun on Synology NAS1