NetBoot OS X from a OpenBSD Server & NetInstall from a OpenDarwin NFS Server

This project is still yet to be finished, at the moment Im using 2 box’s to carry out the installation, the aim is to have one box running OpenBSD doing everything (unfortunately there is no HFS support within the o/s & Im having problems getting mountd to accept connections from clients on a non reserved port)
I did look at FreeBSD 5.3 with HFS+ support but Its early days for the project thus the system panicked everytime I attempt to copy to the NFS share from another host.

1x PC running OpenBSD which is running a tfptd & hacked DHCPD
1x PC running OpenDarwin which has a HFS formatted volume containing the OS X install files shared via NFS
1x Mac (G3 iBook in my case)

Mac gets boot info & kernel image from OpenBSD box & boots, then connects to the OpenDarwin box & starts the GUI/Setup.

I have managed to succesfully install OS X 10.3 & 10.4 with this setup though how the install files where shared on the OpenDarwin box varied between the NetInstall of 10.3 & 10.4.

Lets go through the core part of the setup which needs to be done independent of which version of OS X you are going to be installing.

1. Install OpenDarwin, as OpenDarwin x86 runs off a UFS partition you’ll need a 2nd partition (atleast 2.2gigs if youre installing 10.4) which you’ll format as HFS so remember to partition manually. Note the partition number you’ve installed onto as you’ll need it in the next step!

2. Upon 1st boot you’ll have to manually specify the location of the root partition manually as OpenDarwin doesnt seem to find it & sits there idle.
Press enter at the prompt to specify boot time options & at the prompt enter
rd=disk#s# convention being disk “disknumber” s “partition number”
Once youre logged in edit /Library/Preferences/SystemConfiguration/com.apple.Boot.plist & add rd=disk#s# in the string section under the kernel flags key.

3. Now format the 2nd partition using the newfs_hfs tool
newfs_hfs -v pickaname /dev/disk#s#

4. reboot & log back in, if you look in /Volumes/ you should have a folder called pickaname (or whatever name you picked :P)

5. Using the niutil (netinfo util) you need to create a NFS share
niutil . -create /exports/Volumes/pickaname opts maproot=root:wheel
this will create a share accessible by any host to allow specific hosts use the following command:
niutil . -create /exports/Volumes/pickaname clients 192.168.0.bla
to add aditional IP addresses use the append switch:
niutil . -append /exports/Volumes/pickaname clients 192.168.0.bla

6. To start sharing run:
portmap
nfsd -t -u -n 4
mountd

you may want to add these commands to your /etc/rc to save you having to run it everytime.

7. Run ifconfig -a & note the MAC address of your network card.

1.Install OpenBSD 3.5 (in any configuration you like)
2. Download & extract the sources into /usr/src from the the OpenBSD ftp site
3. Download the patch for dhcpd
& apply to source
patch -p0 < obsd_35patch

4. goto /usr/src/usr.sbin/dhcp/server & run make
5. make a backup copy of your original dhcpd & then overwrite with your new copy
cp /usr/sbin/dhpd /usr/sbin/dhcpd.original
cp dhcpd /usr/sbin/

6. With your dhcpd in place, its onto creating the dhcp lease info. open /etc/dhcpd.conf in your editor & paste the following in & edit to your requirements, you’ll need the MAC addresses of your Mac & PC running OpenDarwin

shared-network LOCAL-NET {
option domain-name "domainname.co.uk";
option domain-name-servers 194.168.4.100, 194.168.8.100;
subnet 192.168.0.0 netmask 255.255.255.0
{option routers 192.168.0.1;
range 192.168.0.2 192.168.0.16;
default-lease-time 600;
max-lease-time 7200;
allow bootp;
not authoritative;
}
host ibook {
hardware ethernet 00:03:66:55:cf:b8;
fixed-address 192.168.0.33;
filename "BootX";
server-name "192.168.0.1";
}
host darwin {
hardware ethernet 00:04:55:66:dd:b5;
fixed-address 192.168.0.10;
}
}

7. Edit /etc/dhcpd.interfaces & enter the name of the interface which dhcpd will run on, run
ifconfig -a if youre unsure of which interface.
8. Edit /etc/bootparams & specify the locations of the root & private folders that the mac will mount on boot
the convention is
hostname root=path private=path eg
ibook root=192.168.0.10:/Volumes/pickaname private=192.168.0.10:/Volumes/pickaname

9.Now onto enabling the services on boot, open /etc/rc.conf.local in your editor & add the following lines:

bootparamd_flags=""
dhcpd_flags="-q"

then open /etc/inetd.conf & uncomment
tftp dgram udp wait root /usr/libexec/tftpd tftpd -s /tftpboot

10. You’ll need to create a folder on the root of your disc called tftpboot, this folder is going to store the files to boot your mac.
11. Using your Mac or the OpenDarwin box copy the following files from your OS X disks to /tftpboot on your openbsd box:
System/Library/CoreServices/BootX
mach_kernel rename it to: mach.macosx
Extensions.mkext rename it to mach.macosx.mkext

To Install OSX 10.3 (Panther)
As the install is spread over multiple discs & the system reboots after the 1st CD is finished, I didnt bother trying to get a full install going at once, Instead I installed the Core & BSD componenets, then rebooted, mounted the NFS share & installed the other components by hand.
1.Copy the contents of CD1 to your nfs share
pax -r -w -p e /Volumes/Mac OS X Install Disc 1/* /Volumes/pickaname/
2. On your mac you’ll need to set the following variables either at the openfirmware prompt directly or using the nvram tool within OS X

boot-device enet:192.168.0.1
boot-args rf=nfs:192.168.0.10:/Volumes/pickaname

If the installer complains that there is 0 space available on your Mac to install onto then make sure you have a folder called .vol on your NFS share.

Theoretically is should be possible to install Tiger this way aswell but the installer complains that the harddisk on the Mac cannot be installed onto as the system cannot be started from that volume!!!

To Install OSX 10.4 (Tiger)
Simply copy the .dmg of the latest Beta Seed to the /Volumes/pickaname
On your mac you’ll need to set the following variables either at the openfirmware prompt directly or using the nvram tool within OS X

boot-device enet:192.168.0.1
boot-args rf=nfs:192.168.0.10:/Volumes/pickaname:nameoftigerimage.dmg

It should be possible to install 10.3 this way aswell though I havent tried.
If youre planing on only installing from a disk image then theoretically there is no need to create a HFS partition on the OpenDarwin box & If you can get OpenBSD to accept connections from clients on non reserved ports then the OpenDarwin box can be ditched all together.

8 Replies to “NetBoot OS X from a OpenBSD Server & NetInstall from a OpenDarwin NFS Server”

  1. “If youre planing on only installing from a disk image then theoretically there is no need to create a HFS partition on the OpenDarwin box & If you can get OpenBSD to accept connections from clients on non reserved ports then the OpenDarwin box can be ditched all together.”

    mountd -n

    I’m all the way to “Load of /sbin/launchd, errno 2, trying /sbin/mach_init”

    It isn’t using the boot-args to load the image, it’s trying to boot from the partition it got from rpc.bootparamd.

    any clue?

  2. This sounds too good to be true!
    I tried doing a netinstall on 3 different macs, a G3/333 imac, a G3 ibook, and a G4/PCI tower.
    They all get the dhcp reply, load BootX, kernel and kext over tftp, but they all fail to mount the tiger dmg over nfs. Sure, they’ll mount the NFS share, and if I copy over the contents of the dmg to the nfs share it ‘sort of’ works, but not quite.
    Any ideas, is this a feature of newer OpenFirmware, perhaps ?

  3. I managed to succesfully install 10.3 & 10.4 beta on a dual usb iBook. I havent tried to do the install again with a the final version, I think its time to update the guide to cover 10.4 Final & OpenBSD 3.7

  4. Actually, I had to look at the xnu source code (opensource.apple.com) to figure this detail out,
    but it does work, atleast with my G3 imac (right up until the ‘this machine is incompatible’)

    I ended up pointing boot-device directly at the tftp server, and using rp (not rf :-]) with nfs:..

    # nvram boot-device=”enet:192.168.200.254″
    # nvram boot-args=”-v rp=nfs:192.168.200.44:/ide/share/Install:Tiger.dmg”

    bootparams so far does not even appear to be required, although I am seeing an rpc portmapper lookup request for service 200100001 .. not sure what that’s supposed to be.

    I’ll have to try the G4 tower and G3 ibook later today, atleast the G4/PCI is compatible.

  5. oh .. found ’em ..

    netinfo 200100000
    netinfobind 200100001

    ie. nothing crucial, although getting netinfo & openldap to talk .. might be the next project.

  6. Hey, thanks for this tutorial!
    It worked great with G4 Tower and Tiger from a Debian without any patches n stuff!

  7. Thank you so much, you saved my poor little Imac with the busted CD-ROM, thank you!

Comments are closed.