Self-Hosting Movies with MoviX
Once all necessary hardware drivers are loaded, any application making use only of the console can be installed easily in the distribution. Both eMoviX and MoviX are based exactly on this principle, because the package MPlayer is able to play audio and video files without X.
If we assume, as it happens in most of cases, the package we want to include in our distribution makes use of the autoconf/automake mechanism, then the easiest way to add the package is to do something like the following:
./configure --prefix=/usr/local/mplayer [further options] make make install
In this case, to transfer the installation to the distribution it is enough to do as follows:
re-mount the inird in /distro
copy the package in /distro: cp -a /usr/local/mplayer/ /distro/usr/local/
add to /distro/lib/ all missing libraries linked to all binaries in /usr/local/mplayer/bin/;
add the /usr/local/mplayer/bin/ path to the PATH variable in profile: PATH=$PATH:/usr/local/mplayer/bin/
add a line to rc.S to create a software link in the distro /lib to all libraries in /usr/local/mplayer/lib/ with ln -s /usr/local/mplayer/lib/* /distro/lib/
unmount and gzip back the initrd.
Following these directions for the application mp3blaster, you easily could produce a mini-distribution able to boot and play automatically every MP3 or Ogg Vorbis audio file—a distribution endowed with a nice console interface (the native mp3blaster one). This would ensure that users are able to play their favorite Vorbis files on any PC (at least as long as its audio card is supported by Linux), regardless of which OS is installed and without having to install any plugin.
A lot of applications need X in order to work. Unfortunately, the XFree package tends to be pretty big (~80MB), which is bad when you need to load everything in RAM to make the CD/DVD drive back available.
Several projects are available whose goal or byproduct is small-sized versions of X, including DirectFB or smallX, but none of them gets close to the hardware support level offered by the latest XFree86 full versions. If you plan to make use of such capabilities for the largest number of cards possible, the best solution is to use the full XFree86 package after removing as many unnecessary component as possible.
Luckily enough, almost half of the XFree86 package is occupied by fonts. As the distribution you are building is going to run only a few applications, you easily can reduce the package size to around 40MB once you identify the few fonts actually used. Getting rid of unnecessary binaries and libraries can bring the package size down to around 30MB.
Of course, you also need to produce a working XF86Config file “on the fly”, either generating it from X itself—using the X -configure command and tweaking it a little (you need at least to set the number of colors and your favorite screen resolution)--or creating a sort of template. In the template method, you would write a script that is able to detect the video card and then set the right parameters corresponding to it.
In both cases it is a good idea to have a tool able to detect the most important data of the monitor, namely the horizontal sync and the vertical refresh frequencies ranges. It is especially helpful if it warn us when the monitor is not able to provide this data, so we can provide standard frequencies instead. A good tool for this is the program ddcxinfo, part of the kudzu package, that returns the ranges we need with ddcxinfo -hsync and ddcxinfo -vsync, respectively. When the information is not available, it simply returns 0-0.
Finally, let me point out that you most likely won't need a window manager, because you are going to run only one application. This is the case for MoviX2. In case you need one, you should try a tiny manager, such as Matchbox.
I hope this article helps increase the number of such dedicated distributions. Their development does not require highly technical skills, only a good acquaintance with the management of a Linux system. Moreover, it is an effective way to increase significantly your knowledge of Linux and the application you're including, thanks to the users feedback.
Let me conclude by thanking all developers whose projects I used for making them open source, because the MoviX project would not have been possible otherwise. Thank you also to all the people whose feedback significantly increased my knowledge of Linux and MPlayer.
- Transitioning to Python 3
- Red Hat OpenStack Platform
- Stepping into Science
- Tech Tip: Really Simple HTTP Server with Python
- Linux Journal December 2016
- CORSAIR's Carbide Air 740
- Radio Free Linux
- The Tiny Internet Project, Part II
- A Better Raspberry Pi Streaming Solution
- FutureVault Inc.'s FutureVault