Fedora8-MacBookPro-4,1

From Mactel-Linux

Jump to: navigation, search

Contents

Introduction

This document describes how to install Fedora 8 x86_64 on a MacBook 3,1 (Santa Rosa) so it can dual-boot with Mac OS X. It lists the steps to install and make Fedora bootable, as well as how to make video, sound, wireless, networking, keyboard, touchpad, bluetooth, camera, and suspend work properly.

Since this document is a work in progress, it is possible that some of the steps are unnecessary and that the document is incomplete. A dual-boot scheme is described, triple booting requires a different partitioning scheme. Most of the steps here are from other documents on this site, and from the Ubuntu wiki, modified to work for Fedora 8 x86_64.

I have made this document for the benefit of others as I could find very little information specific to Fedora 8 x86_64 on the MacBook 3,1. The steps described here have worked for me, but this is no guarantee that they will work for you. Comments and additions are welcome.

Credits

Huge thanks to the people who created the Ubuntu Wiki documentation. This guide is based extensively on their work.

Thanks also to FriedChips for his work on getting wireless to work. Many thanks to Pene for his excellent feedback and suggestions for fixing some of the problems. Also a big shout out to spear at fedoraforum.org for setting me right on a few things.

Thanks also to everyone else in the Fedora and Ubuntu community that have helped me along the way!

Getting more help

For further help or troubleshooting please visit this thread at fedoraforums.org. My username there is BlueC.

How to install Fedora 8 x86_64 on a MacBook 4,1

This guide will help you through all the steps necessary for installing Fedora 8 on a MacBook 4,1. This guide is currently aimed at Fedora 8 x86_64 .

Basic installation instructions

  1. Update the MacBook firmware to the latest version. If you prefer, you may use the standard "Software Update" in OS X.
  2. Get your Fedora installation DVD ready. Note: you should use the x86_64 version of Fedora 8 and that I have only tested this using the Install Media, not the Live DVD. There is a possible problem with the initial release DVD so you may like to use one of the respins. This will also save you time as you won't need as many updates once Fedora is installed.
  3. Install rEFIt on OS X if you want a boot menu to select between OS X/Fedora to appear on every boot. This is highly recommended but optional - this guide assumes you have installed rEFIt. You can make Fedora boot by default and change the menu timeout by editing the "refit.conf" file (described on the rEFIt website).
  4. Use the OS X partition manager to resize your OS X partition and make space for Fedora. On my 80GB hard drive, I shrank the OS X (hfs+) partition to 45GB to leave about 30GB for Fedora. Insert your Fedora installation DVD in the drive and reboot.
  5. If you have rEFIt installed, then on boot you will be given the option to boot from the DVD, choose it. If you don't have rEFIt installed, then hold down "C" to boot from the DVD.
  6. Install Fedora as usual, except:
    1. In the partitioner, select to manually edit partition table
    2. Create a 200MB boot partition with mountpoint '/boot' (this will be /dev/sda3)
    3. Create a new ext3 partition with mountpoint '/' - this will be your main Fedora partition on /dev/sda4. Make sure to leave 2GB free space after this partition for your swap partition
    4. With the remaining 2GB, create a linux swap partition - this will be /dev/sda5
  7. Finish the installation and reboot.
  8. If you installed rEFIt, you should have a choice between booting OS X and Linux. Use the arrow keys and Enter to select Linux.
  9. Log in to Fedora
  10. Follow the steps in the sections below to work around things that still do not work out-of-the-box in Fedora 8.

Post installation

Note: The wireless on the MacBook 4,1 doesn't work out of the box in Fedora, so you're going to need an ethernet internet connection available until we get round to fixing the wireless later in this guide.

It is very important now to update your Fedora installation to the latest packages using yum. To do so:

$ sudo yum update yum rpm

Once yum has finished updating, reboot, and then do a yum update again. Repeat this process until yum finds no more packages to update.

Updating the kernel

The standard 2.6.23 kernel in Fedora 8 works fairly well, but there are two problems:

  1. Extra keyboard functions (accessed using the 'fn' key) are inaccessible redhat bug report
  2. The trackpad only has basic functions and is not configurable via xorg.conf using the synaptics driver redhat bug report

To fix these problems we need to either patch the kernel, or install a pre-patched kernel.

