Personal tools
You are here: Home Team Members Jason Montleon Installing Fedora 16 on Macs

Installing Fedora 16 on Macs

by jmontleon last modified Mar 03, 2012 12:19 AM
— filed under:

Helpful hints for getting Fedora 16 installed on various Mac models

Intro

Mac's use a poor EFI implementation compared to other systems.

In a lot of cases it is also a 32-bit EFI implementation, which means the BOOTX64.efi grub image used on the Fedora media will not work, since it is intended for 64-bit EFI implementations. To add insult to injury a lot of Mac's boot with a dead keyboard when you try to boot off of Fedora Media with support for both EFI and BIOS booting, meaning you can't select either method and you then can't boot.

Even in the case of Mac's with 64-bit EFI implementations I have not had consistent luck using the included BOOTX64.efi on the DVD.

Resources

There are several useful resources for understanding how every other EFI system works, how Mac's work, and how to work with all of this. Some of the ones I retained on my mad hunt for information are:
http://mjg59.dreamwidth.org/4957.html
http://blog.christophersmart.com/2009/07/23/linux-on-an-apple-xserve-efi-only-machine/
http://www.felipe-alfaro.org/blog/2006/09/19/installing-refit-on-the-hidden-efi-system-partition

I have filed a couple of bugs making suggestions that would make life easier for people trying to install Fedora on Mac's. I don't see that any of these suggestions would adversely affect users of other systems, but it will be up to the package maintainers and developers to decide if these changes are truly wise:
https://bugzilla.redhat.com/show_bug.cgi?id=746434
https://bugzilla.redhat.com/show_bug.cgi?id=746421

When to use Legacy and when to use EFI booting.

In most cases Mac's seem to function perfectly well booting either in EFI or legacy mode. In a dual boot situation it seems preferable to use EFI if you can get away with it for the fact that you will probably need to maintain the gpt disk label Mac OS X has created and Mac's won't boot in legacy mode from a gpt partition. In the case of systems with Radeon graphics cards that do not functioning properly in EFI mode legacy booting seems the best route. Speaking of which...

Warning about Radeon Cards

I have encountered issues with the systems that use Radeon cards. Someone reported this issue on bugzilla already.
https://bugzilla.redhat.com/show_bug.cgi?id=735860

I have managed to complete an installation and boot via EFI on these systems. With a little work you can use the fbdev X driver to get a graphical environment.

You can also opt to boot in legacy mode on these Mac's to use the radeon driver. In the case of some (MacBook Pro 2,2) you may still need to follow the instructions here in order to create boot media (else burn a DVD without EFI support), but in the case of others (Mac Mini 5,2) if may be possible to put in the DVD, hold the 'alt' key and choose the Legacy boot mode for the DVD and get going. Mac's won't do legacy booting off of a gpt partition so you will need to use the nogpt option and it may be worth setting up your disks with an msdos label and partition structure ahead of time.

What you will need

- Fedora 16 x86_64 Installation Media
- OS X Install DVD
- FAT Formatted thumb drive
- A second computer running Fedora 16 x86_64 (a VM would be acceptable)
- Patience.
- grub2-efi.i686 rpm. You'll need to grab it from koji.fedoraproject.org, download.fedoraproject.org, or where ever; it is not in the x86_64 repos.

Process

In all cases you should:

  1. Read the model specific instructions.
  2. Complete the Installation Media preparation
  3. Complete the install to taste.
  4. Complete the post-install instructions.

Model Specific Notes

Macbook Air 1,1

1. Once you create the boot media, insert the thumb drive in your Mac and boot holding the 'alt' key. You should get the option to EFI Boot the thumbdrive. Do so.

2. The firmware for the Macbook Air's wireless is not distributed with Fedora which means it will not work during the installation, so you're probably going to need to just go ahead and copy the entire install tree to your thumb drive so you can complete the install, since the only USB port will be tied up with your thumb drive.  I'm sure there are other ways around this, though this is probably the easiest. And once you are done b43-fwcutter can be used to get the firmware installed so that your wireless works.

