Arch linux single, pure efi boot on the macbook air3,1/3,2

Status
11-04-17: haven’t found any time to update anything. school and work is still getting in the way, have literally been at the uni every day since last update.
11-03-02: Tiny typos and some other stuff. the upcoming three weeks are insane so probably won’t be any updates during that time.
11-02-26: woha.. long time no see! did a reinstallation today with the new archboot and updated the packages- and kernel-section. will update the link to the new archboot later.
11-01-31: ran into another site which i remembered visiting while getting the mba to work.. so thats another reference!
11-01-29: The grub2-efi pkg has been moved to the official testing repo, again Keshav (skodabenz) provided the updated info. Also added the reference Debian on the MacBookAir3,1, it really was a good reference while installing.. dunno why i forgot it!
11-01-28: added a link to the grub2 article in archwiki, thank you Keshav (skodabenz) for the info (see comment). sorry bout the delay, school and work getting in the way again.
11-01-17: just remembered that you might need to sudo the dd in os x.
11-01-16: Added new (empty) section regarding hotkeys and one (with a quick pointer, not done) for offline installs.
11-01-15: Updated the empty sections with some pointers, far from a full guide yet tho.. but haven’t got more time than this right now.
11-01-11: First couple of sections published.

 

TOC

Work in progress, disclaimer, etc etc
Hardware needed
Software needed
Preparations for offline installation
USB preparation
Archbooting
Preparing the drive
Installing packages
Installing the mba3 kernel
Installing grub2
Blessing your installation
Post installation
The nvidia drivers
Hotkeys
References

 

Work in progress, disclaimer, etc etc
This guide is far from done, still missing a bunch of sections and is not very well written.. and as always, if your macbook air should burst into flames, grow legs and go on a murderous rampage or just plainly slap you in the face – stop using guides you find on the internet!
also, <enter> or <tab> means the keys “enter” or “tab”..
enjoy!

 

Hardware needed

> Macbook air 3,1 or 3,2 (duh!)
> usb-to-ethernet adapter (unless you’re doing an offline install)
> mac os x usb stick (the one that comes with the mba)
> two usb sticks > 512mb (or one and an external cd-drive)

 

Software needed

Archboot 2010.12
rEFIt iso
If installing without internet connection
mba3 kernel binaries
grub2 (from skodabenz repo)
> hfsprogs (which requires the libbsd package)
> pommed

 

Preparations for offline installation
All you really have to do is download the packages (including the source and patches for pommed, not just the aur tarball) and store them somewhere..

 

USB preparation
Start by booting into mac os x, download archboot and refit and unpack the latter (which for me got done automatically).
Now plug in your first usb stick (if you only got the one and a cd-drive use the usb here) and fire up the terminal (Applications >> Utilities >> Terminal). First of you need to unmount the volume by typing

diskutil umount /Volumes/your-usb-stick

where your-usb-stick is the name of your usb-stick. when the volume is unmounted you navigate to the folder with the refit-iso which should be called rEFIt-0.14.cdr (the version may vary). if you downloaded it to your home folder you’re already there, otherwise it’s prolly just to

cd Downloads

Now it’s time to write the image to the disk but to make sure you write it to the right one you can run

diskutil info /dev/disk1

alotta info will be listed, there will be a “Vendor”-line which should help you figure out whether it’s the right one, if it’s not just try /dev/disk2,3… til you find the right one (i’ll continue using disk1 here so if that’s not right for you don’t copy the commands!). write the iso to your usb with

dd if=rEFIt-0.14.cdr of=/dev/disk1

if you get an error regarding permissions just slap in a sudo:

sudo dd if=rEFIt-0.14.cdr of=/dev/disk1

after you’re done unmount the disk completely by

diskutil unmountDisk /dev/disk1

and unplug the usb.
Now do the same with your second usb and the archboot iso (plug in, unmount volume, dd if=archlinux-2010.12-1-archboot.iso of=/dev/disk1, unmount disk), if you only got one usb burn the iso to a cd.

 

Archbooting
Plugin both usb sticks (i’ll just stick to the sticks from now on, it’s basically the same if you use a cd), reboot and hold down the option-key (left alt-key, third from the left). You will be presented with a nice graphical menu where you can choose between rEFIt and Mac OS X, select rEFIt. In the next menu, before you go ahead and boot from your usb, step down and select “about rEFIt” (the one in the middle of the smaller icons), in the screen that follows you will see a line which says either

Screen Output:  UGA Draw (EFI 1.10), 1440 x 900

or

Screen Output:  Graphics Output (UEFI), 1440 x 900

if it’s the first one remember to add the lines

set debug=video
insmod efi_gop

to your grub.cfg later on, if it’s the second one

set debug=fb
insmod efi_uga

should be used.. whats grub.cfg? you ask (unless you’re familiar with grub2 =), don’t you worry your sweet little head, we’ll get to that!
Now, go back and boot from your smokin hot archboot usb!
When presented with the Archboot-menu step down to the first x86_64-kernel (not the lts-one!), press <tab> and add the argument reboot=pci to the kernel argument list (feel free to add any kernel args you please, but reboot=pci you gotta have), if you’re on a non-US keyboard the =-sign is located on the first key left of the backspace. Hit enter and the booting will commence!

 

Preparing the drive
When you’re all booted up, unplug the rEFIt-disk and plugin your usb-to-ethernet adapter. Hit enter to get into the installation menu, here you can setup your keyboard and to get your network going you can go down to “3 Select Source”, choose “FTP/HTTP” and “Set up Network”. When that’s done return to the main menu and select “Exit Install”.. were gonna do this by hand! you’re now all alone on the ever so scary command line! but fear not little one, i shall guide you through this.. start gdisk by entering the command

gdisk /dev/sda

We use gdisk, as opposed to fdisk since we want to have a gpt and not mbr. if you’re interested in the differences see the references section.
if you want some kinda clue of what you’re doing hit “?”<enter> (without the quotes) and read through the different commands, otherwise just go ahead and do as i tell you, minion!
This is the moment of truth, here you will erase all your data from the drive! if you’re ready to do this hit “o”<enter> (without the quotes), this will erase your current partition-scheme. After that hit “n”<enter><enter><enter>+100MiB<enter>af00<enter> (without the quotes) this will, if i remember the number of <enter>s correctly create a (ridiculously big, but im really not sure how big grub2 can get) Apple HFS/HFS+ partition at the beginning of your drive..
if you’re an experienced user you can now go ahead and partition your drive as you please, i will however assume that your using a boot partition (here it’ll be formatted with ext2).
Here is the setup i use

Number  Size      Code  Name
1       64 MiB    AF00  Apple HFS/HFS+
2       100 MiB   0700  Boot
3       4 GiB     8200  Linux Swap
4       11 GiB    0700  Root
5       98 GiB    0700  Home

You should be able to create a similar layout, use “n” to create new partitions, select the default partition numbers and start sectors, when asked for “Last sector” enter +SizeKiB/MiB/GiB and the “Hex code”s are the ones listed above under Code.
If you want to change the partition’s name use the command “c”<enter>. It’s wise to first print out the layout (“p”<enter>), that way you dont have to remember the partition numbers.
when you’re happy with your layout, verify it with “v”<enter> (without the quotes). unless you’ve made some funky layout you’ll probably be fine. to write it to disk use “w”<enter>.. if the writing is successful you’ll be back on the command line.

 

Installing packages
Start the setup again by

/arch/setup

Step down to alternative number 2 Prepare Hard Drive and press <enter>. In the new menu you select the 4:th alternative, Set Filesystem Mountpoints. Here you’ll have your newly created partitions, all you have to do is to press ok and the select your swap-partition, root and others. If you’re using the same layout as me then swap is /dev/sda3, root is /dev/sda4, after that you’re asked to select any additional partitions; start by selecting /dev/sda2 and enter the mountpoint /boot (I used the filesystem ext4 for boot, root and home without any extra parameters). Then do the same for /dev/sda5 but with the mountpoint /home (labels are practical, use them), skip the hfs+-partition – well get to that later. When you’re done, select DONE, look over your mount-options and if theyr all ok then proceed. What kind of device name scheme you want is completely up to you, i use UUIDs.
When you’re done with this return to the main menu and proceed by selecting source, this you’ll have to manage on your own!
Now you select the packages you want, i went for “base”, “base-devel” and nothing else. When you’re done selecting packages just continue by installing them.. After that configure your system (if you’re on a non-english system remember to set up your /etc/rc.conf and /etc/locale.gen).
So far this part has been pretty standard but now it’s time to enter the darkness again, so when you’re done configuring your system dont install any bootloader but exit..

 

Installing the mba3 kernel
To install the kernel into your new system you first have to chroot into it, but before we do that we have to make some preparations. First of we mount our “real” /dev onto our new one:

mount --bind /dev /tmp/install/dev

other than that we also need a sysfs and a proc:

mount -t proc /tmp/install/proc
mount -t sysfs /tmp/install/sys

now were ready to start messing about so we chroot in:

chroot /tmp/install

The first thing you need to do if you’re installing with an internet connection is to set it up,

dhcpcd -d eth0

(The -d is for debug, gives a more verbose output). if you’re not, just install your kernel and continue. When you’re connected download and install the kernel and the headers by issuing the following commands

wget -O kernel26-mba3-2.6.37-1-x86_64.pkg.tar.xz http://www.dm9.se/?dl_id=11
wget -O kernel26-mba3-headers-2.6.37-1-x86_64.pkg.tar.xz http://www.dm9.se/?dl_id=12
pacman -U kernel26-mba3-2.6.37-1-x86_64.pkg.tar.xz
pacman -U kernel26-mba3-headers-2.6.37-1-x86_64.pkg.tar.xz

If you trust the internet, here embodied by me, blindly you can now uninstall the old kernel.. or you can keep it until you’re done installing!

 

Installing grub2
this is not done yet, but here’s what you gotta do:
install hfsprog and mkfs.hfsplus /dev/sda1, mkdir /efi and mount it there then mkdir /efi/EFI. install grub2-efi-x86_64 then follow the instructions on the GRUB2 page page on the wiki (see “Bootloader Installation for UEFI systems”)..

 

Blessing your installation
This is pretty much a one step procedure but i’ll cover it better later (as with the other ones):
plugin your mac os x usb stick and reboot into os x. start the terminal and

bless --folder=/Volumes/something --file=/Volumes/something/EFI/grub2/grub.efi --setBoot

(see how i stole that from TestingOnMacbook) where something is the name of your volume.
ya done!

 

Post installation
Set up the necessary symbolic links to masquerade the mba3-kernel as a regular one.. not a great way to do it but i didn’t think of it until now.

 

The nvidia drivers
still haven’t got this done..

 

Hotkeys
Just started messing around with pommed..

 

References

Testing grub2 on macbook
skodabenz repo (grub2) (the grub2 pkgs have been moved to the official testing repo and this one is no longer available)
archwiki UEFI
archwiki GPT
archwiki Grub2
MacBook Air 3,2 thread on the ubuntu-forum
Debian on the MacBookAir3,1
Pure EFI Linux Boot on Macbooks
pommed (hotkeys)

 

// sluggo

m4s0n501

  1. Keshav (skodabenz) Says:

    Hi, nice article although I do not own a mac. You might want to add a link to this article in archwiki UEFI page. BTW the grub2 PKGBUILDs have undergone various changes (and updated to grub1 1.99~rc1) and will be in testing repo soon. Most of the .install instructions ahve been moved to archwiki GRUB2 page.

    ----------

  2. Keshav (skodabenz) Says:

    The next archboot iso (mostly 2011.02) will have UEFI support in the installer script (currently in git repo), but it will be more generic and may not work in Macs. It mainly uses efibootmgr (similar to bless command) to add boot entry. It is mainly targeted at the new Asus and MSI Sandy Bridge (P67 and H67 motherboards)

    ----------

  3. sluggo Says:

    thank you for the info, itll be great to check out the new archboot! will make sure to add a link in the wiki as soon as the guide is done.

    ----------

  4. Keshav (skodabenz) Says:

    The grub2 efi packages are now in testing repo. The main Archwiki GRUB2 page has been edited but still some fixes are needed. I have deleted skodabenz-arch-grub2 repo.

    ----------

  5. mike dentifrice Says:

    Hey there! Any luck on getting nouveau or nvidia drivers to work while booting in EFI?

    ----------

  6. sluggo Says:

    Neither the latest proprietary nvidia driver nor the nouveau-package have worked so far.. havent had time to mess around with them yet though! as soon as i do get time ill make sure to at least post some pointers.

    ----------

Comment