Skip to main content

Quick and dirty guide for Ubuntu 10.10 on MacBook Air 2010 (3,1)

EDIT:
Much of this is by now done in the ppa:mactel-support - try using it before proceeding to the steps after "End installation"

To resolve the broken keyboard error, install hid-apple-dkms

Soon after receiving my latest toy I started tinkering with it. Mac OS X is awesome and all, but the power of Linux is really needed for me to be as productive as possible.

Anyhow, this is how I managed to create a (very!) nice Ubuntu install alongside of my OS X.
Disclaimer: This guide is written with the intent of being read by someone with both Linux and Mac OS X experience. You should also be able to think a bit for yourself if I forgot to mention some minor detail - but please leave a comment if you think you have tried your best and I will probably help you :-)
Needed: Ethernet adapter
Quirks: Only tested with one partition - no swap.

Step 1 Download rEFIt. This is going to be your new bootloader. It is quite ugly by default, but after some configuration tweaking and new icons it is really slick!
[caption id="attachment_41" align="alignnone" width="150" caption="rEFIt"][/caption]

Step 2 Create a partition. Resize your OS X partition and create a new one to fill the space. I created a new partition with ExFat as filesystem.

Step 3 Create Ubuntu 10.10 netboot USB:
Step 3.1 Download boot.img.gz and uncompress.
Step 3.2 Insert a USB memory. Unmount (do not eject) the partitions if any. Run diskutil list to find what diskX it is.
Step 3.3 Run
sudo dd if=boot.img of=/dev/rdiskX bs=1m

Note: Use rdisk instead of disk to dramatically speed up the copy process
Step 3.4 sync and eject drive

Step 4 Reboot into rEFIt (it may take a couple of restarts and/or runs of /efi/refit/enable.sh). The menu is accessed by holding Option, which means that you will need to hold it through the normal EFI, click on rEFIt and continue to hold it to get to the menu. If you cannot manage this, run /efi/refit/enable-always.sh (I think it's nice to always have the menu at boot).

Step 4.1 Select the Linux icon with a USB memory on it

If you have done everything correctly you should be created by the Ubuntu installation program. The installation is very straight forward until it is time to install GRUB.
DO NOT INSTALL GRUB TO YOUR MBR. It probably will refuse to install to a GPT "MBR" but please do not try :-). Instead, install to the PBR of your Linux installation (/dev/sda3 for me).

Step 5 Reboot. Linux needs reboot=p as cmdline in order to reboot correctly, which means that the installation program will not be able to reboot your computer. Just let it display "Restarting ..." and then hold down the power key (then turn it back on).

Step 6 (Hold Option key if you did not run enable-always.sh). You should now see a new Linux icon in rEFIt which is your new permanent installation. The USB memory stick is not needed anymore so go ahead and eject it to easy any confusion about which instance to boot. Boot your new Linux but press 'e' when you get to grub.
Step 6.1 Go down to the line that reads "kernel .........." and press Ctrl-E to get to the end of the line. Add 'nomodeset reboot=p' (otherwise the screen will be blank, possibly until X starts - and reboot=p is obviously for enabling rebooting).
Step 6.2 Press Ctrl+X to boot. Hopefully you will reach a terminal or some sort of login (depending of what tasksel you selected during install).
Step 6.3
sudo vim /etc/default/grub 
Add 'reboot=p nomodeset' to GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
Step 6.4
sudo update-grub


Step 7 You should now have a sort of working Ubuntu installation. What is not working at this point is graphic drivers, wifi, bluetooth, multitouch and hotkeys. I have managed to solve them all expect for hotkeys, which probably is a configuration issue at my part. Anyhow, let's finetune!

End installation

Graphic drivers and WiFi
Just launch "Hardware Drivers" and enable the proprietary drivers. Simple as that

Bluetooth
Thanks to Apples rebranding of, among other things, the bluetooth module we need to add the USB product IDs to the kernel modules in order for them to detect the devices.

You will need to get your hands on btusb-dkms_0.0.1_all.deb.gz - it should be floating around on the Ubuntu forums. Install it, it will fail - but it have by then extracted the build files we need.

cd /usr/src/btusb-0.0.1
sudo wget http://korta.nu/a785 -O btusb.c

Now add the following in btusb_table:

/* Apple MacBookAir3,1 */
{ USB_DEVICE(0x05ac, 0x821b) },

Now run:

sudo dkms remove -m btusb -v 0.0.1 --all
sudo dkms add -m btusb -v 0.0.1
sudo dkms build -m btusb -v 0.0.1
sudo dkms install -m btusb -v 0.0.1
sudo rmmod btusb
sudo depmod -a
sudo modprobe btusb

You should now see a bluetooth icon in your taskbar (or dmesg should at least say something like):

[ 314.319085] Bluetooth: Generic Bluetooth USB driver ver 0.6 (HACKED)
[ 314.326435] usbcore: registered new interface driver btusb
[ 314.357761] Bluetooth: L2CAP ver 2.14
[ 314.357764] Bluetooth: L2CAP socket layer initialized
[ 314.364215] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 314.364219] Bluetooth: BNEP filters: protocol multicast
[ 314.372463] Bluetooth: SCO (Voice Link) ver 0.6
[ 314.372467] Bluetooth: SCO socket layer initialized
[ 314.398916] usb 3-5.1: USB disconnect, address 4
[ 314.511223] Bluetooth: RFCOMM TTY layer initialized
[ 314.511229] Bluetooth: RFCOMM socket layer initialized
[ 314.511232] Bluetooth: RFCOMM ver 1.11

