$Id: vaio.html 21 2010-07-08 15:01:59Z gerd $

Linux on Laptop

Well, this page tells how I installed and configured Linux on a Sony Vaio VGN SR19xn laptop computer. There is a huge variety of motivations for writing this. First, it helps me to remember what and how things were done. Second, this information might be useful for other users thinking about buying the same piece of hardware. Still, the most importand reason is to show off and make you jeallous.

At A Glace

When We First Met

First time I saw this laptop was at IFA 2008 in Berlin (Germany) on August 30th (2008). Actually, I was looking for some kind of portable laptop with a bright 13.3" display that suits a software-developer for traveling (by train).

Next time I run into this machine was in a shopping mall. Actually I planed to buy a something completely different. Still, the other one was not available and the Vaio's features seemed nice, too. A closer look a the hardware specifications told me that it should be possible to run Linux on it. After a brief keyboard test I bought it.

At Home

After unpacking the box, very few pieces of hardware appeared. The package also included a Windows-XP installation CD-ROM and some booklets.

On the first boot Windows Vista (business edition) did lots of initialization stuff. As the laptop does not have any system-restorage-media, one have to create them. I followed the guide in the booklet, stuffed in two blank DVDs and backup the brand new laptop.

Installer

In the meantime I downloaded Kubuntu. For the sake of a brand new kernel I decided to install the latest development version of Kubuntu Intrepdid Ibex: Alpha 5. Furthermore I expected some to run into problems with graphix support, hence I used the alternate, text-mode installer.

So I removed the Windows installation and went on with Linux. Actually, the basic installation completed smoothly. Still - as expected - WLAN and X-Server did not work!

Well, I have to admit, I removed Kubuntu and started from scratch a few days later. I just was not happy with the beta version of KDE 4.1. So i wiped the disc clean and started again with plain Debian and good old fashioned KDE 3.

Today, KDE 4 is a mature desktop environment and I really enjoy it. I'm still runing Debian and I don't see why I should switch to Kubuntu, again.

Bright light

Device section in /etc/xorg.conf
Fallback Driver: VESA
Section "Device"
    Identifier  "device0"
    Driver      "vesa"
EndSection
INTEL driver with hardware accelaration
Section "Device"
        BusID           "PCI:0:2:0"
        Identifier      "device0"
        Driver          "intel"
        Option          "VBERestore"   "true"
        Option          "backingstore"   "true"
EndSection

So far, there was text-console only. The X-server just showed a pitch-black screen. At first I did not manage to install a driver for the Intel graphics chip X4500MHD. After several hours I ended up with an old scholl vesa driver. Of cource, this driver does not support hardware accelaration (for this chipset), but it is capable to draw bright pixels on the screen.

A few month' later, I found that Intel's the new driver supports X4500MHD, as well. All I had to do was to install the Debian package and change X.Org-Settings.

Monitor section in /etc/xorg.conf
Section "Monitor"
        Identifier      "monitor0"
        VendorName      "Sony Vaio"
        #DisplaySize     285 179
        #HorizSync       29-60
        #VertRefresh     0-60
        #Modeline        "1280x800" 68.56 1280 1336 1472 1664 800 801 804 824 -HSync +Vsync
EndSection

I forget to mention that I use a quite recent version of X.Org X-server (version 1.5.0) - as it drops out of the Ubuntu package. It can autodetect a fair bit of hardware, but not the build in display. Of course. So I had to enter the monitor's modeline manually. Later when the proper Intel driver was installed, those modelines became obsolote.

After that the X-server started and I could start to enjoy the bright light of this LED backlighted display.

Sound

# apt-get install alsa-base alsa-oss alsa-utils libasound2-plugins
# echo "options snd-hda-intel model=sony-assamd" >>/etc/modprobe.d/alsa-base

Webcam

