Mar 20, '09 07:30:00AM • Contributed by: Anonymous
I needed to reinstall OS X, but my discs were broken. Fortunately, I had an image of the installation DVD on my server, so I figured that I should be able to boot into that image over the network. Well, it wasn't that easy.
In the end what you will need is a computer running two servers: one tftp server and one web or NFS server, preferably NFS, since you don't have to worry about making sure you have Apache 2 or newer to support huge file transfers over http. You'll also need some command-line skills, too.
The first step is to get four files:
- A bootloader
- A kernel
- An mkext file (which is a bunch of drivers)
- The image you wish to boot
The kernel is located at /mach_kernel, just under the root directory. Copy that one, too.
The third one is a little bit trickier. It involves picking the drivers you'll need and putting them in a nice package. I'll give you a line to make life easier:
kextcache -L -N -S -Z -m mach_kernel.mkext /System/Library/Extensions
This will create a file named mach_kernel.mkext in the /System » Library » Extensions folder, which contains everything you need to successfully boot an image over the network. If you're curious about the flags, check out man kextcache. You really should also put this file on some kind of removable media, otherwise you may get stuck.Now, take a deep breath, go make yourself some coffee, and treat yourself to a cookie, as the next two steps will be a little bit trickier if you're not used to fiddling with unix-like systems. You will need to install a tftp server and an NFS server on the machine you wish to boot from. I will not go through this as there are plenty of sources on the Internet to help with these tasks. Once you have these servers up and running, continue with with instructions.
What we want to do now is to fiddle around with the settings stored in the NVRAM (Non-Volatile Random Access Memory) of the Mac that you'd like to net boot. Don't worry -- it's relatively safe; there really is no way in which you might make your computer explode. We need to instruct the computer to boot in our special way. I'm simply going to give you a line, then I'll explain it:
The tftp server serves as host for the bootloader, the kernel, and the kernel extensions. "But hey!" you might say, "I don't see the kernel extension on the line!", and you'd be perfectly right. It's loaded automatically based on what the kernel name is. In the line above, I have assumed that the bootloader, kernel, and kernel extension file are all located in the tftp's server root directory, but of course, they could be anywhere -- you'd just have to adjust the path on the line. The curious --options bit specifies options which are parsed by the bootloader to the kernel. We want the root partition to be loaded from an NFS share located at a certain IP adress, and at a certain directory. The colons (:) delimit the path from the filename.
You also might want to enable some verbosity (lots of text) at the next boot so you can see what's going on, in case anything goes wrong. Issue this command:
sudo nvram boot-args="-v"
So, what are you waiting for? Do it! This will change the boot settings the next time you start your Mac, so that's what we'll do. Reboot your Mac, hope and pray. If everything is alright, and we hope it is, your image will get loaded by the kernel.
To recap:
Your computer will load the bootloader, the kernel, and the kernel extension from the tftp server. If that goes well, the kernel will mount the image from the NFS server and continue the boot from it. I have to accredit two pages on the net which helped me vastly, namely: [robg adds: I haven't tested any of this one, and I suggest having good backups in place before experimenting with it.]