The hard way: patch and build your own kernel

Users wishing to patch and build their own kernel should refer to the most recent patches I have made available in the redhat bug reports above and see the fedora guide to building and patching a custom kernel.

The easy way: pre-patched kernel

not test however this is a guide for the mbp 3,1 : Fedora8OnMacBookSantaRosa#The_easy_way:_pre-patched_kernel

Fedora8OnMacBookSantaRosa Duplication

From this point forward, this is an exact duplicate of Fedora8OnMacBookSantaRosa. However with the new chip, keyboard, and some other idiosyncrasies that exist in this laptop that i have discovered over the past few days, i figured i'd create a new page to document them.


Fixing the wireless

The MacBook 3,1 comes with a Broadcom 4328 wireless chipset. This is not supported by default in Fedora 8 and requires the use of ndiswrapper and Windows drivers to make it work correctly. Additionally, NetworkManager is a bit of a train crash in Fedora 8 and I have been unable to make it work with my wireless network and WPA encryption. However, using wpa_supplicant and dhclient I am able to connect and maintain a good connection to my wireless network.

The steps required to install ndiswrapper depend on whether you are running a stock kernel or a custom patched kernel. Follow the appropriate section below.

Installing ndiswrapper on the stock kernel

Enable the livna yum repositories and install the kmod-ndiswrapper package as well as some others to fix dependencies:

su -
rpm -i http://rpm.livna.org/livna-release-8.rpm
yum install kmod-ndiswrapper kernel-devel gcc make automake

After a reboot, the ndiswrapper kernel module should be installed. Pick up this guide again later on for further wireless installation common to both stock and custom kernels.

Installing ndiswrapper on a custom kernel

If you have installed a custom kernel then the kmod-ndiswrapper package from livna is no use to you and you will need to build your own. Thankfully, this is quite straightforward. The instructions depend on whether you have used my pre-patched kernel (in which case you can just download my kmod-niswrapper RPM), or your own custom patched kernel. Follow the appropriate instructions below:

If you're using my pre-patched kernel

If you have installed my pre-patched kernel, then to install my ready-rolled kmod-ndiswrapper RPM follow these instructions:

cd ~
cd kerneldownload
wget http://www.cenolan.com/fedora8/kmod-ndiswrapper-2.6.23.15-137.cnolan_macbook.fc8-1.48-21.fc8.x86_64.rpm
su -c "rpm -i http://rpm.livna.org/livna-release-8.rpm"
su -c "yum localinstall kmod-ndiswrapper-2.6.23.15-137.cnolan_macbook.fc8-1.48-21.fc8.x86_64.rpm --nogpgcheck"

The kmod-ndiswrapper package for my custom kernel should now be installed. Again, we need to disable yum from updating this package, so adjust the following line in /etc/yum.conf:

exclude=system-config-network* kernel* kmod-ndiswrapper*

After a reboot, the ndiswrapper kernel module should be installed. Pick up this guide again in the later section for further wireless installation common to both stock and custom kernels.

If you're using your own custom patched kernel

If you have installed your own custom patched kernel, then to build and install a custom kmod-ndiswrapper RPM follow these instructions:

As a normal user in ~/ do:

su -c "yum -y install rpmdevtools kmodtool"
rpmdev-setuptree

Now download the ndiswrapper-kmod source rpm to the local directory and rebuild it for the running kernel:

wget ftp://rpmfind.net/linux/livna/fedora/8/SRPMS/ndiswrapper-kmod-1.48-18.lvn8.src.rpm
rpmbuild --rebuild ndiswrapper-kmod-1.48-18.lvn8.src.rpm --define "kernels $(uname -r)" --target $(uname -m)

At the end of the build output you will see the names of the RPMs rpmbuild built (kmod-ndiswrapper and ndiswrapper-kmod-debuginfo). Use yum to install them with a command like this (replace foo according to your file names!):

su -c "yum --nogpgcheck install ~/rpmbuild/RPMS/i686/kmod-ndiswrapper-foo.rpm ndiswrapper-kmod-debuginfo-foo.rpm"

For further information refer to this rpmfusion FAQ.

After a reboot, the ndiswrapper kernel module should be installed. Pick up this guide again in the next section for further wireless installation common to both stock and custom kernels.

