Difference between revisions of "Diskless Mac-Mini Howto"

From MythTV Official Wiki
Jump to: navigation, search
(Don't need first section to match the title of the article.)
m (Reverted edits by Salomon (Talk) to last revision by GBee)
(48 intermediate revisions by 10 users not shown)
Line 1: Line 1:
This '''Diskless Mini-MAC Howto''' should allow you to netboot a Mac Mini from a [[Fedora]] 4 server, without altering anything on the Mac Mini's disk.
+
{{outdated}}
 +
 
 +
[[Image:minimyth.jpg|300px|right]]
 +
 
 +
This '''Diskless Mac-Mini Howto''' should allow you to netboot a Mac Mini MythTV frontend (powerpc, not the newer intel mini!) from a [[Fedora]] 4 server, without altering anything on the Mac Mini's disk. This howto uses a script to install the netboot environment for the mac-mini, this script has only been tested on fedora core 4 (fc4), however it's very likely that it will work on any distribution, as long as rpm and chroot are available.
  
 
== Before you Start ==
 
== Before you Start ==
  
This is a work in progress... At the moment this guide should allow you to netboot a Mac Mini from a fedora 4 server, without altering anything on the Mac Mini's disk. OS X will remain functional, so this is a great way to experiment with a linux mythfrontend on a Mac Mini. The fedora 4 server does '''not''' have to be a ppc platform, this howto should work on any system that fedora core 4 supports (i386, x86_64, ppc).
+
This is a work in progress... At the moment this guide should allow you to netboot a Mac Mini from a fedora 4 server, without altering anything on the Mac Mini's disk. OS X will remain functional, so this is a great way to experiment with a linux mythfrontend on a Mac Mini. The fedora 4 server does '''not''' have to be a ppc platform, in fact, this howto will only work on a i386 (or x86_64 with 32bit compat libraries) system. The script is known to work on fedora core 4, but should work (with perhaps some minor modifications) on distribution for which rpm (the redhat package manager) is available.
  
At this moment, this should allow you to run a stable mythfrontend (both 0.18.1, and 0.19). Please note that it is also possible to run an OS X frontend ([[Myth on Mac OS X]]), you can get binaries at: [http://thesniderpad.com/index.php?option=com_remository&Itemid=36 thesniderpad].
+
At this moment, this should allow you to run a stable mythfrontend (both 0.18.1, and 0.19, and 0.20 which is the default). Please note that it is also possible to run an OS X frontend ([[Myth on Mac OS X]]), you can get binaries at: [http://thesniderpad.com/index.php?option=com_remository&Itemid=36 thesniderpad].
  
Major problems at this moment:
+
Minor problems at this moment:
* sound works, but mixer doesn't, and the sound quality is not great (sounds like low samplerate, no idea how to solve)
+
* newest kernel (2.6.18+) have an nfs cache feature, which prevents two directories on one disk to be mounted both read/write and read only. This breaks redhats diskless scripts. I guess this will be fixed soon, but for the moment don't use the 2.6.18 kernel. To do this, add this line to the beginning of the mkrootfs-ppc script:
* dhcp renew lease doesn't seem to work, so set a long default lease time in the dhcp server
+
<pre>
* sleep doesn't work
+
FORCEKERNELVERSION="2.6.17-1.2187_FC5"
 +
</pre>
 +
* sleep doesn't work (at least I can't get it to work.. )
 +
* newest kernel (2.6.16.1+) has some swapping over NFS problems. This can cause a deadlock on 256MB machines, for me typing this before compiling mplayer/myth solves the problem:
 +
<pre>
 +
sysctl vm.swappiness=95
 +
sysctl vm.min_free_kbytes=16384
 +
</pre>
 +
if somehow compiling still fails, delete the last (empty) .o file, and continue were the mini crashed.
  
 
Major benefits over an OS X frontend:
 
Major benefits over an OS X frontend:
* Much faster (~75% idle, and runs without swap on a 1.25GHz, 256MB Mac Mini)
+
* Much faster (~75% idle, and runs without swap on a 1.25GHz, 256MB Mac Mini. With kerneldeint and denoise3d ~10% idle)
 
* Allows aspect ratio changes
 
* Allows aspect ratio changes
* Potentially allows mythmusic plugin (have not tried myself yet)
+
* Allows most plugins (mythgame is disabled at the moment)
* Netboot allows the harddrive to be spinned down. I really hate that whine in my otherwise very quiet Mini.
+
* Netboot allows the harddrive to be spun down. I really hate that whine in my otherwise very quiet Mini.
  
I can't stress enough, that this is a bit experimental. If you are a linux noob, and terms like dhcp, named and so forth mean nothing to you, then please stop now. Otherwise please do continue, and good luck!
+
Although this is a bit experimental, it shouldn't be too hard to get things working. If you are a complete linux noob, and terms like dhcp, named and so forth mean nothing to you, then it might be a bit of a challenge.
  
 
Bas Hulsken
 
Bas Hulsken
  
 
== Prerequisites ==
 
== Prerequisites ==
 +
[[Image:Package.png]] You'll need the following packages installed on your server:
  
=== Software ===
 
 
You'll need the following packages installed on your fc4 server:
 
 
* system-config-netboot        ( contains redhat scripts for setting up diskless boot )
 
 
* tftp-server                  ( allows systems to netboot from this machine )
 
* tftp-server                  ( allows systems to netboot from this machine )
 
* dhcp                        ( allows systems to obtain ip address from this machine )
 
* dhcp                        ( allows systems to obtain ip address from this machine )
 +
* rpm                          ( always present in fedora systems, if you have another distribution, you might have to install it)
  
 
Now, download the collection of scripts and tools to build the diskless environment:
 
Now, download the collection of scripts and tools to build the diskless environment:
[[http://steadydecline.net/public/diskless.tar.bz2 diskless.tar.bz2]] (unfortunately a slow DSL link, if you know of some place that can host this file for me, please let me know)
+
[http://steadydecline.net/public/diskless-0.4.tar.bz2 diskless-0.4.tar.bz2] (my DSL link is a bit slow, but the file is not big...)
  
 
== Setting up the server ==
 
== Setting up the server ==
Line 40: Line 49:
  
 
Make sure your dhcp server is started at boot:
 
Make sure your dhcp server is started at boot:
<pre><nowiki>
+
<pre>
 
chkconfig dhcpd on
 
chkconfig dhcpd on
</nowiki></pre>
+
</pre>
  
 
And make sure it is configured correctly. Howto do this is beyond the scope of this howto, but see for instance: [http://www.johncooke.info/linux/dhcpdconf.html John Cooke's guide]. Here is the dhcpd.conf that I use, which allows for dynamic dns:
 
And make sure it is configured correctly. Howto do this is beyond the scope of this howto, but see for instance: [http://www.johncooke.info/linux/dhcpdconf.html John Cooke's guide]. Here is the dhcpd.conf that I use, which allows for dynamic dns:
<pre><nowiki>
+
<pre>
 
authoritative;
 
authoritative;
 
ddns-update-style              interim;
 
ddns-update-style              interim;
Line 89: Line 98:
 
         default-lease-time            43200;
 
         default-lease-time            43200;
 
}
 
}
</nowiki></pre>
+
</pre>
 +
 
 +
On the discussion page you'll find a comment from Klaus Weidner about static ip. I'm still not sure if it's necessary to define a static ip, on my system it seems to work with a dynamic ip. Mythtv uses the hostname, and the netboot script installs files in a directory named after the hostname, not the ip. Anyway, if a dynamic ip is troublesome for you, use a fixed one, by adding these lines to dhcpd.conf:
 +
 
 +
<pre>
 +
host minimyth {
 +
        hardware ethernet 00:0d:93:77:77:77;
 +
        fixed-address 192.168.1.999;
 +
}
 +
</pre>
 +
 
 +
and remove these lines:
 +
<pre>
 +
class "minimyth" {
 +
# matches only the MacMini, which has hardware ethernet address: 00:0d:93:5e:3f:bc
 +
        match if substring (hardware, 1, 6) = 00:0d:93:5e:3f:bc;
 +
        ddns-hostname                  "minimyth";
 +
        default-lease-time            43200;
 +
}
 +
</pre>
  
 
=== Configuring the tftp server ===
 
=== Configuring the tftp server ===
  
 
tftp in fedora core 4 is a part of the xinet daemon. So make sure xinetd is started at boot:
 
tftp in fedora core 4 is a part of the xinet daemon. So make sure xinetd is started at boot:
<pre><nowiki>
+
<pre>
 
chkconfig xinetd on
 
chkconfig xinetd on
</nowiki></pre>
+
</pre>
 
and make sure the tftp service is allowed (disable = no) in the file /etc/xinetd.d/tftp
 
and make sure the tftp service is allowed (disable = no) in the file /etc/xinetd.d/tftp
  
 
=== Configuring NFS ===
 
=== Configuring NFS ===
  
For netbooting from this server, two NFS exports are required, one directory for the static root file system, and one directory containing a napshot for each diskless system booting from this server. Add these two lines to /etc/exports (my domain is steadydecline.net, change to your own):
+
For netbooting from this server, two NFS exports are required, one directory for the static root file system, and one directory containing a snapshot for each diskless system booting from this server. Add these two lines to /etc/exports (my domain is steadydecline.net, change to your own, the script defaults to using fc5 on the mini, if you change this to fc4 or fc6, then also change the exported directories):
<pre><nowiki>
+
<pre>
/diskless/ppc/fc4/root/ *.steadydecline.net(ro,sync,no_root_squash)
+
/diskless/ppc/fc5/root/ *.steadydecline.net(ro,sync,no_root_squash)
/diskless/ppc/fc4/snapshot/ *.steadydecline.net(rw,sync,no_root_squash)
+
/diskless/ppc/fc5/snapshot/ *.steadydecline.net(rw,sync,no_root_squash)
</nowiki></pre>
+
</pre>
And restart NFS
+
And re-export filesystems
<pre><nowiki>
+
exportfs -a
/etc/init.d/nfs restart
+
{{Note box|re-exporting the filesystems doesn't always work for me. If this won't work, just restart the nfs daemon }}with:
</nowiki></pre>
+
/etc/init.d/nfs restart
  
 
=== Configuring a lirc server ===
 
=== Configuring a lirc server ===
  
 
If you own an ATi remote wonder II (a radio-frequency remote control) that is connected to the fc4 server, then you can setup a lirc server. This is pretty straightforward, this /etc/sysconfig/lircd allows lirc on the server to listen on port 8765 for network connections:
 
If you own an ATi remote wonder II (a radio-frequency remote control) that is connected to the fc4 server, then you can setup a lirc server. This is pretty straightforward, this /etc/sysconfig/lircd allows lirc on the server to listen on port 8765 for network connections:
<pre><nowiki>
+
<pre>
 
/sbin/modprobe lirc_atiusb
 
/sbin/modprobe lirc_atiusb
 
LIRCD_OPTIONS="--listen=8765 --device=/dev/lirc0"
 
LIRCD_OPTIONS="--listen=8765 --device=/dev/lirc0"
Line 120: Line 148:
 
LIRCMD_OPTIONS=""
 
LIRCMD_OPTIONS=""
 
ENABLE_IREXEC="no"
 
ENABLE_IREXEC="no"
</nowiki></pre>
+
</pre>
 
Of course, on the server you will need the appropriate /etc/lircd.conf for your remote. See the lirc documentation, [[LIRC]], and [[ATI Remote Wonder II]].
 
Of course, on the server you will need the appropriate /etc/lircd.conf for your remote. See the lirc documentation, [[LIRC]], and [[ATI Remote Wonder II]].
  
 
== Creating the diskless environment ==
 
== Creating the diskless environment ==
  
Now unzip the build environment ([[http://steadydecline.net/public/diskless.tar.bz2 diskless.tar.bz2]]) to the root filesystem. Please note that this build environment is for i386 linux, this is because it uses some scratchbox binaries compiled for i386. It should work on x86_64 if the right 32bit libraries are installed. But it won't work on ppc. On ppc there should be no need for the scratchbox binaries anyway, you can edit the script a bit to disable the scratchbox parts (if you do this with the proper conditionals, I'll take over the changes in my script). Now type the following as '''root''', to extract the build environment to the root filesystem:
+
Now unzip the build environment ([http://steadydecline.net/public/diskless-0.4.tar.bz2 diskless-0.4.tar.bz2]) to the root filesystem. Please note that this build environment is for i386 linux, this is because it uses some scratchbox binaries compiled for i386. It should work on x86_64 if the right 32bit libraries are installed. But it won't work on ppc. On ppc there should be no need for the scratchbox binaries anyway, you can edit the script a bit to disable the scratchbox parts (if you do this with the proper conditionals, I'll take over the changes in my script). Now type the following as '''root''', to extract the build environment to the root filesystem:
<pre><nowiki>
+
<pre>
 
cd /
 
cd /
bzip2 -cd diskless.tar.bz2 | tar xfv -
+
bzip2 -cd diskless-0.4.tar.bz2 | tar xfv -
</nowiki></pre>
+
</pre>
 
Enter the /diskless directory, and read and edit the script as you see fit. Some configuration files that will be installed in the diskless environment are located in /diskless/conf. Edit those for your Mac Mini. In particular edit these files:
 
Enter the /diskless directory, and read and edit the script as you see fit. Some configuration files that will be installed in the diskless environment are located in /diskless/conf. Edit those for your Mac Mini. In particular edit these files:
 
* /diskless/conf/xorg.conf (edit monitor settings for your screen, if you have a DELL 2005FPW, this xorg.conf should work)
 
* /diskless/conf/xorg.conf (edit monitor settings for your screen, if you have a DELL 2005FPW, this xorg.conf should work)
Line 135: Line 163:
  
 
Now run the script '''as root''' (RPM relies on chroot to install in different locations, chroot works only as root, sorry about this.. you'll have to trust me.. or carefully read the script):
 
Now run the script '''as root''' (RPM relies on chroot to install in different locations, chroot works only as root, sorry about this.. you'll have to trust me.. or carefully read the script):
<pre><nowiki>
+
<pre>
 
cd /diskless
 
cd /diskless
./mkrootfs-ppc-fc4
+
./mkrootfs-ppc
</nowiki></pre>
+
</pre>
Now a whole bunch of files will be downloaded (only once), and a diskless enviroment will be built. After this is done, copy the kernel and initrd image to the tftpboot directory. Also copy the yaboot binary.
+
Now a whole bunch of files will be downloaded (only once), and a diskless enviroment will be built. Somewhere you'll be asked for a password for vnc. Remember this password, you can use it later on to connect to the macmini with the vncviewer program. After this is done, copy the kernel, the initrd image, the bootloader and the bootloader config to the tftpboot directory.
<pre><nowiki>
+
cp /diskless/tftpboot.fc5/* /tftpboot/
cp /diskless/initrd.img /tftpboot/
+
Now the netboot environment should be ready!
cp /diskless/vmlinuz /tftpboot/
+
 
cp /diskless/ppc/fc4/root/usr/lib/yaboot/yaboot /tftpboot/
+
{{Note box|the yaboot binary included in fc5 has been a bit troublesome for me, it just puts me in the openfirmware menu instead of booting.. I have no idea why this happens, and if its limited to my machine. If the same happens for you, just copy the yaboot binary from the fc4 package. It's located at /usr/lib/yaboot. You can use midnight commander (mc) to extract it from the rpm.}}
</nowiki></pre>
 
Create a suitable configuration file for yaboot, at this location: /tftpboot/yaboot.conf. Make sure that ramdisk_size is the same value as the script displays after running. Here is the yaboot.conf that I use:
 
<pre><nowiki>
 
timeout=3
 
default=linux
 
  
image=enet:0,vmlinuz
+
If you want to use mythtv and mplayer on the Mac Mini, you have to compile them on the Mini. I've written two simple scripts to download svn/cvs versions of mythtv and mplayer into the diskless environment. It also applies a few patches (agains libcdaudio, and mythmusic). If you want to use these scripts, you should run them ''before'' booting the mini! Run the scripts in the /diskless directory like this:
  label=linux
+
<pre>
  initrd=enet:0,initrd.img
+
./getmythtv
  append=" init=/disklessrc rw root=/dev/ram0 NFSROOT=192.168.1.1:/diskless/ppc/fc4 ramdisk_size=19463 selinux=0 noisapnp"
+
./getmplayer
</nowiki></pre>
+
</pre>
Now the netboot environment should be ready!
+
Make sure that all files/cvs/svn are downloaded/checked out! Sometimes sourceforge or ftp servers are temporarily offline.
  
 
== Forcing the Mac Mini to boot from the net ==
 
== Forcing the Mac Mini to boot from the net ==
  
 
Now netboot has to be made the default for the Mac Mini. Boot the Mini into OS X, open a command prompt (or just ssh into it), and type the following:
 
Now netboot has to be made the default for the Mac Mini. Boot the Mini into OS X, open a command prompt (or just ssh into it), and type the following:
<pre><nowiki>
+
sudo nvram boot-device="enet:192.168.1.1,yaboot"
sudo nvram boot-device='enet:192.168.1.1,yaboot'
 
</nowiki></pre>
 
 
where 192.168.1.1 is the ip address of the fc4 server you are going to boot from. If all is well, the next time you boot the Mac Mini, it should boot into linux from the net! You can access your Mini with ssh, as user root, with the same password as the root user on your server. Also once you start X, you can use vncviewer to control the mini.
 
where 192.168.1.1 is the ip address of the fc4 server you are going to boot from. If all is well, the next time you boot the Mac Mini, it should boot into linux from the net! You can access your Mini with ssh, as user root, with the same password as the root user on your server. Also once you start X, you can use vncviewer to control the mini.
  
 
Once you are tired of Linux, you can boot from disk by default by typing this on the Linux commandline (of the Mac Mini!, as root):
 
Once you are tired of Linux, you can boot from disk by default by typing this on the Linux commandline (of the Mac Mini!, as root):
<pre><nowiki>
+
nvsetenv boot-device hd:,\\\\:tbxi
nvsetenv boot-device hd:,\\\\:tbxi
+
{{Note box|If the mini can't boot from the net, then it will wait for a very long time (around 10minutes I think) and then boot from the harddrive. So you can't really ruin your mini with these lines. Although it may seem dead for some time, don't panic! Just wait, and restore to normal boot behaviour with the line shown above.}}
</nowiki></pre>
+
 
 +
The first time you netboot the mini, a lot of data will be copied (~500MB), also the bootscript will generate the module dependency list, and dynamic library cache. Depending on your network speed this can take upto 60 minutes! The new version of the bootscript (version: diskless-0.3 and higher) forces a reboot after all the copying is done, to use the newly generated modules.dep and ldconfig.cache.
  
 
== Building mythfrontend on the Mac Mini ==
 
== Building mythfrontend on the Mac Mini ==
  
The mythfrontend has to be built on the Mac Mini itself, as there are no ppc RPMS available (as far as I know). So download a source tarball of myth (same version as the server ofcourse). You also need lame. And build the stuff on the Mini. The Mini doesn't have cvs, or svn installed, so it's best to check out myth and lame on the server, in the snapshot directory of the mini:
+
The mythfrontend has to be built on the Mac Mini itself, as there are no ppc RPMS available (as far as I know). The same goes for mplayer. If you've downloaded the myth and mplayer sources with my scripts (as explained in the previous chapter) then compiling and installing myth and mplayer is very simple. Log in to the mac mini with secure shell (remember, user: root, password the same as on the computer you build the diskless environment on), and:
<pre><nowiki>
+
<pre>
cd /diskless/ppc/fc4/snapshot/minimyth.steadydecline.net/root
+
cd ~/sources
mkdir sources
+
./buildmythtv
cd sources
+
./buildmplayer
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/lame login
+
</pre>
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/lame co -P lame
+
This compiles mythtv +plugins and mplayer, and installs them in /usr/local. This will take a long time! Moreover, it might crash if your mini has only 256MB of memory (mine has). If that happens, do the following:
svn co http://svn.mythtv.org/svn/branches/release-0-19-fixes/mythtv
+
* reboot the mini
svn co http://svn.mythtv.org/svn/branches/release-0-19-fixes/mythplugins
+
* delete the empty .o file where the compilation process stopped, this is very important!! Otherwise make will skip that file, and the compilation will fail later on.
svn co http://svn.mythtv.org/svn/branches/release-0-19-fixes/myththemes
+
* edit the buildscript to continue where it crashed (means you have to run make again, but not ./configure !)
</nowiki></pre>
+
* hope it will finish this time, if not, just repeat the whole exercise. Eventually it will compile!
 
 
Now ssh into the Mini (using ssh -l root minimyth, type the same root password as you use on the server you build the diskless environment on).
 
 
 
Build and install lame in /usr/local:
 
<pre><nowiki>
 
cd lame
 
./configure --prefix=/usr/local
 
make
 
make install
 
cd ..
 
</nowiki></pre>
 
 
 
Then build and install mythtv, myth-themes and myth-plugins in /usr/local:
 
<pre><nowiki>
 
cd mythtv
 
./configure --disable-firewire --disable-v4l --disable-ivtv --disable-joystick-menu --disable-dbox2 --prefix=/usr/local
 
qmake mythtv.pro
 
make
 
make install
 
cd ..
 
 
 
cd myththemes
 
./configure --prefix=/usr/local
 
qmake myththemes.pro
 
make install
 
cd ..
 
  
cd mythplugins
+
Now you can start the frontend by typing:
./configure --disable-mythbrowser --disable-mythgame --disable-mythphone --disable-mythflix
+
<pre>
qmake mythplugins.pro
+
/etc/init.d/mythfrontend start
make
+
</pre>
make install
 
cd ..
 
</nowiki></pre>
 
  
Mythtv needs some config files, make sure this file exists on the mini: /root/.mythtv/mysql.txt This is the one I use:
+
or even easier just reboot the mini:
<pre><nowiki>
+
<pre>
DBHostName=steady
+
reboot
DBUserName=mythtv
+
</pre>
DBPassword=mythtv
 
DBName=mythconverg
 
DBType=QMYSQL3
 
</nowiki></pre>
 
  
To allow X to start without a desktop or window manager, you need to start mythtv using a file /root/.Xclients. Here is mine:
+
The next time you netboot your mini, mythfrontend will start automatically.
<pre><nowiki>
 
mythfrontend
 
</nowiki></pre>
 
 
 
Now reboot the Mini, to update the linker cache.
 
  
 
== Running mythfrontend on the Mac Mini ==
 
== Running mythfrontend on the Mac Mini ==
  
After the Mini has been rebooted, ssh into the Mini, and type startx. If X was configured well, then the frontend should start, and you're ready to go!
+
Now your Mini is a fullblown MiniMyth frontend! Mythfrontend should start automatically on boot. You can use vncviewer to control the mini, or set up a decent lirc configuration. Make sure to use 'ALSA:default' as the sound device, also set the mixer to 'default'. Oss emulation sounds ugly! If you got this far, and your setup is working, don't forget to report it in the table below!
 
 
Use vncviewer to control the mini, or set up a decent lirc configuration.
 
  
Well.. that's all folks.. happy experimenting. If you have improvents/suggestions/enhancements to this howto, or to the scripts, please let me know! You can mail me at: bhulsken <at> hotmail <dot> com
+
== Configurations known to work ==
  
 +
{| border="1" cellspacing="0" cellpadding="5" style="border-collapse:collapse; border-color:#8eabd0; background:#e7edf5"
 +
|- style="background: lightsteelblue"
 +
|+ known working configurations
 +
!server distribution !! mini distribution !! myth version !! mini type !! script version !! reported by
 +
|-
 +
|fedora core 4 || fedora core 4 || 0.19-fixes || 1.25Ghz ppc 256MB WiFi+Bluetooth DVD+CDRW || diskless-0.3 || Bas Hulsken (--[[User:Bhulsken|Bas]] 18:43, 22 October 2006 (UTC))
 +
|-
 +
|fedora core 4 || fedora core 5 || 0.20-fixes || 1.25Ghz ppc 256MB WiFi+Bluetooth DVD+CDRW || diskless-0.4 || Bas Hulsken (--[[User:Bhulsken|Bas]] 18:43, 22 October 2006 (UTC))
 +
|}
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
 +
[[Category:MacOS]]

Revision as of 18:02, 26 July 2010

Time.png Outdated: The information on this page may no longer be relevant to the current release of MythTV, 34.0. Please consider helping to update it. This page was last modified on 2010-07-26.

Minimyth.jpg

This Diskless Mac-Mini Howto should allow you to netboot a Mac Mini MythTV frontend (powerpc, not the newer intel mini!) from a Fedora 4 server, without altering anything on the Mac Mini's disk. This howto uses a script to install the netboot environment for the mac-mini, this script has only been tested on fedora core 4 (fc4), however it's very likely that it will work on any distribution, as long as rpm and chroot are available.

Before you Start

This is a work in progress... At the moment this guide should allow you to netboot a Mac Mini from a fedora 4 server, without altering anything on the Mac Mini's disk. OS X will remain functional, so this is a great way to experiment with a linux mythfrontend on a Mac Mini. The fedora 4 server does not have to be a ppc platform, in fact, this howto will only work on a i386 (or x86_64 with 32bit compat libraries) system. The script is known to work on fedora core 4, but should work (with perhaps some minor modifications) on distribution for which rpm (the redhat package manager) is available.

At this moment, this should allow you to run a stable mythfrontend (both 0.18.1, and 0.19, and 0.20 which is the default). Please note that it is also possible to run an OS X frontend (Myth on Mac OS X), you can get binaries at: thesniderpad.

Minor problems at this moment:

  • newest kernel (2.6.18+) have an nfs cache feature, which prevents two directories on one disk to be mounted both read/write and read only. This breaks redhats diskless scripts. I guess this will be fixed soon, but for the moment don't use the 2.6.18 kernel. To do this, add this line to the beginning of the mkrootfs-ppc script:
FORCEKERNELVERSION="2.6.17-1.2187_FC5"
  • sleep doesn't work (at least I can't get it to work.. )
  • newest kernel (2.6.16.1+) has some swapping over NFS problems. This can cause a deadlock on 256MB machines, for me typing this before compiling mplayer/myth solves the problem:
sysctl vm.swappiness=95
sysctl vm.min_free_kbytes=16384

if somehow compiling still fails, delete the last (empty) .o file, and continue were the mini crashed.

Major benefits over an OS X frontend:

  • Much faster (~75% idle, and runs without swap on a 1.25GHz, 256MB Mac Mini. With kerneldeint and denoise3d ~10% idle)
  • Allows aspect ratio changes
  • Allows most plugins (mythgame is disabled at the moment)
  • Netboot allows the harddrive to be spun down. I really hate that whine in my otherwise very quiet Mini.

Although this is a bit experimental, it shouldn't be too hard to get things working. If you are a complete linux noob, and terms like dhcp, named and so forth mean nothing to you, then it might be a bit of a challenge.

Bas Hulsken

Prerequisites

Package.png You'll need the following packages installed on your server:

  • tftp-server ( allows systems to netboot from this machine )
  • dhcp ( allows systems to obtain ip address from this machine )
  • rpm ( always present in fedora systems, if you have another distribution, you might have to install it)

Now, download the collection of scripts and tools to build the diskless environment: diskless-0.4.tar.bz2 (my DSL link is a bit slow, but the file is not big...)

Setting up the server

Configuring the dhcp server

Make sure your dhcp server is started at boot:

chkconfig dhcpd on

And make sure it is configured correctly. Howto do this is beyond the scope of this howto, but see for instance: John Cooke's guide. Here is the dhcpd.conf that I use, which allows for dynamic dns:

authoritative;
ddns-update-style              interim;
ddns-updates                   on;
ignore client-updates;
update-optimization            off;

key DHCP_UPDATER {
        algorithm hmac-md5;
        secret "secret md5 hash, created with: dnssec-keygen -a HMAC-MD5 -b 128 -n USER DHCP_UPDATER";
};

zone steadydecline.net. {
        primary 127.0.0.1;
        key DHCP_UPDATER;
}

zone 1.168.192.in-addr.arpa. {
        primary 127.0.0.1;
        key DHCP_UPDATER;
}

subnet 192.168.1.0 netmask 255.255.255.0 {
        range dynamic-bootp            192.168.1.2 192.168.1.254;
        default-lease-time             7200;
        max-lease-time                 43200;
        option domain-name             "steadydecline.net";
        option domain-name-servers     192.168.1.1;
        option netbios-dd-server       192.168.1.1;
        option netbios-name-servers    192.168.1.1;
        option netbios-node-type       0x8;
        option routers                 192.168.1.1;
        option subnet-mask             255.255.255.0;
        option time-offset             3600;
        ddns-domainname                "steadydecline.net";
        option ntp-servers             192.168.1.1;
}

class "minimyth" {
# matches only the MacMini, which has hardware ethernet address: 00:0d:93:5e:3f:bc
        match if substring (hardware, 1, 6) = 00:0d:93:5e:3f:bc;
        ddns-hostname                  "minimyth";
        default-lease-time             43200;
}

On the discussion page you'll find a comment from Klaus Weidner about static ip. I'm still not sure if it's necessary to define a static ip, on my system it seems to work with a dynamic ip. Mythtv uses the hostname, and the netboot script installs files in a directory named after the hostname, not the ip. Anyway, if a dynamic ip is troublesome for you, use a fixed one, by adding these lines to dhcpd.conf:

host minimyth {
        hardware ethernet 00:0d:93:77:77:77;
        fixed-address 192.168.1.999;
}

and remove these lines:

class "minimyth" {
# matches only the MacMini, which has hardware ethernet address: 00:0d:93:5e:3f:bc
        match if substring (hardware, 1, 6) = 00:0d:93:5e:3f:bc;
        ddns-hostname                  "minimyth";
        default-lease-time             43200;
}

Configuring the tftp server

tftp in fedora core 4 is a part of the xinet daemon. So make sure xinetd is started at boot:

chkconfig xinetd on

and make sure the tftp service is allowed (disable = no) in the file /etc/xinetd.d/tftp

Configuring NFS

For netbooting from this server, two NFS exports are required, one directory for the static root file system, and one directory containing a snapshot for each diskless system booting from this server. Add these two lines to /etc/exports (my domain is steadydecline.net, change to your own, the script defaults to using fc5 on the mini, if you change this to fc4 or fc6, then also change the exported directories):

/diskless/ppc/fc5/root/ *.steadydecline.net(ro,sync,no_root_squash)
/diskless/ppc/fc5/snapshot/ *.steadydecline.net(rw,sync,no_root_squash)

And re-export filesystems

exportfs -a

Important.png Note: re-exporting the filesystems doesn't always work for me. If this won't work, just restart the nfs daemon

with:
/etc/init.d/nfs restart

Configuring a lirc server

If you own an ATi remote wonder II (a radio-frequency remote control) that is connected to the fc4 server, then you can setup a lirc server. This is pretty straightforward, this /etc/sysconfig/lircd allows lirc on the server to listen on port 8765 for network connections:

/sbin/modprobe lirc_atiusb
LIRCD_OPTIONS="--listen=8765 --device=/dev/lirc0"
ENABLE_LIRCMD="no"
LIRCMD_OPTIONS=""
ENABLE_IREXEC="no"

Of course, on the server you will need the appropriate /etc/lircd.conf for your remote. See the lirc documentation, LIRC, and ATI Remote Wonder II.

Creating the diskless environment

Now unzip the build environment (diskless-0.4.tar.bz2) to the root filesystem. Please note that this build environment is for i386 linux, this is because it uses some scratchbox binaries compiled for i386. It should work on x86_64 if the right 32bit libraries are installed. But it won't work on ppc. On ppc there should be no need for the scratchbox binaries anyway, you can edit the script a bit to disable the scratchbox parts (if you do this with the proper conditionals, I'll take over the changes in my script). Now type the following as root, to extract the build environment to the root filesystem:

cd /
bzip2 -cd diskless-0.4.tar.bz2 | tar xfv -

Enter the /diskless directory, and read and edit the script as you see fit. Some configuration files that will be installed in the diskless environment are located in /diskless/conf. Edit those for your Mac Mini. In particular edit these files:

  • /diskless/conf/xorg.conf (edit monitor settings for your screen, if you have a DELL 2005FPW, this xorg.conf should work)
  • /diskless/conf/lircd.conf (replace with the lircd.conf from your server, if you are using lirc)

Now run the script as root (RPM relies on chroot to install in different locations, chroot works only as root, sorry about this.. you'll have to trust me.. or carefully read the script):

cd /diskless
./mkrootfs-ppc

Now a whole bunch of files will be downloaded (only once), and a diskless enviroment will be built. Somewhere you'll be asked for a password for vnc. Remember this password, you can use it later on to connect to the macmini with the vncviewer program. After this is done, copy the kernel, the initrd image, the bootloader and the bootloader config to the tftpboot directory.

cp /diskless/tftpboot.fc5/* /tftpboot/

Now the netboot environment should be ready!


Important.png Note: the yaboot binary included in fc5 has been a bit troublesome for me, it just puts me in the openfirmware menu instead of booting.. I have no idea why this happens, and if its limited to my machine. If the same happens for you, just copy the yaboot binary from the fc4 package. It's located at /usr/lib/yaboot. You can use midnight commander (mc) to extract it from the rpm.

If you want to use mythtv and mplayer on the Mac Mini, you have to compile them on the Mini. I've written two simple scripts to download svn/cvs versions of mythtv and mplayer into the diskless environment. It also applies a few patches (agains libcdaudio, and mythmusic). If you want to use these scripts, you should run them before booting the mini! Run the scripts in the /diskless directory like this:

./getmythtv
./getmplayer

Make sure that all files/cvs/svn are downloaded/checked out! Sometimes sourceforge or ftp servers are temporarily offline.

Forcing the Mac Mini to boot from the net

Now netboot has to be made the default for the Mac Mini. Boot the Mini into OS X, open a command prompt (or just ssh into it), and type the following:

sudo nvram boot-device="enet:192.168.1.1,yaboot"

where 192.168.1.1 is the ip address of the fc4 server you are going to boot from. If all is well, the next time you boot the Mac Mini, it should boot into linux from the net! You can access your Mini with ssh, as user root, with the same password as the root user on your server. Also once you start X, you can use vncviewer to control the mini.

Once you are tired of Linux, you can boot from disk by default by typing this on the Linux commandline (of the Mac Mini!, as root):

nvsetenv boot-device hd:,\\\\:tbxi

Important.png Note: If the mini can't boot from the net, then it will wait for a very long time (around 10minutes I think) and then boot from the harddrive. So you can't really ruin your mini with these lines. Although it may seem dead for some time, don't panic! Just wait, and restore to normal boot behaviour with the line shown above.

The first time you netboot the mini, a lot of data will be copied (~500MB), also the bootscript will generate the module dependency list, and dynamic library cache. Depending on your network speed this can take upto 60 minutes! The new version of the bootscript (version: diskless-0.3 and higher) forces a reboot after all the copying is done, to use the newly generated modules.dep and ldconfig.cache.

Building mythfrontend on the Mac Mini

The mythfrontend has to be built on the Mac Mini itself, as there are no ppc RPMS available (as far as I know). The same goes for mplayer. If you've downloaded the myth and mplayer sources with my scripts (as explained in the previous chapter) then compiling and installing myth and mplayer is very simple. Log in to the mac mini with secure shell (remember, user: root, password the same as on the computer you build the diskless environment on), and:

cd ~/sources
./buildmythtv
./buildmplayer

This compiles mythtv +plugins and mplayer, and installs them in /usr/local. This will take a long time! Moreover, it might crash if your mini has only 256MB of memory (mine has). If that happens, do the following:

  • reboot the mini
  • delete the empty .o file where the compilation process stopped, this is very important!! Otherwise make will skip that file, and the compilation will fail later on.
  • edit the buildscript to continue where it crashed (means you have to run make again, but not ./configure !)
  • hope it will finish this time, if not, just repeat the whole exercise. Eventually it will compile!

Now you can start the frontend by typing:

/etc/init.d/mythfrontend start

or even easier just reboot the mini:

reboot

The next time you netboot your mini, mythfrontend will start automatically.

Running mythfrontend on the Mac Mini

Now your Mini is a fullblown MiniMyth frontend! Mythfrontend should start automatically on boot. You can use vncviewer to control the mini, or set up a decent lirc configuration. Make sure to use 'ALSA:default' as the sound device, also set the mixer to 'default'. Oss emulation sounds ugly! If you got this far, and your setup is working, don't forget to report it in the table below!

Configurations known to work

known working configurations
server distribution mini distribution myth version mini type script version reported by
fedora core 4 fedora core 4 0.19-fixes 1.25Ghz ppc 256MB WiFi+Bluetooth DVD+CDRW diskless-0.3 Bas Hulsken (--Bas 18:43, 22 October 2006 (UTC))
fedora core 4 fedora core 5 0.20-fixes 1.25Ghz ppc 256MB WiFi+Bluetooth DVD+CDRW diskless-0.4 Bas Hulsken (--Bas 18:43, 22 October 2006 (UTC))