For Lucid details go here: MacBookAir2-1/Lucid

Installation process

Quick notes

  • my usb port is broken, so I make make 3 more partitions for this installation:
    • /dev/sda4 to store Grub2 and iso files (1GB)
    • /dev/sda5 for swap (1GB)
    • /dev/sda6 for ubuntu root partition (10GB)

Installation

  • Compile Grub2 on a linux machine with --enable-efiemu (or use this: grub2efi.tar.gz)

  • Put content of grub-core (*.efi, *.mod) into (sda4)/efi/boot
  • Edit grub.conf to have an entry similar to this:

menuentry "Ubuntu 12.04 ISO sda04" {
insmod (hd0,4)/efi/boot/loopback.mod
insmod (hd0,4)/efi/boot/iso9660.mod
set isofile="/ubuntu-12.04.2-desktop-amd64+mac.iso"
loopback loop (hd0,4)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject video=efifb
initrd (loop)/casper/initrd.lz
}
  • Install rEFind (replacement of rEFit) on Mac OS (keep rEFind, we need to re-install it later)
  • Boot Precise LiveCD iso using refind -> Grub2 with the above entry.

  • Drop to console while booting and get asked of low resolution graphic,
  • Copy blacklist-agp from MactelSupportTeam/EFI-Boot-Mactel to /etc/modprobe.d/ and restore xorg.conf in /etc/X11, then startx to get to a live session

  • (optional) use gparted to create/modify swap and root partition.
  • (optional, but a must in my case) "sudo umount -l -r -f /isodevice" before start to install Ubuntu to disk
  • (optional) "sudo mount /dev/sdax /isodevice" (x=4 for my installation) before click Continue on the Select Partition screent
  • I installed Bootloader to the new Ubuntu root (/dev/sda6), but the process overwrite MacOS/rEFind boot record, so while in the Live session, reinstall rEFind as well.
  • Reboot
  • (optional) mount iso ubuntu LiveCD to /media/cdrom and enable Software Source from that cdrom, you can install restricted wifi driver and enable wifi.

General

  • Everything seems fine with a bit of tweak
  • Sound doesn't work

Video

  • Resolution is correct with default binary hardware drivers.

Sound

  • Show correct sound card, alsamixer runs fine, but no sound can be heard.

Make sure you are a member of the "audio" group. Remember to re-login after making yourself a member.

If that does not work then here is a script to get sound working:

# Autogenerated python code from HDA-Analyzer that gets sound going:
#!/usr/bin/env python

import os
import struct
from fcntl import ioctl

def __ioctl_val(val):
  # workaround for OverFlow bug in python 2.4
  if val & 0x80000000:
    return -((val^0xffffffff)+1)
  return val

IOCTL_INFO = __ioctl_val(0x80dc4801)
IOCTL_PVERSION = __ioctl_val(0x80044810)
IOCTL_VERB_WRITE = __ioctl_val(0xc0084811)

def set(nid, verb, param):
  verb = (nid << 24) | (verb << 8) | param
  res = ioctl(FD, IOCTL_VERB_WRITE, struct.pack('II', verb, 0))

FD = os.open("/dev/snd/hwC0D0", os.O_RDONLY)
info = struct.pack('Ii64s80si64s', 0, 0, '', '', 0, '')
res = ioctl(FD, IOCTL_INFO, info)
name = struct.unpack('Ii64s80si64s', res)[3]
if not name.startswith('HDA Codec'):
  raise IOError, "unknown HDA hwdep interface"
res = ioctl(FD, IOCTL_PVERSION, struct.pack('I', 0))
version = struct.unpack('I', res)
if version < 0x00010000:        # 1.0.0
  raise IOError, "unknown HDA hwdep version"

# initialization sequence starts here...

set(0x18, 0x707,   0x45) # 0x18070745 (SET_PIN_WIDGET_CONTROL)
set(0x19, 0x707,   0xa5) # 0x190707a5 (SET_PIN_WIDGET_CONTROL)

os.close(FD)

Copy and paste it to a file, ie. hda-intel-mba21.py, and execute the code:

$ sudo python hda-intel-mba21.py

Touchpad

  • Works without modification

Apple keys

  • Volume works
  • Display brightness work for default binary driver, not work after install nvidia driver (with or without pommed).
  • Keyboard backlight work.

Network

  • Wifi works with restricted driver.

Tweaks

  • Keyboard backlight defaut on 100%, change (without pressing F5 for 100s times):

 (as root) echo 0 > /sys/class/leds/smc::kbd_backlight/brightness 

  • Resume from Suspend is very sensitive to the keyboard, and the keyboard is very likely to be pressed when the lid is closed and the machine is in a bag. Disable keyboard Resume by

 (as root) echo OHC1 > /proc/acpi/wakeup 

and make sure "cat /proc/acpi/wakeup" has OHC1 as disabled.

  • Function keys act as in MacOS as default (fn+F1 to actually press F1), change by

 (as root) echo 2 > /sys/module/hid_apple/parameters/fnmode 


CategoryAudio

MacBookAir2-1/Precise (last edited 2014-04-14 03:30:56 by joolli)