Mac

From ArchWiki
Jump to navigation Jump to search


Second Gen MacBook (Core2Duo)

Here is what I did to get a dual boot (MacOSX & Arch 0.8b2) running on my MacBook.

Partitioning

  • In MacOSX, download Boot Camp.
  • Install it, then run the Boot Camp Assistant
  • Partition your hard drive however you like

Install

  • Get an ArchLinux 0.8 FTP install CD
  • Put it in your MacBook and reboot. Make sure you hold down 'c' during booting, so it will start from the CD.
  • Configure your network
  • Open /etc/pacman.conf in your favorite editor, and uncomment the community repository.
  • Since archlinux.org is throttled now, open /etc/pacman.d/current and /etc/pacman.d/community and move a fast mirror to the top.
  • Run 'pacman -Sy refit parted'

Partitioning Part 2

  • Type 'parted /dev/sda'
  • Type 'p' to see the current partition table
  • NOTE: DO NOT TOUCH THE 1st and 2nd PARTITIONS!
  • You can safely delete the third partition, so type 'rm 3'
  • Now we can make one partition for swap, and one for root.
  • For swap, type 'mkpart primary linux-swap <START> <END>'
    • For <START> and <END> use the count in MBs of where you want your partition to start
  • Same for root, type 'mkpart primary ext2 <START> <END>'
  • Type 'quit' to exit.
  • Then sync your partition tables, type 'gptsync /dev/sda'
  • Then start installation '/arch/setup'

Installation

  • Install everything normally, until you get to the bootloader, choose GRUB
  • MAKE SURE YOU INSTALL GRUB ONTO YOUR ROOT PARTITION (i.e. /dev/sda4)
  • DO NOT, I REPEAT, DO NOT, INSTALL ONTO /dev/sda!!!
  • After that, sync your partition tables one more time for good measure 'gptsync /dev/sda'
  • Reboot back into OSX one last time

rEFIt

  • Now we must install rEFIt. It is possible to install this before partitioning and such, but for some reason, my keyboard wont work in the livecd with it installed. So install it now.
  • Download the .dmg from -> [Homepage] and install it.
  • Then reboot, you should see an icon for Linux, select it and boot into your new system!

Post Install

Backlight Control

  • Install the 'pommed' program from community
  • Put 'pommed' in your DAEMONS array in /etc/rc.conf
  • Start it manually with '/etc/rc.d/pommed start'

Frequency Scaling

  • Run 'pacman -S cpufrequtils'
  • Add speedstep-centrino, cpufreq_conservative to your MODULES array in /etc/rc.conf
    • Modprobe them manually too.
  • Run 'cpufreq-set -c 0 -g conservative' and 'cpufreq-set -c 1 -g conservative'
    • Put them in /etc/rc.local to set them on boot

Fan Speed

  • The fan doesn't seem to change speeds with the temperature. We can (somewhat) fix this
  • Add 'applesmc' to your MODULES array in /etc/rc.conf
    • Modprobe it too
  • This creates a bunch of magic files in /sys/devices/platform/applesmc
  • As root type 'echo 1 > /sys/devices/platform/applesmc/fan0_manual'
  • As root type 'echo 3500 > /sys/devices/platform/applesmc/fan0_target_speed'
    • You may want to add this to your /etc/rc.local
    • The number can be anywhere from 1800 to 6200.
    • I find that for normal use, 3500-4000 is good.
    • When it gets really hot, 4500-5000 is good.
    • I'm going to try and write a script to deal with this better.

Temperature Sensors

  • To go along with this, we should be able to read from the temperature sensors.
  • Type 'pacman -S lm_sensors'
  • To autodetect sensors type 'sensors-detect'
  • In /etc/modprobe.conf add:
alias char-major-89 i2c-dev
  • In /etc/rc.local add:
modprobe i2c-i801
modprobe eeprom
modprobe coretemp
sensors -s
  • Now you can type 'sensors' to see your core temperatures.

X11

  • Type 'pacman -S xorg xf86-video-i810 915resolution
  • Type 'X -configure'
  • Open /etc/conf.d/915resolution in your editor, uncomment the 'MODE' and 'RESOLUTION'.
  • Set the RESOLUTION to '1280 800'
  • Add 915resolution to your DAEMONS array in /etc/rc.conf
    • Start it manually with /etc/rc.d/915resolution start

Touchpad

  • First you must add, appletouch, usbhid, and tsdev modules to the MOD_BLACKLIST array in rc.conf
  • Then add appletouch, usbhid to MODULES array IN THAT ORDER.
  • Type 'pacman -S synaptics'
  • Add this to your xorg.conf:
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "CorePointer"
Option "Device" "/dev/input/mouse1"
Option "Protocol" "auto-dev"
Option "LeftEdge" "100"
Option "RightEdge" "1100"
Option "TopEdge" "50"
Option "BottomEdge" "300"
Option "FingerLow" "20"
Option "FingerHigh" "30"
Option "MaxTapTime" "150"
Option "MaxTapMove" "90"
Option "MaxDoubleTapTime" "180"
Option "VertScrollDelta" "25"
Option "HorizScrollDelta" "30"
Option "VertTwoFingerScroll" "true"
Option "HorizTwoFingerScroll" "true"
Option "FastTaps" "true"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "MinSpeed" "0.5"
Option "MaxSpeed" "3.5"
Option "AccelFactor" "0.15"
EndSection
  • Add the mouse to the "ServerLayout" also.

iSight

There is linux-uvc-isight in the AUR, follow the instrucion printend in the post install and then load the uvcvideo module

Wifi

Dual Monitors

First Gen MacBook

Overview

