Vaio PCG-Z505JE

Installing Debian GNU/Linux on a Sony Vaio PCG-Z505JE

Please note that I have stopped updating this page, except for major changes. It still contains useful information about how to install Debian on the laptop, but I have modified some things that I am too lazy to explain here. The Vaio PCG-Z505JE is rather old now, which means that Linux is pretty much supporting everything on the laptop now (except the Memory Stick Media slot). I hope you find all this information useful. I will write a similar page when I get a new laptop and install Debian on it.

I got a Sony Vaio PCG-Z505JE for work in July 2000. Since I don't use Windows, I had to install Linux on it.

Last modified: $Date: 2007-12-23 22:50:03 -0800 (Sun, 23 Dec 2007) $


The challenge

Installing Debian is usually pretty straight-forward, whether you do an installation via the network or via an IDE CD-ROM drive (i.e. not a PCMCIA one).

The problem was that the PCMCIA CD-ROM drive is only detected once the kernel modules are installed, and Debian 2.2 needs 3 installation floppies. However, this laptop has a USB floppy drive, which is not supported by Linux 2.2. It means that as soon as you have to insert a new floppy, you lose.

Useful information can be found on the Linux on Laptops page, on the Vaio 505 Web Ring and in the Sony 505 mailing list and on the Linux-sony mailing list.

Starting the installation

One way that I haven't tried is to boot Linux from the installation CD-ROM with the following kernel parameter: ide2=0x180,0x386.

My second installation (since my hard drive died) was better than my first one, so I documented it here.

