FreeBSD Setup For MacBook 1,1 and 2,1

FreeBSD with some additional setup can be installed on a MacBook 1,1 or 2,1. This article covers how to do so with FreeBSD 10-12.

Installing

FreeBSD can be installed as the only OS on your MacBook if desired. What you should have is:

Burn the ISO file to the blank CD or DVD. Once done, make sure it's in your MacBook and then power off the MacBook. Turn it on, and hold down the c key until the FreeBSD disc boots.

Once booted, go ahead and select option one. Complete the installer, and at the very end when prompted if you would like to exit to the shell select it. Once in the shell, execute the comand:

gpart set -a active ada0

Note: Depending on your partition setup, this may be different.

Now shutdown your MacBook. Boot it again, and hold down the trackpad button until the DVD or CD ejects. Once ejected swap the disc with the Mac OS X installer disc. Then power off your MacBook and power it on again, holding the c key as before until the installer boots.

Once in the Mac OS X installer in the Menu Bar select Utilites, then Terminal. At the Terminal execute the command:

bless --device /dev/disk0s1 --setBoot --legacy

Note: Depending on your partition setup, this may be different.

Now you can shutdown your MacBook. Next time you turn it on it will boot into FreeBSD.

Setup The Trackpad

The driver for the touchpad has an issue with high IO load and becoming unresponsive on FreeBSD 10-STABLE and newer. This can be fixed by applying a patch to the driver's source code provided by the driver's developer themself, compiling it, and installing it on your system.

You need to download

/usr/src
for your FreeBSD version if the directory
/usr/src
is empty. Do so with the following commands:

rm -rf /usr/src/*
svn checkout http://svn.freebsd.org/base/release/12.0.0/ /usr/src

You can replace

release/12.0.0
with other versions.

Download the atp patch to

/usr/src/sys/dev/usb/input/atp.patch

.

To apply the patch, execute the following commands:

cd /usr/src/sys/dev/usb/input
if [ ! -e atp.c.save ]; then
    cp atp.c atp.c.save
fi
if [ ! -e atp.c.orig ]; then
    patch < atp.patch
fi
if [ ! -e /boot/kernel/atp.ko.save ]; then
    cp /boot/kernel/atp.ko /boot/kernel/atp.ko.save
fi
cd /usr/src/sys/modules/usb/atp
make
kldunload atp
make install
cp /boot/modules/atp.ko /boot/kernel
# protect filesystem in case kld[un]load causes problems. Hasn't happened for
# me with atp, but it's a general habit based on a few bad experiences.
sync
kldunload atp
kldload atp

Now the patch is applied and your touchpad will no longer become unresponsive over high IO load.

Next, add the following lines to /boot/loader.conf:

hw.psm.synaptics_support="1"
moused_enable="YES"
hw.psm.synaptics_support="1"

Then, create the file /etc/X11/xorg.conf with the following commands:

mkdir -p /etc/X11
touch /etc/X11/xorg.conf

Add the following lines to

/etc/X11/xorg.conf
:

Section "InputDevice"
    Identifier      "Mouse0"
    Driver          "mouse"
    Option          "Protocol"      "auto"
    Option          "Device"        "/dev/sysmouse"
    Option          "ZAxisMapping"  "4 5 6 7"
EndSection

Then add the following to the file

/etc/sysctl.conf
:

hw.psm.synaptics.vscroll_hor_area=1300
hw.psm.synaptics.min_pressure: 16
hw.psm.synaptics.max_pressure: 220
hw.psm.synaptics.max_width: 10
hw.psm.synaptics.weight_current: 3
hw.psm.synaptics.weight_previous: 6
hw.psm.synaptics.weight_previous_na: 20
hw.psm.synaptics.weight_len_squared: 2000
hw.psm.synaptics.div_min: 9
hw.psm.synaptics.div_max: 17
hw.psm.synaptics.div_max_na: 30
hw.psm.synaptics.div_len: 100
hw.psm.synaptics.multiplicator: 10000
hw.psm.synaptics.margin_top: 200
hw.psm.synaptics.margin_right: 200
hw.psm.synaptics.margin_bottom: 200
hw.psm.synaptics.margin_left: 200
hw.psm.synaptics.na_top: 1783
hw.psm.synaptics.na_right: 563
hw.psm.synaptics.na_bottom: 1408
hw.psm.synaptics.na_left: 1600
hw.psm.synaptics.window_min: 4
hw.psm.synaptics.window_max: 10
hw.psm.synaptics.tap_max_delta: 80
hw.psm.synaptics.tap_min_queue: 2
hw.psm.synaptics.taphold_timeout: 125000
hw.psm.synaptics.vscroll_hor_area: 1300
hw.psm.synaptics.vscroll_ver_area: -600
hw.psm.synaptics.vscroll_min_delta: 50
hw.psm.synaptics.vscroll_div_min: 100
hw.psm.synaptics.vscroll_div_max: 150

Video Driver

To run in the native screen resolution and install the proper driver, install the intel video driver with the command:

pkg install xf86-video-intel

Then add the following line to /boot/loader.conf:

i915kms_load="YES"
You will need to reboot to apply the changes.

Speaker Headphone Out

When you want headphone audio jack out, add the following lines to the file

/boot/device.hints
:

hint.hdac.0.cad0.nid10.config="as=2 seq=2"
hint.hdac.0.cad0.nid11.config="as=0 seq=2"
hint.hdac.0.cad0.nid12.config="as=4 seq=1"
hint.hdac.0.cad0.nid15.config="as=0 seq=2"
hint.hdac.0.config="gpio0 ovref"

Then add the following to the file

/etc/sysctl.conf
if it does not exist already:


sysctl hw.snd.default_unit=0

You will need to reboot to apply the changes.

Speaker Audio Out

When you want speaker audio output, comment out the headphone audio jack out lines above from the file

/boot/device.hints
so it looks like:

#hint.hdac.0.cad0.nid10.config="as=2 seq=2"
#hint.hdac.0.cad0.nid11.config="as=0 seq=2"
#hint.hdac.0.cad0.nid12.config="as=4 seq=1"
#hint.hdac.0.cad0.nid15.config="as=0 seq=2"
#hint.hdac.0.config="gpio0 ovref"

Then add the following to the file

/etc/sysctl.conf
if it does not exist already:


sysctl hw.snd.default_unit=0

You will need to reboot to apply the changes.

Enable the DVD Drive

Add the following line to the file

/boot/loader.conf
:

hw.ata.atapi_dma="1"

You will need to reboot to apply the changes.