Tuesday, 16 September 2008

Ubuntu 8.04 (Hardy Heron) on a MacBook 4.1 (Santa Rosa)

Hardy Heron Screenshot
Hardy Heron Screenshot, originally uploaded by REALJimBob.


Specification:
  • MacBook (Black) 4.1 (aka Santa Rosa)
  • Core 2 Duo T8300 (@2.40GHz, 800MHz FSB, 3MB L2 Cache)
  • 2GB 667MHz DDR2 SDRAM
  • Graphics Card
  • Widescreen Display (1280x800)
  • Broadcom Corporation BCM4328 802.11a/b/g/n (rev 03) Wireless Chipset
  • 250GB Hard Disk
A MacBook bought in the US (the exchange rate was fantastic), so I'm stuck with a US keyboard. Unfortunately, I hadn't realised the wireless chipsets had changed and have had trouble getting networking to, well, work.

First run through with Hardy Heron, I made the mistake of installing the 32bit release rather than the 64bit one. I managed to get most things working -- sound, trackpad, compiz, etc. However, Wireless networking always eluded me. I managed to get the drivers loaded and could browse the list of available networks -- I just couldn't connect to the router one metre from me...

Information Sources:

Sadly there is no LaptopTestingPage for the MacBook 4.1. However, the Ubuntu Help Community Documentation site houses three similar but confusing pages:
  • How to Install Ubuntu on a MacBook - Mostly written towards installing Hardy Heron onto an older MacBook, not specifically intended for the Santa Rosa generations.
  • MacBook Santa Rosa - Definitely geared towards installing Ubuntu onto a Santa Rosa chipset. However, it's downside is that it's written from the point of view of installing 7.10 (Gutsy Gibbon) rather than Hardy Heron.
  • MacBook on Santa Rosa on Hardy - Big plans to be the best of both worlds, installation guide for Hardy Heron on the Santa Rosa chipset. However, it's still very new and only describes the wireless configuration changes.
A combination of these three documents along with whatever I manage to glean from the Internet will hopefully guide me through.

Installation:

First check your MacBook chipset version:

sudo dmidecode -s system-product-name

Ensure you have a backup (obviously), I shouldn't really need to say this.

Boot from the Live Install CD: ubuntu-8.04.1-desktop-amd64.iso -- on startup insert the CD and hold down the C key to select the CDROM boot device.

Install as a normal Ubuntu installation. The options I went with were English Language, London location and timezone, USA keyboard and Guided partitioning using the entire disk. Create the first user for yourself and name your computer. After installation you'll need to let it reboot.

The first thing I'd do after installation is let it run the software update to install all the updates that have been released since the CD was imaged (this is a LTS release after all).

Configuration:

Various bits and bobs need configuring. Ubuntu is grossly unprepared for the MacBook platform. Almost as if the MacBook was designed as a propriatory platform...

Touchpad

The touchpad is probably the first thing to fix. If you can't control the machine it's kinda difficult to configure everything else. The synaptics driver is the key here, and it's extensive (and very configurable) settings are described in the man synaptics page. Default settings of the synaptics driver can be discovered by running synclient -l (assuming that you've already set the SHMConfig option). This will output all the possible settings, both the ones already configured above and the default values that aren't specified. Many of the online guides drive you towards either an overcomplicated configuration, or a Mac OS feel. I reckon that if you want to feel like you're using Mac OS, then use Mac OS, but you need to decide how you wish to emulate the middle and right click buttons that you don't have (I've never understood how you could get away with only one button). I opted to use the synaptics feature of being able to detect the number of fingers that are tapped onto the touchpad. Specifically, if I tap with two fingers I want to right-click, if I tap with three fingers the less common middle-click. Optionally you can emulate the scrolling functions of many modern mouses, but I'm not a massive fan of the function and tend to leave that unconfigured.

Default configuration of the synaptics driver in the /etc/X11/xorg.conf was:

Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizEdgeScroll" "0"
EndSection

