Wednesday, October 10, 2007

MacBook

Pros and cons of a MacBook for Linux users

Pros:

  • nice design

  • price is ok

  • comes with the Mac OS X operating system, which is almost as compatible as Windows for many commercial applications but much like Linux on the command line level, thus it is probably the preferable alternative to Windows for Linux users

Debian installation

Single boot - Debian only

Make sure you've received the latest apple updates in OS X. This is needed, because the latest updates include a BIOS compatibility layer, we are going to use to boot Debian.

Boot from the CD, you might have to hold C while booting. Before setting up partitions in the installer, press ALT+F2. At the prompt, you are going to wipe the whole disk:

# dd if=/dev/zero of=/dev/sda

This clears the whole disk (remember: all data is lost) and, most importantly, it deletes the GPT partition table. This command may take a while (or forever?). However, it seems to be sufficient to let it run for some time, so that the beginning of the disk is cleared. Then you can interrupt it with Ctrl-c. It is probably not wise to let it run and continue with the installation on the first console simultaneously.

(If you change your mind now and want to go back to Mac OS X without Linux, you can reinstall Mac OS X after having cleared the disk. Boot with the Mac OS X installation DVD. Partition the disk with 'Utilities' -> 'Disk Utility'. Quit the Disk Utility. Select a partition and continue the installation process.)

Switch back to the installer with pressing ALT+F1 and continue installation as normal. Remember to install the boot loader to the MBR (/dev/sda), and not to the partition boot record (like when installing with rEFIt)!

On some systems bios compatibility mode needs a primary partition marked as bootable, else it doesn't boot from MBR.

(Do not try to reinstall Mac OS X after you finished installing Debian using this method, the Mac OS X installer will not recognize the Debian install, and you will loose all your data.)

Double boot - Mac OS X & Debian

Partitioning (via OS X)

Before you can install Debian, you have to make space for it on the disk. There are different ways to do it. You can either (re)partition the whole disk or shrink the existing Mac OS X partition.

Hint: It is not really necessary to create linux partitions at this point (this can be done during the installation of Debian), but it might be advantageous for two reasons. Firstly, The Mac OS X Disk Utility behaves strangely if you just request free space and do not define a file system, see below. Secondly. It is important that the Linux system partition is a primary partition (number 1 to 4), see Section "Install Debian". This can be secured by creating and verifying it early in the process. If you define Linux partitions at this stage, consider also to create a partition for exchanging data between Linux and Mac OS X, see Section "Cross-mount file systems" below.

Partition disk with Disk Utility: In the initial phase of the installation procedure for Mac OS X you can use the 'Disk Utility' partition tool that you can find in the 'Installer' by clicking on 'Utilities' -> 'Disk Utility'. This tool is a bit erratic. It likes to move partitions around and change their sizes when you perform the final step of partitioning. We finally succeeded with the following method:

  1. Within the Disk Utility click on the hard drive entry (not any of its subentries).

  2. Click on 'Partition' (between 'Erase' and 'RAID').

  3. Under 'Volume Scheme:' choose the number of partitions. Don't use 'Split' and 'Delete', this seems to confuse the program.

  4. Then work your way from the top partion to the bottom one. Always select a Format (for later Linux partitions use 'UNIX File System', avoid 'Free Space') and mark 'Locked for editing'.

  5. Click on 'Partition' in the bottom right and cross your fingers.

  6. To verify that the program did the partitioning as you intended, leave 'Partition' (e.g. by clicking on 'First Aid') and reenter it (by clicking on 'Partition' again). Check whether the actual partitioning is what you want.

Hint: The partitions made by the 'Disk Utility' will be numbered beginning with 2, probably to have number 1 left for rEFIt. Thus, to make sure the Linux system partition is a primary one it must be one of the first three partitions.

Shrink Mac OS X partition with diskutil: If you have Mac OS X installed already and don't want to reinstall it (and thereby erase all data), you can use the diskutil program to shrink the Mac OS X partition. Supposing you want to reserve 20GB for your Mac OS X partition, run the following command from a terminal (Applications -> Utility -> Terminal):

Mac OS X $ sudo diskutil resizevolume disk0s2 20G
Started resizing on disk disk0s2 Macintosh HD
Verifying
Resizing Volume
Adjusting Partitions
Finished resizing on disk disk0s2 Macintosh HD
WARNING: You must now reboot!