I have removed my old btusb module from /lib/modules all together to prevent mix ups, but that should not be necessary.

Multitouch


sudo add-apt-repository ppa:mactel-support
sudo apt-get update
sudo apt-get install bcm5974-dkms xserver-xorg-input-synaptics
cd /usr/src/bcm5974-1.1.5

(I should probably provide a patch for this, perhaps later :P).
Add the following:

#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238

/* Add the following three lines */
#define USB_DEVICE_ID_APPLE_AIRBOOK_ANSI 0x0242
#define USB_DEVICE_ID_APPLE_AIRBOOK_ISO 0x0243
#define USB_DEVICE_ID_APPLE_AIRBOOK_JIS 0x0244

#define BCM5974_DEVICE(prod) { \


BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
/* Add this line */
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_AIRBOOK_ISO),
/* Terminating entry */
{}


{ DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
{ DIM_X, DIM_X / SN_COORD, -4460, 5166 },
{ DIM_Y, DIM_Y / SN_COORD, -75, 6700 }
},
/* Add this block */
{
USB_DEVICE_ID_APPLE_AIRBOOK_ANSI,
USB_DEVICE_ID_APPLE_AIRBOOK_ISO,
USB_DEVICE_ID_APPLE_AIRBOOK_JIS,
HAS_INTEGRATED_BUTTON,
0x84, sizeof(struct bt_data),
0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
{ DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 },
{ DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
{ DIM_X, DIM_X / SN_COORD, -4460, 5166 },
{ DIM_Y, DIM_Y / SN_COORD, -75, 6700 }
},
{}

Now run:

sudo dkms remove -m bcm5974 -v 1.1.5 --all
sudo dkms add -m bcm5974 -v 1.1.5
sudo dkms build -m bcm5974 -v 1.1.5
sudo dkms install -m bcm5974 -v 1.1.5
sudo rmmod bcm5794
sudo depmod -a
sudo modprobe bcm5974

As I wrote above for bluetooth you might need to remove the old kernel module to prevent confusion. Restart X and you should be able to right click by pressing with two fingers. Configure to your hearts wishes in the Mouse preferences (click the Touchpad tab).

Hotkeys
I have not successfully managed to get this working, but pommed should be able to handle MacBookAir3,1 accordingly to the git commit logs.
Install from their git repos, not much to say really except that I chose to install the Ubuntu package and then replace the binary with my own in order to get a pre-configured configuration file (which sort of worked (i.e. started) after a few tweaks).
I have not played around enough to call this a success or failure, you're on your own here.

Anyway, I hope this "guide" is helpful to someone with a totally awesome computer.

Comments

Popular posts from this blog

Buying an IBM Mainframe

I bought an IBM mainframe for personal use. I am doing this for learning and figuring out how it works. If you are curious about what goes into this process, I hope this post will interest you. I am not the first one by far to do something like this. There are some people on the internet that I know have their own personal mainframes, and I have drawn inspiration from each and every one of them. You should follow them if you are interested in these things: @connorkrukosky @sebastian_wind @faultywarrior @kevinbowling1 This post is about buying an IBM z114 mainframe (picture 1) but should translate well to any of the IBM mainframes from z9 to z14. Picture 1: An IBM z114 mainframe in all its glory Source: IBM What to expect of the process Buying a mainframe takes time. I never spent so much time on a purchase before. In fact - I purchased my first apartment with probably less planning and research. Compared to buying an apartment you have no guard rails. You are ...

System z on contemporary zLinux

IBM System z supports a handful of operating systems; z/VM, z/VSE, z/OS, z/TPF, and finally zLinux. All the earlier mentioned OSes are proprietary except for zLinux which is simply Linux with a fancy z in the name. zLinux is the term used to describe a Linux distribution compiled for S390 (31 bit) or S390X (64 bit). As we are talking about modern mainframes I will not be discussing S390, only S390X. There is a comfortable amount of distributions that support S390X - more or less all of the popular distributions do. In this  list  we find distributions like Debian, Ubuntu, Gentoo, Fedora, and RHEL. Noticeably Arch is missing but then again they only have an official port for x86-64. This is great - this means that we could download the latest Ubuntu, boot the DVD, and be up and running in no time, right? Well, sadly no. The devil is, as always, in the details. When compiling high level code like C/C++/Go the compiler needs to select an instruction set to use for the compi...

Brocade Fabric OS downloads

Fabric OS is what runs on the SAN switches I will be using for the mainframe. It has a bit of annoying upgrade path as the guldmyr blog can attest to. TL;DR is that you need to do minor upgrades (6.3 -> 6.4 -> 7.0 -> ... > 7.4) which requires you to get all  Fabric OS images for those versions. Not always easy. So, let's make it a bit easier. Hopefully this will not end up with the links being taken down, but at least it helped somebody I hope. These downloads worked for me and are hash-verified when I could find a hash to verify against. Use at your own risk etc. The URLs are: ftp://ftp.hp.com/pub/softlib/software13/COL59674/co-168954-1/v7.3.2a.zip ftp://ftp.hp.com/pub/softlib/software13/COL59674/co-157071-1/v7.2.1g.zip ftp://ftp.hp.com/pub/softlib/software13/COL59674/co-150357-1/v7.1.2b.zip ftp://ftp.hp.com/pub/softlib/software12/COL38684/co-133135-1/v7.0.2e.zip ftp://ftp.hp.com/pub/softlib/software13/COL22074/co-155018-1/v6.4.3h.zip ftp://ftp.hp.c...