GNU/Linux on the Sony Vaio PCG-V505DX

March 30, 2004

1. Introduction

I purchased my Vaio at Circuit City as an open box special for $1499 plus tax with a $100 rebate on March 30, 2004.

Update [2006.03.16] There have been huge advances in laptop support in Linux since I started this HOWTO. I am currently running Ubuntu 6.04 (Dapper Drake) and it works almost flawlessly right out-of-the-box. A HOWTO isn’t really needed with Ubuntu, but nevertheless I have added a section dedicated to Ubuntu. I have also finally tried out the modem and verified that it is supported.

2. Hardware

Type Description Driver Status
Processor Intel Pentium M 1.4 GHz speedstep_centrino OK
Memory 512 MB DDR SDRAM OK
Hard Drive 60 GB Toshiba MK6021GAS OK
Display 12.1" XGA (1024 x 768) TFT Display OK
Optical UJDA745 DVD/CDRW, ATAPI CD/DVD-ROM drive OK
Wireless Intel Corp. PRO/Wireless LAN 2100 3B Mini PCI Adapter (rev 04) ipw2100 OK
Firewire Ricoh Co Ltd R5C551 IEEE 1394 Controller ochi1394 OK
USB Intel Corp. 82801DB (ICH5) USB UHCI usb_hcd OK
Audio Intel Corp. 82801DB (ICH5) AC'97 Audio Controller (rev 03) snd-intel8x0 (ALSA) OK
Video ATI Technologies Inc RV250 5c61 [Radeon Mobility 9200 M9+] (rev 01) 32 MB fglrx or radeon OK
Ethernet Intel Corp. 82801BD PRO/100 VE (MOB) Ethernet Controller (rev 83) e100 OK
Modem Intel Corp. 82801DB (ICH5) AC'97 Modem Controller sl-modem OK
PCMCIA Ricoh Co Ltd RL5c475 (rev b8) yenta_socket Untested
Touchpad ALPS GlidePoint synaptics OK
IDE Controller Intel ICH5 rev 3 Intel PIIXn OK

lspci Output

% /sbin/lspci -tv
-[00]-+-00.0  Intel Corp. 82855PM Processor to I/O Controller
      +-01.0-[01]----00.0  ATI Technologies Inc RV250 5c61 [Radeon Mobility 9200 M9+]
      +-1d.0  Intel Corp. 82801DB (ICH5) USB UHCI #1
      +-1d.1  Intel Corp. 82801DB (ICH5) USB UHCI #2
      +-1d.2  Intel Corp. 82801DB (ICH5) USB UHCI #3
      +-1d.7  Intel Corp. 82801DB (ICH5) USB2 EHCI Controller
      +-1e.0-[02]--+-05.0  Ricoh Co Ltd RL5c475
      |            +-05.1  Ricoh Co Ltd R5C551 IEEE 1394 Controller
      |            +-08.0  Intel Corp. 82801BD PRO/100 VE (MOB) Ethernet Controller
      |            \-0b.0  Intel Corp. PRO/Wireless LAN 2100 3B Mini PCI Adapter
      +-1f.0  Intel Corp. 82801DBM LPC Interface Controller
      +-1f.1  Intel Corp. 82801DBM (ICH5) Ultra ATA Storage Controller
      +-1f.3  Intel Corp. 82801DB/DBM (ICH5) SMBus Controller
      +-1f.5  Intel Corp. 82801DB (ICH5) AC'97 Audio Controller
      \-1f.6  Intel Corp. 82801DB (ICH5) AC'97 Modem Controller

LCD Specifications

3. Original Configuration

The machine came with Windows XP Home, tons of multimedia software and all the Sony utilities preinstalled. The 60 GB hard drive had three partitions:

Those numbers are according to Windows XP Disk Management. They only add up to 55.89 GB.

This is the fdisk output:

# fdisk -l /dev/hda

Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1       654   5253223+  12  Compaq diagnostics
/dev/hda2   *       655      2478  14651280    7  HPFS/NTFS
/dev/hda3          2479      7296  38700585    f  Win95 Ext'd (LBA)
/dev/hda5          2479      7296  38700553+   7  HPFS/NTFS

4. Preparation

First, make a set of restore media discs if there is a chance you’ll want to restore the factory system some day. This might come in handy if you ever decide to sell it or in case something goes wrong. There are 9 restore CDs you have to make in all and it takes an hour or more. The hard drive restore is handy, but its too bad they don’t provide premade restore CDs.

If you decide to leave the Windows XP and recovery partitions intact, I recommend removing the data partition (D:) and making your Linux partitions in this space then leaving room at the end of the drive to make another Windows partition since many of the preinstalled applications are preconfigured to store their data on D:. This will also provide a convenient storage area for transferring files between the Linux and Windows.

5. Kernel Configuration (2.6.x)

If you compile a custom kernel, the following options are important.

The sonypi Module

The sonypi module is included with the 2.6.x kernel.

Add the following line to /etc/modprobe.d/aliases (Debian Sarge) or /etc/modprobe.conf (Fedora Core) to enable automatic loading of the module:

alias char-major-10-63 sonypi

Now, every time a program such as spicctrl tries to access /dev/sonypi, the sonypi module will automatcally be loaded by modprobe.

Load the module:

# /sbin/modprobe sonypi

Check the output:

# dmesg | grep sonypi
sonypi: Sony Programmable I/O Controller Driver v1.23.
sonypi: detected type2 model, verbose = 0, fnkeyinit = off, camera = off,
        compat = off, mask = 0xffffffff, useinput = on, acpi = on
sonypi: enabled at irq=11, port1=0x1080, port2=0x1084
sonypi: device allocated minor is 63

Now, make a device node for the controller so that other programs can access it:

# mknod /dev/sonypi c 10 63

# ls -al /dev/sonypi
crw-r--r--  1 root root 10, 63 2004-12-22 21:19 /dev/sonypi

Note: These instructions should be almost identical on 2.4.x kernels except that /etc/modules.conf should be modified instead of modprobe.conf.

spicctrl is a handy program which uses the /dev/sonypi interface. It is useful for scripts, allowing you to change the screen brightness and retrieve the AC adapter or battery status. I use it in my ACPI power management event scripts.

6. Debian GNU/Linux (Sarge)

This section is based on my experience installing Debian GNU/Linux using both a network-install from a netinst cd image and from installing using the two-DVD official snapshot of the i386 testing (Sarge) release from 2004.12.10 downloaded with Jigdo.

The Debian Installer

Note: This version of the debian installer doesn’t have support for the centrino wireless adapter, only the built-in ethernet adapter (using the e100 module). Thus, if you want to perform a network install be sure to have an ethernet cable handy–you can’t rely on the wireless network for the install.

Steps:

Important Debian packages to select:

Wireless Adapter

See the Debian section of my ipw2100 mini-HOWTO for instructions on using the ipw2100 module.

Power Management

You will need to install the following packages: powermgmt-base, acpi, acpid, cpufreqd, hdparm, laptop-mode-tools and spicctrl. Additionally, the sonypi module must be available (see the section above for its configuration).

cpufreqd

Make sure that the cpufreq interface module is loaded before installing cpufreqd or you must do the following:

# modprobe speedstep_centrino
# dpkg-reconfigure cpufreqd

The default cpufreqd configuration files should be sufficient, but if you want to take a look at the profiles, the file you need is /etc/cpufreqd.conf.

ACPI

Simply make sure that ACPI support is compiled into your kernel and that the packages are installed. The ACPI configuration files are in /etc/acpi/.

laptop_mode

The laptop mode scripts are now included in Debian testing in the laptop-mode-tools package. Laptop mode allows you to save power by spinning down the hard drive when it is not in use. The configuration file is /etc/laptop-mode/laptop-mode.conf

Customizations

Before laptop mode, I used to include the hdparm calls in my power management scripts. Now these scripts only change the LCD brightness and disable some services and modules that I don’t use when I’m running on battery power. There are two files: an ACPI event file and an ACPI action script. The event is triggered when the power source changes from battery to AC or vice versa. When the laptop is running on battery power, the script dims the LCD, unloads the following modules: parport_pc, lp, parport, and stops the following services: sysklogd, pcmcia, atd, cron. When the AC adapter is plugged in again, the LCD is switched to full brigtness, the services restarted, and the modules are reloaded.

Files:

To use these scripts, put ac_adapter.sh in /etc/acpi/actions and ac_adapter.event in /etc/acpi/events. The ac_adapter event is only triggered when the power source changes so ac_adapter.sh won’t run on startup without some help. As far as I know, Debian doesn’t use /etc/rc.local so I simply add a symlink to runlevel 2 that calls the script on startup.

# ln -s /etc/acpi/actions/ac_adapter.sh /etc/rc2.d/S21ac_adapter

Accelerated Radeon Drivers

FireGL Driver

See the following installation guide. I used the instructions in the section “4.3 Build with the make-kpkg command.”

I have used the version numbers present on my system so you may need to adjust them for your system:

kernel-image-2.6.6-1-686
kernel-source-2.6.6
fglrx-4.3.0-kernel-src
fglrx-4.3.0-driver
fglrx-4.3.0-control-qt3

Add the following repositories to /etc/apt/sources.list:

# fglrx modules
deb     http://www.stanchina.net/~flavio/debian/ ./
deb-src http://www.stanchina.net/~flavio/debian/ ./

Install the packages:

# apt-get update
# apt-get install fglrx-4.3.0-kernel-src fglrx-4.3.0-driver fglrx-4.3.0-control-qt3

Configure your kernel:

# tar xjvf kernel-source-2.6.6.tar.bz2
# cd kernel-source-2.6.6
# cp /boot/config-2.6.6-1-686 .config
# make-kpkg --append-to-version "-1-686" --revision 2.6.6 --config old configure

Unpack the module source in /usr/src:

# tar xzvf fglrx-4.3.0-3.9.0.tar.gz

Create a kernel module package:

# cd kernel-source-2.6.6
# fakeroot make-kpkg --append-to-version "-1-686" --revision 2.6.6 --added-modules fglrx-4.3.0-3.9.0 modules_image

Install the created package (it is is /usr/src):

# cd ..
# dpkg -i fglrx-4.3.0-kernel-2.6.6-1-686_3.9.0-5+2.6.6_i386.deb

Reconfigure X (Try fglrxconfig or take a look at my XF86Config-4 file).

Restart.

XFree86’s radeon driver

XFree86 has an accelerated driver for the Radeon which is sufficient unless you want to do intensive OpenGL stuff like gaming. To load this driver, find the Device section of your /etc/X11/XF86Config-4 file and change the line

Section "Device"
        ...
        Driver          "vesa"
        ...
EndSection

to read

Section "Device"
        ...
        Driver          "radeon"
        ...
EndSection

Other

Edit /etc/group and add yourself to the cdrom group then, (for mplayer, etc. later on):

# cd /dev
# chgrp cdrom hdc
# ln -s /dev/hdc /dev/dvd

Problems

Shutdown Issues

If your system won’t shut down properly, if it says acpi_power_off called and hangs, add the option nolapic to the kernel boot parameters in /boot/grub/menu.lst.

7. Fedora Core 1 (Yarrow)

These are instructions for the CD install but they should serve as a good guide for other types of installations as well.

If you try the default graphical install by pressing ENTER at the boot prompt, the framebuffer console will go crazy and you won’t be able to read anything. To get around that, at the boot: prompt, type linux nofb and press ENTER.

In the monitor configuration I selected Generic LCD Display::LCD Panel 1024x768 since I have no idea what type of panel it is. This turned out to work great.

Disk Druid will probably give you a warning that the partitions are inconsistent, but this can be ignored. These things happen when using Windows to do partitioning.

I decided to leave hda1 and hda2 (the recovery and XP partitions) intact and use the remaining space to create the following partitions: hda3 1 GB linux swap, hda4 extended partition, hda5 1 GB vfat temporary cross-platform storage (D:), hda6 16 GB ext3 root, and hda7 20 GB ext3 home. Ultimately, Disk Druid didn’t agree with me for some reason so I had to go to root console (by pressing CTRL+ALT+F2) and use fdisk to get my partitions to come out like I wanted:

% /sbin/fdisk -l /dev/hda

Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1       654   5253223+  12  Compaq diagnostics
/dev/hda2           655      2478  14651280    7  HPFS/NTFS
/dev/hda3          2479      2603   1004062+  82  Linux swap
/dev/hda4          2604      7296  37696522+   5  Extended
/dev/hda5   *      2604      4549  15631213+  83  Linux
/dev/hda6          4550      7165  21012988+  83  Linux
/dev/hda7          7166      7296   1052226    c  Win95 FAT32 (LBA)

[05/20/2004] Update: I recently completely repartitioned my hard drive and removed windows. Linux fdisk decided to use different geometry (cylinders/heads/sectors) than before. I’m assuming that Linux is correct and that the hard drive was partitioned with the wrong geometry before. Don’t let this scare you, it is perfectly okay to continue with the “inconsistent” partitions, it’s just a matter of being proper about it since using the true hard drive geometry so that partitions end sector boundaries. I did however lose my data partition (which was backed up, of course) doing this because I was going to convert it from an extended partition to a primary one by recreating a new partition with the same starting and ending points. Unfortunately those points weren’t there since the geometry was changed.

Out-of-Box Results

Kernel Upgrade

To get most of the extra features, you should upgrade to a 2.6.x series kernel. This includes features such as the sonypi module, software suspend, ALSA sound drivers, and improved ACPI support. While I haven’t actually booted the old kernel for comparison, the system seems to run much cooler and quieter with the 2.6.4 kernel than with the RHFC1 default. I assume this is due to better power management in the new kernel, but I haven’t followed the kernel development closely so maybe it is just my imagination.

I’m not going to attempt to write a kernel upgrade guide, just an overview of the specific things you will need to have enabled. See HOWTO: Fedora Core 1 with kernel 2.6 for more detailed information. I built the kernel from source, but the guide uses prebuilt packages (which I wasn’t aware of at the time) so adjust everything accordingly.

Note: OSS is the default sound system for Fedora Core 1 so it must be configured in addition to ALSA to ensure compatibility.

These are the basic steps to build a custom kernel on FC1:

# make mrproper
# make menuconfig
# make bzImage && make modules modules_install
# make install

Add the following to /etc/grub.conf:

title Fedora Core (2.6.4)
        root (hd0,4)
        kernel /boot/vmlinuz-2.6.4 ro root=/dev/hda5 rhgb
        initrd /boot/initrd-2.6.4.img

Add the following line to /etc/fstab:

none                    /sys                    sysfs   defaults        0 0

Note: After booting the new kernel, new hardware was found. I chose to remove the old configurations and configure the new devices. The screen was at 800x600. I ran redhat-config-xfree86 to correct this. I also downloaded the hotplug rpm from the Fedora development branch.

spicd

spicd forks into the background and waits for a switch between AC and battery power. It then adjusts the display brightness and throttles the CPU appropriately.

Download and compile spicd. Place it somewhere like /usr/local/bin and make it run on startup by adding a script in /etc/init.d with links from runlevel 5.

Here are the steps:

# tar zxvmpf spcid-0.2.tar.gz
# cd spicd-0.2
# make
# mkdir /usr/local/man
# mkdir /usr/local/man/man1
# make install
# spicd

Wireless

See my ipw2100 mini-HOWTO for details on using the ipw2100 Centrino driver with Fedora Core.

ACPI

ACPI can control the CPU speed using the speedstep-centrino module.

# modprobe speedstep-centrino

[2004.04.04] Update: spicd correctly lowers the CPU speed when the AC adapter is unplugged but does not raise it again once AC power returns.

[2004.04.05] Update: I wrote a cputoggle script to serve as a workaround for the above problem:

#!/bin/bash
#
# Toggles the CPU speed between 600MHz and 1.4GHz
# via /proc/sys/cpu

CPUDIR=/proc/sys/cpu/0
SPEED_MAX=$(cat $CPUDIR/speed-max)
SPEED_MIN=$(cat $CPUDIR/speed-min)
SPEED=$(cat $CPUDIR/speed)

if [ "$SPEED" = "$SPEED_MAX" ]; then
    echo $SPEED_MIN > $CPUDIR/speed
else
    echo $SPEED_MAX > $CPUDIR/speed

Software Suspend

Software suspend is part of the 2.6.4 kernel. Following the instructions in the HOWTO, download suspend.sh from the sourceforge swsusp project site. Run it as root and it makes two files: /usr/local/sbin/hibernate and /etc/suspend.conf.

Modified /etc/grub.conf to the following to enable resuming:

title Fedora Core (2.6.4)
        root (hd0,4)
        kernel /boot/vmlinuz-2.6.4 ro root=LABEL=/ rhgb resume=/dev/hda3
        initrd /boot/initrd-2.6.4.img

ALSA

Install the packages alsa-driver, alsa-lib, and alsa-utils from FreshRPMs. For more information see the ALSA documentation.

Here is my /etc/modprobe.conf after running alsaconf:

include /etc/modprobe.conf.dist
alias eth0 e100
alias eth1 ipw2100
# --- BEGIN: Generated by ALSACONF, do not edit. ---
# --- ALSACONF verion 1.0.2 ---
alias snd-card-0 snd-intel8x0
alias sound-slot-0 snd-intel8x0
# --- END: Generated by ALSACONF, do not edit. ---

Radeon 9200 Mobility

I installed the fglrx package from ATI’s Linux Radeon driver page. I had to remove the XFree86-Mesa-libGL package first because of conflicts. Read the installation instructions first and make sure to run fglrxconfig after installation.

I compiled the 2.6.5 kernel with DRI compiled in, agpgart as a module and intel_agp as a module. Then I recompiled the fglrx module. Load the modules in the following order: agpgart, intel_agp, fglrx

8. Ubuntu (Dapper Drake)

Out-of-Box Results

Modem

While the needed drivers weren’t installed by default, getting the modem to work was relatively simple. First, install the driver:

% sudo apt-get install sl-modem-daemon

You should see something similar to the following:

Starting SmartLink Modem driver for: modem:1.
Creating /dev/modem symlink, pointing to: /dev/ttySL0.

and the kernel should report:

ACPI: PCI Interrupt 0000:00:1f.6[B] -> Link [LNKB] -> GSI 9 (level, low) -> IRQ 9
PCI: Setting latency timer of device 0000:00:1f.6 to 64
MC'97 1 converters and GPIO not ready (0xff00)

sl-modem-daemon should now start automatically at boot time and your modem should be ready to use. You can either dial up the old-school way and start pppd yourself, or use a dialer such as gnome-ppp.

Xorg Configuration

I have written an xorg.conf file which uses the fglrx accelerated FireGL driver, display cloning for using the external VGA port, and the Synaptics touchpad driver.