Mythic Beasts

Intel Mac Mini Linux walk through

The easiest way to get started is net booting, that way you can sort out your disks and such from a position of stuff working. I assume you have an installed image which you have exported over NFS from you server (which I shall imaginatively call server), to your mac.

Step 1. Build a working kernel on the server (or cheat and download one)

Download and unpack the kernel:
[root@server Walker]# wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.16.1.tar.bz2
--14:58:58--  ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.16.1.tar.bz2
           => `linux-2.6.16.1.tar.bz2'
[...]
[root@server walkthrough]# tar xfj linux-2.6.16.1.tar.bz2 
Fetch the various patches:
[root@server walkthrough]# wget 'http://svn.sourceforge.net/viewcvs.cgi/*checkout*/mactel-linux/trunk/misc/misc/imac-2.6.16.1.patch?rev=25' -O imac-2.6.16.1.patch
Warning: wildcards not supported in HTTP.
--15:04:39--  http://svn.sourceforge.net/viewcvs.cgi/*checkout*/mactel-linux/trunk/misc/misc/imac-2.6.16.1.patch?rev=25
           => `imac-2.6.16.1.patch'
[...]
[root@server walkthrough]# wget http://www.mythic-beasts.com/macmini/kernel/piix.ich7.patch
--15:01:28--  http://www.mythic-beasts.com/macmini/kernel/piix.ich7.patch
           => `piix.ich7.patch'
[...]
[root@server walkthrough]# wget http://www.mythic-beasts.com/macmini/kernel/rtc.patch
--15:01:33--  http://www.mythic-beasts.com/macmini/kernel/rtc.patch
           => `rtc.patch'
[...]
[root@server walkthrough]# wget http://www.mythic-beasts.com/macmini/ethernet/sky2-1.0msi.patch
--15:01:42--  http://www.mythic-beasts.com/macmini/ethernet/sky2-1.0msi.patch
           => `sky2-1.0msi.patch'
[...]
[root@server walkthrough]# wget http://www.mythic-beasts.com/macmini/vga/kernel-vgacons.patch
--15:01:49--  http://www.mythic-beasts.com/macmini/vga/kernel-vgacons.patch
           => `kernel-vgacons.patch'
[...]
[root@server walkthrough]# wget http://www.mythic-beasts.com/macmini/kernel/ir.patch
--15:01:55--  http://www.mythic-beasts.com/macmini/kernel/ir.patch
           => `ir.patch'
[...]
[root@server walkthrough]# wget http://www.mythic-beasts.com/macmini/kernel/sigmatel_audio.patch
--15:02:01--  http://www.mythic-beasts.com/macmini/kernel/sigmatel_audio.patch
           => `sigmatel_audio.patch'
[...]
[root@server walkthrough]# 
Patch the kernel:
[root@server walkthrough]# cd linux-2.6.16.1
[root@server linux-2.6.16.1]# patch -p1 < ../imac-2.6.16.1.patch
patching file Makefile
[...]
patching file sound/pci/hda/patch_sigmatel.c
[root@server linux-2.6.16.1]# patch -p1 < ../piix.ich7.patch 
patching file drivers/ide/ide-io.c
[root@server linux-2.6.16.1]# patch -p1 < ../rtc.patch 
patching file arch/i386/kernel/time.c
[root@server linux-2.6.16.1]# patch -p1 < ../sky2-1.0msi.patch 
patching file drivers/net/sky2.c
patching file drivers/net/sky2.h
[root@server linux-2.6.16.1]# patch -p1 < ../kernel-vgacons.patch 
patching file arch/i386/kernel/setup.c
[root@server linux-2.6.16.1]# patch -p1 < ../ir.patch 
patching file drivers/usb/input/Makefile
patching file drivers/usb/input/Kconfig
patching file drivers/usb/input/appleir.c
Configure and build the kernel and modules
[root@server linux-2.6.16.1]# cp ../config .config
[root@server linux-2.6.16.1]# make oldconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/split-include
[...]
CRC32c (Castagnoli, et al) Cyclic Redundancy-Check (LIBCRC32C) [Y/n/m/?] y
[root@server linux-2.6.16.1]# make bzImage
  CHK     include/linux/version.h
[...]
  BUILD   arch/i386/boot/bzImage
