FreeBSD on a MacBook
I bought a brand new MacBook a few weeks ago. Even though a good operating system is already installed, I wanted to get my favorite OS installed, because I was missing several stuff in Mac OSX.
I almost didn't find any information on the web if FreeBSD even boots up on a MacBook. So I downloaded 3 ISOs: 6.1 (stable), 6.2 RC1 and the current snapshot for November. 6.1. The current asked me if I want to panic while the kernel was starting. I pressed N for no, but the keyboard didn't respond. After a few tries I figured out that you need to press the power button to continue booting. Fortunately, 6.2 RC1 booted without a problem that's why I installed 6.2 RC1 .
1. Pre Installation
First I setup a special EFI Boot manager called rEFIt which automatically detects new operating systems etc.
The installation is pretty straight forward.I installed rEFIt onto my harddrive. An other good option is to install rEFIt onto a CD-ROM.
2. Installation
It is not possible to use net install, because no network interface works with the default kernel. Therefore, you should use a standard ISO image and download the the driver for the ethernet card.
The installation will work without a problem.
The FreeBSD boot manager can be installed either in the MBR or onto the root partition. I chose to install it into the root partition, because I wanted to install Windows later and so it doesn't get deleted.
REFIt automatically detects it after the next reboot.
3.Hardware
3.1 Ethernet
Now mount the USB stick or CD-ROM on which the ethernet driver is located and unpack the archive. You will see a file called if_myk.ko. Copy this file to /boot/kernel/ and load the module with
Now you should have a working ethernet interface called myk0. We finally can install some nice software with the ports system :)
Of course, you don't want to load the kernel module „by hand“ after every reboot/boot. So you need to edit /boot/loader.conf and add this line:
Now, it will automatically load the module!
3.2 intel925 and X
After you have installed your favorite window manager and configured X, the maximum resolution you can set will be 1024x748 which isn't any good on a wide screen display.
You can get the native resolution (1280x800) with the package
to see what resolution has what number. In my case I used
to modify the BIOS to the right resolution. After a restart of X, it will use the right resolution. Unfortunately, you need to modify the BIOS after every reboot. Therefore, I added this line to the rc.local
and activated rc.local to start on every reboot.
Another problem you will have is that you have no [ALT GR] Key to get all the wonderful symbols like [] {} | ...
I use the [APPLE] key as a [ALT GR] key! To do this you need to create a Xmodmap file in your home directory:
!! xmodmap for Apple MacBook - German layout
!!
! Let the left apple key act as mode switch
keycode 115 = Mode_switch
! Use the right apple switch as "ALT_GR" key, provides the additional
! characters you find on a tradition pc keyboard (example @)
! !! Also this key acts as right mouse button when used with left apple key
keycode 116 = ISO_Level3_Shift NoSymbol Pointer_Button3
! Use the Delete key correctly
! Maps to center mouse if used with left apple key
keycode 108 = Delete Delete Pointer_Button2
! Page Up/Down
keycode 98 = 0xff52 NoSymbol 0xff55
keycode 104 = 0xff54 NoSymbol 0xff56
keycode 100 = 0xff51 NoSymbol 0xff50
keycode 102 = 0xff53 NoSymbol 0xff57
! Switch keys ( lt/gt <-> circle/accent )
keycode 94 = 0xfe52 0x00b0 0x00ac 0x00ac 0x00ac 0x00ac
keycode 49 = 0x003c 0x003e 0x007c 0x00a6 0x007c 0x00a6
I got this from http://gentoo-wiki.com/MacBook.
Now enter this line in your xinitrc so that the settings will be loaded every time you start x:
xbset m
3.3 Sound
The next thing which doesn't work out of the box is the sound card which is a Intel 82801G High Definition Audio Controller. But, thanks to ariff, who wrote the snd_hda module, you can make it work. Just download the driver from http://people.freebsd.org/~ariff/. I recommend using a precompiled module for your FreeBSD system (either 6 relenge for a 6.x release, or HEAD for the current tree). After downloading and unpacking it, copy the snd_hda.ko file to /boot/kernel/ and edit the /boot/loader.conf:
snd_hda_load="YES"
Next load the modules:
kldload snd_hda
You should have a working sound device now. Do a cat /dev/sndstat to see if it works :)
3.4 Speed Stepping & Battery Life Time
On my last laptop FreeBSD did the speed stepping out of the box, but this time sysctl showed that the cpu was running at full speed, even thought the cpu usage was at 2%. So we need to start powerd by hand. Therefore, add this to your rc.conf:
powerd_flags="-a adaptive -b adaptive"
Now we got the speed stepping to work. But, you will still get an “on battery� runtime of only 2 ½ h. Which sucks!
I haven't yet looked at macbook-backlight control. As soon as I have done that, I will publish it.
3.5 Dual Core: Activating the second core
The standard generic kernel doesn't support SMP. Therefore, you are only using one core at the moment. Let's change that. We only need to recompile the kernel with SMP support.
An generic SMP kernel config already exists in /usr/src/src/sys/i386/conf/SMP-GENERIC
So, if you only want to add SMP support, do a:
make buildkernel KERNCONF=SMP-GENERIC
If you have never compiled a FreeBSD kernel, you better take a look at: Building and Installing a Custom Kernel
After the next reboot both cores should be active. Just take a look at the output of top, you should notice a new column which tells you on which core the process is running.
3.6 WLan
So far, I haven't gotten the atheros wifi card to work.
