Macbook Pro 4,1 (2008). Since its EFI conflicts with nouveau, this is a CSM/BIOS installation for Fedora 16 (and Windows of course).
I'm not using rEFIt, but I have stumbled on a way to make any of the three systems default bootable.
I used Windows Vista 64-bit, not Windows 7. Using Vista does kinda pollute this recipe, because officially from 10.6.6 forward Apple's Bootcamp (the drivers and installation assistant) only supports Windows 7. Therefore I also did not use Bootcamp at all for this. Further I'm not sure if Windows 7 wants an extra partition for itself in addition to the main one. This document implies it wants a system partition but doesn't say how big it should be or what its hex code is.
However, when I separately tried using Bootcamp to split-resize a single jhfs+ partition as most users would do, I only ended up with one Windows partition. Go figure.
I am also assuming the target disk is /dev/sda. Yours might be /dev/sdb. Make sure!
1. Lion DVD boot. (If you use Snow Leopard you will have one less partition since Lion creates an extra partition for Recovery HD.)
2. Disk Utility. Partition the disk with two partitions in order: 1. jhfs+ for Mac OS and 2. Free Space. Free Space will be used for Lion Recovery HD (automatically takes 620M from unallocated space) and Fedora and Windows.
3. Install Mac OS, reboot, first login, and make sure it has an internet connection. At some point behind the scenes a Firmware.scap file (see other thread) is installed into the EFI System Partition. Not sure what it is still, but may be BIOS related. So far I've found a few minutes does the trick - you could launch Activity Monitor, check network traffic and once roughly 13MB has been received, this Firmware.scap file is likely present.
4. Insert Fedora 16 Live CD, reboot, hold option key, terminal and type:
yum install gdisk
gdisk /dev/sda
Current partition for a Lion post install looks like this. Extra note for Snow Leopard users, you won't have a Recovery HD so you'll just have two partitions at this point:
Code:
Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI System Partition
2 409640 156659639 74.5 GiB AF00 Banana
3 156659640 157929175 619.9 MiB AB00 Recovery HD
With ~400G of free space. So I add more partitions and end up with the following. [NOTE: Why am I doing this in gdisk? Because I'm not using Bootcamp and because I don't want the Windows installer partitioning my hard drive, because it only understands MBR and I'll end up with a totally fakaked disk if I let it do any partitioning.]
Code:
Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI System Partition
2 409640 156659639 74.5 GiB AF00 Banana
3 156659640 157929175 619.9 MiB AB00 Recovery HD
4 157929176 157931223 1024.0 KiB EF02 BIOS boot partition
5 157931224 158955223 500.0 MiB EF00 ext4
6 158955224 767129303 290.0 GiB 8E00 Linux LVM
7 767129304 976773134 100.0 GiB 0700 Microsoft basic data
[Note: Snow Leopard users can certainly create a Recovery HD partition if they want, it won't hurt, or just make your partition 3 the BIOS boot partition and continue on for a total of six partitions. It is possible to use dd partition to partition if you have access to an actual populated Lion Recovery HD such as on a USB stick.]
Next, while still in gdisk, I hit 'r' for recovery menu and 'h' to make a hybrid MBR. I add only partition 7 (6 for Snow Leopard users who skipped creating a Recovery HD partition): Yes to placing EFI GPT in MBR; accept default 07 hex code; yes to set bootable flag; no to protecting more partitions. Now hit 'w' command to write out the GPT and MBR to the disk.
5. I also took the opportunity to format sda7 for Windows. I'm pretty sure the Windows installer could do this without repartioning but I didn't test this.
Code:
mkfs.ntfs -f -L Windows /dev/sda7
6. Reboot, holding down option key. Once menu appears, hit eject button on keyboard to remove the Live CD from the drive and insert your Windows disk. Once the new CD/DVD "Windows" disk appears, choose it. If an CD/DVD icon "EFI Boot" option appears don't choose it, getting Windows to EFI boot on Apple hardware is apparently a dead end since Windows pretty much insists on UEFI 2.0 or later and Apple's EFI is based on Intel EFI 1.10, not UEFI 2.x.
7. Installing Windows, should see your hybrid MBR and list two partitions. The first partition will have no free space. The second partition is the one you want to target for your installation. This equates to GPT partition 7 (or 6 for SL users). It will reboot several times as it says, and interestingly enough it reboots and maintains Windows as the default boot system. After you're done installing and playing with Windows, eject the Windows disk, and move on to the next step.
[At this point you will notice rebooting will default back to Windows. If you option key reboot and choose Mac OS, the Startup Disk panel in System Preferences will list both Mac OS and Windows as options.]
8. Insert the Fedora Install DVD (or Live CD) and reboot, holding down the option key. Again, choose the CD/DVD icon labeled "Windows". [NOTE some users may have hardware that can successfully do an EFI boot instead of using Apple's CSM/BIOS. I'm not covering that in this guide, on both Macbook Pro 4,1 and 8,2 I tried it on, I couldn't get a suitably functioning system.]
9. Installation type. Choose Replace Existing Linux with "Review & modify partitioning layout" checked (useful if you want the installer to use the installer default linux boot and LVM layout). I tested this and it worked for me without any further modifications, but it's a good idea to check to make sure!
Alternatively, choose Create Custom Layout if you want to do something different right off the bat with sda5 and sda6 (which will not have been formatted so you'll need to do that for the installer to proceed).
[NOTE: At this point, behind the scenes, parted is going to obliterate your hybrid MBR turning it into a protective MBR which will render both Windows and Fedora unbootable. This will be fixed later. A bug has been filed.]
10. When it asks where to install the bootloader, install it on /dev/sda (default). Choose your packages, install, reboot.
11. Best to reboot off the Live CD since I use gdisk to "fix" the MBR. Technically the MBR is correct, it should be a protective MBR. However Windows is a BIOS based installation on Apple hardware, and both Windows and Apple's CSM/BIOS implementation need a hybrid MBR. And while Fedora does not require a hybrid MBR, again Apple's CSM/BIOS implementation does. So we're stuck with the bastardization of hybrid MBRs for now.
12. Basically you are going to repeat step 4, minus creating new GPT partitions. Install gdisk. Run it on sda. Go immediately to the recovery menu with 'r' and then 'h' to make a hybrid MBR, just as you did in step 4. Write out your changes with 'w', which also exits gdisk.
13. Reboot. Eject all CD/DVD disks.
Holding down option key at startup will get you three options for Lion users: Mac OS, Recovery HD, and Windows. Negative Recovery HD for Snow Leopard users. Choosing Windows is actually your gateway to GRUB2. In that menu, by default you'll have Fedora Linux, Fedora Linux - Recovery, and Windows. You can modify /etc/default/grub and add the line:
which in my case means the 3rd grub entry (Windows) is to be the default to boot from. More info, including making Grub menu hidden, and adjusting the timeout is here.
Anytime you change /etc/default/grub you need to use
Code:
grub2-mkconfig -o /boot/grub2/grub.cfg
to write out a new grub.cfg that includes the changes.
Now if you option key restart, choose the Mac OS disk icon to boot to Mac OS, in System Preferences>Startup Disk you still have the ability to choose either Mac OS or "Windows" as your default.
So with a combination of the Startup Disk panel and /etc/default/grub you can control which of the three operating systems will boot by default.
---------- Post added at 10:26 PM ---------- Previous post was at 07:33 PM ----------
I am having a problem with grub2-mkconfig on the actual Macbook Pro, but not in VM, where it does not overwrite grub.cfg but creates grub.cfg.new which ends ### BEGIN /etc/grub.d/30_os-prober ### and therefore does not contain the Windows entry.
So if you have this problem also, I suggest not deleting your old anaconda created grub.cfg in favor of the grub.cfg.new as it won't list Windows at all. I'm not sure what the problem is yet, why it stops creating the configuration file at os-prober.