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.

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 left to your own devices to ensure the state of whatever thing you are buying as it likely…

Powering a mainframe

The last few days have been eventful. I was contacted by the datacenter that the mainframe's cage is now ready for moving in, and the power has been made available. Very exciting! I grabbed my home-made power cables (more on that later) and my best screwdrivers and set off to the datacenter.


The datacenter staff, not needing a forklift in their day-to-day, had managed to solicit the services of a forklift, the associated operator, and some very handy folks to help navigate the mainframe from the storage space to its final location.



After some intense period of fighting the inclination of the road between the storage facility and the cage (and a door that was a bit too small) it was finally in place. Incidentally we were forced to trust the wheels on this pretty rough floor. I did not expect it to roll that well on raw concrete, I was pleasantly surprised. This thing is a tank!

Now, everybody wanted to see if it was working. My machine did not come with a power cable so I had to so…

Open Datacenter Hardware - Leopard Server

Introduction The Leopard is an OpenRack v1 compliant 12V server commissioned by Facebook to offer compute power. It consists of 2x Intel Xeon E5-2678 v3 and is available with either DDR3 or DDR4 memory. The model is manufactured by two vendors primarily: Quanta and Wiwynn.

Leopard features a 24x PCIe slot which can fit either a PCIe card with low profile, or a riser card with 1x 16x and 1x 8x slots. The server also supports a 3.5" SATA drive as well as either an mSATA or an M.2 drive mounted on the motherboard.

Connectivity wise Leopard has a mezzanine card slot allowing for example 10Gb/s or 25Gb/s Ethernet.

Figure 1 and figure 2 shows the server layout. The server is made to fit inside an OpenRack v1 enclosure, at which point it looks something like figure 3. Due to power constraints an OpenRack v1 can fit 30 of these servers before power starts to become an issue. The Leopard servers that the organization Serverfarm Upstate provides are all fitted with 256GiB DDR3 RAM and 2x …