Here is how to proceed:

  1. Boot the Debian CD-ROM and nuke all the partitions.
  2. Boot the Sony recovery CD, and run PhDisk to create a partition (phdisk /create /partition /ram192) for the hibernation mode.
  3. Boot the Debian CD-ROM again and partition the hard disk as you wish, leaving /dev/hda4 alone (this is the hibernation partition). Set one of your swap partitions to FAT 16.
  4. Boot the Sony recovery CD. Format C: (your swap partition which is in FAT 16).
  5. Insert the Debian CD-ROM, and copy /debian/dists/potato/main/disks-i386/current/*.tgz and /debian/dists/potato/main/disks-i386/current/images-1.44/* to C:.
  6. Boot the Debian CD-ROM and do the installation. When asked to install the kernel and drivers, choose to do that from the hard disk and choose the FAT 16 partition.
  7. When you reboot, convert your FAT 16 partition into a real swap partition.

Configuring the system

Note that several times, there are snippets of kernel configuration. With a standard Debian kernel image (kernel-image package), you should be all set. Would you want to recompile a kernel, I encourage you to read the Linux Kernel HOWTO.

I have now switch to a 2.4 kernel, which works fine. APM used to hang until version 2.4.5, but now works ok. You can download my kernel configuration file for Linux 2.4.x (likely to be the latest version).

XFree86

The NeoMagic MagicMedia 256AV+ is not supported by XFree86 3.3.6. However, it's compatible with the 256AV (NM2200).

Alternatively, you can use the frame buffer device. In that case, run the kernel with vga=0x318 and use the xserver-fbdev X server. However, by doing this you are losing the DPMS functionalities.

I have an XInput section for my USB mouse.

Below is my XF86Config:

Section "Files"
    RgbPath	"/usr/X11R6/lib/X11/rgb"
    FontPath   "/usr/X11R6/lib/X11/fonts/misc/:unscaled"
#    FontPath   "/usr/X11R6/lib/X11/fonts/cyrillic/:unscaled"
    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
    FontPath   "/usr/X11R6/lib/X11/fonts/Speedo/"
    FontPath   "/usr/X11R6/lib/X11/fonts/Type1/"
    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"
#    FontPath   "/usr/X11R6/lib/X11/fonts/cyrillic/"
    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/"
    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"
    FontPath "/usr/X11R6/lib/X11/fonts/freefont/"
    FontPath   "/usr/local/X11R6/lib/X11/fonts/URW/"
EndSection

Section "ServerFlags"
#    NoTrapSignals
#    DontZap
    DontZoom
#    DisableVidModeExtension
#    AllowNonLocalXvidtune
#    DisableModInDev
#    AllowNonLocalModInDev
EndSection

Section "Keyboard"
    Protocol	"Standard"
#    Protocol	"Xqueue"
    AutoRepeat	500 30
#    ServerNumLock
#    Xleds      1 2 3
#    LeftAlt     Meta
#    RightAlt    ModeShift
#    RightCtl    Compose
#    ScrollLock  ModeLock
#    XkbDisable
    XkbKeymap   "xfree86(us)"
    XkbModel	"pc105"
EndSection

# Built-In TouchPad
Section "Pointer"
    Protocol    "PS/2"
    Device      "/dev/mouse"
    Emulate3Buttons
    Emulate3Timeout    50
EndSection

# USB Mouse
Section "XInput"
    SubSection "Mouse"
        DeviceName	"USB Mouse"
        Protocol	"IMPS/2"
        Port		"/dev/input/mice"
        Buttons		5
	ZAxisMapping	4 5
        AlwaysCore
    EndSubSection
EndSection

Section "Monitor"
    Identifier  "LCD XGA TFT"
    VendorName  "Sony"
    ModelName   "No idea"
    HorizSync   31.5,35.15,35.5
    VertRefresh 50-90
    Modeline "1024x768" 44.9  1024 1048 1208 1264  768  776  784  817 Interlace
EndSection

Section "Device"
    Identifier "Linux Frame Buffer Device"
EndSection

Section "Device"
    Identifier  "NeoMagic (laptop/notebook)"
    VendorName  "NeoMagic"
    BoardName   "MagicMedia 256AV+"
    Chipset     "NM2200"
    Option	"power_saver"
    Option	"hw_cursor"
    Option	"intern_disp"
    Option	"extern_disp"
EndSection

Section "Screen"
    Driver      "FBDev"
    Device      "Linux Frame Buffer Device"
    Monitor     "LCD XGA TFT"
    Subsection "Display"
        Depth       24
        Modes       "default"
    EndSubsection
EndSection

Section "Screen"
    Driver      "svga"
    Device      "NeoMagic (laptop/notebook)"
    Monitor     "LCD XGA TFT"
    DefaultColorDepth 24
    Subsection "Display"
        Depth       16
        Modes       "1024x768"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       24
        Modes       "1024x768"
        ViewPort    0 0
    EndSubsection
EndSection

If you are running XFree86 4.x, use the following XF86Config-4.

Sound

There are two ways to get the sound working.

Using the kernel OSS driver

If you have a recent kernel (I tested it with version 2.2.19), you can use the Yamaha PCI OSS driver. Here are the options I use:

#
# Sound
#
CONFIG_SOUND=y
CONFIG_SOUND_OSS=y
CONFIG_SOUND_YMFPCI=y

If you use an old kernel (the latest 2.4 doesn't have this problem), you need to compile the sound driver as a module because it does not resist a suspend operation. I therefore used to unload the driver everytime I suspended the machine (in /etc/apm/events.d/sound):

#!/bin/sh

case "$1" in
suspend)
        /sbin/rmmod ymfpci
        /sbin/rmmod ac97_codec
        ;;
esac

Below was the contents of /etc/modutils/sound:

alias sound-slot-0 ymfpci
alias sound-service-0-0 ymfpci
post-install ymfpci /usr/bin/aumix -L

Using the ALSA driver

If you prefer, you can use the ymfpci driver of Alsa (at least version 0.5.8b).

0 [card1          ]: YMFPCI - Yamaha DS-XG PCI (YMF744)
                     Yamaha DS-XG PCI (YMF744) at 0xfecf0000, irq 9

To get the sound work fine, you need to disable the Plug and Play capabilities in the BIOS. However, if you do that, be sure to compile your kernel with CONFIG_PNP unset otherwise the system will hang when you try to configure the network interface (see the discussion about PnP in debian-laptop).

Here's my /etc/modutils/alsa:

alias char-major-116 snd
alias char-major-14 soundcore

options snd snd_major=116 snd_cards_limit=4 snd_device_mode=0660 snd_device_gid=29 snd_device_uid=0

alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss

#alias snd-card-0 snd-card-dummy
#alias snd-card-1 snd-card-serial
#alias snd-card-2 snd-card-share
#alias snd-card-3 snd-card-virmidi

alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1
alias sound-slot-2 snd-card-2
alias sound-slot-3 snd-card-3

alias char-major-116 snd
alias snd-card-0 snd-card-ymfpci
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
post-install snd-card-ymfpci /usr/bin/aumix -L

However, I noticed the sound doesn't work anymore if the machine is suspended and then resumed. Until I figure out why, I added /etc/init.d/alsa stop and /etc/init.d/alsa start in /etc/apm/event.d/alsa.

Note that the ALSA drivers require installing extra packages (e.g. alsa-base) so I now use the kernel OSS driver.

PCMCIA

I now use the PCMCIA modules included in the kernel. See my kernel configuration.

In order to make the Orinoco support work, you need to install hermes.conf in /etc/pcmcia as explained in the Wavelan IEEE/Orinoco and its friends page.

In order to the removable IDE devide support work, you need to replace all instances of ide_cs by ide-cs in /etc/pcmcia/config, explained in pcmcia-cs's note about PCMCIA support in the 2.4 kernel.

The problem with PCMCIA is that there is an internal network interface. I configure it at boot up so that it works when I'm at work. If I want to use my wireless card with DHCP, I need to bring down the internal interface using my netenv customizations. Here's my /etc/pcmcia/network.opts:

case "$ADDRESS" in
*,*,*,*)
    INFO="DHCP configuration"
    # Transceiver selection, for some cards -- see 'man ifport'
    IF_PORT=""
    # Use BOOTP (via /sbin/bootpc, or /sbin/pump)? [y/n]
    BOOTP="n"
    # Use DHCP (via /sbin/dhcpcd, /sbin/dhclient, or /sbin/pump)? [y/n]
    DHCP="y"
    # If you need to explicitly specify a hostname for DHCP requests
    DHCP_HOSTNAME=""
    # Host's IP address, netmask, network address, broadcast address
    IPADDR=""
    NETMASK=""
    NETWORK=""
    BROADCAST=""
    # Gateway address for static routing
    GATEWAY=""
    # Things to add to /etc/resolv.conf for this interface
    DOMAIN=""
    SEARCH=""
    # The nameserver IP addresses specified here complement the
    # nameservers already defined in /etc/resolv.conf.  These nameservers
    # will be added to /etc/resolv.conf automatically when the PCMCIA
    # network connection is established and removed from this file when
    # the connection is broken.
    DNS_1=""
    DNS_2=""
    DNS_3=""
    # NFS mounts, should be listed in /etc/fstab
    MOUNTS=""
    # If you need to override the interface's MTU...
    MTU=""
    # For IPX interfaces, the frame type and network number
    IPX_FRAME=""
    IPX_NETNUM=""
    # Run ipmasq? [y/n]  (see the Debian ipmasq package)
    IPMASQ="n"
    # Extra stuff to do after setting up the interface
    start_fn () { /etc/netenv/bringdown; return; }
    # Extra stuff to do before shutting down the interface
    stop_fn () { /etc/netenv/bringup; return; }
    # Card eject policy options
    NO_CHECK="n"
    NO_FUSER="n"
    ;;
esac

Internal network interface

Different network environments

I use my laptop in different places, and I sometimes want to use my internal network interface to use a static IP address, and sometimes I want it to use DHCP. I decided to use netenv for that.

netenv is usually used with the PCMCIA card controller. I don't use it that way. I use schemes for the PCMCIA card controller, and I use netenv to enable/disable/configure my internal network interface. I use the NETENV_SCRIPT facility to have netenv do what I want.

I have different netenv profiles:

which use the following scripts:

Power saving problems

There is a problem with the internal network interface: if the machine is suspended and resumed, the network interface doesn't come back to life, although Donald Becker said he found a workaround in the driver code.

My uglier workaround is to bring eth0 down and then bring it back up. This is achieved in /etc/apm/event.d/buggy_eepro100:

#!/bin/sh

IF=eth0
FILE=/tmp/buggy_eth0_down

case "$1" in
suspend)
        /sbin/ifconfig | /bin/grep $IF > /dev/null
        if [ $? = 1 ]; then
          exit
        fi
        /etc/netenv/bringdown
        /bin/touch $FILE
        ;;
resume)
        if [ ! -f $FILE ]; then
          exit;
        fi
        /bin/rm $FILE
        /etc/netenv/bringup
        ;;
esac

It is somewhat complex because of my other ugly hack for PCMCIA.

Internal modem

It is a controlorless modem (a.k.a. WinModem): Conexant Soft56K Data,Fax PCI Modem (I/O: 02F8-02FF).

Conexant contracted MBSI to write a driver for Linux. They release a Linux driver for Conexant HSF modems which works well for me.

A final version of the driver is available from Conexant.

USB

The USB controller is an Intel Corporation 82371AB PIIX4 USB (rev 01).

Linux up to version 2.2.17 does not support USB. However, there exists a backport of v2.4 USB to the v2.2 kernels. This backport patch was integrated in Linux 2.2.18pre2.

I finally bought an optical USB mouse, so I had to play with USB configuration. However, I haven't received the mouse yet, so it only appears to work: I haven't tested it yet.

I compiled my kernel with USB enabled (for the floppy drive and my mouse, and an optionnal keyboard - you never know). Here's an excerpt of my .config:

#
# SCSI support
#
CONFIG_SCSI=m
CONFIG_BLK_DEV_SD=m
# CONFIG_CHR_DEV_ST is not set
# CONFIG_BLK_DEV_SR is not set
# CONFIG_CHR_DEV_SG is not set
# CONFIG_SCSI_MULTI_LUN is not set
# CONFIG_SCSI_CONSTANTS is not set
# CONFIG_SCSI_LOGGING is not set

#
# USB support
#
CONFIG_USB=y
# CONFIG_USB_DEBUG is not set
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_BANDWIDTH is not set
CONFIG_USB_UHCI=y
# CONFIG_USB_OHCI is not set
# CONFIG_USB_PRINTER is not set
# CONFIG_USB_SCANNER is not set
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_ACM is not set
# CONFIG_USB_SERIAL is not set
# CONFIG_USB_IBMCAM is not set
# CONFIG_USB_OV511 is not set
# CONFIG_USB_DC2XX is not set
# CONFIG_USB_MDC800 is not set
CONFIG_USB_STORAGE=m
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_DABUSB is not set
# CONFIG_USB_PLUSB is not set
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RIO500 is not set
# CONFIG_USB_DSBR is not set
# CONFIG_USB_MICROTEK is not set
CONFIG_USB_HID=y
# CONFIG_USB_WACOM is not set
# CONFIG_USB_WMFORCE is not set
CONFIG_INPUT_KEYBDEV=m
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_EVDEV is not set

I have then created a /dev/input/mice device:

mkdir /dev/input
mknod /dev/input/mice c 13 63

and have edited my XF86Config file, as decribed in the Linux USB Guide.

I have also mounted /proc/bus/usb by adding in /etc/fstab:

/proc/bus/usb	/proc/bus/usb	usbdevfs	defaults	0	0

And it worked fine. I can plug and unplug my Logitech WheelMouse and use it in X as well as the touchpad. Kick ass!

Now the question is how much power does it need and what will be the impact on the battery life?

Advanced Power Management

The APM code up to Linux version 2.4.8 shows a rather random remaining battery time.

Dave Zarzycki wrote a patch fixing the battery life time estimation. Note that this patch does report report an erroneous remaining charge time, but at least it tells you the battery life time.

The problem was fixed in Linux 2.4.9.

Also, the events sent by the APM BIOS are not recognized by apmd.

I have no use for it, and I have therefore haven't tried it. However, it is supported. You will probably find more details on other guides to running Linux on Vaios.

In summary, try it by yourself and see if it works.

IrDA

The infrared port works fine. You need to compile the following things in the kernel:

CONFIG_IRDA=m
CONFIG_IRLAN=m
CONFIG_IRCOMM=m
CONFIG_IRDA_COMPRESSION=y
CONFIG_IRDA_DEFLATE=m
CONFIG_IRTTY_SIR=m
CONFIG_IRPORT_SIR=m
CONFIG_NSC_FIR=m

With that, you should be able to use your infrared port for networking, synchronizing your PDA, etc.

/etc/modutils/irda need the following extra line:

alias irda0 nsc-ircc
options nsc-ircc dongle_id=0x09

You need to change the IO address of ttyS2 in /etc/serial.conf:

/dev/ttyS2 uart 8250 port 0x04e8 irq 4 baud_base 115200 spd_normal skip_test

Finally, after installing irda-common and irda-tools (I installed version 0.9.14), run:

irattach irda0

You can them do things with your pilot, such as pilot-xfer /dev/ircomm0 -l.

Port replicator

I successfully used the serial port which is on the port replicator. However, installing the port replicator is a pain because the manual says that the machine needs to be turned off. I don't really understand why, but anyway, I just suspend the laptop before plugging or unplugging it. There is a discussion about this issue in the sony505 mailing list.

Jog Dial

The jog dial works in 2.4 kernels with the Sony Vaio Programmable I/O Control Device support enable, and by using sonypid under X to make it behave like a mouse wheel. There also a patch adding Jog Dial support to IMWheel.

Finally, S-Jog tries to mimic the Windows functionalities of the Jog Dial under Linux.

Memory Stick Media Slot

The Memory Stick controller is on the PCI bus:

00:0d.0 Non-VGA unclassified device: Sony Corporation Memory Stick Controller (rev 01)
        Subsystem: Sony Corporation: Unknown device 8085
        Flags: medium devsel
        Memory at 10001000 (32-bit, non-prefetchable) [disabled] [size=1K]
        Capabilities: [dc] Power Management version 2

All the success reports I have seen use the Memory Stick reader as a USB device. Unfortunately, the one on the 505JE is a PCI one, and even though people are trying to make it work, the Memory Stick slot doesn't seem to be supported under Linux.

Tuning

I (hopefully) increase the disk access performance by putting in /etc/rcS.d/S40hdparm:

#! /bin/sh

echo Tuning hard disk...
/sbin/hdparm -u1 -c1 -a128 -d1 -X66 -m 16 /dev/hda

My opinion about this laptop

This is a cool puppy. It's small, light, I enjoy the keyboard, and it has a good screen.

If you want a serial port, you need to carry the port replicator, and you cannot plug it while the machine is on.

Also, I have a triple-capacity battery because this machine uses a lot of energy. I guess that the triple-capacity battery lasts between 4h and 5h. The standard one lasts around 1h20.

Note that after a few months of use, I have discovered a few problems:

But on the whole, I'm pretty happy about it.


Hugo Haas (hugo@larve.net).
$Id: linux-vaio.html 6343 2007-12-24 06:50:03Z larve $