Difference between revisions of "Diskless Mac-Mini Howto"

From MythTV Official Wiki
Jump to: navigation, search
(Alternative download location)
m (Categorized)
Line 202: Line 202:

Revision as of 00:30, 12 March 2006


This Diskless Mac-Mini Howto should allow you to netboot a Mac Mini MythTV frontend from a Fedora 4 server, without altering anything on the Mac Mini's disk.

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, infact, 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 any RPM based distribution.

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: thesniderpad.

Major problems at this moment:

  • sleep doesn't work

Minor problems:

  • dhcp renew lease doesn't seem to work, but setting a long default lease time in the dhcp server is a good workaround.

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 mythmusic plugin (with big-endian patch agains 0.19-fixes, included in scripts)
  • Netboot allows the harddrive to be spinned 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!

Bas Hulsken



You'll need the following packages installed on your fc4 server:

  • tftp-server ( allows systems to netboot from this machine )
  • dhcp ( allows systems to obtain ip address from this machine )

Now, download the collection of scripts and tools to build the diskless environment: [diskless-0.2.tar.bz2] (unfortunately a slow DSL link, if you know of some place that can host this file for me, please let me know)

Alternative download using the new Googlepages diskless-0.2.tar.bz2

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:

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

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

zone steadydecline.net. {
        key DHCP_UPDATER;

zone 1.168.192.in-addr.arpa. {
        key DHCP_UPDATER;

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

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 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):

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

And restart NFS

/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"

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.2.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.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

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.

cp /diskless/initrd.img /tftpboot/
cp /diskless/vmlinuz /tftpboot/
cp /diskless/ppc/fc4/root/usr/lib/yaboot/yaboot /tftpboot/

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:


  append=" init=/disklessrc rw root=/dev/ram0 NFSROOT= ramdisk_size=19463 selinux=0 noisapnp"

Now the netboot environment should be ready!

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:


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:,yaboot'

where 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

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

This compiles mythtv +plugins and mplayer, and installs them in /usr/local. This will take a long time!

Now reboot the Mini, to update the linker cache.

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!

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!

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