MacBook 2,1

1.) Once you create the boot media, insert the thumb drive in your Mac and boot holding the 'alt' key. You should get the option to EFI Boot the thumb drive. Do so.

2.) You may wish to retain a copy /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport from OS X before wiping it out. You will need to use the isight-firmware-tools package so your iSight camera will function properly in Fedora and extract the firmware from the file above.

MacBook Pro 2,2

1.) Once you create the boot media, insert the thumb drive in your Mac and boot holding the 'alt' key. You should get the option to EFI Boot the thumb drive. Do so. Since this model has a Radeon graphics card you will have to settle for using fbdev if you EFI boot.

2.) Burning a DVD with no EFI support is also a good option for this model and it will allow you to do a graphical install without resorting to VNC. Take your Fedora DVD and follow the instructions for sections 2.6.1 and 2.6.2 here: http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/5.3/html/Deployment_Guide/satops-kickstart.html if you want to do this.

3.) You may wish to retain a copy /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport from OS X before wiping it out. You will need to use the isight-firmware-tools package so your iSight camera will function properly in Fedora and extract the firmware from the file above.

Mac Mini 5,2

1.) Once you create the boot media, insert the thumb drive in your Mac and boot holding the 'alt' key. You should get the option to EFI Boot the thumb drive. Do so. Since this model has a Radeon graphics card you will have to settle for using fbdev if you EFI boot.

2.) If you want to install a legacy mode boot setup for working graphics skip the instructions for creating boot media and boot off the Fedora Install DVD. If you hold the 'alt' key when booting you should get the option to either boot using EFI or 'Windows' from the DVD. Choose 'Windows' and add nogpt to the boot options, and install. You can probably stop reading here and go on installing and enjoying Fedora.

Do note that this model was freezing when I tried to boot using the Fedora 16 and 17 DVD's in Legacy mode until I downloaded a firmware update on 2/25/2012. Once the update was installed the Fedora 16 and 17 discs started working properly, so at worst you may need to do this before getting started.

Installation Media

If you don't want to go through the trouble of creating the boot media in its entirety you can download:

https://sites.google.com/a/montleon.com/home/EFI.tar.gz

This includes /EFI/BOOT/{grub.cfg,BOOTIA32.efi,BOOTX64.efi}, which you can copy to your fat formatted thumb drive. You can copy the vmlinuz and initrd.img from /images/pxeboot on the DVD to /images on your thumb drive and you will be done with this section. To create everything manually follow the instructions below.

We will perform these steps on a second computer running Fedora 16 x86_64. A VM is acceptable, if you don't have another physical system running Fedora.

1. Install grub2-efi.x86_64 if it is not already installed.

2. Run the following command in an empty temporary directory. When done you should end up with a file called BOOTX64.efi. This is the 64-bit EFI image.

grub2-mkimage -d /usr/lib/grub2-efi/x86_64-efi/ -o BOOTX64.efi \
-O x86_64-efi --prefix /efi/boot part_gpt part_msdos lvm fat ext2 \
chain boot configfile normal minicmd linux reboot halt search \
gfxterm gfxmenu efi_gop efi_uga video loadbios gzio video_bochs \
video_cirrus echo true loadenv

3. Copy the newly created BOOTX64.efi file to /EFI/BOOT/BOOTX64.efi on your thumb drive.

Note: If you know that your Mac is using a 64-bit EFI implementation you can skip this steps 4 through 6. Otherwise you should plan to execute them.

4. We can't install grub2-efi.i686 since it conflicts with grub2-efi.x86.64, but we only need one folder, so we will get it the hard way:

 a. Get grub2-efi.i686 from koji, the Fedora i686 repos, or where ever you prefer.

 b. Use rpm2cpio to convert the package to a cpio archive.

 rpm2cpio grub2-efi*i686.rpm > grub2-efi.i686.cpio

 c.  In an empty temporary directory extract the archive

 cpio -id < grub2-efi.i686.cpio

 d. While in the temporary directory you extracted the archive copy the necessary files to the correct location:

 cp -r usr/lib/grub2-efi/i386-efi /usr/lib/grub2-efi