Wireless installation using ndiswrapper for both custom and stock kernels

Now that you have ndiswrapper installed and working, we can get the wireless drivers, blacklist some incompatible kernel modules, switch NetworkManager off, and unzip the drivers:

su -
wget http://ftp.us.dell.com/network/R151517.EXE
echo "blacklist bcm43xx" >> /etc/modprobe.d/blacklist
echo "blacklist ssb" >> /etc/modprobe.d/blacklist
echo "blacklist b43" >> /etc/modprobe.d/blacklist
echo "alias wlan0 ndiswrapper" >> /etc/modprobe.d/ndiswrapper
echo "alias wlan0 ndiswrapper" >> /etc/modprobe.conf
chkconfig --levels 345 NetworkManager off
chkconfig --levels 345 NetworkManagerDispatcher off
mkdir wifidriver
unzip -a R151517.EXE -d wifidriver/

At this point you need to cd to the directory that holds the file "bcmwl5.inf" then use ndiswrapper to install the driver:

cd wifidriver/DRIVER/
ndiswrapper -i bcmwl5.inf

At this stage you should now have the wireless drivers installed through ndiswrapper. To confirm, the output of "ndiswrapper -l" should look something like this:

bcmwl5 : driver installed
       device (14E4:4328) present (alternate driver: ssb)

If it doesn't, then something has gone wrong so retrace your steps and ensure you did everything correctly. If it does, then you should be able to scan for wireless networks using "iwlist wlan0 scan" and it should pick up any wireless networks in your area.

From here on, the wireless configuration is up to you. You may want to try using NetworkManager to see if you have more luck than me, in which case do:

su -
chkconfig --levels 345 NetworkManager on
chkconfig --levels 345 NetworkManagerDispatcher on
service NetworkManager start
service NetworkManagerDispatcher start

Now ensure you have nm-applet running and see if you can connect to your wireless network.

If NetworkManager isn't doing it for you and you use WPA encryption then disable NetworkManager and NetworkManagerDispatcher and refer to this guide for setting up wpa_supplicant. The individual wireless setup is outside the scope of this guide but more help can be found at fedoraforum.org and through google.

Fixing the touchpad

If you have installed the custom patched kernel then you can make the touchpad behave very much like it does in OS X by configuring it with the synaptics driver.

Important: If you have not installed the custom patched kernel then ignore this section because it won't work and will crash your X server.

First, to enable the double tap and double finger scroll functionality you will need to install a newer version of the synaptics driver than that which is available in the current Fedora 8 repositories. To build the new synaptics driver you will first need both the X and GNOME development libraries installed - these can be installed from the Fedora install media, or through yum as follows:

su -
yum groupinstall "GNOME Software Development" "X Software Development"

Now that you have these dependencies installed, to build and install the newer synaptics driver do the following:

su -c "yum install xorg-x11-server-sdk"
wget http://web.telia.com/~u89404340/touchpad/files/synaptics-0.14.6.tar.bz2
tar xjvf synaptics-0.14.6.tar.bz2
cd synaptics-0.14.6/
make
su -c "cp /usr/lib64/xorg/modules/input/synaptics_drv.so /usr/lib64/xorg/modules/input/synaptics_drv.so.old"
su -c "cp synaptics_drv.so /usr/lib64/xorg/modules/input/synaptics_drv.so"

Now, backup and edit xorg.conf:

su -
cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup 
gedit /etc/X11/xorg.conf

Ensure that you have the following line in the "ServerLayout" section of xorg.conf:

InputDevice "Synaptics Touchpad" "CorePointer"

For reference my entire "ServerLayout" section looks like this:

Section "ServerLayout" 
	Identifier 	"Default Layout" 
	Screen 	0 	"Screen0" 0 0 
	InputDevice 	"Keyboard0" "CoreKeyboard" 
	InputDevice 	"Synaptics Touchpad" "CorePointer"
EndSection

Now create an "InputDevice" section as follows:

Section "InputDevice"
        # updated 2007-12-07
        # use command "synclient -m 1" to see raw output
        # common stuff
        Identifier      "Synaptics Touchpad"
        Driver          "synaptics"
        Option          "SendCoreEvents"        "true"
        Option          "Device"                "/dev/psaux"
        Option          "Protocol"              "auto-dev"
        
        # not using edge scrolling
        Option          "HorizEdgeScroll"       "0"
        Option          "VertEdgeScroll"        "0"
        
        # use two finger scrolling
        Option          "VertTwoFingerScroll"   "1"
        Option          "HorizTwoFingerScroll"  "1" # set to 0 if you don't want horizontal scrolling
        
        # scroll speed, lower is faster
        Option          "HorizScrollDelta"      "10"
        Option          "VertScrollDelta"       "10"

        # minimum pressure motion factor
        Option          "PressureMotionMinZ"    "10"

        # touch and untouch thresholds, higher numbers if you like to push hard
        Option          "FingerLow"             "10"
        Option          "FingerHigh"            "20" # change to 30 or 40 if you like

        # borders based on output from synclient
        Option          "LeftEdge"              "20"
        Option          "RightEdge"             "1200"
        Option          "TopEdge"               "20"
        Option          "BottomEdge"            "370"

        # speeds, smaller number for a slower mouse
        Option          "MinSpeed"              "0.8" # 0.5 is very slow, 1.5 is very fast
        Option          "MaxSpeed"              "1.2" # up to 1.5 works ok
        Option          "AccelFactor"           "0.10"

        # tap times, change to suit your tapping habits
        Option          "MaxTapMove"            "100"
        Option          "MaxTapTime"            "100"
        Option          "MaxDoubleTapTime"      "200"
        
        # don't change these or two finger tap stops working
        Option          "TapButton2"            "3"
        Option          "TapButton3"            "2"

        # must be commented out or normal tapping wont work
        #Option         "TapButton1"            "0"

        # needed for disabled while typing fix  
        Option          "SHMConfig"             "on"
EndSection

Finally, ensure you have the following in your "Module" section of xorg.conf - I have found it wasn't loading the synaptics module otherwise:

Load "synaptics"

Again, for reference, my entire "Module" section looks like this (you may not have all these X modules installed, but you can see the structure here):

Section "Module" 
	Load "synaptics" 
	Load "extmod" 
	Load "dbe" 
	Load "glx" 
	Load "xtrap" 
	Load "dri" 
	Load "GLcore" 
	Load "record" 
EndSection

For these changes to take effect you need to restart your X session by pressing control+alt+backspace (or just log out of gnome and log back in).

This will give you a OS X like feel. You can right click by tapping two fingers. The two finger scroll also works.

Disable touchpad while typing

To disable the touchpad while your typing uses this command:

syndaemon -i 1 -d

This disables the touchpad for 1 second after you type something. This works well but if you go back and forth a lot it can be a hassle to wait that one second.

Alternatively,

syndaemon -t -d 

This disables tapping motions but not movement while typing.

Both work fine, and the one that works best for you will likely be determined by the type of computing you do. Try them both and decide for yourself.

Once you've found the one you want to use, add it as an application to start in your gnome session.

Fix Firefox scrolling issue

Firefox interprets horizontal scrolling as forward/back commands which can be very annoying if you do it by mistake. To fix this type about:config in the address bar and change these two lines (click lines to edit). This is not a specific issue to the Santa Rosa version but its a common problem and an easy fix.

mousewheel.horizscroll.withnokey.action (change it to 1 to allow scrolling or 0 to turn it off)
mousewheel.horizscroll.withnokey.sysnumlines (change it to “true”)

Fix the sound

Sound is supported, but has detection trouble.

To resolve, add the following to /etc/modprobe.conf:

options snd_hda_intel model=mbp3 

Fix the function keys

Pommed is a daemon to support extra keys on apple computers. These include brightness, eject, and others. I found that the eject and volume keys work fine in gnome without pommed, but I needed pommed to make the brightness keys work.

There is no fedora package of pommed available, so we need to build it ourselves:

wget http://alioth.debian.org/frs/download.php/2223/pommed-1.14.tar.gz
tar xvzf pommed-1.14.tar.gz
cd pommed-1.14

I found that the pommed Makefile is hardcoded to use libpci in /usr/lib/ whereas we need to use /usr/lib64/ so we need to change the Makefile

gedit pommed/Makefile

Find the line that says this (line 53):

LIBS = /usr/lib/libpci.a

and change it to:

LIBS = /usr/lib64/libpci.a

