INSTALLING LINUX ON A SONY VAIO V505BX (PCG-V505BX)

Changelog

  • 12-DEC-2003: updates concerning reading DVDs and audio CDs
  • 09-DEC-2003: updates concerning CD writing
  • 04-DEC-2003: initial write-up

Hardware Specifications

  • CPU: Intel Pentium 4 M 2.0 GHz (512K L2 Cache)
  • RAM: 512 MB
  • Display: 12.1 TFT (1024 x 768 @ 24bpp)
  • Video: 16 MB ATI Radeon Mobility M6 LY (rev 0)
  • Audio: Intel 82801CA/CAM AC'97 Audio (rev 2)
  • Hard Disk: 40 GB (HITACHI DK23EA-40), ATAPI
  • CDRW/DVD-ROM: MATSHITA UJDA745 DVD/CDRW, ATAPI CD/DVD-ROM
  • Ethernet: Intel 82801CAM (ICH3) Pro/100 VE (LOM) (rev 66)
  • Wireless Ethernet: Harris Semiconductor Prism 2.5 Wavelan (rev 1)
  • PCMCIA: Ricoh Cardbus Bridge (rev 184)
  • Firewire: Ricoh R5C551 IEEE 1394 Controller (rev 0)
  • USB: NEC Controller (rev 67)
  • USB 2.0: NEC Enhanced USB Controller (rev 4)
  • Memory Stick: Sony Memory Stick MSC-U03
  • Modem: Intel 82801CA/CAM AC'97 Modem Controller (rev 2)

Output From lspci -tv

[han@entropy]$ lspci -tv 
-[00]-+-00.0  Intel Corp. 82845 845 (Brookdale) Chipset Host Bridge
      +-01.0-[01]----00.0  ATI Technologies Inc Radeon Mobility M6 LY
      +-1e.0-[02]--+-02.0  Harris Semiconductor Prism 2.5 Wavelan chipset
      |            +-05.0  Ricoh Co Ltd RL5c475
      |            +-05.1  Ricoh Co Ltd R5C551 IEEE 1394 Controller
      |            +-07.0  NEC Corporation USB
      |            +-07.1  NEC Corporation USB
      |            +-07.2  NEC Corporation USB 2.0
      |            \-08.0  Intel Corp. 82801CAM (ICH3) PRO/100 VE (LOM) Ethernet Controller
      +-1f.0  Intel Corp. 82801CAM ISA Bridge (LPC)
      +-1f.1  Intel Corp. 82801CAM IDE U100
      +-1f.3  Intel Corp. 82801CA/CAM SMBus
      +-1f.5  Intel Corp. 82801CA/CAM AC'97 Audio
      \-1f.6  Intel Corp. 82801CA/CAM AC'97 Modem

Introduction

I did a little bit of reading up before I tried to install linux on this machine. The references are:

I started with a Red Hat 7.3 installation and updated the kernel to 2.4.23. As far as I could tell, I was able to get pretty much everything EXCEPT OpenGL to work. The problem wasn't with the kernel, but the older version of XFree86 (Red Hat 7.3 uses 4.2, which apparently did not have good DRI support for the Radeons). So, rather than recompiling from source to update my system (as I can recall, XFree86 took a long time to compile), I went ahead and used Red Hat 9.0 for my base (re)install. (Incendentally, Red Hat 9.0 did not give me the option of creating a user account during the setup process. I also do not like their new way of grouping packages and forcing a 1.5GB+ install -- their minimal installation option was found wanting.)

      Just in case you were wondering, I formatted the the entire drive without making the restoration CDs Sony allows you to make. I am pretty sure that I won't be regretting that decision.