5. Run the following command in an empty temporary directory. When done you should end up with a file called BOOTIA32.efi. This is the 32-bit EFI image.

grub2-mkimage -d /usr/lib/grub2-efi/i386-efi -o BOOTIA32.efi -O i386-efi \
--prefix /efi/boot part_gpt part_msdos lvm fat ext2 chain boot configfile \
normal minicmd linux reboot halt search gfxterm gfxmenu efi_gop efi_uga \
video loadbios gzio video_bochs video_cirrus echo true loadenv

6. Copy the newly created BOOTXIA32.efi file to /EFI/BOOT/BOOTIA32.efi on your thumb drive.

7. Create /EFI/BOOT/grub.cfg on your thumb drive. The first option can be used for Mac's that you intend to boot via EFI. The second and third options can be used to finish an install without a gpt disk label so you can boot into legacy mode using either a text or VNC mode install.

set timeout=30
set default=0

menuentry "Fedora 16 fakebios, askmethod" {
        fakebios
        search --set -f /images/vmlinuz
        linux /images/vmlinuz askmethod
        initrd /images/initrd.img
}

menuentry "Fedora 16 fakebios, askmethod, nomodeset, nogpt" {
	fakebios	
	search --set -f /images/vmlinuz
	linux /images/vmlinuz askmethod nomodeset nogpt
	initrd /images/initrd.img
}

menuentry "Fedora 16 fakebios, askmethod, nomodeset, nogpt, VNC" {
        fakebios
        search --set -f /images/vmlinuz
        linux /images/vmlinuz askmethod nomodeset nogpt vnc
        initrd /images/initrd.img
}

menuentry "Fedora 16 Rescue" {
	fakebios
	search --set -f /images/vmlinuz
	linux /images/vmlinuz rescue nomodeset text
	initrd /images/initrd.img
}

8. Copy /images/pxeboot/vmlinuz and /images/pxeboot/initrd.img from your Fedora installation media to /images/ on your thumbdrive. This should leave you with /images/vmlinuz and /images/initrd.img

Installation

Disk Setup

For a legacy boot setup you can pretty much do what you always do. Create a /boot partition and then a physical volume for the remainder of your partitions. Or whatever you want, really.

For an EFI boot setup you will need to create /boot/efi and /boot partitions without putting them on lvm. (re: /boot this is an installer limitation because it will install grub-efi, which does not support /boot on lvm, instead of grub2-efi; with some thought and pre-planning you can eliminate this partition post-install) Something like:
sda1 /boot/efi fat ~50-200MB
sda2 /boot ext4 ~500MB
sda3 Physical Volume with the remainder of your partitions.

Post-Install

1.) These instructions apply to EFI mode. When your install is complete do not reboot. If you were hasty and rebooted already, you can reboot in rescue mode from the media you created and complete these steps.

2. Press ctrl-alt-f2 to get a terminal.

3. chroot /mnt/sysimage

4. Mount your thumb drive under /mnt

5. Copy the BOOTIA32.efi and BOOTX64.efi file from your thumbdrive to your fat formatted efi partition in the EFI/BOOT dir, which should now be mounted under /boot/efi so that you have /boot/efi/EFI/BOOT/BOOTIA32.efi and /boot/efi/EFI/BOOT/BOOTIX64.efi

6. Make sure you have grub2-efi installed and create your boot config. You may have to uninstall grub-efi first. You should either be able to install it by mounting /dev/sr0 somewhere, pre-staging it on your thumb drive, or bringing up eth0 and installing it from the yum repos. After running grub2-efi-mkconfig, do not forget to add fakebios to the boot entry if you need it.

