Gentoo Linux on Sony Vaio FZ140E

Intro

I have been using Gentoo Linux (32-bit version) on my Sony Vaio FZ140E for about 4 months now. After quite a bit of tweaking most things work great. I have tried to make this guide distribution-independent. The sole reason for choosing Gentoo was that at the time I bought the laptop most other distibution installation media could not even boot properly on it. I believe this guide partially applies to many newer Sony Vaio models. If you have questions or comments feel free to email me at .

Kernel version at least 2.6.23 is needed or otherwise Fn-keys will not work and the ethernet module will cause problems. I will list most of the nontrivial kernel options that need to be enabled. Here is my full kernel configuration.

Network

Wireless

The wireless adapter (Intel Pro/Wireless 4965 AGN) is supported by the native driver. To build it you need to enable the new wireless stack in the kernel.

Networking → Wireless
Generic IEEE 802.11 Networking Stack (mac80211)

You can also download a newer version of the stack from the driver's website. The driver is included in the kernel since the first release candidate of 2.6.24. Even though the native driver is quite stable, it is worth mentioning that ndiswrapper works with Windows drivers from Intel's website.

Ethernet

The network card is supported by the "sky2" kernel module.

Device Drivers → Network device support
Ethernet (1000 Mbit) → SysKonnect Yukon2 support

Note that using kernel version prior to 2.6.23 will cause the network card to ignore all packets after resume.

Video

Support

The video card is Intel GMA965 also known as X3100. It is supported by the X.org open-source drivers (module intel) since version 2.1.0. I suggest you use the latest version of the driver as well as of the Mesa library. The driver supports the RandR 1.2 protocol which you will certainly appreciate when you connect the laptop to a TV or a projector (needs X.org server version 1.3). To have direct rendering, you need to enable it in the kernel configuration as follows.

Device Drivers → Character Devices
/dev/agpgart → Intel 440LX/BX/GX
Direct Rendering Manager
Direct Rendering Manager
Intel 830M, 845G, 852GM, 855GM, 865G → i915 driver

You also need to add "dri" to the "Module" section of xorg.conf and add the DRI section (chances are that both are already there unless you are writing xorg.conf from scratch).

Section "DRI"
Mode 0666
EndSection

Compositing

To use Compiz, add the following line to the "ServerLayout" section of xorg.conf.

Option "AIGLX" "true"

The intel video module supports two acceleration methods: EXA and XAA. Since version 2.2.0 EXA is used by default. However, its performance is quite bad and it still has several glitches. If you want to use XAA, add the following two lines to the "Device" section (you can similarly switch to EXA if you have a driver older than version 2.2.0).

Option "XAANoOffscreenPixmaps" "true"
Option "AccelMethod" "XAA"

However, when XAA is used with compositing, any attempt to use the XV extension to play a video will cause a BadAlloc error (without compositing, XV works fine). Several workarounds exist. One is to use the textured video output (gl2 in MPlayer, for example). This, however, will cause the window with video to be drawn directly and thus you will not see its live preview when switching windows. Another is to activate the video Compiz plugin and apply this patch to MPlayer. This makes XAA, Compiz, and MPlayer coexist peacefully but no similar patch currently exists for other players. I personally use XAA without compositing.

Backlight

There are two ways to change the backlight brightness. One is the backlight kernel module. You need to enable it in the kernel.

Device Drivers → Graphics Support
Backlight and LCD Device Support → Lowlevel Backlight Controls

When the module is loaded, it will create a sysfs file which you could use to set the brightness as follows.

# echo 50 > /sys/class/backlight/acpi_video0/brightness

Gnome Power Manager can use this interface to control the brightness automatically.

Another way to control brightness is provided by the X.org driver which supports the Backlight extension to the RandR protocol. The "xbacklight" application (sources can be found here) can utilize this extension.

Suspend

Enable suspend and hibernation support in the kernel.

Power Management Options
Suspend to RAM and standby
Hibernation (aka 'suspend to disk')

Check that the "CONFIG_HIBERNATION_SMP_POSSIBLE" and "CONFIG_SUSPEND_SMP_POSSIBLE" options are enabled. Otherwise, the kernel will not suspend on the dual-core system.

With 2G of memory writing its image on the disk can be rather slow. The userspace suspend utilities provide support for fast RAM image compression. I checked out the CVS version, and it has proved to be very stable. If you are building the suspend utilities from source, make sure to enable compression support in the configuration file. For resuming, a custom initrd image will be generated. You will need to alter your boot configuration to load the image. The sources contain documentation on integrating the resume utility into an existing initrd image.

The suspend utilities contain a program "s2disk" for hibernation and "s2ram" for suspending to RAM. The former works out of the box perfectly — you do not even need to reload any kernel modules. The latter works too (use the "--force" option) but after resume the backlight is off. One way to fix it is to switch the virtual terminals back and forth. To do it automatically, add the commands "chvt 1" and "chvt 7" to your suspend script (for example, "/usr/lib/hal/scripts/linux/hal-system-power-suspend-linux" if you use HAL).

Input

Keyboard

The support for Fn keys is provided by the sony-laptop kernel module.

Device Drivers → Misc devices
Sony Laptop Extras

You will need to create a new section in xorg.conf (for which evdev support is required).

Section "InputDevice"
Identifier "Vaio keys"
Driver "evdev"
Option "Name" "Sony Vaio Keys"
Option "XkbLayout" "us"
Option "XkbModel" "pc106"
EndSection

Finally, add the new input device to the "ServerLayout" section.

InputDevice "Vaio keys" "SendCoreEvents"

Now you can use the "xev" program to see which key codes are generated by Fn keys and use your favorite application to bind actions to them. Note that Fn keys will not work at all for kernels versions prior to 2.6.23.

Touchpad

If you do not want to use synaptics, add the option "proto=exps" to the psmouse module (or append "psmouse.proto=exps" to the boot options if the driver is compiled into the kernel) to enable click-and-drag. I suggest you try synaptics because it is supposed to enable scrolling and can be used to disable the touchpad while you type.

Sound

The sound codec "CXD9872AK" is supported by the latest ALSA. However, it detects the model incorrectly and the mic does not work. If the model is specified manually, then plugging in headphones stops muting the external speakers. One solution is to apply a patch to the ALSA driver and specify the "model=vaio-ar" option for the "snd-hda-intel" module. After that set the CAPTURE property of the Capture control in a mixer (press space in alsamixer).

Web Camera

The web camera is actually made by Ricoh and attached through USB. There is a driver available (though its homepage does not seem to exist anymore). You need to download a copy of the tarball and patch the sources (I found the patch here). You need to have certain modules enabled in the kernel.

Device Drivers → Multimedia
Video For Linux → Enable Video For Linux API 1

You can find more detailed instructions in the tarball. This is a v4l driver and thus various v4l-compatible programs such as XawTV and Ekiga work with the camera.

Card Reader

In the kernel configuration enable the following modules.

Device Drivers → Misc devices
TI Flash Media interface support → TI Flash Media PCI74xx/PCI76xx
Device Drivers → MMC/SD card support
TI Flash Media MMC/SD Interface support

After the "tifm_sd" module is loaded, SD cards are recognized and ready to be mounted. Alternatively, you can checkout the latest driver sources from SVN at the project website, as they have preliminary support for Memory Stick.

Misc

The CD/DVD writer works out of the box. I have not tried burning double-layered DVD yet.

I have no idea whether the modem works as the "lspci" command does not even list it.

Read this Ubuntu bugreport about high load cycle count. The issue is relevant for this laptop, so you may have to tweak the hard drive with the "hdparm" utility.