Test webcam:
$ mplayer tv:// -tv driver=v4l2
Record from webcam:
$ mencoder tv:// -tv driver=v4l2:device=/dev/video0 -nosound -ovc lavc -o test.avi

Build in Cameras are handy gimmicks. It's just nice talking to people and seeing each other. The one above the screen is labeled motion eye, but it is actually a Ricoh device.

# lsusb | grep -i Camera
Bus 001 Device 003: ID 05ca:183e Ricoh Co., Ltd Visual Communication Camera VGP-VCC9 [R5U870]
# modprobe -a uvcvideo
# dmesg 
Linux video capture interface: v2.00
uvcvideo: Found UVC 1.00 device <unnamed> (05ca:183e)
input: UVC Camera (05ca:183e) as /devices/pci0000:00/0000:00:1a.7/usb1/1-2/1-2:1.0/input/input10
usbcore: registered new interface driver uvcvideo
USB Video Class driver (v0.1.0)

Mobile Computing

Bluetooth

# apt-get install bluetooth bluez-utils
# apt-get install kdebluetooth

Networking

As usually the laptop comes with build in ethernet. A Marvell 88E8040 controller that works well. All I had to do was to plug in the cable. Actually, it supports Gbit ethernet. still, I just own 100Mbit switches.

Install firmware and load module
$ grep FIRMWARE_DIR /lib/udev/hotplug.functions
$ grep FIRMWARE_DIR /etc/default/hotplug
$ sudo cp iwlwifi-5000-1.ucode /usr/local/lib/firmware
$ sudo modprobe -av iwlagn
insmod /lib/modules/2.6.27.8/kernel/net/wireless/cfg80211.ko
insmod /lib/modules/2.6.27.8/kernel/net/mac80211/mac80211.ko
insmod /lib/modules/2.6.27.8/kernel/drivers/leds/led-class.ko
insmod /lib/modules/2.6.27.8/kernel/net/rfkill/rfkill.ko
insmod /lib/modules/2.6.27.8/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko
insmod /lib/modules/2.6.27.8/kernel/drivers/net/wireless/iwlwifi/iwlagn.ko
$ sudo iwlist wlan0 scanning
Configure wlan
$ sudo apt-get install wpasupplicant
$ cat /etc/wpa_supplicant.conf
network={
        ssid="YOUR-NETWORD_SSID"
        psk=WHATEVERYOURKEYIS
}
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback

allow-hotplug eth0
allow-hotplug wlan0
iface wlan0 inet dhcp
$ sudo ifup wlan0

Well, mobile computing requires WiFi, not Gbit LAN. When I bought this piece of hardware the Intel chipset was brand new. Actually, Kernel support is quite good, still you need at least Kernel version 2.6.27.8 with module iwlagn.

Also hotplug and a proper firmware is required. Download the firmware from Intel's Wireless pages and install it in your firmware folder. The location depends on the hotplug tools you use. Debian's default is udev (which is the successor of hotplug). Find out which directories are used to load firmare code from. The very default location is defined in the shell functions in variable FIRMWARE_DIR. Still, those variables may be overwriten in /etc/default/hotplug.

Load module iwlagn and test network card by scanning the network. Install wpasupplicant and configure, setup network interfaces and you're done.

On/Off

One very nice feature of current Operation Systems is suspend to RAM (a.k.a. sleep) respectively disk (a.k.a. hibernat). Using that, you hardly have to boot, and resuming your previous session is just a matter of seconds. I just love it. Both, suspend to disk and RAM work fine. I just had to remove the package uswsusp, pm-utils and a modern Kernel is just fine.

/etc/pm/config.d/parameter
ADD_PARAMETERS="--quirk-vbe-post"

Still, there is one problem after wake up: the display just stays black. Call vbetool post and it is all good. PM-Utils can do this for you, just add the parameter in the config file.

I also installed kpowesave kpowerdevil- an applet that allows users to change screen's brightness, adjust CPU frequency scaling and puts your computer to suspend. To use it, add users to the group "powerdev".

