The Linux VdrNfsroot HOWTO Copyright (C) 2001 Clemens Kirchgatterer V2.0 2002-09-06 This document describes, how you can make your vdr box boot from a server within your lan and use an exported directory as the / filesystem. Changes: VdrNfsroot-HOWTO-1.0 initial release VdrNfsroot-HOWTO-1.1 some minor addons and bugfixes (thx to Jochen Kirstätter) VdrNfsroot-HOWTO-1.2 additional informations and even more links VdrNfsroot-HOWTO-1.3 uneeded kernel options removed all TODOs are done now some typos fixed VdrNfsroot-HOWTO-1.4 Minor layout updates Chapter 5 completely rewritten kernel options for additional vdr features moved kernel configuration to chapter 3 some rephrasing here and there VdrNfsroot-HOWTO-1.5 updated dhcpd.conf for dhcpd-3.0.x VdrNfsroot-HOWTO-2.0 new credits subchapter additional loading of kernel via nfs instead of tftp filesystem description updated to VdrNfsroot-DISTRI-2.0 ------------------------------------------------------------------------------- Table of Contents 1. Introduction 1.1 Terminology used in this document 1.2 New versions of this document 1.3 Feedback 1.4 Distribution Policy 1.5 Credits 2. Requirements 2.1 Hardware 2.2 Software 2.3 Usefull programms 3. Installation 3.1 Bootprom 3.2 Kernel 3.3 DVB 3.4 VDR 4. Configuration 4.1 dhcp 4.2 tftp 4.3 nfsd 5. Building a root filesystem 5.1 VdrNfsroot Distribution 5.2 File Hierarchy 5.3 Detailed Description ------------------------------------------------------------------------------- 1. Introduction =============== This is the Linux VdrNfsroot HOWTO document. It is intended as a quick reference covering everything you need to know to install and configure the needed software to make your vdr box run without a harddisk. If you don't know what vdr is visit: http://www.cadsoft.de/people/kls/vdr/index.htm NOTE: This howto is based on other howtos found on the net. So the structure and layout or even some more common sentences are shamelessly stolen from others. 1.1 Terminology used in this document ------------------------------------- DVB-Card satelite receiver and hardware mpeg2 decoder DVB-Driver kernel modules to allow software to access the DVB-Card VDR video disk recorder software for recording, viewing and more Bootprom loaded from disk or eprom on bootup to get ip and kernel client/vdr box the machine that should be booting from network server all services are built and running on that machine 1.2 New versions of this document --------------------------------- You will find the most recent version of this document at: http://thf.ath.cx/public/ A german translation is also available (even in html) now at: http://www.midek.de/linux/vdr-nfsroot-howto.html It's maintainer is "Jochen Kirstätter" , who is also responsible for many corrections and suggestions in this howto. If you make a translation of this document to another language, let me know and I'll include a reference to it here. 1.3 Feedback ------------ I rely on you, the reader, to make this HOWTO useful. If you have any suggestions, corrections, or comments, please send them to and I will try to incorporate them in the next revision. 1.4 Distribution Policy ----------------------- Copyright (C) 2001 by Clemens Kirchgatterer . This document may be distributed under the terms set forth in the LDP license at sunsite.unc.edu/LDP/COPYRIGHT.html. This HOWTO is free documentation; you can redistribute it and/or modify it under the terms of the LDP license. This document is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the LDP license for more details. 1.5 Credits ----------- Thanx for contributions, suggestions or feedback go to: Jochen Kirstaetter Jan Sporbeck Juergen Hahn 2. Requirements =============== 2.1 Hardware ------------ A server with the largest harddisk you can get (for storing recordings) and 100Mbit ethernet adapter. pentium cpu would be nice. A client with 100Mbit Ethernet adapters including a bootprom socket. Alternativly you can put a floppy drive into your vdr box and load the bootprom image from floppy disk. Of course you will need a DVB PCI Card. look at http://www2.arnes.si/~mthale1/index.html#Cards for details. Other hardware isn't that important. my vdr box is a pentium 100MHz, 32MB ram Nullmodem Twisted Pair RJ45 Cable (single client) 100Mbit Switch/Hub (more than one client) 2.2 Software ------------ dhcpd (should come with your distribution) in.tftpd (should come with your distribution) nfsd (should come with your distribution) inetd (should come with your distribution) Linux DVB driver (http://www.linuxtv.org/download/dvb) Linux VDR software (http://www.cadsoft.de/people/kls/vdr/download.htm) Bootprom Image (http://rom-o-matic.net) mknbi (http://download.sourceforge.net/etherboot) Linux >= 2.4.0 (http://www.kernel.org/pub/linux/kernel/v2.4) 2.3 Usefull programms --------------------- LIRC (http://www.lirc.org/index.html) 3. Installation =============== The following actions should all be done directly on the server that will hold the clients kernel and root directory in the near future. Things that have to be typed in at the shell prompt are prefixed by "$ " and i assume, that the path to your nfsroot directory (the client's / directory) is /etherboot/nfsroot/. NOTE: You can allways download my latest VdrNfsroot archive from: http://thf.ath.cx/public/ That archive contains precompiled DVB-drivers and the vdr programm. If you are going to use that, you only need to compile a kernel, that matches the DVB-drivers. If you want to use my VdrNfsroot archive but need more features like DVD support in VDR, you still have to install the DVB-driver sources, but you don't need to compile them. They are just needed by vdr to build correctly. 3.1 Bootprom ------------ 1. go to http://rom-o-matic.net 2. click on the latest stable release 3. select your NIC 4a.ignore custom ROM configuration or 4b.select custom ROM configuration and enable DOWNLOAD_PROTO_NFS 5. choose "Floppy Bootable ROM Image" and 6. press "Get ROM" to start the download. Put a disk into your floppy drive and do: $ dd if=YOURBOOTROMIMAGE of=/dev/fd0 bs=512 Maybe you must become root first, depending on the permissions of /dev/fd0. You can put that floppy in your vdr box's drive and boot it. It should allready detect your network card and try to find a dhcp server to get an ip address. NOTE: This document does not cover booting from a real rom on your network adapter, nor does it describe how to build such a prom at the moment. If you are curios, read the information provided on the etherboot homepage at: http://etherboot.sourceforge.net 3.2 Kernel ---------- The first thing we need, is the kernel, as the dvb driver heavyly depends on it. Make sure there is no directory "/usr/src/linux" nor a link that points to any other allready installed kernel sources and untar your downloaded kernel to /usr/src. $ tar xfvj linux-2.4.x.tar.bz2 or $ tar xfvz linux-2.4.x.tar.gz The DVB driver README says the version of the currently booted kernel and the version of the just installed kernel sources should be the same, so you should probably first compile, install and boot this new kernel on your server. To configure the kernel do: cd /usr/src/linux make menuconfig These are the important options for compiling a kernel for your vdr box: Loadable module support ---> [*] Enable loadable module support General setup ---> [*] Networking support [*] PCI support (Any) PCI access mode [*] System V IPC [*] Sysctl support <*> Kernel support for ELF binaries Networking options ---> <*> Packet socket <*> Unix domain sockets [*] TCP/IP networking [*] IP: kernel level autoconfiguration Network device support ---> [*] Network device support [*] IMPORTANT: don't forget to compile in your network adapter driver Character devices ---> [*] Virtual terminal [*] Support for console on virtual terminal I2C support ---> <*> I2C support Multimedia devices ---> <*> Video For Linux Network File Systems ---> [*] /proc file system support <*> NFS file system support [*] Provide NFSv3 client support [*] Root file system on NFS To use some nice features of vdr you may need some or all of the following options: vdr streaming: Network File Systems ---> [*] IP: multicasting dvd support: ATA/IDE/MFM/RLL support ---> <*> ATA/IDE/MFM/RLL support IDE, ATA and ATAPI Block devices ---> <*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support <*> SCSI emulation support (works better than native ide for dvds, IMHO) [*] Generic PCI IDE chipset suppor [*] Sharing PCI IDE interrupts support [*] Generic PCI bus-master DMA support [*] Use PCI DMA by default when available [*] NOTE: compile in your chipset, if available SCSI support ---> <*> SCSI support <*> SCSI CD-ROM support [*] Enable vendor-specific extensions (for SCSI CDROM) <*> SCSI generic support serial remote controll: Character devices ---> Standard/generic (8250/16550 and compatible UARTs) serial support mp3, vcd, ... features: File systems ---> <*> ISO 9660 CDROM file system support <*> UDF file system support (read only) improved console loging: Console drivers ---> [*] VGA text console [*] Video mode selection support To start compilation type: $ make dep && make bzImage $ cp arch/i386/boot/bzImage /etherboot/vmlinuz Next we have to make this kernel bootable from network. To do so, we first must install the mknbi package downloadable from: http://download.sourceforge.net/etherboot/ After you have installed the package (read README and INSTALL for instructions), just execute the following commands: $ cd /etherboot $ mknbi-linux --ip=rom --rootdir=/etherboot/nfsroot vmlinuz > nfskernel This tells the kernel where to mount its root directory from and that it should use the ip address provided by the bootprom. Maybe you should have a look at the mknbi-linux manpage for additional parameters as: --append="vga=extended hda=scsi" 3.3 DVB ------- Next we should download and install the DVB-drivers like this: $ cd /usr/src $ tar xfvz siemens_dvb-0.9.4-XXXX-XX-XX.tgz $ mv siemens_dvb-0.9.4-XXXX-XX-XX DVB to compile the modules do: $ cd /usr/src/DVB/driver $ make The place, where the modules should get installed, depend on your nfsroot filesystem. In the VdrNfsroot distributen they are expected to be in /lib/modules. 3.4 VDR ------- Get vdr from http://www.cadsoft.de/people/kls/vdr/download.htm and do: $ cd /usr/src $ tar xfvz vdr-X.XX.tgz $ cd VDR Now read the README and INSTALL files and all the other important textfiles and change the Makefile to fit your needs best. When you are done, type $ make at the shell prompt. Now install the binary to your nfsroot filesystem. For VdrNfsroot do: $ cp vdr /etherboot/nfsroot/bin 4. Configuration ================ This part of the document describes how to set up the server daemons. 4.1 dhcp -------- Edit /etc/dhcpd.conf to something like this: # additional options for dhcpd-3.0.x authoritative; ddns-update-style none; # end additional options subnet 192.168.0.0 netmask 255.255.255.0 { option broadcast-address 192.168.0.255; } host secrets { hardware ethernet XX:XX:XX:XX:XX:XX; fixed-address 192.168.0.11; filename "nfskernel"; # for tftp filename "/etherboot/nfsroot/nfskernel"; # for nfs } Substitute XX:XX:XX:XX:XX:XX with the mac address of the clients ethernet adapter and change the ip addresses according to your network configuration. 4.2 tftp -------- If you fetch your kernel over nfs, you can skip this. Add the following line to your /etc/inetd.conf: tftp dgram udp wait root /usr/sbin/tcpd in.tftpd -s /etherboot Make inetd reread its config file by doing: $ killall -SIGHUP inetd NOTE: Be aware that this can open a security hole on your server, especially if your server is also a gateway to the big, bad internet. You should probably restrict access to the inetd services by editing /etc/hosts.allow and /etc/hosts.deny or even install a firewall. You may have a look at the firewall HOWTO at: http://www.linuxdoc.org/HOWTO/Firewall-HOWTO.html 4.3 nfsd -------- /etc/exports must contain something like this: /etherboot/nfsroot 192.168.0.11(rw,no_root_squash,no_all_squash) Assumeing your vdr box's ip address is 192.168.0.11. Don't forget to restart the nfs service. 5. Building a root filesystem ============================= The last step, before we can switch on our diskless set-top-box, is setting up the operating system itself, that should get booted over the network. However, you have many possibilities here. Either you take your old vdr installation and put it, where the nfskernel expects it to be, or you have a look at http://linux-from-scratch, download a hole bunch of sources and compile your system all by yourself, like i've done. ;-) If this to much work for you to investigate, grab one of the tiny Linux Distributions, spread over the net. 5.1 VdrNfsroot Distribution --------------------------- The VdrNfsroot Distributon, downloadable from http://thf.ath.cx/public/, tries to provide everthing, that is needed, to make vdr usable. 5.2 File Hierarchy ------------------ Lets have a look at the file system hierarchy first: /: video var tmp proc lib etc dev bin var: run log tmp: proc: lib: modules libpthread.so.0 libdvdcss.so.2 liba52.so libz.so.1 libm.so.6 libdl.so.2 ld-linux.so.2 libstdc++-libc6.2-2.so.3 libjpeg.so.62 libdjbfft.so DVB librt.so.1 libdvdread.so.2 libc.so.6 etc: timers.conf svdrphosts.conf mtab lirc.conf commands.conf setup.conf localtime channels.conf ca.conf dev: video0 video sr0 ost null lircd lirc hdd hdc hdb hda dvd console bin: vdr sort rmmod portmap mount insmod ifconfig sync sh rm netdate lircd init find Yes, these are really all files and directories needed to make vdr work. :o) 5.3 Detailed Description ------------------------ I will try to describe the function of the more important files. / bin/ programm files and system utilities dev/ nodes for the kernel device drivers etc/ system and vdr configuration files lib/ system libraries proc/ mountpoint for the virtual proc fs var/ pid and log files go here video/ can you say "harddiskrecording" /bin find is needed by vdr to bring up the recordings menue ifconfig we must configure the network device before netdate works init init script prepares system, loads modules and starts vdr insmod kernel drivers can be loaded with this little tool lircd remote controll daemon mount maybe we have to mount further network filesystems netdate to sync vdr system clock with server portmap the portmapper is needed, so we can mount /video seperatly rm while booting, we should delete some files for cleanup rmmod -> insmod if vdr crashes, we want to reload the drivers too sh the shell, that interpretes the init script sort to show recordings in the right order sync vdr calls sync to make sure everything made it to the disk vdr last but not least the vdr binary /dev console the kernel needs this to bring his messages to the screen dvd -> sr0 a link to the real device node of the dvd driver hd* if you have an ide dvd drive you need this lirc device node for remote controll driver lircd the remote controll can be reached through this socket null every system needs its own blackhole ost/ all dvb related driver nodes are kept within this directory sr* if you use scsi (or scsi emulation) for your dvd-drive video* this are the video4linux devices /etc ca.conf vdr wants to know if a channel can be descrambled channels.conf channel list for vdr commands.conf external commands, can be defined for execution by vdr lirc.conf timeing description file for remote control localtime libc reads the timezone information from this file mtab df looks for mounted devices here, so we fake it setup.conf general vdr setup parameters are read from this file svdrphosts.conf configures, which hosts are allowd to connect via svdrp timers.conf whenever you programm a timer, it gets stored here /lib DVB/ DVB hardware firmware directory ld-linux linux dynamic library loader liba52 ac3 dolby decoder libc standart c library libdjbfft contains extrem fast fft functions for ac3 decoding libdl dynamic linker library libdvdcss css descrambler library libdvdread dvd reading library libjpeg jpeg encoding/decoding library libm library for mathematical calculations libpthread posix threads implementation librt realtime library for asyncron I/O operations libstdc++ standart c++ library libz gzip de/compression library modules/ kernel module directory /var log/ remote control daemon logfile run/ pid file of lircd /video epg.data vdr writes a electronic program guide file