And, my updated Options section ended up as:

Option "SHMConfig" "true"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "VertEdgeScroll" "false"
Option "HorizEdgeScroll" "false"

The SHMConfig option is important as it allows the use of the synclient tool, as well as being a prerequisite for the syndaemon options that we'll set up below to disable the touchpad while you're typing (to stop those annoying twitches). TapButton1, TapButton2 and TapButton3 specify the actions when that number of fingers are used to tap the touchpad, one finger is unset as the main button below the touchpad is preferred. Two and three fingers are used for the right-click and middle-click respectively. Vertical and Horizontal scrolling actions remain unset as I'm not a huge fan of those actions.

To disable the twitchiness of the touchpad when typing, set up the syndaemon in the Gnome session startup programs. From the menu System -> Preferences -> Sessions, add a new Startup program:

Name: Synaptics Daemon
Command: syndaemon -i 2 -d
Comment: Control Synaptics Settings

This will introduce a 2 second freeze on the touchpad whenever you're typing. The time interval can be changed by setting the i parameter to a lower or higher number. There is also an alternative switch -t which only disables clicks and scrolls on the touchpad, mouse movement is still enabled. Use whichever suits your style of work more -- heavier command line user you probably want to use -i, more of a GUI application user you might want to use -t. Again, man syndaemon explains the various options.

Without using the edges of the touchpad for scrolling, it seems important to make as much of the real estate available as possible. Using the values output from the synclient -m 1 command and slowly moving my finger to the edges of the touchpad I reached a set of values for each edge. Comparing those with the original values given by synclient -l shows that considerable edges were being wasted.

synclient -m 1 values for Edges

Option "LeftEdge" "15"
Option "RightEdge" "1210"
Option "TopEdge" "10"
Option "BottomEdge" "380"

synclient -l default values for Edges

Option "LeftEdge" "121"
Option "RightEdge" "1094"
Option "TopEdge" "38"
Option "BottomEdge" "348"

Obviously if you are planning on using edge scrolling, either horizontal or vertical, you'll need to bring in those values for the RightEdge and BottomEdge somewhat. Some of the Ubuntu community documentation suggests some alternate values in this case.

Wireless

The Broadcom Wireless chipset in the MacBook is a bit of a bugger. The standard BMC43* drivers don't recognise it. Having followed the guidelines on the MacBook Santa Rosa on Hardy page, the NDIS WLAN drivers load and recognise the chipset, however, connecting to an actual network still seems to be beyond them. Definitely not yet considered working.

Luckily, six months after the release of Hardy Heron the automatic updates within Ubuntu dropped a new release of the BMC43* proprietary drivers and wireless now works perfectly happily, no configuration was required - it just works. When prompted, all you have to do is accept and enable the 'restricted' (propietary) driver for the Broadcom device.

Screenshot-Hardware Drivers


Sound

According to the MacBook Santa Rosa page sound is fully supported, however it's not detected. To enabled detection add the following line to the /etc/modprobe.d/options file:

options snd_hda_intel model=mbp3

Restart the laptop to enable the detection. However, still no sound -- the speakers have been disabled during installation (as the card wasn't detected). To enable the speakers you need to open the Volume Control panel (right click on the audio icon on the Notification Area)

Volume Control

Then on that panel move to the Switches tab and enable speaker by ensuring that the associated tick box is ticked.

Screenshot-Volume Control: HDA Intel (Alsa mixer)

2 comments:

mark said...

hello-
thanks for this post. i too am trying to setup hardy heron on a santa rosa macbook. however, i'm an absolute beginner.

i'm trying to customize the trackpad, but i havent figured out how to enable SHMConfig. can you help?

cheers
mark

REALJimBob said...

Mark, if you're still reading here and haven't found out already, it's actually described above - you have to edit the /etc/X11/xorg.conf file and add in the SHMConfig settings.