Green PC

/etc/hdparm.conf
/dev/sda {
  read_ahead_sect = 2048
  spindown_time = 6
}
/etc/sysctl.conf
# power saving options
vm.laptop_mode = 5
vm.dirty_expire_centisecs = 60000
vm.dirty_writeback_centisecs = 60000
vm.dirty_ratio = 60
vm.dirty_background_ratio = 1
vm.swappiness = 10 
/etc/syslog.conf
auth,authpriv.*         /dev/null
*.*;auth,authpriv.none  /dev/null
lpr.*                   /dev/null
mail.*                  /dev/null
user.*                  /dev/null

Apropos mobile computing. There are heaps of parameters regarding power management. I tweaked the hard diskparameter to spin down hard disk motor after 30 (5*6) seconds. Furthermore hard disk caches were increased - this helps to avoid lots of hard disk activity and hopefully saves a few watts.

Syslog is another deamon that hardly doesn't do anthing but wirting on disk. As logging on this machine is not that importand, it's good enough to wirting log message to /dev/null.

Slot Machine

Load kernel modules
# modprobe -av sdricoh_cs
insmod /lib/modules/2.6.27-rc6/kernel/drivers/pcmcia/pcmcia_core.ko
insmod /lib/modules/2.6.27-rc6/kernel/drivers/pcmcia/pcmcia.ko
insmod /lib/modules/2.6.27-rc6/kernel/drivers/mmc/host/sdricoh_cs.ko
Now insert you SDCard
# dmesg
[... lots of messages ...]  
[14473.186875] mmc0: new SD card at address 0002
[14473.189011] mmcblk0: mmc0:0002       3911680KiB
[14473.190415]  mmcblk0: p1
This shows the device location and partition(s)
# ls -l /dev/mmcblk0*
brw-rw---- 1 root plugdev 179, 0 2008-09-18 22:26 /dev/mmcblk0
brw-rw---- 1 root plugdev 179, 1 2008-09-18 22:26 /dev/mmcblk0p1
# mount /dev/mmcblk0p1 /media/sdcard
You probably want to add this to /etc/fstab

One special feature of Sony hardware is the support for Memory Sticks. Hence this laptop comes with two slots in front. One for Memory Sticks and the other one can read MMC and SDCards. I tried the memory stick, but without success. Still, the SDCard-reader works nice. All you have to do is load the matching kernel module, watch dmesg's output and set a mount point accordingly

Show Off

Well, the bad thing about brand new hardware is, that it is a pain to get everything running on Linux. On the bright side, you can tell you friends about the hardware configuration and make them realy jeallous.

Hardware

Brand Sony
Make Vaio VGN SR19XN
Processor Intel Core 2 Duo P8400
2.2GHz, 800Mhz FSB
RAM 3072 MB DDR2 SDRAM, 800MHz
(1 x 1024, 1 x 2048 MB)
Display 13.3" XWXGA+ (1280x800)
TFT, LED Backlight
Graphic Mobile Intel GM45 / X4500MHD
Hard Disk 160 GB SATA
Samsung HM160JI
Detected Hardware
$ lspci
00:00.0 Host bridge: Intel Corporation Cantiga Memory Controller Hub (rev 07)
00:02.0 VGA compatible controller: Intel Corporation Cantiga Integrated Graphics Controller (rev 07)
00:02.1 Display controller: Intel Corporation Cantiga Integrated Graphics Controller (rev 07)
00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 03)
00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 (rev 03)
00:1c.2 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 3 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 4 (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03)
00:1d.3 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93)
00:1f.0 ISA bridge: Intel Corporation ICH9M LPC Interface Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation ICH9M/M-E SATA AHCI Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 03)
01:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8040 PCI-E Fast Ethernet Controller (rev 12)
04:00.0 Network controller: Intel Corporation Device 4232
06:03.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 05)
06:03.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 22)
06:03.2 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 12)