Difference between revisions of "Mac"

From ArchWiki
Jump to: navigation, search
m (Touchpad)
m (typo)
Line 72: Line 72:
 
===Frequency Scaling===
 
===Frequency Scaling===
 
* Run 'pacman -S cpufrequtils'
 
* Run 'pacman -S cpufrequtils'
* Add speedstep-centrino (be carefull, since a recent update it seems to be "acpi_cpufreq"), cpufreq_conservative to your MODULES array in /etc/rc.conf
+
* Add speedstep-centrino (be careful, since a recent update it seems to be "acpi_cpufreq"), cpufreq_conservative to your MODULES array in /etc/rc.conf
 
** Modprobe them manually too.
 
** Modprobe them manually too.
 
* Run 'cpufreq-set -c 0 -g conservative' and 'cpufreq-set -c 1 -g conservative'
 
* Run 'cpufreq-set -c 0 -g conservative' and 'cpufreq-set -c 1 -g conservative'
Line 204: Line 204:
 
==Overview==
 
==Overview==
  
I (hackmiester) own(s) a [http://www.apple.com/macbook/macbook.html 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.
+
I (hackmiester) own a [http://www.apple.com/macbook/macbook.html 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==
 
==Setting the scene==

Revision as of 23:46, 11 November 2007


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

Second Option

  • If you don't care about your existing OSX partition, boot up the OSX DVDs and run Disk Utility
  • Partition your drives however you want.
  • Reinstall OSX
  • Continue with the rest of the article

Third Option

  • If you don't care at all about OSX, and just want Linux, you can go ahead and just install Arch normally. You can then skip the sections about rEFIt and you can also install GRUB to /dev/sda.
  • WARNING: This is probably not a good idea. There may be firmware updates in the future to correct stuff. So a better idea would be to install OSX on a smaller partition if you really don't plan on using it.

rEFIt

  • Now we can install rEFIt. This will give us a nice boot menu to choose between OSX and Linux
  • Download the .dmg from -> Refit Homepage and install it.

Install

  • Get the latest Arch Linux 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, or just pick it from the rEFIt menu.
  • Note: Sometimes the keyboard wont work after you start to boot the CD. The only options are to either get a USB keyboard, which will work all the time, or keep rebooting until it works.
  • 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'
  • NOTE: If you get an error when installing grub, run the following commands
# Replace the '3' with whatever your root partition is (i.e. sda4 -> 4)
# 83 is for ext2/3, if you have something else, type sfdisk -T for a list of partition types
# 
$ sfdisk -c /dev/sda 3 83
$ gptsync /dev/sda
  • If you get an error again when installing grub, just keep trying those commands, it will work eventually.
  • Reboot, choose the correct icon in rEFIt, and enjoy yor new Arch MacBook!

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'

You may also want to install gpomme which is GUI for pommed daemon. Edit then ~/.gpommerc and add gpomme to startup (it's not a daemon).

By default the F1, F2 ... FX keys are disabled and act like Fn+F1, Fn+F2 ... To enable the keys and make use of Fn+FX, modify /etc/pommed.conf.mactel or /etc/pommed.conf.pmac by changing fnmode = 1 to fnmode = 2. Save it as pommed.conf and restart pommed with /etc/rc.d/pommed restart.

To enable the sound keys (Fn+F3, Fn+F4 and Fn+F5), you have to modify /etc/pommed.conf : change init = -1 to init = 80 and (at least on Macbook 2) change volume = "PCM" to volume = "Front" and after that restart pommed with /etc/rc.d/pommed restart. (Thanks to the Debian Wiki)

Frequency Scaling

  • Run 'pacman -S cpufrequtils'
  • Add speedstep-centrino (be careful, since a recent update it seems to be "acpi_cpufreq"), 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/fan1_manual'
  • As root type 'echo 3500 > /sys/devices/platform/applesmc/fan1_output'
    • 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.
(I've wrote simple app in C to keep my macbook cold. It's written for xfce4-genmon-plugin, but you can also use it with conky, cron or anything else.) -- Husio 16:38, 30 June 2007 (EDT)

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

With 7.3 version of x.org and kernel 2.6.22 or later, it should work out of the box. However, if it doesn't for some reason, try these steps:

  • First you must add, appletouch, usbhid, and tsdev modules to the MOD_BLACKLIST array in rc.conf. (This is because udev loads the modules in random order)
  • 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.
  • NOTE: The two fingered scrolling with the synaptics driver is not very good right now, so if you set VertTwoFingerScroll and HorizTwoFingerScroll to "false" then the left and bottom edges of the touchpad will scroll horizontally and vertically.

The Debian Wiki has also a few suggestions on how to configure right-clicking and scrolling.

iSight

There is linux-uvc-isight in the AUR. Follow the instructions printed in the post-install, and then load the 'uvcvideo' module and add it to your /etc/rc.conf if you want it to load at boot. You can find the driver here.

Apple Remote

Load the 'appleir' module (or add it to the MODULES array in /etc/rc.conf). Then run xev to check the signals, or copy this to ~/.Xmodmap:

keycode 153 = XF86AudioNext
keycode 144 = XF86AudioPrev
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume
keycode 162 = XF86AudioPlay
keycode 158 = XF86Favorites

and run xmodmap ~/.Xmodmap.

Wifi

Ndiswrapper

  • First, install the package like so:
$ pacman -Sy ndiswrapper
  • The Lenovo Thinkpad 802.11abgn driver works well with the MacBook. The driver can be found on this page.
$ wget -c ftp://ftp.software.ibm.com/pc/pccbbs/mobiles/7iwc28ww.exe
  • You need 'cabextract' to extract the file. Get it with pacman.
$ pacman -S cabextract
$ cabextract <filename>
# Replace <path/to/driver> with the .inf file from the .exe
# If using the Lenovo Thinkpad 802.11abgn driver then replace <path/to/driver> with WINXP_2K/NET5416.INF
$ ndiswrapper -i <path/to/driver>
# The below command may have already been executed during installation of the ndiswrapper application, but run it anyway just to be sure
$ ndiswrapper -m
# Verify your driver has been installed properly
$ ndiswrapper -l
  • Now you can add 'ndiswrapper' to your MODULES array in /etc/rc.conf.
    • Load it manually:
$ modprobe ndiswrapper

Madwifi

  • Primary method of installation:

First, install the madwifi driver and madwifi-utils:

$ pacman -Sy madwifi madwifi-utils

Then, you can load the 'ath_pci' module. You can also add it to the MODULES list in /etc/rc.conf if you want it to load on a normal boot.

$ modprobe ath_pci

And if everything is ok, you should see something like this:

$ ifconfig             
 ath0    Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
         inet6 addr: fe80::219:e3ff:fed4:be51/64 Scope:Link
         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:0 
         RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
  • Some MacBook users have reported more success when downloading and installing from SVN. An Arch Linux contributor is currently maintaining a madwifi-svn package that can be compiled and installed with ABS, and can be found here.

First Gen MacBook

Overview

I (hackmiester) own 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)