Tvheadend on OpenWrt

I asked about the availability of Tvheadend on OpenWrt some time ago and was surprised that it existed and I could install it using

opkg install tvheadend

The version available (on OpenWrt) is 4.0.10-1 which is quite a bit behind other platforms. Is it possible to build my own version and if so how do I set about it?

  1. Edit the package file
  2. Build it
  3. Install it
  4. Realize that all-in-one router hardware is ill-suited for being a streaming media server, recorder, and/or transcoder
1 Like

Not sure where to get the package file...

OpenWrt suits me very well for doing Linux testing because it lacks 'bloatware'.

As a transcoder sure thats to much to ask from a router, but for streaming media a lot of routers are perfectly suited. The wrt1200/1900/32x all have full speed sata/usb3 ports, which is more than enough for streaming. With the new 10-14 TB drives you can have a sizeable media collection via a inexpensive device, that's already on 24/7.

1 Like

I would like to use TVheadend also but I also want to use a more current version.

  1. What package file do I edit and where do I find it?
  2. Build with what?
  3. How do I install it? opkg? (using the SDK is also possible, though, at least for me, if you're going to build packages from source, you might as well build the images yourself).

The makefile will be in ./feeds/packages/multimedia/tvheadend once you've updated the feeds.

Custom packages that are build with the SDK or the build system can be installed on the "matching" system with opkg. At least in my opinion building an entire, self-consistent image is the "preferred" path, especially with something as large and complex as a media server. (When you install with opkg, you don't get the benefit of compression into the ROM.)

1 Like

Awesome. Thanks! I'll give it a try.

1 Like

For Debian, I install

apt install build-essential git gitk libncurses5-dev gawk unzip wget curl ccache rsync zlib1g-dev

gitk and rsync not required or used by OpenWrt builds, AFAIK
I use ccache in my builds, which is supported by OpenWrt (which may build its own, I haven't confirmed)

So, do I have to use an seperate Linux system and not SSH with the router to build this? I don't understand how you would get the compiled program on to the router though.

Just curious, couldn't you guys just update Tvheadend package so we don't have to build it from source? That way when a user runs 'opkg install tvheadend' it would install a current version.

That is correct, a running Linux-based "desktop" system is required (a VM with 32 GB of storage will work for Debian, last I checked). It is close to impossible to build OpenWrt on a running OpenWrt system.

If you're building a package, at least in my opinion, you might as well build the entire image and flash it to your device. You can build packages with the SDK that exactly matches your kernel version, but the system requirements for that are just about the same and you don't get the compression advantage of including the package in your custom ROM.

"You guys" often comes down to a motivated individual making the changes and submitting a patch or pull request. With something "far off the beaten track", the number of "motivated individuals" is very small. Build errors are often fixed, but keeping up with version updates for a "rare" package isn't a high priority for most.

I found the makefile. Now what do I do? I really have no idea what I am supposed to do.

Using the preformatted-text button is helpful, especially as screenshots are hard to read and can't be indexed.

The first, key section is



You'll need to "bump" the PKG_RELEASE, change the PKG_VERSION and then adjust the PKG_HASH. You can download the tarball yourself and compute the, as I recall, sha256 hash. The build system, as I recall, will also throw a warning or error and show the hash it computed.

Then it comes down to trying to build it and resolving any significant warnings (Use V=s with make) and errors.

Edit: I'd remove the patches first, as they may well have been resolved in the upstream source by now.


So, like this?
How do I compute the hash?
Doesn't it just download from github anyway?



Yes, it will download from GitHub. You can download it and manually compute the hash (here for the existing version)

$ wget
$ sha256sum v4.0.10.tar.gz 
f610e7d9f3bf6cff05cd73830a66ee0c74bc5291c4c9d08369364c4c681ebf23  v4.0.10.tar.gz

or wait for the build system to tell you that the hash doesn't match

And then I go to the ./openwrt/ folder and type 'make tvheadend'?
I went to 'make menuconfig' and chose to build the SDK along with Tvheadend.

I would first confirm that your build environment is properly set up, as well as "priming" the toolchain for the right target with

make menuconfig

and selecting your target and device and, under developer options, enable ccache.

Then, you should be able to run

make -j12 clean download toolchain/install world

to eventually get what should be a functional, flashable image (no LuCI).

Change -j12 to the number of cores you have, or one or two less if you want to use the machine while it's building. Grab a drink. Building the cross-compile toolchain takes a while, but it's usually a "once" task.

Once that completes successfully, then you can start trying to build the package

make package/tvheadend/install V=s

and start to work through any issues that come up.

With a full build system, there usually isn't a need for the SDK -- you use the build system itself.

Okay, so .. target system -> ATH79 (DTS)
subtarget-> generic
target profile -> Netgear WNDR3700 v1
Advanced configuration options -> enable ccahche.

1 Like

You probably want luci as well (it's not preinstalled in the default config).

1 Like

And that's why it crashed. I'm running it on an old first generation core i3. lol

Why does it keep saying this?

make -r install/toolchain: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
make: *** [/home/rob/dev/openwrt/include/ install/toolchain] Error 1