Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Apple MacBook support on FreeBSD ====== This project aims to bring %%FreeBSD%% more compatible with Apple hardware (mostly %%MacBooks%%). Originally, it was part of Google Summer of Code 2007. ---- ====== Recommended drivers ====== * cpufreq(4) * coretemp(4) * asmc(4) * new USB stack * Xorg intel driver ---- ====== FreeBSD 8.0/8.1 issues ====== (Fixed in r215896, should work in 8.2) ====== NVIDIA MCP89 issues ====== Recent %%MacBook%% Pro and Mac Mini with NVIDIA MCP89 cannot find SATA drives. Linux added a workaround ([[https://bugzilla.kernel.org/show_bug.cgi?id=15923]]) and we may need a similar hack until correct fixes are found. ====== sysinstall issues ====== %%MacBooks%% use the gpt partition scheme, which includes a compatibility fdisk table. sysinstall understands only the fdisk portion of this label, and may improperly rewrite it during the install. You will need to record the original fdisk layout manually before install so that you can later restore it. Both printing and restoring the fdisk table may be done from fixit mode. ====== Plain installation on Macbook Pro ====== Use bootcamp to set aside space for %%FreeBSD%%. Boot the release CD/DVD by holding down the alt/option key (3rd from the left in bottom row) and selecting the "Windows CD" Enter Fixit mode use fdisk(8) to print MBR layout it will look something like: <code> The data for partition 1 is: sysid 238 (0xee),(EFI GPT) start 1, size 4096639 (200 Meg), flag 0 beg: cyl 1023/ head 254/ sector 63; end: cyl 1023/ head 254/ sector 63 The data for partition 2 is: sysid 175 (0xaf),(HFS+) start 409640, size 167510016 (81792 Meg), flag 0 beg: cyl 1023/ head 254/ sector 63; end: cyl 1023/ head 254/ sector 63 The data for partition 3 is: sysid 11 (0x0b),(DOS or Windows 95 with 32 bit FAT) start 168181800, size 66259808 (32353 Meg), flag 0 beg: cyl 1023/ head 254/ sector 63; end: cyl 1023/ head 254/ sector 63 The data for partition 4 is: <UNUSED> </code> Copy this information down, you may need it later. Exit fixit mode and install %%FreeBSD%% into slice 3 using sysinstall. Do not change the slices in the Fdisk editor, they must match the GPT which sysinstall does not show. Do not install bootcode, choose "None". Once installation is over, enter Fixit mode again Use fdisk(8) to correct the sysid, start, size and beg/end for slice 1 & 2 per the information you previously recorded with fdisk. Check that slice 3 has sysid 165 and flags 0x80. Run "gpart show ad4" and verify block numbers match those shown by fdisk. To select which OS boots, hold down the alt/option during startup and live with the fact that it calls %%FreeBSD%% for "Windows" ---- ====== FreeBSD-only Installation with ZFS ====== * Boot the 8.0 %%LiveFS%% memstick (use [[http://www.rodsbooks.com/refind/|rEFInd]] to boot it). * Gain a shell by selecting the "Fixit" menu entry * If you only want %%FreeBSD%% on your system you might as well lose the GPT: <code> # gpt destroy adX </code> * Issue the following commands: <code> # kldload /mnt2/boot/kernel/zfs.ko # mkdir /boot/zfs # fdisk -BI ad5 # bsdlabel -wB ad5s1 </code> * Create partions/newfs as described in [[ZFSOnRoot]] * Issue the following commands: <code> # zfs create tank/usr tank/home # cp -R /mnt2/boot /tank/bootdir # cp -R bin etc lib libexec rescue root sbin tmp usr var /tank # mkdir /tank/dev # chmod 1777 /tmp # echo 'zfs_load="YES"' > /tank/boot/loader.conf # echo 'vfs.root.mountfrom="zfs:tank"' >> /tank/boot/loader.conf </code> * Edit your ''%%/tank/etc/fstab%%'' as explained in [[ZFSOnRoot]] * Issue the following commands: <code> # umount /tank/bootdir # zfs set mountpoint=legacy tank # zfs set mountpoint=/usr tank/usr # zfs set mountpoint=/home tank/home # mount /dev/adXs1a /mnt # cp /boot/zfs/zpool.cache /mnt/boot/zfs # reboot </code> * Now your system should boot on zfs. * Reinstall the system using source build or install CD1. Make sure you do this last step because your system is not fully functional yet and is insecure. File permissions are wrong because we copied the files from the CD. ---- ====== Xorg configuration ====== For the %%MacBooks%% you need to use the "intel" Xorg driver. For %%MacBook%% Pros you need to use the "radeon" driver. ---- ====== Backlight (non Pro MacBooks) ====== Xorg is now capable of handling the backlight brigthness via ''%%XrandR%%'' API and the ''%%xbacklight(1)%%'' application. You may need to type: <code> $ xrandr --output LVDS --set BACKLIGHT_CONTROL combined </code> with Intel cards. **It's recommended that you use X.org 7.2+ as it can shutdown the LCD backlight via DPMS (e.g.: ''%%xset dpms force off%%'').** ---- ====== Keyboard ====== X.org 7.2+ supports Apple %%MacBook%% keyboards (English and International). Example: <code> Option "XkbRules" "xorg" Option "XkbModel" "macbook79" Option "XkbLayout" "pt" </code> The ''%%Enter%%'' key (located near the right Apple key) is the substitute for ''%%Alt Gr%%''. ===== Eject button ===== The eject button is better handled with the ''%%usbhidaction%%'' userland utility. Create, for example, ''%%/etc/usbhidaction.uhid0%%'' with the following contents: <code> Consumer:Consumer_Control.Consumer:Eject 1 0 umount /cdrom && cdcontrol eject </code> Then add the following to ''%%/etc/rc.local%%'': <code> /usr/bin/usbhidaction -f /dev/uhid0 -c /etc/usbhidaction.uhid0 </code> And the eject key should work fine now. ---- ====== Touchpad ====== The ums(4) driver present in %%FreeBSD%% 8.0 should allow you to move the mouse and press the only button. Use the atp(4) driver in %%FreeBSD%% 9.0 to get multi finger tapping, among other things. You should ensure that moused is only attaching to /dev/atp0, not /dev/ums0 too; use ps to check otherwise it will be jerky and unreliable. ---- ====== IR receiver ====== ''%%aird(1)%%'' stands for "Apple IR daemon" and is the utility you need if you want to control your computer via the Apple Remote. It's available at http://svn.freebsd.org/viewvc/base/user/rpaulo/aird/ , or use the port ''%%sysutils/aird%%''. This is a straight copy & paste of the EXAMPLES section of the aird(1) man page: <code> EXAMPLES To pair a remote controller with your IR receiver, do the following: aird -f /dev/uhid1 -k 0 Then press the Menu and Forward keys at the same time for five seconds. The following will show up: Your Apple remote pairing key is: 131 Next time you run aird, pass this number as the -k argument. This example shows how to control mpd(1) with aird(1). You need mpc(1) and ncmpc(1) installed. Run aird(1) from your ~/.xinitrc startup file like this: aird -p ~/.aird.pid -f /dev/uhid1 -P "mpc toggle" -F "mpc next" \ -B "mpc prev" -U "mixer vol +2" -D "mixer vol -2" \ -M "xterm -e ncmpc" If you want to stop other users from gaining control of the IR receiver and to prevent commands to be executed when someone presses a button on the remote control, run aird(1) only with the -f argument: aird -f /dev/uhid1 </code> ---- ====== System Management Controller ====== The System Management Controller (SMC for short) is a device that allows you to read the temperatures, fan speed and keyboard backlight status. It also lets you control the fan minimum and maximum speed and the keyboard backlight on/off status. On boot, you should see something like: <code> asmc0: <Apple SMC MacBook Core Duo> at irq 6 on isa0 asmc0: [FILTER] </code> All the values are exported via ''%%sysctl%%'' in the ''%%dev.asmc%%'' tree: <code> dev.asmc.0.%desc: Apple SMC MacBook Core Duo dev.asmc.0.%driver: asmc dev.asmc.0.%parent: isa0 dev.asmc.0.fan.0.speed: 3083 dev.asmc.0.fan.0.safespeed: 1200 dev.asmc.0.fan.0.minspeed: 1500 dev.asmc.0.fan.0.maxspeed: 6200 dev.asmc.0.fan.0.targetspeed: 3070 dev.asmc.0.temp.enclosure: 34 dev.asmc.0.temp.northbridge1: 55 dev.asmc.0.temp.northbridge2: 56 dev.asmc.0.temp.heatsink1: 65 dev.asmc.0.temp.heatsink2: 64 dev.asmc.0.temp.memory: 53 dev.asmc.0.sms.x: 23 dev.asmc.0.sms.y: 8 dev.asmc.0.sms.z: 273 </code> Note that currently there's no way to set Fan speeds. It will be fixed later. Also, when the laptop is moved or receives a shock, you'll see on the ''%%dmesg%%'': <code> asmc0: WARNING: possible shock! asmc0: WARNING: possible shock! asmc0: WARNING: high acceleration detected! asmc0: WARNING: high acceleration detected! asmc0: WARNING: high acceleration detected! asmc0: WARNING: high acceleration detected! asmc0: WARNING: high acceleration detected! asmc0: WARNING: high acceleration detected! asmc0: WARNING: high acceleration detected! </code> Just hope that your ''%%dmesg%%'' doesn't display "free fall", or you'll probably be in trouble. If you want a fancy Qt3 status monitor for ''%%asmc(4)%%'', I've created ''%%asmcgui%%''. Get it from http://people.freebsd.org/~rpaulo/asmcgui.tgz . ---- ====== Bluetooth ====== The Bluetooth controller works out of the box, but needs to be switched to HCI mode. The reason for this is explained at: http://times.usefulinc.com/2004/06/12-hidproxy Find the bluetooth controller's address; <code> # dmesg |grep ugen </code> Look for the possibly unidentified one, perhaps with vendor ''%%0x05ac%%''. The bus number and address are found here as ''%%ugen%%''//X//.//Y// Add to rc.conf: <code> ubthidhci_enable=yes ubthidhci_busnum=X ubthidhci_addr=Y </code> Run ''%%service ubthidhci start%%''. ''%%uhid2%%'', ''%%ukbd1%%'' and ''%%ums1%%'' should now be gone and ''%%ubt0%%'' should now show up. After ''%%ubt(4)%%'' recognizes de the device, just follow the Handbook on how to configure Bluetooth under %%FreeBSD%%: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-bluetooth.html ---- ====== Splash screen boot image ====== <callout type="warning"> **Outdated?** </callout> If you are fond of a splash screen during system boot and would like to show your appreciation for this project here's an image you can use: {{applemacbook/mac.pcx?linkonly|mac.pcx}} . This is a 1024x786 PCX image, so you need ''%%splash_pcx%%'' kernel module and ''%%options VESA%%''. After that, copy the image to your ''%%/boot%%'' directory and edit ''%%/boot/loader.conf%%'' to include the following: <code> splash_pcx_load="YES" bitmap_load="YES" bitmap_name="/boot/mac.pcx" </code> This image was created by Daniel Bento. The %%FreeBSD%% logo and The Power to Serve are trademarks of The %%FreeBSD%% Foundation. ---- ====== FAQ ====== ===== Help, I can't boot anything! / BootCamp stopped working! ===== A: Most likely your EFI partition (partition 1) is not correctly defined. Both Apple's firmware and Boot Camp are picky about this. Long story short, your first partition should be: <code> The data for partition 1 is: sysid 238 (0xee),(EFI GPT) start 40, size 409600 (200 Meg), flag 0 beg: cyl 0/ head 0/ sector 41; end: cyl 406/ head 6/ sector 14 </code> If you can't boot anything, try using the %%FreeBSD%% Install CD, choose the Fixit menu, and fix partition 1 with ''%%fdisk(1)%%'' so that it looks like the example above. On Mac OS X use: ''%%fdisk /dev/disk0%%'' On %%FreeBSD%% use: ''%%fdisk ad5%%'' or ''%%fdisk ad0%%'' If your GPT is also damaged, here's one example to help you out: <code> % gpart show ad5 => 34 234441581 ad5 GPT (112G) 34 6 - free - (3.0K) 40 409600 1 efi (200M) 409640 192498608 2 apple-hfs (92G) 192908248 262144 - free - (128M) 193170392 41271216 3 freebsd (20G) 234441608 7 - free - (3.5K) % gpart show -r ad5 => 34 234441581 ad5 GPT (112G) 34 6 - free - (3.0K) 40 409600 1 c12a7328-f81f-11d2-ba4b-00a0c93ec93b (200M) 409640 192498608 2 48465300-0000-11aa-aa11-00306543ecac (92G) 192908248 262144 - free - (128M) 193170392 41271216 3 516e7cb4-6ecf-11d6-8ff8-00022d09712b (20G) 234441608 7 - free - (3.5K) </code> ===== Wired network seems to hang ===== If you see msk(4) watchdog timeouts, try disabling MSI in ''%%/boot/loader.conf%%'': <code> hw.msk.msi_disable=1 </code> And then, reboot. ===== AHCI (disk) controller times out ===== Similarly, if you get MSI timeouts writing to internal storage, try disabling MSI in ''%%/boot/loader.conf%%'' (or at the loader prompt): <code> hint.ahci.0.msi=0 </code> and reboot. ====== References ====== * [[https://forums.freebsd.org/threads/apple-macbook-pro-touchpad-configuration.50170/|Apple MacBook Pro: touchpad configuration (FreeBSD Forums)]] ---- {{tag>Apple InactiveProject HowTo}} applemacbook.txt Last modified: 2019/04/02 05:39by TrevorRoydhouse