Building V4L RPM for TBS hardware

For a MythTV system I have a couple of TBS Video capture cards. As far as I’m aware the TBS driver module is not part of the mainstream or Rocky kernel. There are various builds both OpenSource and from TBS themselves that provide source for you to build. The source includes all the other v4l modules and replaces the v4l module tree in /lib

Perhaps I’m making things too complicated for myself but, rather than compiling the source, as root, and replacing the modules I’d prefer to compile an RPM and do the install the normal way for RH derived systems.

So far I’ve got a draft RPM that builds but I haven’t worked out the install part. I’m looking for the .src.rpm for the v4l tree to see what is done in their .spec file.

Any pointers most welcome

Thanks

Ken

Maybe I’m misunderstanding something, but I thought tbs driver and v4l are completely different things?

Do you actually have the card working?

Hi Gerry, I do have the TBS driver working on a Rocky 8.5 system. For some reason the TBS video capture card’s driver has not been accepted into the mainstream. The build I’m attempting to do is for a Rocky 9.5 system.

My understanding is that the v4l driver tree (https://www.linuxtv.org/) contains drivers for many video capture cards such as those made by Hauppauge and others.

For reasons I don’t quite grasp, the available TBS driver sources also includes the whole v4l package and adds the TBS driver to that tree when compiled, replacing the previously installed drivers.

What I’m attempting to do is make a local RPM package containing the v4l tree plus the TBS driver. So far my prototype RPM compiles but I’d like to see the code in the spec file of the v4l tree so I can get the install part working correctly.

:slight_smile: Ken

I should have said. I’ve found the compiled binary RPM for v4l here, on one of the mirrors, https://dfw.mirror.rackspace.com/rocky/9.5/AppStream/x86_64/os/Packages/l/libv4l-1.20.0-5.el9.x86_64.rpm

but I’d like to trace its source RPM to see the spec file.

:slight_smile: Ken

Can we go back a few steps?

Can you clarify the exact TBS card you are using?

Regarding Rocky 8.5, can you say how you got it working, maybe you built the official driver from somewhere, but even if you did, how did you install it on 8.5? It’s important because the way it works on 8.5 is similar to how it works on 9.5

Regarding why do TBS people try to obliterate the whole of the linux media drivers tree and all the firmware, and then blat their’s over the top, who knows?

Regarding the linuxtv site, you are right, it does have some drivers, but I don’t think it has drivers for TBS?

Regaring making an RPM I’d say that’s a long way off, I mean you don’t have a way of installing it manually on 9.5, let alone being able to make an RPM?

Can you clarify the exact TBS card you are using?

Multimedia controller: TBS Technologies DVB Tuner PCIe Card
Subsystem: Device 6902:0002
Physical Slot: 4
Flags: bus master, fast devsel, latency 0, IRQ 52
Memory at fbcc0000 (32-bit, non-prefetchable) [size=256K]
Capabilities: [50] Power Management version 3
Capabilities: [70] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [90] Express Endpoint, MSI 00
Capabilities: [100] Device Serial Number 00-00-00-00-00-00-00-00
Kernel driver in use: TBSECP3 driver
Kernel modules: tbsecp3

Regarding Rocky 8.5, can you say how you got it working, maybe you built the official driver from somewhere, but even if you did, how did you install it on 8.5? It’s important because the way it works on 8.5 is similar to how it works on 9.5

Compiled it on Rocky 8.5. Indeed, I’ve found that compiling on 9.5 is similar.

Regarding why do TBS people try to obliterate the whole of the linux media drivers tree and all the firmware, and then blat their’s over the top, who knows?

I had hoped you might be able to shed some light on that.

Regarding the linuxtv site, you are right, it does have some drivers, but I don’t think it has drivers for TBS?

Exactly as described in my original post

Regaring making an RPM I’d say that’s a long way off, I mean you don’t have a way of installing it manually on 9.5, let alone being able to make an RPM?

I appreciate that I could just compile it on 9.5. Indeed I have that working just fine on a test 9.5 system. As described above, I’d like to do things in a more RH compatible way and build up my own RPM.

If you know where the source RPM is for libv4l-1.20.0-5.el9.x86_64.rpm that will probably get me on my way again.

Thanks :slight_smile:

So you’ve already got it built and working on 8.5, you’ve also “compiled” it on 9.5, but does it actually work on 9.5? You didn’t say how you installed it on either, which doesn’t help planning how to install it with an rpm. Are you using secure boot on either 8.5 or 9.5, as this would be a barrier to installing the kernel modules, they’d need to be signed. In addition, look out for overwriting modules that are already in Rocky, e.g. ‘i2c_mux’

The way it normally works with an rpm, is that you run ‘make install’, but it will use a special prefix to do a dummy install. The rpm ‘files’ section must then match every file from the dummy location. When the final rpm is installed, it will then place each file into the destination directory.

It’s in production on 8.5. Testing on 9.5. Neither system is secure boot. Both systems installed by compiling source scripts.

The source is here http://www.tbsdtv.com/download/document/linux/media_build-2024-08-29.tar.bz2

I’m aware of how rpmbuild and spec files work although my experience is limited. There is a script (install.sh), in the source, whose install step is the standard “make install” command. Running that within the RPM build environment fails. I’ve been looking at the Makefiles to work out the steps being taken in order to trace the failure.

I’m far from a Makefile guru, so it occurred to me that I could avoid “reinventing the wheel” if I took a look at the “install” section of someone elses’s spec file to get some guidance.

If you’ve time, perhaps you could take a look at that source and see if you can unravel how their Makefile arrangement can be translated into a .spec file “%install” section

Yikes.

That sentence is mixing up three different things; compiling code, running scripts and installing binaries. What exact commands did you use; did you do it all in one go by running a “master” script, or did you do it in stages, build it first as standard user, install it as root?

I can see they have shell scripts that then call perl scripts, and then build scripts (Makefile), and then install.

About Secure Boot - its the computer I have and I’m not about to replace it. I judge the risk profile as small as its not publicly visible, its on a secure LAN and its main role is to process DTV streams. I’ve not come across an attack vector via DTV streams. But I may be wrong about that! But that is getting rather off topic.

I followed the suggestion from here TBSDTV Community Forum • View topic - Red Hat Enterprise Linux 9.4 driver installation guide(5.14)

cd media_build
./patch-kernel.sh
make -j8
make install

Do you have some insight into the Makefile scripting.

These commands are helpful, but did you run all (any) of them as root?

In an earlier post you said you’d used ‘install.sh’ which is not shown here?

There’s a repo here

https://github.com/AlexanderS/tbsecp3-driver

that shows a much simplified version of what’s in the official offline driver bz2 file you posted above.

The Makefile is extremely simple, they are using the kernel build system (with all the complexity hidden inside).

There’s a command line argument called ‘modules_install’, and this is the part that actually installs the modules.

Stroke of genius Gerry. I’ll try to compile that up.

:slight_smile: Ken