I (hackmiester) own(s) a MacBook from Apple. Actually, that link is inaccurate - I own a first generation MacBook, while Apple now sells a second generation. In any case, I ran into a few pitfalls as I installed Arch on my MacBook and I'm going to share here how I got Arch running smoothly. Even if you DO have a second gen MacBook, trying these instructions probably won't hurt anything. (If it does, it's not my fault, though!) You might even find these helpful if you have any other kind of Intel Mac.

Setting the scene

Before I started this process, I'd partitioned my MacBook in two using Boot Camp for Mac OS X. This gave me a 10G Windows partition and the rest as a Mac OS X partition.

Step 1 - Partition the disk

Later, when I decided to install Arch, I resized the Windows partition to make room. I used BootIt NG from Terabyte Unlimited. If closed source software makes you uneasy, use parted. Whatever works.

If you use BootIt NG, this process is drop dead easy. If you use parted, you're on your own. :-P

Step 2 - Wonder if your keyboard is broken

After you boot the Arch installation CD-ROM, you will probably find that every letter you type has a long delay, and then comes out double!!! After much Googling, I found this excellent page on the Debian wiki about the MacBook. As that page says, what you want to do is provide the kernel with the "noapic irqpoll acpi=force" options. At the boot prompt, you'd do this:

boot: arch noapic irqpoll acpi=force

Yay, now you can actually run the installer. That's certainly an improvement.

Step 3 - The usual installation... or is it?

Okay, so just when you think everything's going your way, your ethernet adapter isn't detected. Neither my wireless or wired were detected. There was an eth0 interface, however. Dmesg revealed that to be an IP over 1394 device that takes advantage of Apple's FireWire in the MacBook.

I found it odd that the FireWire works but the Ethernet doesn't.

You might be thinking, "But hackmiester! A network connection isn't required for the installation!" However, it IS required if you are like me and have the crappiest Internet link ever, and just want to get a base system going using the FTP install disc.

Anyway, I wasn't sure how to fix the problem, so I decided to do it the hard way. Here's what I did on another laptop with FireWire:

[hackmiester@99-AFZ00 ~]$ dmesg | grep 1394
ieee1394: Initialized config rom entry `ip1394'
ohci1394: fw-host0: OHCI-1394 1.1 (PCI): IRQ=[11]  MMIO=[c0215000-c02157ff]  Max Packet=[2048]  IR/IT contexts=[4/8]
ieee1394: Host added: ID:BUS[0-00:1023]  GUID[00061b032400b0b4]
eth1394: eth2: IEEE-1394 IPv4 over 1394 Ethernet (fw-host0)

Hey, looks like I already have eth1394 loaded! (If you don't, just sudo modprobe eth1394 .) According to that line, it's on eth2. So, let's get the configuration for eth2.

[hackmiester@99-AFZ00 ~]$ ifconfig eth2
eth2      Link encap:UNSPEC  HWaddr 00-06-1B-03-24-00-B0-B4-00-00-00-00-00-00-00-00  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

It doesn't have an IP or anything. Good. Now we can give it the one we want. I'm gonna use 192.168.10.1 because you probably don't already have that on your network. I didn't.

[hackmiester@99-AFZ00 ~]$ sudo ifconfig eth2 192.168.10.1 netmask 255.255.255.0 broadcast 192.168.10.255
[hackmiester@99-AFZ00 ~]$ ifconfig eth2
eth2      Link encap:UNSPEC  HWaddr 00-06-1B-03-24-00-B0-B4-00-00-00-00-00-00-00-00  
          inet addr:192.168.10.1  Bcast:192.168.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

OK, now our FireWire network interface has an IP. :D Now we have to tell that box to be an Internet gateway. My wireless Internet's on eth1. Adjust this if yours isn't.

[hackmiester@99-AFZ00 ~]$ sudo iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
sudo: iptables: command not found

Uh... whoopsy.

[hackmiester@99-AFZ00 ~]$ sudo pacman -Sy iptables
:: Synchronizing package databases... 
 current                  [#################################################################################################################################################] 100%      71K    19.6K/s  00:00:03
:: extra is up to date
:: unstable is up to date
 community                [#################################################################################################################################################] 100%     151K    25.2K/s  00:00:05
 danimoth                 [#################################################################################################################################################] 100%       2K    14.0K/s  00:00:00

Targets: iptables-1.3.7-1

Total Package Size:   0.3 MB

Proceed with upgrade? [Y/n] 

:: Retrieving packages from current...
 iptables-1.3.7-1         [#################################################################################################################################################] 100%     321K    26.6K/s  00:00:12

checking package integrity... done.
loading package data... done.
checking for file conflicts... done.
installing iptables... done.
[hackmiester@99-AFZ00 ~]$ sudo /etc/rc.d/iptables start
Cannot load iptables rules: /etc/iptables/iptables.rules is missing!

Dammit! More problems!

[hackmiester@99-AFZ00 ~]$ sudo cp /etc/iptables/empty.rules /etc/iptables/iptables.rules

THERE. Now we have a basic iptables configuration in place. So let's start up iptables and configure it to forward packets and stuff.

[hackmiester@99-AFZ00 ~]$ sudo modprobe ip_tables
[hackmiester@99-AFZ00 ~]$ sudo modprobe iptable_filter
[hackmiester@99-AFZ00 ~]$ sudo /etc/rc.d/iptables start
:: Starting IP Tables [done]
[hackmiester@99-AFZ00 ~]$ sudo iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
[hackmiester@99-AFZ00 ~]$ sudo iptables --append FORWARD --in-interface eth2 -j ACCEPT
# (not finished yet)

We should now be forwarding packets. To test this, I plugged the MacBook into the FireWire cable and gave it an IP. Then I tried to connect to the Internet.

(not finished yet)