Linux Kernel 2.4.23 Options

  • PCMCIA: enabled PCMCIA cardbus as a module
  • ACPI/APM: disabled APM and enabled ACPI
  • CDROM/DVD: make sure to enable scsi emulation; you will also need scsi disk support (sd_mod) in order to use the Sony memory stick)
  • Firewire: use the OHCI-1394 module
  • Ethernet: use EtherExpressPro/100 module (eepro100 or e100; either one works)
  • Wireless: Hermes chipset (Orinico/Prism2/Symbol) and include Prism 2.5 support (use the orinoco_pci module)
  • Input: compile input core as module (for USB mouse, etc)
  • Sony Programmable I/O: enabled as module (sonypi)
  • Video: compile agpgart module with Intel 440LX/BX/GX ... I850/I860 support (uses i845); DRI enabled for the Radeon chip
  • Sound: use the i810_audio module (also compiled OSS support)
  • USB: EHCI, OHCI support (for my MS USB Intellimouse) and mass storage support (needed for memory stick
  • SCSI: generic scsi support (also needs scsi disk and scsi cdrom support); this is needed for cd writing and for the memory stick

      I'm still trying to tweak my kernel config file. Once I find a config I can be happy with, I'll post it here. I definitely recommend using the graphical interface (use: make xconfig) if you're not too familiar with setting up the kernel options. Before you start compiling, you should make sure to patch the orinoco_pci driver with this patch

linux-2.4.20-u101lanexpress3872.patch

--- linux-2.4.20/drivers/net/wireless/orinoco_pci.c.orig	2003-05-21 11:40:59.000000000 -0400
+++ linux-2.4.20/drivers/net/wireless/orinoco_pci.c	2003-05-21 11:41:52.000000000 -0400
@@ -359,6 +359,7 @@
 }
 
 static struct pci_device_id orinoco_pci_pci_id_table[] __devinitdata = {
+	{0x1260, 0x3872, PCI_ANY_ID, PCI_ANY_ID,},
 	{0x1260, 0x3873, PCI_ANY_ID, PCI_ANY_ID,},
 	{0,},
 };

The patch above IS NOT in the latest kernel (2.4.23 as of this writing) so you WILL need it in order to get your wireless networking card to be recognized.

ACPI, spicctrl, sonypi

ACPI was compiled into the kernel. If you use the module, I recommend compiling all the (relevant) ACPI into the module (use Y and not M) so that you have ONE SINGLE module to load. Otherwise you'll end up having to load several different modules to get complete ACPI support. You DO NOT need to patch kernel 2.4.23 with any of the patches referred to by the links above -- they're already in there. Anyway, you should definitely download the ACPI daemon (acpid) and install it.

      Once you have acpid installed, (this should create the directory /etc/acpi along with some subdirectories (namely actions and events). As complicated as it may seem, the way you use acpid is quite simple. Create event handlers in your /etc/acpi/actions directory and they will be called by the event handler. In order for the event handler to know what action to take, you'll need to create "config" files in the /etc/acpi/events directory. Each file in the events directory should contain two lines:

/etc/acpi/events/battery

event=ac_adapter
action=/etc/acpi/actions/battery.sh

      The first line is the event (in this case, we're trapping all events relating to ac_adapter). The second line tells the acpid event handler where to find the file to execute upon any ac_adapter event.

/etc/acpi/actions/battery.sh

#!/bin/sh

# ACAD_XXX values are for when the ac adapter is available
# BATT_XXX are values used during battery operation

# lcd brightness; valid range: 0-255
# requires spicctrl (http://spop.free.fr/sonypi/) as well as sonypi kernel 
# support 
ACAD_LCD=200
BATT_LCD=100

# max cpu speed (performance)
# cat /proc/acpi/processor/CPU0/performance for more info
ACAD_CPU=0
BATT_CPU=1

# cpu throttling
# cat /proc/acpi/processor/CPU0/throttling for more info
ACAD_THR=0
BATT_THR=2

# spindown time for HD (man hdparm for valid values)
# I prefer 10 mins for acad and 5 mins for batt
ACAD_HD=120
BATT_HD=60

# battery event handler

status=`awk '/^state: / { print $2 }' /proc/acpi/ac_adapter/ACAD/state`

case $status in
        "on-line")
                echo "Setting HD spindown to 10 mins"
                /sbin/hdparm -S $ACAD_HD /dev/hda > /dev/null 2>&1
                /usr/sbin/spicctrl -b $ACAD_LCD
                echo -n $ACAD_CPU:$ACAD_THR > /proc/acpi/processor/CPU0/limit
                exit 0
        ;;
        "off-line")
                echo "Setting HD spindown to 5 minute"
                /sbin/hdparm -S $BATT_HD /dev/hda > /dev/null 2>&1
                /usr/sbin/spicctrl -b $BATT_LCD
                echo -n $BATT_CPU:$BATT_THR > /proc/acpi/processor/CPU0/limit
                exit 0
        ;;
esac

      This is a fairly robust script (configurable as well) which I wrote to handle any change in the power source. Bascially, it changes the cpu performance and throttling options. To find out more about how many different performance and throttling states there are, refer to the /proc/acpi/ directory and http://acpi.sf.net. You may want to install sonypi and spicctrl if you wish to be able to use the Fn key combos as well as to adjust the LCD lighting. Below are the rest of my scripts... I'm still working on something for the thermal zone.

/etc/acpi/events/lidbutton

event=button/lid
action=/etc/acpi/actions/lidbutton.sh


/etc/acpi/actions/lidbutton.sh

#!/bin/sh