Support for the resizevolume verb was added in Mac OS X 10.4.6. If you have an earlier version, you'll need to upgrade.

The program diskutil can also add partitions, see the man page. But note that it doesn't provide a way to remove partitions.

Preparing to dual boot (via OS X): rEFIt

First install the latest rEFIt from [WWW] rEFIt homepage. For the manual way (which is not needed) read the [WWW] rEFIt install documentation. If you don't have your MacBook connected to the internet, you can download the rEFIt Mac disk image onto a USB memory stick and install rEFIt from there by double clicking on rEFIt-0.10.dmg (or whatever version you have) and then on rEFIt.mpkg.

NOTE: The combination of pre-0.9 rEFIt and GNU parted is known to cause problems: see [WWW] http://refit.sourceforge.net/doc/c4s5_parted.html. If you install an old version of rEFIt and then install Debian + Lilo, you might not be able to install Grub afterwards. Reinstalling rEFIt 0.9 or greater will fix this problem.

It's now possible to proceed with installing Debian.

Note refit doesn't support making linux the default boot choice in tripple-boot environments, so you might want to look into other options. rEFIt does support making GNU/Linux the default choice when dual-booting. From OS X, edit the /efi/rEFIt/refit.conf file and uncomment/add the line

legacyfirst

Install Debian

