View Single Post
 
Old 11-18-2008, 02:39 AM
munky munky is offline
Cheetah
 
Join Date: Nov 2008
Posts: 4
Finally, the beef!

So, best practice is to use a boot-132 disc and install a fresh Leopard installation onto a GPT disk from retail. Lets call this 'Phase 0'. You find or create a boot-132 disc capable of booting to the installer from a retail Leo disc on your particular setup. Go into Disk Utility from the menu and partition one of your drives as GUID Partition Table type and create at least one partition big enough for Leopard. Look elsewhere for questions about boot-132 (like the links above). This guide assumes you can, and have, booted the retail Leo disc and installed to a GPT disk.

Once you've done that, boot into your new install via boot-132, and do the following:

Phase 1: Reformatting the EFI System Partition.

1) Open Terminal

2) sudo -s (and type in your password)

3) diskutil info / | grep Identifier - this tells you the values for diskXsY for '/', which is the currently-booted system. (If you're doing this on a disk other than the one you've booted from, you need to modify accordingly.)

4) diskutil list - diskXs1 should be called EFI. this is the hidden EFI partition on your target drive.

5) diskutil eraseVolume "HFS+" "EFI" /dev/diskXs1 - now, be *VERY* sure this is the correct drive. this will format the EFI partition as HFS+. (NB After erasing it will try to mount it, but will fail with "Could not mount disk0s1 with name after erase". Ignore this).

Phase 2: Installing the modified bootloader.

1) Extract the attached zip file to a directory (Safari might do this for you).

2) in terminal, cd to that directory (the one containing boot0, boot1h, boot-turbo-munky.bin and fdisk)

3) ./fdisk -f boot0 -u -y /dev/rdiskX - this puts the stage 0 bootloader onto the target disk

4) dd if=boot1h of=/dev/rdiskXs1 - this puts the stage 1 bootloader onto the target partition (EFI partition)

5) mkdir /Volumes/EFI

6) mount_hfs /dev/diskXs1 /Volumes/EFI

7) cp boot-turbo-munky.bin /Volumes/EFI/boot

8) cp update.sh /Volumes/EFI/

Phase 3: Make the disk bootable

This stage may not be necessary on some boards, but on my Intel board and Bad Axe boards it is. If you skip this step and your system wont boot, try doing it. That said, doing this on boards which DONT need it will do no harm so my logic is do it anyway.

Type the fdisk command and then each line as shown:

1) ./fdisk -e /dev/rdiskX (NB: Ignore any fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory error)

2) f 1

3) w

4) q

Phase 4: Setup your new bootloader EFI partition

1) Setup directory tree:

mkdir -p /Volumes/EFI/System/Booter
mkdir /Volumes/EFI/Extensions
mkdir /Volumes/EFI/.fseventsd

2) touch /Volumes/EFI/.fseventsd/no_log - this prevents the File System Events Daemon (fseventsd) from logging on this volume, which can cause the EFI partition to become unmountable.

3) copy necessary extensions into /Volumes/EFI/Extensions (eg:

cd <directory containing kexts>
cp -R *.kext /Volumes/EFI/Extensions)

4) if necessary, copy patched kernel into /Volumes/EFI/ (eg:

cd <directory containing the wonderful Voodoo kernel)
cp mach_kernel.voodoo /Volumes/EFI/

5) cd /Volumes/EFI
chmod +x update.sh
sudo ./update.sh - this will build a kextcache in /System/Booter. Please check update.log for any errors. (Dependency warnings are ok and normal - the dependencies will be available at boot time from /System/Library/Extensions).

6) umount /Volumes/EFI (If this fails, do umount -f /Volumes/EFI).

7) rm -rf /Volumes/EFI

8) If your machine cannot use the vanilla kernel, at this point you must take a note of your install's UUID. Open Disk Utility.app and click on the partition containing your fresh install. Click the blue 'I' information icon and look for Universal Unique Identifier. This should be a fairly long hex string. Write this down somewhere on a piece of paper. (not in a text file on the computer!)

You should be ready to boot at this stage.

Phase 5: Test boot!

So this differs slightly depending on whether you have a Core cpu or not - that is, whether you can (or choose to) run the vanilla kernel or a patched kernel.

If you boot the vanilla kernel, you should just have to press Return, as the bootloader should find your installed OS.

If you boot a patched kernel, the magic you need is this:

bt(0,0)/mach_kernel.voodoo -v boot-uuid=<the install's uuid you wrote down earlier>.

