torstai 14. helmikuuta 2008

Quickie: Setting NTP

If you are doing DVB recordings via timers like I am, then you probably want to set up ntp-client to update the systemtime in startup.

During this past month that I have been slowly building my HTPC, systemtime is already ahead by five minutes. That means basically that every timer now starts recording 5 minutes too early and ends early also. I have, of course, setup extra time before and after every timer, in fact VDR does this by default. But if the time gets ahead by more than 10 minutes, my recordings start to end prematurely, which of course is not very nice.


So ntp-client to the rescue! Here is short how to, in which we are using NTP-server in Finland, please find one closer to your location.

echo "net-misc/ntp caps" >> /etc/portage/package.use
emerge -a ntp


Edit /etc/ntp.conf and change the server to one close to your location. For us Finns it is "server fi.pool.ntp.org".

Edit /etc/conf.d/ntp-client and change the NTPCLIENT_OPTS to following (again this server is in Finland)

NTPCLIENT_OPTS="-s -b -u fi.pool.ntp.org"

Test the ntp-client by issuing date commands before and after starting the ntp-client. System time should be updated. If it works, set it to run every boot by adding it to default runlevel.

date /etc/init.d/ntp-client start date rc-update add ntp-client default

If running time sync every boot is not enough for you, then you can set up the ntpd. But do not setup the ntpdate to be run by cron, here is why.

tiistai 12. helmikuuta 2008

Installing HTPC software (part 3)

In this entry we will have a look at how to install VDR (Video Disk Recorder) on Gentoo.

This time we are not going to utilise Gentoos excellent emerge-tool, but we are going to do it manually. Main reason for compiling VDR by ourselves, is that this way we get the version we want, with patches we want. For the first time it may be easier to install VDR via emerge, but later on, if you want to play more with VDRs plugins, I suggest that you compile it by hand.

Patching VDR can be little bit tricky, so I am going to use my old pre-patched version of 1.4.7 VDR source code. As with MMS there is also unstable release of VDR 1.5, this time however I am going to install the old and proven-to-be-stable version. You should probably download vanilla source code, that way you can patch it yourself if you need to and if not, you can keep the changes to minimum.

First thing is to take care of the dependencies, emerge libcap and jpeg. Those two are required for VDR to compile. Now download the source code (I am using root to run VDR, bad policy, I know) in to /root, then extract it. Now I have following directory /root/vdr-1.4.7 and I will create following symlinks, these are also needed for compilation. After that you can just issue "make && make install" in VDR directory.

ln -s /usr/src/linux /root/DVB
ln -s /root/vdr-1.4.7 /root/VDR


Compiling the plugins is a bit more involved. You must extract your plugins into /root/VDR/PLUGINS/src directory. That is not enough though, you also need to create a symlink for every plugin, removing the version numbering. For example this is what you would do for subtitles-plugin

cd /path/to/vdr/PLUGINS/src
wget http://virtanen.org/vdr/subtitles/files/vdr-subtitles-0.5.0.tgz
tar xvfmz vdr-subtitles-0.5.0.tgz
ln -s subtitles-0.5.0 subtitles


Do the same for all your plugins and modify the process accordingly, then just run "make plugins" in /root/VDR . If everything compiles correctly you need to copy the resulting files in /root/VDR/PLUGINS/lib to /vdr/lib, create the latter if it is not there already. (Notice that if you are compiling xineliboutput-plugin then you need to run "make install" in xineliboutputs own directory.)

Now you are set to go, meaning you can start the hard part, configuring VDR and plugins.

In next entry, configuring VDR and adding the needed scripts.

tiistai 5. helmikuuta 2008

Installing HTPC software (part 2)

OK kids, today we are learning how to install the MMS (that is short for My Media System kids) the ´Hard way´.

Nice screenshot showcasing new feature, movie thumbnailing.

Kidding aside, installing the latest, unstable release 1.1.0, is not that hard either. Thanks to nice people in Gentoo (and MMS) community we already have mms-1.1.0-rc1.ebuild available. Using the ebuild the installation is pretty easy, although it has few more steps to it, than the basic stable installation I talked about in part 1 of "Installing HTPC software".

First thing we need to do is create a local portage. Make sure you have /usr/local/portage directory available and create it if not. After that add the following line in to your /etc/make.conf, if it is not already there.

PORTDIR_OVERLAY="/usr/local/portage"

Then create the following directory structure

/usr/local/portage/media-video/mms

In the directory mentioned above, run following command to download the ebuild. (Sorry about the small print, but the blogger.com loses few letters from it if it is any bigger.)

wget ftp://83.142.84.214/gentoo-ebuild/mms/mms-1.1.0_rc1.ebuild

Then you need to make few changes to package.keywords and package.use files. The first one adds CPU-type detection for MMS package installation and another one tells emerge to use latest available version of MMS.

echo "media-video/mms cpudetection" >> /etc/portage/package.use
echo "media-video/mms ~*" >> /etc/portage/package.keywords


Next we "digest" the ebuild to create correct Manifest, then we are going to emerge the MMS.

ebuild mms-1.1.0_rc1.ebuild digest
emerge -av =media-video/mms-1.1.0_rc1


Now emerge should run its course and you should have functioning MMS as a result. Configuration files reside in /etc/mms directory, so start from there, some configuration is needed in several files. You should be able to figure out the needed changes, which of course, depend on your setup.

Before we can actually run the MMS we need to install X server, all we need is the most basic of graphical mode. I for example have no need for a desktop environment like KDE or Gnome. Installing basic GUI is as easy as typing "emerge xorg-server" after that you need to configure the graphics settings in /etc/X11/xorg.conf, but I will leave that to you, since every hardware configuration has it´s own settings. However here is a sample xorg.conf for Mirai DTL-642E500 television with Nvidia graphics adapter.

Once the xorg.conf is ready, easiest way to start MMS with X is to edit /etc/xinitrc file this file gets executed when X is started. So add a line like one below to start MMS automatically on X startup.

/usr/local/bin/mms

More on my MMS configuration in next entry (or one after that), you should be able to go on by yourself, configuring your /etc/mms settings to way you like.


Disclaimer: Thanks for the ebuild and advices on how to get it to work goes to Vitalogy in MMS forums.