Get an installation CD: Burn yourself a Debian installation CD (i383 version!, 1st CD/DVD of full CD/DVD set). CD-images are available from [WWW] http://www.us.debian.org/distrib/.

  • REMARK: In principle an amd64 version would be suitable for a Core 2 Duo MacBook. However, the amd64 version has no refit package available yet ([WWW] bug 383802 which is waiting for [WWW] bug 383801). Since refit is crucial to synchronize the MBR and GPT, it is more difficult to install the amd64 than the i386 version. There are three options to install amd64, but if you don't want that, i386 installation should work fine.

    1. It has been suggested to use rEFIt using Mac OS X for synchronizing MBR and GPT, which would require to reboot into Mac OS X rEFIt in the middle of the installation process and then reboot back into the Debian installation.

    2. You can install refit from refit.sf.net under OS X, do your partitioning from there too (a bit tricky, be careful), and use the gptsync feature from refit when you reboot (it's in the utilities offered by the bootloader at boot time - it'll save your life eventually).

    3. Another option is to boot a livecd of some kind, do your partitioning with parted, reboot, use gptsync from the refit menu at boot, boot the installer -> you're done.

    I was able to install AMD64 on MacBookPro June 2007 with these steps (7 oct 2007, Eugen Dedu) (I chose the expert mode, but this wouldn't change anything I think):

    • install refit 0.10 in OS X

    • shrink OS X with diskutil (see above the command sudo diskutil ...)

    • reboot and, in refit, choose Disk Partitioning and synchronise

    • reboot on debian CD

    • install all the system, up to lilo

    At this point, the only thing remaining to install is lilo, but this cannot be done yet, since MBR and GPT are not sync, so:

    • instead of lilo/grub, choose without boot loader

    • finish the installation, reboot computer

    • during boot, in refit, do again: Disk Partitioning, and synchronise

    Now, it remains to install lilo:

    • reboot on debian CD

    • go to all stages up to partitioning

    • as partitions are not yet known, enter partitioning, then go back; if it does not go back (d-i bug?), choose partitioning, then manual, then go back

    • execute commands to install lilo, as shown below: mkdir /mnt/sda3 etc.

    • reboot computer and it's ok

Boot from installation CD: Insert the Debian installation CD and hold down the c-key while booting. This should bring up the Installation CD welcome screen. Simply press return there and proceed with the installation.

  • TROUBLESHOOTING (double keypresses): If you have strange keyboard problems (double keypresses) or other problems while booting from the install CD, use the following command line on the boot prompt:

    install noapic irqpoll acpi=force

    TROUBLESHOOTING (dead keyboard): If you cannot type anything in the CD/DVD boot prompt (a problem that has occured on a MacBook Core 2 Duo), you can fix it by using USB-attached keyboard.

    If you do not have a USB keyboard, you can try to reboot from CD repeatedly and see whether finally the keyboard responds. This might work, because the error is not always reproducable.

    There are three different ways of booting from CD, of which the third one seems to be the best. (Laurenz Wiskott: Since I have started collecting statistics, the three methods worked (i) 3/8, (ii) 1/9, and (iii) 3/6 times). All three methods require the Linux CD to be in the drive.

    1. Keep the c-key pressed after starting the computer.

    2. If rEFIt is installed let the computer boot into the rEFIt menu and choose the Linux CD there.

    3. If Mac OS X is installed, boot into Mac OS X, insert the Linux installation disc, within Mac OS X go to 'System Preferences' -> 'Startup Disk', click on the Linux CD icon (this tells the computer to start from CD without the need to press the C key at boot time), click on the 'Restart' button, confirm 'Restart', wait. To get back to Mac OS X you might have to restart the computer and keep the eject button pressed to eject the CD, otherwise you keep booting from CD (possibly with the same keyboard problem as before, the behavior is a bit erratic). This last version has been reported to solve the problem [[WWW] 2007-08-27, Apple Discussions], but it does not seem to be reliable either.

    This problem seems to be related to refit, since disabling it and booting while holding the C button pressed (boots directly from CD) fixes this (sometimes). (It seems that booting after the real power-off seems to have less problem than reboot with "shutdown -r now". Also it seems to help situation a bit better by not pressing keyboard except when needed.)

[!!] Choose language ...

[!] Select a keyboard layout ...

[!!] Configure the network: (Laurenz Wiskott: I think it is important to configure the network here, because the refit package does not seem to be on the installation CD but is needed later, see also comment below under [!] Configure the package manager. The easiest is to do it via DHCP.)

[!!] Partition disks: When creating new partitions for Linux, take care that the Linux boot/system partition is among the first four partitions, i.e. is a primary partition. There are reports that rEFIt does not notice partition five and higher [[WWW] Linux auf einem MacBook Pro]. Also consider creating a partition for exchanging data between Linux and Mac OS X, see Section Cross-mount file systems below.

Also make sure all partitions are formatted and have a known file system type. Otherwise you get in trouble further below, see TROUBLESHOOTING (GPT partition of type 'Unknown' found, will not touch this disk.). Partitions with free space are ok.

(Laurenz Wiskott: I guess the linux partition should have the bootable flag turned on, but I am not sure. Anybody knows for sure?)

[!!] Set up users and passwords ...

[!] Configure the package manager: (Laurenz Wiskott: I think it is important to configure a network mirror here, because the refit package, which is needed later, does not seem to be on the installation CD but has to be downloaded. Can anybody confirm this?)

[!] Configuring popularity-contest ...

[!] Software selection: Select the Laptop here (in addition to the defaults Desktop environment and Standard system).

[!!] Configuring uswsusp: This step may cause the following problem.

  • TROUBLESHOOTING (Configuring uswsusp: Continue without a valid swap partition?): During the standard installation of packages you might get the following error message:

                      [!!] Configure uswsusp
    The swap partition that was found in uswsusp's configuration file is not active. In most cases this means userspace software suspend will not work for you and you will need to choose (or let uswsusp choose) another partition. In some corner cases however, this can be what you want.

    Continue without a valid swap partition?


    (Laurenz Wiskott: I had a swap partition created during the Linux partitioning. So I did not know what to do about this error message and simply replied with . Has anybody a better advice?)

[!] Install the GRUB boot loader on a hard disk: Do not install the GRUB boot loader. So, leave this menu item and go to the main menu by selcting .

Synchronize MBR and GPT: Switch to the second virtual console by pressing ctrl-alt-F2, press return to start the shell, and then enter

 chroot /target aptitude install refit
/target/sbin/gptsync /dev/sda

and enter 'y' at the prompt. This synchronizes the [WWW] MBR from the [WWW] GPT, which were made out of sync by parted.

(The directory /target is the directory in which the Debian installer installs the new system and it later becomes the root directory /.)

  • TROUBELSHOOTING (no refit available): If aptitude tells you that refit is not available, the reason might be that you have no internet connection and there is no refit package on the Debian installation CD. One solution is to connect the MacBook to the internet during installation.

    It might also be that you have used the amd64 version, which does not have refit available, see comment above at Get an installation CD.

    TROUBLESHOOTING (GPT partition of type 'Unknown' found, will not touch this disk.): If there is a partition of type 'Unknown', gptsync will not synchronize MBR. Go back to first console and there to the partitioning. If there is no important data on the partition with the unknown filesystem type, reformat it (but only this one and possibly the swap partition). After that synchronization should work. (However, LILO installation did not work (stalled at 50%, see below) and I had to start from scratch.)

Then switch back to the first virtual console by pressing ctrl-alt-F1.

[!!] Install the LILO boot loader on a hard disk: In the main menu choose select "Install the LILO boot loader on a hard disk". Choose /dev/sda3 (or whatever your new Debian partition is) for the LILO installation target. Do not install LILO to the MBR! When the installer asks whether you want to make this partition active, choose "No."

  • TROUBLESHOOTING (LILO installation stalls forever at 50%): I have no solution for that one and simply started from scratch. The solution recommended in the next troubleshooting point (LILO installation fails) did not work for me, since the command lilo was not known to the system.

    TROUBELSHOOTING (LILO installation fails): If you get an error while trying to install LILO :

    1. reboot, start the refit shell and type gptsync /dev/sda, and answer y

    2. boot from the debian CD and follow the steps until the partitioning step, type ctrl-option-F2, press return to start the shell and then enter

    3. mount /dev/sda3 to /mnt/sda3, mount /proc to /mnt/sda3/proc, chroot into /mnt/sda3 and run lilo:

    • mkdir /mnt/sda3
      mount /dev/sda3 /mnt/sda3
      mount /proc/ /mnt/sda3/proc
      chroot /mnt/sda3
      lilo -b /dev/sda3

[!!] Finish the installation: Remove the ejected installation CD and select . During reboot select Linux from the Mac rEFIt menu.

  • TROUBLESHOOTING (Missing operating system): Once Debian is installed it asks you to remove the installation CD and reboot without it. You might then get the error message "Missing operating system". I guess, this means that the MacBook still tries to boot from CD (even though there is none) because following method (iii) in "TROUBLESHOOTING (dead keyboard)" above you have told Mac OS X to boot from CD. To solve this, you can do either of the following two things.

    1. Reboot and keep the alt/option-key pressed during boot. Then select rEFIt to boot.

    2. Insert the Mac OS X installation DVD and boot from it (keep the c-key pressed). Choose your language. Click on 'Utilities' -> 'Startup Disk...'. Select Mac OS X as the system to start. Click on 'Restart...' and confirm 'Restart...'. This should bring you into the rEFIt menu.

If i386 Debian installed, change the kernel to amd64 (MacBook Core 2 Duo)

As mentioned above, it is problematic to use the amd64 version of the Debian installation CD. However, it is possible to install the amd64 kernel afterwards.

Install the amd64 kernel: Simply run

aptitude install linux-image-amd64

This should install the amd64 kernel and also update the LILO boot loader to automatically boot into amd64.

Reboot: Reboot to start the amd64 kernel.

VALIDATION: To validate that the amd64 kernel is running, run

uname -r

The output should be something like

2.6.18-5-amd64
  • TROUBLESHOOTING (1280x800 resolution is gone): Installing the amd64 kernel might disrupt the 1280x800 resolution. See the section Upgrade to resolution of 1280x800 for how to fix this. You will probably have to this manually.

    TROUBLESHOOTING (automatic update back to i686): After you have installed the amd64 kernel the old kernel i686 is still present and if you perform an automatic update under aptitude, the i686 might be updated and the LILO changed back to boot into the i686 kernel. It might therefore be advisable to remove the i686 kernel, see below. If you want to keep the i686 kernel but still boot into amd64, you can edit file /etc/lilo.conf and change the default variable to the amd64 image. You find valid values in the label entries and have to guess, which one is the amd64 image, because the names are not very instructive (it could be LinuxOLD, for example). After having changed the value, run lilo in a terminal to make the change active. Then reboot.

    It might also be an option to add

             promt
    timeout=100

    to the configuration file (do not forget to run lilo afterwards). promt tells LILO to start a menu that allows you to select either of the two kernels. timeout=100 tells LILO to automatically boot into the default kernel after 10 seconds. See man lilo.conf for details. However, also this suffers from the nasty dead-keyboard problem mentioned above, see TROUBLESHOOTING (dead keyboard), so that in most of the cases you get the menu, but you don't get the chance to use it, because the keyboard does not work.

Remove the i686 kernel: To avoid the problem that an automatic update brings you back to the i686 kernel (see TROUBLESHOOTING (automatic update back to i686) above) you can remove the i686 kernel from within aptitude. Run aptitude, search forward (press '/') for linux-image, mark for purge (press '_' and not '-') all installed packages that start with linux-image and end on 686, perform the purge (press 'g' twice). Finally, run lilo in a shell (if required).

Replacing lilo with GRUB

Configuring GRUB

(Laurenz Wiskott: I guess, this and the following section Switching to Grub should be integrated somehow by somebody who knows what (s)he is talking about.)

The GRUB included with Debian 4.0 Etch (GRUB 0.97-10 or greater) is compatible with MacBook if you configure proper MBR/GPT hybrid. Although it was possible to install GRUB during the initial d-i install with many manual fiddling processes of MBR/GPT synching, I recommend you to install LILO initially as above and install GRUB to /dev/sda3 and/or /dev/sda4 later for the ease of process and ease of updating kernel. "rEFIt " on OS X does not like anything other than MSDOS or HFS+ for file system description in GPT table when executing gptsync to create matching MBR record. So I marked Linux partitions as MSDOS before executing gptsync. I used both disked for GPT and fdisk for MBR. Once you marked the MBR with the proper file system type (eg. 83), GRUB is happy to boot Debian by looking into FS and finding files.) Here is an example of /boot/grub/menu.lst for dual booting 486 and amd64 systems:

  • timeout 10
    default 0
    fallback 1
    # For booting GNU/Linux (For frozen keyboard)
    title GNU/Linux64-safe
    root (hd0,2)
    kernel /boot/vmlinuz-2.6.18-4-amd64 root=/dev/sda3
    initrd /boot/initrd.img-2.6.18-4-amd64

    # For booting GNU/Linux
    title GNU/Linux64
    root (hd0,2)
    kernel /vmlinuz root=/dev/sda3
    initrd /initrd.img

    # For booting GNU/Linux
    title GNU/Linux64.old
    root (hd0,2)
    kernel /vmlinuz.old root=/dev/sda3
    initrd /initrd.img.old

    # For booting GNU/Linux
    title GNU/Linux32
    root (hd0,3)
    kernel /vmlinuz root=/dev/sda4
    initrd /initrd.img

    # Change the colors.
    title Change the colors
    color light-green/brown blink-red/blue

(Linux kernel is GPT-aware thus the swap partition maybe located in places such as /dev/sda7)

Switching to Grub

To switch to grub you first need to change the partition type to linux. You can do this by using sfdisk to dump the partition information to a text file. Editing it to change the partition type, and then using sfdisk to save that to the partition table.

sfdisk -d /dev/sda > sda.out

edit sda.out and change the id to 83 (linux) as in the below

# partition table of /dev/sda
unit: sectors

/dev/sda1 : start= 1, size= 409639, Id=ee
/dev/sda2 : start= 409640, size= 83886080, Id=af
/dev/sda3 : start= 84295720, size= 68953126, Id=83, bootable
/dev/sda4 : start=153248846, size= 3052609, Id=82

Now mount a usb drive if possible in case you made a mistake somewhere so that you can save recovery data.

Warning!!: this next line can wipe out your partition table if you made a mistake. It might be a good time to look at the sfdisk manual if you aren't sure what this does. It may be possible to undue unspeakable damage with the hdd-partition-sectors.save file so long as you can access it, which you might not be able to do if you saved it to the disk you are editing rather than the recommended usb disk.

sfdisk /dev/sda -O /media/usbdisk/hdd-partition-sectors.save <>

In case sfdisk does not work for you (complains about not being able to make the kernel reread the partition table because a partition is mounted, or mismatching start/end partition boundaries) you can alternatively use fdisk to change the partition type. Use "p" to list partitions, "t" to change partition type, and "w" to write the table back to disk.

