OpenELEC/OpenELEC.tv — pull request #1847 by vpeter4 (2013-02-04 09:56:49+00:00)
Title: linux: support for kernel drivers which interfere with each other (like ...

...TBS, s2-liplianin)

I created a very simple way to include tbs and similar kernel drivers within openelec in a way that they don't interfere with system ones (from linux kernel itself). So they doesn't brake anything.

What I did was build normal kernel which is installed in /lib/modules/3.7.5.
Then I copied this folder to 3.7.5-sys which means system kernel modules.
Then I build tbs driver and install modules over /lib/modules/3.7.5.
In next step I removed all SAME kernel module files which are already in 3.7.5-sys folder and make symbolic links to them (to make image smaller).
At the end I rename 3.7.5 to 3.7.5-tbs and create symbolic link /lib/modules/3.7.5 => /var/run/modules/3.7.5.
In one new init file just after mounting filesystem I check for a file in /storage/.config.

If file use-driver-tbs.txt exist symbolic link is created /var/run/modules/3.7.5 => /lib/modules/3.7.5-tbs.
If this file is not present symbolic link is created /var/run/modules/3.7.5 => /lib/modules/3.7.5-sys and nothing from tbs can be used because it's not present.
The whole magic happens in install script for a driver (tbs, s2-liplianin).

The final image size difference is only 3 MB extra for TBS modules. It can also include two different TBS modules (one for default DVB-T/S/S2 and one for DVB-C).

root ~ # ls -l /lib/modules/
lrwxrwxrwx 1 root root 22 Feb 3 12:00 3.7.5 -> /var/run/modules/3.7.5
drwxrwxr-x 8 root root 4096 Feb 3 12:00 3.7.5-s2liplianin/
drwxrwxr-x 8 root root 4096 Feb 3 12:00 3.7.5-sys/
drwxrwxr-x 8 root root 4096 Feb 3 12:00 3.7.5-tbs/
drwxrwxr-x 8 root root 4096 Feb 3 12:00 3.7.5-tbs-dvbc/

root ~ # ls -l /var/run/modules/
lrwxrwxrwx 1 root root 22 Feb 3 12:00 3.7.5 -> /lib/modules/3.7.5-tbs/

root ~ # du -hx --max-depth=0 3.7.5-s2liplianin/
15M 3.7.5-s2liplianin/
root ~ # du -hx --max-depth=0 3.7.5-sys/
25M 3.7.5-sys/
root ~ # du -hx --max-depth=0 3.7.5-tbs
15M 3.7.5-tbs
root ~ # du -hx --max-depth=0 3.7.5-tbs-dvbc/
15M 3.7.5-tbs-dvbc/

9 MB larger SYSTEM file with 3 extra kernel drivers (TBS, TBS for DVB-C, s2-liplianin).

I think having TBS (and others) drivers in official OpenELEC image would be useful for many users. Especially because they don't interfere with each others. Waiting for tbs to create better drivers ....