2013年7月17日星期三

Dual Boot Max OS X and Fedora19 on MacBookPro

I'm totally a linux guy who want to control as many parts as I can on my laptop, no exception to MacBookPro.

Preparation
1. USB key with Fedora19 x86_64 Live installed
2. MacBookPro with enough power
3. downloaded wifi firmware from here

Notice: the 3rd step is critical because newly installed Fedora can't recognize the broadcom wifi chip, I missed this step at first, so I have to download it over tethered network from my Android phone.

Steps
Step1: Just follow the article "How to Dual Boot Linux on Your Mac and Take Back Your Powerhouse Apple Hardware" to shrink your Macintosh HD, install rEFI, and start installing Fedora. Personally I would suggest that keep 50GB+ disk empty without any partition from the Disk Utility, then leave it to Fedora installation process.

Step2: reboot Mac with Fedora Live USB key plugged. you just need to use rEFI to boot the Live OS and choose "Install Fedora to Disk". the next step is the most critical part of this dual boot: do create another EFI partition (usually 200MB) for Fedora instead of reusing that from Mac OS X. I strongly suggest using "review/modify partition before install" to do it manually. You should get error checking disk before clicking "Installation" button because you have to uncheck the "install bootloader" on the disk. Since it uses rEFI, I didn't want to install another bootloader into MBR. I just unchecked it so that it will configure the bootloader on my own.

Step3: after Fedora installation completes, it ask you to reboot the system ,then follow the guide in step1 to sync GPT partition table to get rEFI less confused. In this step, please boot into your Live Fedora 19 again and fix the bootloader config. we skipped bootloader install in step2, so we will fix it in the booted Live OS. you need to run command "grub2-mkconfig -o ~/grub.cfg", then mount your system EFI partition of fedora to /mnt, copy the grub.cfg file into /mnt/EFI/fedora/grub.cfg. before rebooting, please modify this grub.cfg file and alter the command linux and initrd to linuxefi and initrdefi, or you will get "linux: can't find comand linux".

Step4: boot the fedora on your MacBookPro. Usually it chooses "Boot Linux from shim", then you will see the familar grub option menu. Please select the "Advanced option for Fedora 19" and select the last subentry. Then it will boot the newly installed Fedora19!

The last step is installing wifi firmware. I copied the firmware tar file into the Live OS USB stick, so I just need to extract and install and then reboot again (details can be found here):

  $ tar xjf broadcom-wl-5.100.138.tar.bz2
  $ sudo b43-fwcutter -w "$FIRMWARE_INSTALL_DIR" broadcom-wl-5.100.138/linux/wl_apsta.o

PS: I've got several comments from Google plus and I decided to add more tips:

1. rEFI is actually optional. One comment from Google plus suggested that MacBook Pro allow more than one OS co-exist. I reviewed the Mac OS X EFI boot and Fedora19 EFI boot, then realized that as long as it uses separate EFI partition for Fedora, you can hold the "option" key (a.k.a., the alt key) during MacBook booting time and it will prompt bootable partitions. So you can remove rEFI, or even leverage the "option" key without rEFI at all.

2. create the following file to load wireless driver during linux boot:

  $ sudo vi /etc/sysconfig/modules/pci-wireless.modules
  #!/bin/sh

  exec /sbin/modprobe b43 >/dev/null 2>&1
  $ sudo chmod +x /etc/sysconfig/modules/pci-wireless.modules

3. Since it uses SSD in the new MacBook Pro, you'd better switch to noops disk queue scheduler for performance boost:

  $ sudo tee /sys/block/sda/queue/scheduler <<< noop

6 条评论:

Pablo Salvatierra 说...

Great Tutorial. But which macbook pro you used?

轩印 说...

MacBook Pro 13' with Retina display.

Unknown 说...

Quick question: how do you mount /mnt in step three? Where is the /mnt/EFI folder? Thanks!

Unknown 说...

您的评论要在确认后才会显示出来。

polly 说...

thank you for the detailed tutorial

朱可 说...

The EFI partition installed should be /dev/sdaX and you can find it on your disk.