Difference between revisions of "Diskless Mac-Mini Howto"
(→Software) |
(→Creating the diskless environment) |
||
Line 124: | Line 124: | ||
== 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.1.tar.bz2 diskless-0.1.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><nowiki> | ||
cd / | cd / |
Revision as of 12:21, 16 February 2006
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.
Contents
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:
- sound works, but mixer doesn't, and the sound quality is not great (sounds like low samplerate, no idea how to solve)
- dhcp renew lease doesn't seem to work, so set a long default lease time in the dhcp server
- sleep doesn't work
Major benefits over an OS X frontend:
- Much faster (~75% idle, and runs without swap on a 1.25GHz, 256MB Mac Mini)
- Allows aspect ratio changes
- Potentially allows mythmusic plugin (have not tried myself yet)
- 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
Prerequisites
Software
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.1.tar.bz2] (unfortunately a slow DSL link, if you know of some place that can host this file for me, please let me know)
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; }
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" 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.1.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 ./mkrootfs-ppc-fc4
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:
timeout=3 default=linux image=enet:0,vmlinuz label=linux initrd=enet:0,initrd.img append=" init=/disklessrc rw root=/dev/ram0 NFSROOT=192.168.1.1:/diskless/ppc/fc4 ramdisk_size=19463 selinux=0 noisapnp"
Now the netboot environment should be ready!
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
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:
cd /diskless/ppc/fc4/snapshot/minimyth.steadydecline.net/root mkdir sources cd sources cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/lame login cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/lame co -P lame svn co http://svn.mythtv.org/svn/branches/release-0-19-fixes/mythtv svn co http://svn.mythtv.org/svn/branches/release-0-19-fixes/mythplugins svn co http://svn.mythtv.org/svn/branches/release-0-19-fixes/myththemes
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:
cd lame ./configure --prefix=/usr/local make make install cd ..
Then build and install mythtv, myth-themes and myth-plugins in /usr/local:
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 ./configure --disable-mythbrowser --disable-mythgame --disable-mythphone --disable-mythflix qmake mythplugins.pro make make install cd ..
Mythtv needs some config files, make sure this file exists on the mini: /root/.mythtv/mysql.txt This is the one I use:
DBHostName=steady DBUserName=mythtv DBPassword=mythtv DBName=mythconverg DBType=QMYSQL3
To allow X to start without a desktop or window manager, you need to start mythtv using a file /root/.Xclients. Here is mine:
mythfrontend
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.
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