With a bit of luck, you'll boot up into your nice shiny new Leopard install, and be able to use Software Update without worrying.


Phase 6: Post-Install - Kexts, EFI strings, Boot.plist, Troubleshooting

Kexts:

So you booted back up, but you maybe dont have gfx support, or are missing some nice LAN kext... To mount EFI:

sudo -s
mkdir /Volumes/EFI
mount_hfs /dev/diskXs1 /Volumes/EFI

to install new kexts:

sudo -s
cd path/to/kext
cp -R Blah.kext /Volumes/EFI/Extensions
cd /Volumes/EFI
./update.sh


EFI Strings and com.apple.Boot.plist:

v3 of the bootloader supports a com.apple.Boot.plist file located on the EFI partition. You can place this in either of these two locations:

/Volumes/EFI/com.apple.Boot.plist
-or-
/Volumes/EFI/Library/Preferences/SystemConfiguration/com.apple.Boot.plist

Its your choice, and it makes no difference. If you have both it will favour the one in /Library/Pref.....

This is, of course, the place to put EFI strings - aka device properties - strings. This bootloader supports EFI strings in the same format as Chameleon expects them.

Troubleshooting

If you ever get 'mount_hfs: Invalid argument' when trying to mount the EFI partition, do this to fix it:

fsck_hfs /dev/disxXs1.

*** Always unmount the EFI partition before rebooting, to stop this happening! umount /Volumes/EFI! ***



Notes

On my system (a Pentium D920 currently, though after tomorrow it'll be a Core 2 Duo), there is actually one modification to the installed system, and that is the com.apple.Boot.plist file. I simply couldnt be bothered typing out the uuid every time I booted the machine, so I put my boot parameters into that plist file. v3 supports a com.apple.Boot.plist on the EFI partition

I also have a vanilla installation on a USB drive which I share between two real macs (my home MacBook Pro and my work MacBook Pro) as well as my hack. I have the necessary kexts and kernels on the EFI partition (remember, the real macs ignore this partition), and to boot it on my hackintosh, i just have to type in the correct parameters for booting, ie:

bt(0,0)/mach_kernel.voodoo boot-uuid=<blah>.
v3 supports com.apple.Boot.plist on EFI.

One thing - you can actually use rd=diskXsY to specify the boot device. I prefer using boot-uuid because that wont break if I change the configuration of hard disks on my machine, whereas the diskXsY values could.


Another thing, for pre-Core users, please keep the relevant System.kext on the EFI partition for the kernel you wish to use. For example, my hackintosh has mach_kernel.voodoo (9.4.0 kernel for 10.5.4), and the 9.4.0 (10.5.4) System.kext in /System/Booter/Extensions.mkext. These are used in preference to the kernel and System.kext on the installation, which are both vanilla 9.5.0 (10.5.5) versions. This means USB mounting etc wont break.


Dual- Triple- Quadruple-.... Booting!

Since this bootloader is based on dfe, you can hit escape at the darwin boot prompt and enter a new bios device id to boot from. If you have a 2nd hard disk with Windows, you can hit esc, type 81 and enter, and it should show the darwin prompt with 'Foreign OS'. Hit enter to boot Windows


Background Reading

If this stuff is new to you, or you're having trouble following, please read these threads first:

http://forum.insanelymac.com/index.php?showtopic=113288

http://forum.insanelymac.com/index.php?showtopic=123841

http://forum.insanelymac.com/index.php?showtopic=123313


Source Code

Now attached. Apologies for not having commented it all properly, or even doing basic cleaning up. All work by dfe, turbo, zef, chameleon team with a couple small bits and bobs from me.

Changelog and Downloads

v1 is the original bootloader, comprising Turbo's changes to the dfe bootloader. Deprecated by v2
v2 supports EFI strings in com.apple.Boot.plist. apply them in chameleon style - ie <device-properties> tag. Deprecated by v3
v3 supports a com.apple.Boot.plist on the EFI partition (in root or in /Library/Preferences/SystemConfiguration), boots faster, and integrates the update.sh script
v4 supports JMicron and other 'troublesome' ATA
v5 adds the improved FSB detection code from Chameleon
v5.1 is a repackaging of v5 to correct a misnamed file. No other changes.
v6 supports DSDT override, and has apple boot logo removed (needed to save space )

v5.1 Download is here (requires InsanelyMac login).

v6 Download is here (requires InsanelyMac login).

v5.1 Source code here (requires InsanelyMac login).

Last edited by munky; 11-30-2008 at 03:16 PM.
Reply With Quote