Root device is (33, 66)
Boot sector 512 bytes.
Setup is 6911 bytes.
System is 1813 kB
Kernel: arch/i386/boot/bzImage is ready  (#1)
[root@server linux-2.6.16.1]# make modules
  CHK     include/linux/version.h
[...]
  LD [M]  sound/usb/usx2y/snd-usb-usx2y.ko
[root@server linux-2.6.16.1]# 
You new kernel is ready.

Step 2. Build or get elilo

Download or follow these instructions to build elilo with my VGA support, or cheat and download it.

Step 3. Make sure you have the latest firmware for your mac

You'll need the firmware which actually has a VGA BIOS kicking about in it somewhere. Version 1.0.1 does., 1.0 doesn't. You'll need MacOS X to do the upgrade, so boot into that (you might want to take this opportunity to do some partition resizing in preparation for a disk install). If you're new to OS-X click once on the thing that looks like a compass to bring up a web browser. Then browse your way to the link above, and click on the download link. The downloaded file will appear on your desktop and you can double click it to mount it (it's a disk image). It should then install.

Step 4. Install the kernel and boot loader on your mac

You'll need to have the bzImage file and the elilo.efi file from the previous two steps somewhere where they can be read from MacOS X. Boot your Mac into OS-X.
Bring up a terminal (if you're new to OS X, you need to double click on the picture of a hard disk, then double click on Applications, then double click on Utilities, then double click on Terminal). In the terminal type:
Last login: Sun May 28 16:08:45 on console
Welcome to Darwin!
notroots-computer:~ notroot$ sudo bash
Password: [enter your user password here]
notroots-computer:~ root# mkdir -p /efi
notroots-computer:~ root# mount -t msdos /dev/disk0s1 /efi
kextload: /System/Library/Extensions/msdosfs.kext loaded successfully
notroots-computer:~ root# cd /efi                  
notroots-computer:/efi root# mkdir -p elilo
notroots-computer:/efi root# cd elilo

[now copy the two files over, I put them in /tmp/tomac on server]

notroots-computer:/efi/elilo root# scp server:/tmp/tomac/* .
root@server's password: 
bzImage                                       100% 1821KB   1.8MB/s   00:00    
elilo.efi                                     100%  326KB 325.9KB/s   00:00    
notroots-computer:/efi/elilo root# mv bzImage vmlinuz

[Now use your favourite text editor to make an elilo.conf file,          ]
[mine's cat. Note that my root image for this mac is on server (whose IP ]
[address is 10.32.32.1) is on server:/export/minimac                     ]

notroots-computer:/efi/elilo root# cat > elilo.conf
legacy-free

image=vmlinuz
label=default
append=" ip=dhcp nfsroot=10.32.32.1:/export/minimac "
root=/dev/nfs


[I've pressed CTRL-D to send an EOF to cat here]

notroots-computer:/efi/elilo root# 
notroots-computer:/efi/elilo root# ls
elilo.conf      elilo.efi       vmlinuz
notroots-computer:/efi/elilo root# cat elilo.conf 
legacy-free

image=vmlinuz
label=default
append=" ip=dhcp nfsroot=10.32.32.1:/export/minimac "
root=/dev/nfs
notroots-computer:/efi/elilo root# 

[Finally make the firmware load elilo.efi at boot time]

notroots-computer:/efi/elilo root# bless --setBoot --verbose --mount /efi --file /efi/elilo/elilo.efi 
EFI found at IODeviceTree:/efi
Mount point for /efi is /efi
Mount point is '/efi'
No BootX creation requested
No boot.efi creation requested
Relative path of /efi/elilo/elilo.efi is \elilo\elilo.efi
IOMedia disk0s1 has UUID
Setting EFI NVRAM:
        efi-boot-device='<array ID="0"><dict ID="1"><key>BLLastBSDName</key><string ID="2">disk0s1</string><key>IOMatch</key><dict ID="3"><key>IOProviderClass</key><string ID="4">IOMedia</string><key>IOPropertyMatch</key><dict ID="5"><key>UUID</key><string ID="6">D7DB7D60-115A-4C97-BC23-B9C22954DB61</string></dict></dict></dict><dict ID="7"><key>IOEFIDevicePathType</key><string ID="8">MediaFilePath</string><key>Path</key><string ID="9">\elilo\elilo.efi</string></dict></array>'
Setting EFI NVRAM:
        IONVRAM-DELETE-PROPERTY='efi-boot-file'
Setting EFI NVRAM:
        IONVRAM-DELETE-PROPERTY='efi-boot-mkext'
NVRAM variable "boot-args" not set.
notroots-computer:/efi/elilo root# 
That's it - click on the little apple and restart and you'll reboot into Linux, from there you can create some partitions and install a root file system.

Copyright © 2000-2009 Mythic Beasts Ltd. All Rights Reserved.