# Laptop lid closed; shut down gracefully
# (need to implement "standby" mode instead)

# Only shutdown if running on battery; otherwise turn off lcd
# Get radeontool from: http://fdd.com/software/radeon/

lid_status=`awk '/^state:/ { print $2 }' /proc/acpi/button/lid/LID/state`
batt_status=`awk '/^charging state:/ { print $3 }' /proc/acpi/battery/BAT1/state`

case $lid_status in
        "closed")
                if [ -n $batt_status -a $batt_status = "discharging" ] ; then
                        /sbin/init 0
                else
                        /usr/local/bin/radeontool light off
                fi
                exit 0
        ;;
        "open")
                /usr/local/bin/radeontool light on
                exit 0
        ;;
esac


/etc/acpi/events/powerbutton

event=button/power
action=/etc/acpi/actions/powerbutton.sh


/etc/acpi/actions/powerbutton.sh

#!/bin/sh

# Power button pressed; shut down the system gracefully

/sbin/init 0

      If you want more specific event handling, you will need to know more about the ACPI events. While no one has really documented any of the events, they are listed in include/acpi/acpi_drivers.h I will try to write some documentation on this once I have finished playing around with the event handling system. You might also want to get radeontool if you have Radeon-based video card to turn off the back light.

Ethernet And Wireless Ethernet

My ethernet drivers are set up via /etc/modules.conf with the lines:

alias eth0 eepro100
alias eth1 orinoco_pci

