Self-Hosting Movies with MoviX

How to build your own dedicated distribution.
Adding Your Application

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.

Dealing with X

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.

Conclusion

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.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Self-Hosting Movies with MoviX

Anonymous's picture

Thanks for this very informative article, it's just what I'm looking for.

BTW, to avoid overwriting the modules of the running Linux, you can do

make INSTALL_MOD_PATH= modules_install

Suggestion for yet another dedicated distro.

Anonymous's picture

A distribution that boots into:

Freevo: http://freevo.sourceforge.net

or:

MythTV: http://www.mythtv.org

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix