That has been a few months since I wanted to buy a laptop, to be able to mess around with Wifi and all. I was searching for a light, linux-compatible laptop with a long life battery. This VGN-B1VP reaches those goals for me. I have got a very fast computer with a 4 hour long battery life, that weights only 2.3 kg.

Update : I do not own that laptop anymore.

This document contains my notes on installing Debian Sid on a SONY Vaio VGN-B1VP. I always try to do things the debian way but If I don't at a particular point, please help me to improve the document.

The document, unlike others, aims at being a straight installation, and not a feature driven installation. I do not know if this is the right choice. It is a try. This means that it does not explain how to have feature work, but it explains how to compile the kernel with all required options, get X running, get networking running, and so on, and everything should work at the end of the installation.

As usual, # at the beginning of the command line indicates commands to be issued as root, and $ means normal user.

Here is what lspci reads :

00:00.0 Host bridge: Intel Corporation 82852/82855 GM/GME/PM/GMV Processor to I/O Controller (rev 02)
00:00.1 System peripheral: Intel Corporation 82852/82855 GM/GME/PM/GMV Processor to I/O Controller (rev 02)
00:00.3 System peripheral: Intel Corporation 82852/82855 GM/GME/PM/GMV Processor to I/O Controller (rev 02)
00:02.0 VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)
00:02.1 Display controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 83)
00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 03)
00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 03)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 03)
00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 03)
02:04.0 CardBus bridge: Texas Instruments PCI7420 CardBus Controller
02:04.2 FireWire (IEEE 1394): Texas Instruments PCI7x20 1394a-2000 OHCI Two-Port PHY/Link-Layer Controller
02:04.3 Mass storage controller: Texas Instruments PCI7420/7620 Combo CardBus, 1394a-2000 OHCI and SD/MS-Pro Controller
02:08.0 Ethernet controller: Intel Corporation 82801DB PRO/100 VE (MOB) Ethernet Controller (rev 83)
02:0b.0 Network controller: Intel Corporation PRO/Wireless 2200BG Network Connection (rev 05)

The laptop is also labelled (at the bottom) PCG-5B1M.

Preparation

Backing Windows up

The bad news is that the laptop comes with no installation CDs. Although I did not care at all about the shipped Windows XP Pro copy, I wanted to back it up (in cases I would sell the computer).

For this purpose, I had to boot the pre-installed Windows, accept those lenghy and alienating EULAs, and run into a 10 CD long writing process. This took me almost 2 hours. That done, I rebooted and wiped out the hard drive.

Booting Debian

I had an old Woody CD that I wanted to use to install a base system and then upgrade it to Sid. But Woody comes with a 2.4 kernel at best, and this kernel does not include a suitable Ethernet Controller driver. The eepro100 driver does not work with the internal Ethernet Controller of the laptop.

Kernel 2.6 contains the e100 driver that works out of the box. I downloaded a Sarge installation CD and booted it with the linux26 option and, additionally to discovering the Sarge installer (congratulations guys), I flawlessly installed a base system.

If you need more information about the installation process, and if a Google search does not answer your questions, feel free to ask for help.

Once free of the installation CD, I ran apt-setup, chose a mirror, edited /etc/apt/sources.list and replaced stable with unstable and then I did :

# apt-get update && aptitude dist-upgrade

This installed Debian Sid on the laptop.

Compiling the kernel

There is no need to compile the kernel except to get brightness control and suspend2 working.

The process

Install the debian packages needed to compile the kernel, and add yourself to the src group to be able to compile the kernel as a normal user.

# aptitude install kernel-package fakeroot libncurses5-dev gcc make
# aptitude install linux-source-2.6.<your_version>
(this requires to log out and in to be effective) # adduser <your_username> src

The brightness control included in the sonypi module is not functional with this laptop. That's why I used to patch the kernel to get the functionnality with the sony_acpi patch. Nowadays, the sony_laptop kernel module (included in the officiel release) gives us what is required, which is worth an extra hour of battery when lowering the contrast.

You can use my .config to configure your kernel, but as there are peripherals I don't use (yet?), it certainly lacks a number of options. It should be a good start for configuring Linux on this laptop though.

$ cd /usr/src
$ tar xjf linux-source-2.6.<your_version>
$ cd linux-source-2.6.<your_version>
$ patch -p1 < /path/to/brightness_patch

This is the right time to patch your kernel with the tuxonice patch to be able to suspend.

$ patch -p1 < /path/to/tuxonice_patch

(optional) $ cp /path/to/.config .
$ make menuconfig
$ make-kpkg clean
$ make-kpkg --rootcmd=fakeroot --append-to-version '-vgn-b1vp' --revision=$(date +%Y%m%d%H%M) kernel-image
# dpkg -i /usr/src/linux-image*.deb

And then reboot with your new kernel.

# reboot

Some tips to use the kernel

If you happen to compile the same kernel version more than one time, dpkg will complain about an existing module directory. As long as you don't have extra kernel modules (i.e. not included in the official Linux kernel), or as long as you keep reinstalling them using rebuilt debian package (modules-image*.deb), you can ignore this warning and just go on. If you want different directory, use the –revision option of make-kpkg. See manual page for more details.

Modules are loaded using the modprobe utility. If you want a module to load at boot time, simply add its name in the /etc/modules file.

If you happen to use lilo, the Loading Linux step of the boot process (just after lilo) was very slow (nearly 10 seconds). I fixed this by uncommenting the compact option of the Debian standard /etc/lilo.conf. Do not forget to update the bootloader by issuing # lilo.

Power management

ACPI

# apt-get install acpid laptop-mode-tools

I then configured acpid events to change the brightness automatically when ac power is plugged or unplugged.

FIXME Describe acpi events.

# modprobe sony_laptop
# echo <0-8> > /sys/class/backlight/sony/brightness

Or alternatively using dbus something in the likes of :

$ dbus-send --system --type=method_call --print-reply\
  --dest=org.freedesktop.Hal\
  /org/freedesktop/Hal/devices/computer_backlight\
  org.freedesktop.Hal.Device.LaptopPanel.Set uint32:<0-8>

I'd like a brightness of 1 when I start the computer. So be it.

# echo 1 > /sys/devices/platform/sony-laptop/brightness_default

CPU frequency scaling

First, appropriate modules must be loaded. Fot this, I added the following lines in /etc/modules :

# Deprecated : speedstep-centrino
acpi-cpufreq
cpufreq-ondemand

Second, you must instruct the kernel the identifier of the CPU frequency scaling governor you want to use. For this, you can use a user-space daemon.

# aptitude install powernowd

Alternatively, I use laptop-mode and its configuration file to use the ondemand scaling governor. Here is an excerpt from /etc/laptop-mode.conf :

BATT_CPU_GOVERNOR=ondemand
LM_AC_CPU_GOVERNOR=ondemand

A third option is to add the following lines somewhere at the very beginning of /etc/init.d/bootmisc.sh :

# Set CPU speed scaling governor
for cpu in /sys/devices/system/cpu/cpu*
do
    echo ondemand > $cpu/cpufreq/scaling_governor
done

Suspending

# aptitude install hibernate vbetool

To RAM

Suspend to RAM nearly switches your computer off but does not really.

To suspend, I had it work using the s2ram utility :

# aptitude install uswsusp
# s2ram -f -p

(yes I'll have the laptop added to the uswsusp whitelist…)

Suspend to RAM did not work using the PIIX IDE driver (CONFIG_BLK_DEV_PIIX). All it took to make it work is for me to investigate the new libata PATA implementation of linux kernel 2.6.19 to discover that :

  • A libata driver for my IDE controller had been available for a few years (since about when the linux kernel started to support SATA).
  • This libata driver (CONFIG_ATA_PIIX) suppresses the laptop's inability to suspend to RAM. Although the driver is labelled as a SATA driver, it is completely suitable for the ICH4 PATA intel chips.

To disk

Suspend to disk basically freezes all your processes, saves the contents of your RAM to your swap partition, and turns the computer off. Upon restart, it loads back your memory and resumes to where you suspended. It is longer than suspend to RAM, but it saves more power (your computer is off).

Since kernel 2.6.13, suspend to disk works using the TuxOnIce patch and resumes 3D acceleration with no need to reload the i830 module.

Suspend to disk also works using the standard suspend option of the kernel (i.e. CONFIG_SOFTWARE_SUSPEND), using the same hibernate script.

To suspend, issue :

# hibernate

My current hibernate.conf is the default from the Debian hibernate package.

Please note that suspend to disk does not appear to work with Intel framebuffer enabled. Prefer vesafb.

Through HAL

If you want to suspend through the Hardware Abstraction Layer, for example to use fancy stuff like gnome-power-manager, you need to do a few things to make it work.

First, you need to adduser the user you use to login to the group powerdev. hald policies require this.

Next, you need to tell hald to do some VBE posting when suspending to RAM. To do so, I dropped the following contents in a new file named /etc/hal/fdi/information/b1vp.fdi :

<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">
  <device>
    <match key="system.hardware.vendor" string="Sony Corporation">
      <match key="system.hardware.product" contains="VGN-B1VP">

    <merge key="power_management.quirk.vbe_post" type="bool">true</merge>
      </match>
    </match>
  </device>
</deviceinfo>

Restarting hald should make all this taken into account.

X server

Installation

# apt-get install x-window-system-core xserver-xorg-input-synaptics xserver-xorg-video-intel
# modprobe psmouse

You can use xorg.conf which is the configuation file I use. There is also my unmaintained XF86Config-4 file for XFree86 users.

Alps Touchpad

Load the psmouse module and configure the X configuration file to use the synaptics driver (see mine for details). It should work with no problems.

The driver comes with a nice utility : syndaemon. It disables the touchpad while you are typing. To enable it, simple run :

$ /usr/bin/syndaemon -i 1 -d

(for a 1 second long deactivation of your touchpad after the last key press)

To enable syndaemon whenever your log on to your computer, simply add the same line at the top of your ~/.xsession file.

Hardware 3D acceleration

3D acceleration worked out of the box on my setup. It is enough to play Quake 3! Here is the glxgears benchmark.

XFree86 benchmark :

$ glxgears
3545 frames in 5.0 seconds = 709.000 FPS
3714 frames in 5.0 seconds = 742.800 FPS
3764 frames in 5.0 seconds = 752.800 FPS
3767 frames in 5.0 seconds = 753.400 FPS

X.org benchmark :

$ glxgears
3278 frames in 5.0 seconds = 655.600 FPS
3827 frames in 5.0 seconds = 765.400 FPS
3827 frames in 5.0 seconds = 765.400 FPS
3828 frames in 5.0 seconds = 765.600 FPS
3828 frames in 5.0 seconds = 765.600 FPS

External display

This is all good using the newer Xorg 7.2.

Now, when your plug an external monitor to the laptop, it displays a perfect picture of what you see on your laptop. Perfect? No. It lacks overlay, which is used for example for video playback. Fortunately, using the xvattr utility, it is possible to change the screen where the overlay is active.

Display discovery with the new intel driver

xorg 7.2 has introduced the newer intel video driver. The xorg.conf lines are not needed anymore to have a clone view.

Swapping overlay from one screen to the other

aptitude install xvattr

I have written a simple script to swap the overlay from screen 0 to screen 1 and vice-versa. Feel free to improve it, as I am not quite confident with my shell scripting abilities.

#!/bin/bash
# swap_overlay_pipe script
# A good idea would be to map it to the Fn-F7 key.
# Swaps the overlay pipe using the xvattr utility

set -e

XVATTR=$(which xvattr)
ATTRIBUTE=XV_PIPE
CUR_PIPE=`$XVATTR -a $ATTRIBUTE | grep $ATTRIBUTE | cut -d&#039; &#039; -f 3`

if [ $CUR_PIPE -eq "0" ]
then
  NEW_PIPE=1
else
  NEW_PIPE=0
fi

$XVATTR -a $ATTRIBUTE -v $NEW_PIPE > /dev/null

FIXME Associate the command with the Fn-F7 key and use i810switch to switch the external display off when overlay is not on its pipe. There is interesting stuff about this.

Audio

# apt-get install alsa-utils

To hear sound, you must (I don't know why) mute the external amplifier. Just lauch alsamixer and press M on the External amplifier.

To keep changes accross reboots :

# alsactl store

Wireless LAN

# aptitude install wireless-tools firmware-ipw2x00
# modprobe ipw2200
# iwconfig

Wireless works quite well. Prefer WPA, considering the level of security provided by WEP.

Here are some tips to configure Wireless networking. First, ensure iwconfig says you are associated to an access point. Make sure it does not say unassociated. Then, use ifup to configure networking.

What I call seamless networking may be easily achieved. You may check the Network profiles with Debian Sid page that is about using wpa_supplicant, guessnet and resolvconf alltogether.

Fn Keys

SONY Programmable I/O Device

As of kernel 2.6.16, the sonypi driver does not allow brightness adjustements.

Make a new file /etc/modprobe.d/sonypi:

alias char-major-10-250 sonypi
options sonypi minor=250

Then run :

# update-modules

# modprobe sonypi
# mknod /dev/sonypi c 10 250

Three modules and some scripts

Using sonypi, sony_laptop and our modified hotkey modules, FnKeys work using acpid!

Simply install the acpi-support package and they should work.

FIXME Make volume, suspend keys work and the switch screen key work with our xvattr script.

Conclusion

At this stage, I've got a very compatible Linux laptop.

References