Then you can install grub "aptitude install grub"

Once grub is installed you need to edit /etc/kernel-img.conf so that when you install a kernel image it doesn't also replace grub with lilo.

As per (zless /usr/share/doc/grub/README.Debian.gz) set to the following.

postinst_hook = /sbin/update-grub
postrm_hook = /sbin/update-grub
do_bootloader = no

Cross-mount file systems

To make a double boot system really useful it is desirable to cross-mount file systems, i.e. to make Mac OS X-filesystems readable (and writable) under Linux and vice versa. Mac OS X uses a file system called HFS+ while Linux uses ext3.

Even though cross-mounting is possible in either direction, there seems to be some scepticism (and possibly bad experience?) concerning the reliability, so that the common advice seems to be to only use small partitions mounted under both operating systems and use them for data exchange. Mounting and using large partitions for regular usage under both operating systems seems to be not advisable. (Please let us know if you have experience with that.)

Mount Mac OS X filesystems (HFS+) under Linux

If you want to mount a Mac OS X-filesystem under Linux in read-write mode (not read-only) then you have to turn off journaling first under Mac OS X. If you leave journaling on, you can only mount in read-only mode and will not be able to write or modify files in the Mac OS X-filesystem. This is a trade-off, of course, because journaling gives you security that your Mac system lacks if you turn it off. It might thus be advisable to have one partition for the Mac operating system with journaling (which is the default) mounted from Linux read-only (if at all) and one partition with user data without journaling mounted from Linux read-write. See [[WWW] HOWTO hfsplus] for more information about HFS+ under Linux.

