Debian 3.1 on Sony Vaio B3XP
This webpage provides basic information on how to tune
a Debian installation on a Sony Vaio B3XP laptop.
It does not offer a step-by-step explanation, but
merely useful hints that might help you in getting the tricky bits
working, especially:
- suspend to ram, suspend to disk
- some IDE/hard disk problems (see the 'suspend' section)
- full 1400x1050 resolution
- wireless network card
- external monitor
- sound
- special function keys
Disclaimer: I am not an expert on
Linux and/or Laptops. I have found helpful advice from other
people by searching the web, and eventually I managed to get
all features I need on my laptop.
The following description is based on my experiences and
will certainly not give you the best or most elegant way of
installing Debian on this laptop.
1. Suspend
All the following, except suspend-related stuff, may be done
with the standard Debian kernel 2.6.8.2.
To get suspend-to-ram to work, I had to upgrade to
the Debian kernel 2.6.11.
Unfortunately, suspend-to-ram (S3) drains battery power
too quickly. It normally survives only a few hours
(I have once seen 24h, but it usually does not last this
long).
Consequently, I had to install suspend-to-disk (S4), which required me
to build a custom kernel. After applying the software-suspend-2
patches to the kernel and some tweaking, I got S3 and S4 working.
Be warned that I found a working configuration purely by
trial and error. For all I know, my settings might not work for you or
even damage your (file-) system.
The procedure in more detail:
First install the packages:
- acpi
- acpid
- vbetool
- laptop-mode-tools
- hibernate
(and all the necessary packages for making a kernel,
i.e. kernel-package and all the 2.6.11 stuff:
headers, source, tree, doc)
(Please note that I don't restart the network on resume
for neither suspend-to-ram nor suspend-to-disk. This is just
my personal preference and should not be a problem.)
Suspend to Disk
For software suspend, get the patches for Software Suspend 2 from
http://www.suspend2.net/.
Apply the patch, and add software suspend-2 as a module in the
kernel configuration. (I simply used the already set options;
go to http://www.suspend2.net/HOWTO for more detailed information.)
For the hard disk to resume properly after a suspend to RAM,
and also for DMA to work, all IDE options
in the kernel configuration MUST be selected as modules,
NOT to be build directly into the kernel.
Compile the kernel, make sure to use the
--initrd option, e.g. :
make-kpkg --initrd -revision 1 --apend-to-version "-sws" kernel-image
On suspend the memory will be written into the swap partition
(which must be at least two times the RAM size).
One has to add the kernel boot option "resume2=swap:/dev/hda3"
assuming that /dev/hd3 is the swap partition.
My entry in /boot/grub/menu.lst:
title Debian GNU/Linux, kernel 2.6.11-sws
root (hd0,1)
kernel /boot/vmlinuz-2.6.11-sws root=/dev/hda2 ro resume2=swap:/dev/hda3
acpi_sleep=s3_bios noapic nolapic psmouse.proto=imps
initrd /boot/initrd.img-2.6.11-sws
savedefault
boot
|
Now the hibernate command needs to be configured. My /etc/hibernate/hibernate.conf:
### swsusp2_15 (for Software Suspend 2)
UseSwsusp2 yes
Reboot no
EnableEscape yes
DefaultConsoleLevel 1
SuspendDevice swap:/dev/hda3
LoadSuspendModules suspend_core suspend_swap suspend_lzf suspend_text
UnloadSuspendModulesAfterResume no
PowerdownMethod 5
##############################################################################
### Some global settings
##############################################################################
Verbosity 0
LogFile /var/log/hibernate.log
LogVerbosity 1
Distribution debian
##############################################################################
### Scriptlets
### Scriptlets provide support for doing all sorts of things before and after
### suspending. The defaults settings here should work for most people, but
### you may wish to edit these to taste. Consult "hibernate -h" for help on
### the configuration settings.
##############################################################################
### clock
SaveClock restore-only
### special scripts
OnResume 90 /usr/sbin/855resolution 3c 1400 1050
### modules
UnloadBlacklistedModules yes
LoadModules auto
### network
DownInterfaces eth0
DownInterfaces eth1
# UpInterfaces auto
### vbetool
EnableVbetool yes
RestoreVbeStateFrom /var/lib/vbetool/vbestate
VbetoolPost yes
### xhacks
SwitchToTextMode yes
|
I have also added
- ipw2200
- ehci_hcd
- uhci_hcd
to /etc/hibernate/blacklisted-modules
I have a problem with the special touchpad driver (see below) and prefer
to get a generic driver. In my case this works best if
psmouse is not present in /etc/hibernate/blacklisted-module
but removed and added explicitly. To hibernate, I excecute:
rmmod psmouse
hibernate
modprobe psmouse proto=imps
Suspend to RAM
Suspend to RAM works easily but usually
either the screen or the hard drive fail to
resume afterwards. It took me many tries to find a working
configuration. In my opinion it is important to
use the kernel boot options
- acpi_sleep=s3_bios
- noapic AND nolapic
I added the kernel options noapic and nolapic because
apic/lapic is said to sometimes cause problems.
The trick for getting the hard drive to resume is to put a hard disk
reset as the first command on resume.
This can be set in /etc/acpi/sleep.sh:
#unload critical modules
rmmod ehci_hcd
rmmod uhci_hcd
rmmod ipw2200
# unload this for touchpad driver problem
rmmod psmouse
# set hard drive into a more 'safe' mode
# (don't know if this is necessary)
hdparm -d0 -c0 -A0 -m0 -B255 -u0 /dev/hda
sync
sleep 1
sync
# go to sleep
echo "mem" > /sys/power/state
# Waking up:
# resetting the hard drive
# this is a purely experimental and probably
# dangerous method but without it my hard disk fails
# to resume
hdparm -w /dev/hda
hdparm -C /dev/hda
hdparm -C /dev/hda
hdparm -C /dev/hda
# switch back to imps driver for touchpad
modprobe psmouse proto=imps
# reload modules
modprobe uhci_hcd
modprobe ehci_hcd
modprobe ipw2200
# set optimum parameters for the hard disk again
hdparm -d1 -c1 -m16 -u1 -A1 -X69 /dev/hda
|
2. Screen resolution
To get the full 1400x1050 resolution,
install the Debian package 855resolution
(or get it from http://perso.wanadoo.fr/apoirier/)
Create a link from /etc/rc2.d/ (it must start before gdm)
to a script that executes:
855resolution 3c 1400 1050
For example, I have made the following script in /etc/init.d/:
#! /bin/sh
#
# skeleton Example initscript
# This file should be used to construct scripts to be
# placed in /etc/init.d.
#
# Author: Miquel van Smoorenburg .
# Ian Murdock .
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.
#
# Version: @(#)skeleton 2.85-23 28-Jul-2004 miquels@cistron.nl
#
NAME=855resolution
FULL=/usr/sbin/$NAME
case "$1" in
start)
echo -n "Starting $NAME"
start-stop-daemon --start \
--exec $FULL 3c 1400 1050
echo "."
;;
stop)
;;
restart|force-reload)
;;
*)
# echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
|
and then link it to /etc/rc2.d/S30resolution
I have also changed the respective
sections in my XF86Config-4 as follows
(I don't know which of this is really necessary):
Section "Monitor"
Identifier "LCD"
HorizSync 31.5-90
VertRefresh 59-75
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Videocard0"
Monitor "LCD"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1400x1050" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
Section "DRI"
Group 0
Mode 0666
EndSection
|
3. Wireless
Get ipw2200 module (from Debian) and follow the
instructions. You need the firmware from
http://ipw2200.sourceforge.net/firmware.php
(In my case the Versions v0.19-v1.0.3).
4. Sound
Sound works out of the box with Alsa. The following
section uses the Alsa mixer to set/change the volume.
Note that one MUST mute the 'external amplifier'
to get sound output. I do that automatically by
adding the following lines to one of the start scripts
in /etc/init.d/ :
# use this script to mute the External Amplifier
/usr/bin/amixer sset 'External Amplifier' mute >/dev/null
|
Something starts 'esd' automatically on my machine, which
stops sound from working properly. For the moment I
simply removed /usr/bin/esd to fix that.
5. External Monitor
For using an external monitor:
Download i855crt, put i855crt.conf into /etc,
i855crt into /usr/local/sbin.
My function-key settings (below), for example, will switch on the
external monitor with a 1024x768 resolution. In this
case one has to switch the screen to this resolution before
switching the external output on.
Of course the X server has been started with 1400x1050, and on the external monitor
one cannot see the outer parts of the screen. A nice work-around for that
is to use a vncserver, e.g. for presentations in full-screen mode:
/usr/bin/vncserver -geometry 1024x768 :2
/usr/bin/xvncviewer :2
This opens a window with an empty X screen with 1024x768 resolution and one can
start applications to appear in there, for example
ooffice -display :2
acroread --display=:2
6. Function keys
You need to install the following:
- sonypi,
(for generating events from the function keys)
Debian or http://popies.net/sonypi/
- sony_acpi,
(program that allows to set the LCD brightness)
http://popies.net/sonypi/
- sonykeyd
http://www.juljas.net/linux/vaiofx240/sonykeyd.html
Install the first two and add to etc/modules
sonypi
sony_acpi
Then install sonykey and adapt the script
/usr/local/sbin/sonykey.sh.
My version below allows to:
- fn-f2 mute/unmute (see the sound section above)
- fn-f3 decrease volume
- fn-f4 increase volume
- fn-f5 decrease LCD brightness
- fn-f6 increase LCD brightness
- fn-1 bring up eth0
- fn-2 bring up eth1
- fn-3 ifdown eth0 and eth1
- fn-d switch screen off
- fn-f switch screen on
- fn-e eject cdrom
- fn-f11 suspend to S3 (RAM)
- fn-f12 suspend to S4 (hibernate)
#!/bin/bash
# Copy this file to /usr/local/sbin
# It controls the actions taken for each event
#version: 0.03
#last updated: Thu Dec 30 15:14:51 CET 2004
#
PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
#File where do we want to log commands executed (LOG="" to disable)
LOG=/var/log/sonypid
#LOG=""
#In this directory I'll remember what gauge is currently adjusted
STATE=/var/local/sound/state
#Program that controls brightness level (download source from: http://popies.net/sonypi/)
#SPICCTRL=/usr/local/bin/spicctrl
#Program that controls audio level
AUMIX=amixer
#Program that do CD-ROM eject
EJECT=eject
#
KEY="$1"
declare -i no=1
function cmd {
#output command to log file (you can comment out
echo "$(date) ($KEY) #$((no++)) $*" >>$LOG
eval "$@"
}
case $KEY in
fn-e)
cmd "$EJECT" ;;
fn-f2)
if [ -e "$STATE"/mute ]; then
#unmute
VOL="$(cat "$STATE"/mute 2>/dev/null)"
cmd rm -f "$STATE"/mute
cmd "$AUMIX" sset Master unmute >/dev/null
else
#mute (and remember current volume level)
VOL="$($AUMIX -q | grep ^vol | awk ' { print $3; }')"
cmd echo "${VOL:-90}" >"$STATE"/mute
cmd "$AUMIX" sset Master mute >/dev/null
fi
;;
fn-f3)
#adjust voulme (PCM) -2
cmd "$AUMIX" sset Master 2- >/dev/null
;;
fn-f4)
#adjust voulme (PCM) -2
cmd "$AUMIX" sset Master 2+ >/dev/null
;;
fn-f5)
VALUE="$(($(cat /proc/acpi/sony/brightness)-1))"
[ $VALUE -lt 0 ] && VALUE=0
cmd echo "$VALUE" >/proc/acpi/sony/brightness
;;
fn-f6)
VALUE="$(($(cat /proc/acpi/sony/brightness)+1))"
[ $VALUE -gt 8 ] && VALUE=8
cmd echo "$VALUE" >/proc/acpi/sony/brightness
;;
fn-f7)
cmd /usr/local/sbin/i855crt swcursor on 1024x768@75
;;
fn-f8)
cmd /usr/local/sbin/i855crt off
;;
p-p1)
#DISPLAY=:0.0 xclock -geometry +100+100 -digital
;;
fn-f12)
## see http://swsusp.sourceforge.net/
cmd rmmod psmouse
cmd hibernate
sleep 10
cmd modprobe psmouse proto=imps
;;
fn-1)
# bring up eth0
cmd /sbin/ifup eth0
;;
fn-2)
# bring up eth1
cmd /sbin/ifup eth1
;;
fn-3)
# bring down eth0 + eth1
cmd /sbin/ifdown eth0
cmd /sbin/ifdown eth1
;;
fn-f11)
# suspend to ram
cmd /etc/acpi/sleep.sh
;;
fn-d)
# switch off screen
cmd /usr/sbin/vbetool dpms off
;;
fn-f)
# switch on screen
cmd /usr/sbin/vbetool dpms on
;;
#add any other definitions here
#see available key names in strings.c file (not all may be available on your laptop)
*)
#log key events without any action
echo "no action on key: $KEY" >>$LOG
;;
esac
|
|