Neither card is set up during boot (to speed up the booting process since dhcp is currently set to use a long timeout and since I'm picky about when to use which ethernet interface). That is, the modules are loaded, but I set up the init scripts to stop just short of calling ifup. When I want to use, say, wireless ethernet, I just manually run ifup eth1. For the other interface, I would use ifup eth0. Both ethernet interfaces work without problems.

      I also compiled the e100 module for the internal ethernet card. You can use the e100 module (Intel driver) in place of the eepro100 module. I have encountered no problems with the eepro100 module, and don't plan to test out the e100 module until I do encounter problems with the eepro100 driver. (Oh yeah... I did load this module for the 2.4.23 kernel during the Red Hat 7.3 trial and it worked without problems.)

Audio

The built-in audio works without needing a kernel update. I just had to make sure that I didn't forget to add support for it in the kernel I intended to compile. You might run into problems with audio playback -- sounds may play back smoothly but slowly, or even in "chunks" with tiny pauses in between. This is because the i810_audio driver may sometimes have problems computing the clocking. (Check your /var/log/messages after loading the i810_audio module) You can easily fix this problem (for good) by adding the option clocking=48000 when loading i810_audio. Alternatively, have the following lines in your /etc/modules.conf file:

alias sound-slot-0 i810_audio
options i810_audio clocking=48000

      UPDATE: (12-DEC-2003) I was tinkering around with xmms today. After installing an updated version of xmms (1.2.8), which includes the mp3 playback plugin removed by Red Hat, I had trouble getting audio CDs to play. This was quickly fixed by editing the options for the audio CD plugin -- use digital mode (instead of the default analog).

PCMCIA And Firewire

The Ricoh cardbus is loaded using the ohci1394 module (which also requires the ieee1394 module). The modules load fine; sadly I do not own any firewire products to test whether or not the port even works. Until I do, this module will not be loaded on boot. The PCMCIA cardbus module loads fine using the yenta_socket module. Red Hat users should read on... The 2.4.23 kernel module creates /lib/modules/2.4.23/kernel/pcmcia which contains only symlinks to the actual PCMCIA modules. The problem is that the PCMCIA init script assumes that the existence of such a directory implies the system is running Slackware. As a result, the script modprobes with the .o extension rather than leaving off the .o extension as done in Red Hat systems. So either delete that directory or modify your init script so that it loads at the time you would like them to load using the correct modprobe syntax.

USB Hardware

The NEC USB controller uses the usb-ohci driver. You will need the ehci-hcd driver for the NEC USB 2.0 controller (which also needs usb-ohci -- one more reason to make sure to include usb-ohci). My USB MS Intellimouse works fine. In X, I can use both the USB mouse as well as the touchpad mouse. (You just need to configure them both using "CorePointer" and "AlwaysCore" options -- the first for the touchpad and the latter for the USB mouse.) The drivers for the memory stick seem to work fine (but like firewire, I have no hardware to test the driver). If you're wondering, the Sony memory stick requires USB SCSI support. There is just one small issue -- nothing which seems to affect operation of USB hardware, however. When using lsusb I get a number of "Unknown line at line XXXX" messages followed by a correct listing of all the USB hardware attached to the various buses. I'm still trying to figure this out, so more to come later... I hope.

CD-RW/DVD-ROM And CD Creating

The CD-RW/DVD-ROM drive appears to work without any problems (with the help of kudzu). I have not yet tested out any DVD roms or watched any DVD videos. I have not yet created any CDs either. Once I get the chance to do any of these things, I will update here.

      UPDATE: (09-DEC-2003) I just burned the first ISO image of Fedora Core 1 using xcdroast. The writing session went well and no problems were found. They CDROM is mountable under linux, and is also readable under Windows. DVD reading/testing still to come...

      UPDATE: (12-DEC-2003) I compiled ogle and tested out the DVD-ROM drive with a bit of Trek. The first attempt produced some errors about root priviledges -- but it in fact was erroneous error message. It turns out you need to have /dev/dvd symlinked to /dev/scd0 (aka the CDRW drive). Once that was done, I played an episode of Star Trek Deep Space 9 (season 7) without any problems. The framerate could have been a bit better -- it kept steady at around 30 fps. Perhaps the color depth of X could have something to do with it? I know it does for OpenGL programs... in any case, it worked.

Final Comments

Everything seems to working without problems. There are some details I woud like to eventually work out:

  • There does not appear to be any fan control interface via ACPI. Perhaps some poking in the DSDT table might show something. So far the DSDT table seems perfectly bugfree using Intel's (dis)assembler. Unfortunately, beyond (dis)assembly, I know nothing about AML.
  • The ACPI event handler still needs some work (e.g. implement standy mode and also trap thermal zone events). A small annoyance is the use of IRQ9 for interrupt sharing. Apparantly every PCI device is using IRQ9.
  • The Fn keys work in the sense that sonypid recognizes the key presses. I will probably modify the code and put in some routines to handle the mute, volume, brightness, video output, and standby buttons.
  • The Win Modem reportedly works using the Conexant drivers.
  • The anti-aliasing available in Red Hat 9.0 is quite nice.

Miscenalleous Files

/etc/modules.conf

alias eth0 eepro100
alias eth1 orinoco_pci
alias usb-controller usb-ohci
alias usb-controller1 ehci-hcd
# alias ieee1394-controller ohci1394
alias ieee1394-controller off
alias sound-slot-0 i810_audio
options i810_audio clocking=48000
post-install sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -L >/dev/null 2>&1 || :
pre-remove sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -S >/dev/null 2>&1 || :
alias char-major-10-250 sonypi
options sonypi minor=250
alias char-major-226 radeon
pre-install radeon modprobe agpgart

# modifications for the 2.4.23 kernel
# char-major-10-134 is APM
# char-major-97 is parallel port
alias char-major-10-134 off
alias char-major-97 off


/etc/X11/XF86Config

Section "ServerLayout"
	Identifier     "Default Layout"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
	InputDevice    "DevInputMice" "AlwaysCore"
EndSection

Section "Files"
	RgbPath      "/usr/X11R6/lib/X11/rgb"
	FontPath     "unix/:7100"
EndSection

Section "Module"
	Load  "dbe"
	Load  "extmod"
	Load  "fbdevhw"
	Load  "glx"
	Load  "record"
	Load  "freetype"
	Load  "type1"
	Load  "dri"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "keyboard"
	Option	    "XkbRules" "xfree86"
	Option	    "XkbModel" "pc105"
	Option	    "XkbLayout" "us"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "PS/2"
	Option	    "Device" "/dev/psaux"
	Option	    "ZAxisMapping" "4 5"
	Option	    "Emulate3Buttons" "yes"
EndSection

Section "InputDevice"
	Identifier  "DevInputMice"
	Driver      "mouse"
	Option	    "Protocol" "IMPS/2"
	Option	    "Device" "/dev/input/mice"
	Option	    "ZAxisMapping" "4 5"
	Option	    "Emulate3Buttons" "no"
EndSection

Section "Monitor"
	Identifier   "Monitor0"
	VendorName   "Monitor Vendor"
	ModelName    "Generic Laptop Display Panel 1024x768"
	HorizSync    31.5 - 48.5
	VertRefresh  40.0 - 70.0
	Option	    "dpms"
EndSection

Section "Device"
	Identifier  "Videocard0"
	Driver      "radeon"
	VendorName  "Videocard vendor"
	BoardName   "ATI Radeon Mobility M6"
	VideoRam    16384
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Videocard0"
	Monitor    "Monitor0"
	DefaultDepth     24
	SubSection "Display"
		Depth     24
		Modes    "1024x768" "800x600" "640x480"
	EndSubSection
EndSection

Section "DRI"
	Group        0
	Mode         0666
EndSection