yum remove -y grub-efi
yum install -y grub2-efi
grub2-efi-mkconfig > /boot/efi/EFI/BOOT/grub.cfg

7. Create /boot/grub2-efi/grub.cfg as a link to /boot/efi/EFI/BOOT/grub.cfg so it gets updated when new kernels are installed.

8. If you have one of the models that normally boots with a dead keyboard edit /etc/grub.d/10_linux. Below line 77 add:

cat << EOF
fakebios
EOF

Note: Editing this file is probably a bad idea, since it can be overwritten by updates, but I haven't found a better way yet. You may want to chattr +i it for the time being.
9. Shut down

Final Steps

1. You should now be able to hold down the 'alt' key when starting your mac so that you get the option to EFI Boot into Fedora from the hard drive. You should also notice that if you just boot your Mac without holding the 'alt' key it will just blink a folder icon and be very sad.
2. To fix this, boot off a Mac OS X DVD.

3. One it loads open a terminal from the Utilities menu.

4. Check to see that your /boot/efi partition was mounted (if is it is probably /Volumes/Untitled. If not, mount it:  (i.e., mkdir /Volumes/UNTITLED; mount -t msdos /dev/disk0s1 /Volumes/Untitled)

5. Run:

ioreg -l -p IODeviceTree | grep firmware-abi

(thanks to: http://macperformanceguide.com/SnowLeopard-64bit.html for this command)

6. depending on whether this returns EFI64 or EFI32 run the appropriate command

bless --mount /Volumes/Untitled --setBoot --file \
/Volumes/Untitled/EFI/BOOT/BOOTIA32.efi

or

bless --mount /Volumes/Untitled --setBoot --file \
/Volumes/Untitled/EFI/BOOT/BOOTIX64.efi


7. Shut down without installing OS X :)

8. Boot your system.

9. Hopefully at this point you are enjoying Fedora.

Using fbdev with Radeon cards in EFI mode

If you have a radeon card you may need to boot the first time by adding 'modprobe.blacklist=radeon' to the kernel line.

Add the line 'blacklist radeon' to /etc/modprobe.d/blacklist.conf

You can run 'X11 -configure to create an xorg.conf and replace the 'radeon' driver line with fbdev.

Example /etc/x11/xorg.conf for using fbdev on a MacBook Pro 2,2:

Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "Screen0" 0 0
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
    ModulePath   "/usr/lib64/xorg/modules"
    FontPath     "catalogue:/etc/X11/fontpath.d"
    FontPath     "built-ins"
EndSection

Section "Module"
    Load  "dri2"
    Load  "glx"
    Load  "record"
    Load  "extmod"
    Load  "dbe"
    Load  "dri"
EndSection

Section "InputDevice"
    Identifier  "Keyboard0"
    Driver      "kbd"
EndSection

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option        "Protocol" "auto"
    Option        "Device" "/dev/input/mice"
    Option        "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
    Identifier   "Monitor0"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
EndSection

Section "Device"
    Identifier  "Card0"
    Driver      "fbdev"
    BusID       "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor    "Monitor0"
    DefaultDepth 24
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection

Useful Packages once you're up and running:

isight-firmware-tools - Loads firmware for iSight cameras in certain models like the MacBook 2,1 and MacBook Pro 2,2. Note that you will need to obtain the firmware from a Mac and you may want to grab this before wiping out OS X. This file is at: /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport

b43-fwcutter - Loads firmware for some wireless cards, like the one in the MacBook Air 1,1. You will need to manually download the firmware itself off the internet.

bluez-hid2hci - Seems necessary to get properly functioning bluetooth on some models, like the MacBook Pro 2,2

Turning off Optical Out

If your laptop has a red light coming out of the headphone hack this is the optical out. You can turn it out by running alsamixer on the command line, hitting (Fn+)F6, choosing your sound card, arrowing over to S/PDIF, and hitting M to mute it.

Document Actions
Log in


Forgot your password?
New user?