Save the file and exit.

Now make and install pommed:

make
su
cp pommed/pommed /usr/sbin/
cp pommed/data/* /usr/share/pommed
cp pommed.conf.mactel /etc/pommed.conf
cp pommed.init /etc/init.d/pommed
chmod +x /etc/init.d/pommed
chkconfig --levels 345 pommed on
cp dbus-policy.conf /etc/dbus-1/system.d/pommed.conf

Now to fix pommed from crashing when the mute button is pressed, edit /etc/pommed.conf and change in the audio section the card line to

card = "hw"

Reboot.

Default behaviour on apple keyboards is to have the top row keys primarily function is as media keys (brightness, volume, etc), and have the expected function keys (F1, F2, etc) accessible with the fn keys. To reverse this behaviour either:

  1. Edit /etc/pommed.conf by changing the value of fnmode or
  2. Add the following lines to /etc/rc.local and uncomment the appropriate line
# Inverted fn key behavior for MacBooks 

#echo -n 0x02 > /sys/module/hid/parameters/pb_fnmode #FN off (press fn for volume/brightness/etc) 

# Default fn key behavior for Macbooks 

# echo -n 0x01 > /sys/module/hid/parameters/pb_fnmode #FN on (like OSX)

iSight camera

This works for me in Skype and Ekiga. I can't get it to work with gstreamer as I think it requires a kernel patch.

First of all, you will need a copy of the firmware from Apple. You can either download this, or copy it from a Mac OS X partition. While the latter is usually preferred, unfortunately the firmware distributed in Macbook 3,1 Leopard firmware is not supported yet. Tiger and retail versions of Leopard are apparently supported, however.

Acquiring the firmware. Save the file AppleUSBVideoSupport to your home directory.

To see which firmware file you have, use sha1sum to check the signature of the file with sha1sum.

sha1sum AppleUSBVideoSupport  
01e291d529e7c18deea2eba252d18114e096276e  AppleUSBVideoSupport

The above signature is known to work. If your file is signature is "1c60ef27d57221cf3d76687a4973ec72ff6fa103", you will need to get a different version of the firmware.

First, we need to install the uvcvideo driver. We get this from the linux-uvc svn server.

svn checkout svn://svn.berlios.de/linux-uvc/linux-uvc/trunk
make
su -c "make install"

Next, we need to convert the AppleUSBVideoSupport to a useable firmware file. The isight-firmware-tools will do this for us but unfortunately there is no Fedora package available, so we need to build it ourselves:

wget http://bersace03.free.fr/ift/isight-firmware-tools-1.0.1.tar.gz
tar xvzf isight-firmware-tools-1.0.1.tar.gz
cd isight-firmware-tools-1.0.1
./configure --sysconfdir=/etc
make
su -c "make install"

I found a couple of problems here:

  1. The "make install" command doesn't seem to install the ift-load program properly
  2. The udev isight.rules file that is installed doesn't work under fedora 8

To solve these problems:

su -c "cp src/ift-load /usr/local/bin/"
su -
gedit /etc/udev/rules.d/isight.rules

Make the file look like this:

ACTION=="add", SYSFS{idVendor}=="05ac", SYSFS{idProduct}=="8300", RUN+="/usr/local/bin/ift-load --firmware /lib/firmware/isight.fw"

Save and exit. (Note: I suspect the idProduct should be 8501 not 8300, but it seems to work for me anyway.)Reply to Note: The idProduct should be 8300. The id changes to 8501 (or 8502) after loading the firmware.

Now, finally, we can convert the AppleUSBVideoSupport to a useable firmware file. From your home directory where you downloaded the AppleUSBVideoSupport file:

su -c ift-extract --apple-driver AppleUSBVideoSupport

The easiest way to get the firmware to load is to just restart your machine, or if you want to load it right now:

su -c "/usr/local/bin/ift-load --firmware /lib/firmware/isight.fw --usb-bus 2 --usb-dev 6"

(For me, the isight camera (05ac:8501) is on USB bus 2, device 6. Yours may be different.)

Your camera should be in working order. Test it using Ekiga or Skype 2 beta. If the camera works in Ekiga but not in Skype 2 beta then make sure you have the following line in the "Modules" section of your /etc/X11/xorg.conf file:

Load "extmod"

See the touchpad section above for a full example of the "Modules" section that I use.

External monitor

See http://www.intellinuxgraphics.org/dualhead.html - its pretty straighforward.

Bluetooth

Bluetooth works out of the box, but due to some kernel bug it needs to be enabled properly first.

Edit /etc/sysconfig/bluetooth and make sure it says 'HID2HCI_ENABLE=true'.

That'll fix it on subsequent reboots. For now, just run '/sbin/hid2hci' as root.

Apple SMC

The applesmc kernel module is not loaded by default - I guess this is a bug. The correct way to load a module on boot in Fedora 8 is to create a .modules file in /etc/sysconfig/modules/ - here is how to do it for applesmc:

su -
gedit /etc/sysconfig/modules/applesmc.modules

Paste the following into the file:

#!/bin/sh
echo -n "Loading Apple SMC module..."
if /sbin/modprobe applesmc
then
        echo "SUCCESS"
else
        echo "FAILURE"
fi

Save and exit, then change the file permissions as follows:

chmod 744 /etc/sysconfig/modules/applesmc.modules

On next boot the applesmc module will load. Meanwhile, just do "modprobe applesmc" as root.

Suspend and Hibernate

Suspend/resume works but has some little bugs that are fixed in this section. Hibernate doesn't work for me yet - possibly something to do with the ndiswrapper module?

Fixing the suspend problems

The biggest problem with suspend is that the LCD panel backlight doesn't come back on after resume. This means that the display is working, but the brightness is zero so it is almost impossible to see what is on the screen. You can force the backlight to come back on by changing to virtual terminal 1 and then back to virtual terminal 7 by doing "ctrl+alt+F1" then "ctrl+alt+F7". This becomes a bit tiresome after a while, so you can automate it by copying the code below into a new file at /etc/pm/sleep.d/98video and make sure the file is chmod 755

#!/bin/bash
#
# cnolan - switch consoles to fix screen not waking up!

. /usr/lib/pm-utils/functions

resume_video()
{
        chvt 1
#       sleep 2
        chvt 7
#       sleep 1
}

case "$1" in
        thaw|resume)
                resume_video
                ;;
        *)
                ;;
esac

exit $?

Another problem after a suspend/resume cycle is that the virtual terminals 1-6 become unusable. To fix this add "vga=786" as a kernel option in the /boot/grub/grub.conf file. For example:

kernel /vmlinuz-2.6.23.9-85.cnolan_macbook.fc8 ro root=LABEL=/ rhgb quiet vga=786

Also the ethernet dies after a suspend/resume cycle. To fix this, create a file /etc/pm/config.d/unload_modules containing a single line as follows:

SUSPEND_MODULES="sky2"

Additionally, bluetooth doesn't come back after a suspend/resume cycle. To fix this copy the code below into a new file at /etc/pm/sleep.d/48bluetooth and then chmod the file to 755

#!/bin/bash

. /usr/lib/pm-utils/functions

suspend_bluetooth()
{
        if [ -f /var/lock/subsys/bluetooth ]; then
                savestate apple_bluetooth enabled
                service bluetooth stop
        else
                savestate apple_bluetooth disabled
        fi
}

resume_bluetooth()
{
        case "$(restorestate apple_bluetooth)" in
                enabled)
                        service bluetooth start
                        ;;
                disabled)
                        ;;
        esac
}

case "$1" in
        hibernate|suspend)
                suspend_bluetooth
                ;;
        thaw|resume)
                resume_bluetooth
                ;;
        *)
                ;;
esac

exit $?

Using the above script, if the bluetooth service is running at suspend time, then it will be restarted again after resume.

Known problems

  1. Hibernate is broken.
  2. Webcam won't work with gstreamer.
  3. Acceleratometer is not functional.

Untested

I haven't tested writing a CD or DVD. "spear" reports that burning a DVD works fine but my MacBook doesn't have a DVD writer so I can't verify that.

I also haven't tested the IR port as I don't need it - I guess it should work though.

To do

I might have a play around with some further mactel-linux kernel patches to try to get more advanced features of applesmc working like the automatic disk head locking using the acceleratometer.

I might also try to patch the kernel to make the isight work with gstreamer. Neither of these things are big issues for me though.

Personal tools