Step 1 (if mounting read-write) - turn off journaling under Mac OS X: If you want to mount the Mac OS X-filesystem in read-write mode (not read-only) then you have to turn off journaling.

(i) Boot into Mac OS X.

(ii) Start a terminal.

(iii) As root (e.g. with sudo) use diskutil to turn off journaling ([WWW] Disabling journaling via diskutil):

mac:user> sudo /usr/sbin/diskutil disableJournal /data

This assumes your partition is mounted to the directory /data. If you want to turn off journaling for your Mac operating system partition, use / instead.

(iv) Reboot into Linux.

Step 2 - mount the Mac OS X-filesystem under Linux: If /dev/sda2 contains the HFS+-filesystem of the Mac OS X you want to mount, then run under Linux the following as root [[WWW] Dave Taylor, 2005-05-14].

root# mkdir /media/macdata
root# mount -t hfsplus /dev/sda2 /media/macdata

This mounts /dev/sda2 on the directory /media/macdata (only read-only if the HFS+ partition is using journaling, which is the default when Mac OS X creates a HFS+ partition). Of course, you can also create and mount on a different directory.

  • Verify: To check whether your mount was successfull, as root go into the directory /media/macdata and list the files, create a file, and remove it again. To check whether users have access, as root create a directory for that user in /media/macdata, change ownership to that user, change into that directory, su to that user and perform the same test actions as before (list, create and delete a file).

Step 3 (optional) - edit fstab to auto-mount at boot time: If you want to mount the partition automatically at boot time, you have to add an entry like the following in the file /etc/fstab.

/dev/sda2   /media/macdata   hfsplus   defaults   0   2
  • Verify: To check whether automount should work, unmount the partition (if it is still mounted from Step 2), and remount it with the -a option.

    root# umount /media/macdata
    root# mount -a

    Then perform the same checks as in Step 2.

TROUBLESHOOTING (cannot write on HFS+ filesystem anymore): If you cannot write on the HFS+ filesystem anymore, boot into Mac OS X and perform a filesystem check, maybe that helps [[WWW] Linux on an Apple iBook G4].

Mount Linux filesystems (ext3) under Mac OS X

To mount Linux filesystems (ext3) under Mac OS X the only open source option seems to be to use ext2fsx [[WWW] Mac OS X Ext2 Filesystem at SourceForge]. You have to use the newest version (1.4d4 as of 2007-09-02), which is not stable yet. Version 1.3 does not work for recent Mac OS X versions.

Hardware configuration

Devices that work

The following features work

  • Ethernet (as of kernel 2.6.16) (works out-of-the-box) (sky2)

  • Video (requires installation of 915resolution)

  • Sound (as of kernel 2.6.18) (works out-of-the-box) (snd_hda_intel)

  • CD-R (works out-of-the-box)

  • backlight (works out-of-the-box)

  • bluetooth (works out-of-the-box)

(See below for more)

Devices to be confirmed

  • suspend (works, unload module sky2 before suspending; tested with kernel 2.6.20)

s2ram -f -p -m works (for some values of "work") with original macbook (sys_product = "MacBook1,1" sys_version = "1.0" bios_version = "MB11.88Z.0061.B03.0610121324") kernel 2.6.21.3 and mactel patches rev 126. Resumes with backlight off but can turn back on with pommed (usually...).

Backlight + Volume + CD Eject button

Backlight keys (Fn+F1 and Fn+F2) work using [WWW] Julien Blache's [WWW] pommed (there is a new project homepage at [WWW] alioth); you can even turn off the backlight using the keyboard; pommed also enables the CD Eject button's functionality, Fn behaviour and remote control. Besides, you can also install [WWW] gpomme: a GTK+ client suitable for all environments (you should start it when your session starts) and [WWW] wmpomme (a WindowMaker dockapp)

By default on Debian testing, 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 by changing fnmode = 1 to fnmode = 2 and restart pommed with /etc/init.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/init.d/pommed restart.

Video

Upgrade to resolution of 1280x800

After installation of Debian, there will be only very few screen resolutions available, e.g. only 1024x768, 800x600, and 640x480 (1024x768 is the biggest normal size that fits the screen). The resolution of the screen of a MacBook (Intel 915, video chipset 945GM) is 1280x800 and rescaling the 1024x768 display to 1280x800 results in a fuzzy and distorted picture.

To get support for the 1280x800 resolution you have to install the [WWW] 915resolution package.

Install 915resolution: As root run

aptitude install 915resolution

915resolution should automatically set the correct video mode for 1280x800 and configure X properly.

Restart X: Press Ctrl-Alt-Backspace to restart X, but close any sensitive application first.

If it works and you get high resolution, you should see it right away from the more focussed image. You can also check it under Main menu -> Desktop -> Preferences -> Screen resolution.

  • TROUBLESHOOTING (automatic setup did not work): If the automatic setup of 915resolution did not work for some reason (happened once after upgrading to amd64), you can set it up manually. Edit file /etc/defaults/915resolution and set the following variables.

    MODE=5c
    XRESO=1280
    YRESO=800
    BIT=32

    To check whether it works, run

    /etc/init.d/915resolution start

    as root and then restart X by pressing Ctrl-Alt-Backspace (but first close all sensitive applications). If you get the high resolution, reboot to test whether it also works automatically during boot.

Configure highres video playback

For highres video playback something like the following is needed in the Device section:

        Option          "LinearAlloc" "6144"
Option "CacheLines" "1080"

See also an [WWW] xorg.conf file which enables use of an external monitor.

Note when using an external display: unless the display resolution is in the small builtin supported list (it won't be if it's widescreen or highres) then you'll need to use 915resolution to set a mode for the external display too.

Note when using multiple displays: the order for MonitorLayout is "pipe a, pipe b" but this corresponds to "screen 1, screen 0", not "screen 0, screen 1" as you might expect (and isn't documented in the man page...)

Configure dual screen (for sid users)

Dual screen configuration for etch does not work for xorg 7.2 and later. Just use the usual single-screen xorg.conf, and configure output later.

You can control X with xrandr.

LVDS is the liquid display, VGA is the external output. (see output of xrandr command)

To enable dual screen

xrandr --output VGA --mode 1024x768
xrandr --output VGA --right-of LVDS

or in one big command including handling of disabling unneeded output:

xrandr --output TMDS-1 --off  --output LVDS --mode 1280x800 --crtc 1 --output VGA --mode 800x600  --right-of LVDS --crtc 0

To disable dual screen, simply specify VGA to off

xrandr --output VGA --off

Sound

ALSA driver snd_hda_intel works for playback as of 2.6.18-rc1.

MacBook with Debian 4.0 Etch has no problem with sound. Although, you may need to run alsaconf as root.

If you hear any distortions even when all of the mixer settings are at least 20% below their maximum, it might help to load snd-hda-intel with the 'position_fix=1' option. In the file /etc/modprobe.d/alsa-base, change the line

install snd-hda-intel /sbin/modprobe --ignore-install snd-hda-intel $CMDLINE_OPTS && /lib/alsa/modprobe-post-install snd-hda-intel

to

install snd-hda-intel position_fix=1 /sbin/modprobe --ignore-install snd-hda-intel $CMDLINE_OPTS && /lib/alsa/modprobe-post-install snd-hda-intel

Note the microphone requires mactel patches and the following to activate:

amixer sset 'Input Source' Line; amixer sset 'Input Source' Mic; amixer sset Mux 20.00dB

The microphone did not worked on debian testing with kernel 2.6.21. However I made it work by compiling alsa from subversion (as of 12/08/07) on kernel 2.6.21 without mactel patches.

Wireless

There are two possibilities: madwifi drivers or the ndiswrapper way. Both have some common procedures, which you need to perform at the end (see the "common setup" subsection).

No comments: