I recently bought a Dell XPS 13 Ultrabook with the 2nd-generation Intel Core CPU. (The latest model is 3rd-generation Intel Core CPU and comes with Windows 8.) The laptop came with Windows 7, and there is a Ubuntu 12.04-based image available as part of Dell’s Project Sputnik. My preference is to use Slackware.

Introduction

The specification of my XPS 13 is:

  • CPU: Intel Core i5-2467M @ 1.60GHz

  • RAM: 4GB DDR3 1333MHz

  • HD: 128GB SSD (Samsung SATA 3)

  • Screen: 13.3" @ 1366x768

  • Graphics: Intel HD Graphics 3000

  • Audio: Intel HD Audio

  • Network: Intel Centrino Advanced-N 6230 with Bluetooth v3.0 (No wired Ethernet)

  • Webcam: 1.3MP GSPCA-based

  • Dimensions: 316mm x 205 mm x 6/18 mm

  • Keyboard: chiclet-type, backlit

  • Trackpad: Cypress, integrated buttons

  • Ports: 1 x USB 2.0, 1 x USB 3.0, mini-DisplayPort, headphone jack

When planning the purchase and configuration, I relied on the Gentoo Wiki article for this version of the XPS 13.

My XPS 13 came with BIOS version A04 which appears to have solved the ‘noisy fan’ problem. There is a more recent BIOS that I believe provides Windows 8 support which I will avoid unless it seems necessary for some other reason.

The A04 BIOS does not appear to have be UEFI (Secure Boot). I don’t exactly know what a UEFI BIOS looks like, never having encountered one as far as I know, but installation of Slackware was no different to any of my recent experiences: boot from USB stick, partition drive, create LVM volumes, install Slackware, install LILO in MBR, create initrd, re-run LILO & reboot.

I reckon that 95% of the XPS 13 worked out-of-the-box with Slackware 14.

What works

X starts without any need for special configuration. OpenGL performance is certainly good enough for Xscreensaver. The glxgears benchmark reports about 60 FPS.

Running XFCE, all the Fn keys I have tested work: Wireless/Bluetooth toggle, battery level, screen brightness up/down, keyboard backlight toggle, volume up/down/mute. The play/pause, next track & previous track keys report the appropriate XF86Audio keycode so can be configured with the player of your choice. I haven’t tested the screen switcher as I don’t have a mini-DisplayPort adapter.

I use NetworkManager for network configuration. Connection to my wifi access point worked flawlessly.

After configuring my Xfce Power Manager settings, suspend/resume worked (mostly, see below) on either screen close/open or from the Xfce exit dialog. Hibernate also works, after some configuration steps.

What doesn’t work

Actually, adjusting the backlight brightness did not work out-of-the-box but it is an easy fix.

The Cypress trackpad works, but only as a plain 2-button mousepad, not as a touchpad. There is no tap-to-click, no two-finger scroll. I imagine you could configure X to emulate 3 buttons for simultaneous left/right click. There is a Linux driver for the Cypress trackpad as part of the Ubuntu Sputnik Kernel PPA. I will cover how to get the trackpad working later.

When resuming from suspend, the wireless device would be hard blocked. To restore wireless required toggling the Fn wireless button twice. I found a work-around (see the Configuration section) that fixed the problem for me but there may be a better long-term solution.

Slackware Installation

I used the standard Slackware USB installer, following the instructions in /usb-and-pxe-installers/README_USB.txt to create a bootable USB drive. I copied the /slackware64 directory to another USB drive then deleted the sets I did not want to install: e and kdei.

Plug in the bootable USB drive and press F12 when the Dell splash screen appears. Choose the ‘Removable Drive’ option and boot.

The XPS 13 comes with its 128GB divided between 4 partitions:

  • 41 MB ‘Dell Utility’ partition

  • 13 GB ‘Recovery’ partition

  • 106 GB main partition

  • 8 GB ‘Hibernate’ partition

I decided to keep the ‘Dell Utility’ partition which can be accessed from the F12 boot menu and lets you run some hardware diagnostics. (I can afford to lose 42 MB and I don’t know if deleting the partition would upset the BIOS.)

The other partitions I deleted as I only want a main partition (which I will divide using LVM) and a swap/hibernate partition. Robbie Workman’s instructions (/usr/doc/pm-utils-X/README.SLACKWARE) for setting up hibernate suggest that 2x RAM is a good size but as space on a 128GB SSD is at a premium, I went with 1.5x RAM or 6GB for swap.

  1. Run cfdisk /dev/sda

  2. Delete all partitions except the ‘Dell Utility’ partition (or delete that too if you like).

  3. Create a primary partition for swap: /dev/sda2, 6GB, type 82.

  4. Allocate the rest to a primary partition for LVM: /dev/sda3, type 8E.

  5. Write the new partition table and exit.

Configure the LVM partition as you like using Eric Hameleers' instructions in README_LVM.txt on the Slackware DVD. I did the following:

pvcreate /dev/sda3
vgcreate vg1 /dev/sda3
lvcreate -L 20G -n root vg1
lvcreate -L 20G -n opt vg1
lvcreate -l 100%FREE -n home vg1

Plug in the USB drive with the /slackware64 directory. Create a mount point that is not in /mnt and mount it:

mkdir /slackware
mount /dev/sdb1 /slackware

Run setup and when it comes to choosing the installation media, select the directory you mounted. Install as normal, following the README_LVM.txt instructions when it comes to configuring LILO:

chroot /mnt
/usr/share/mkinitrd/mkinitrd_command_generator.sh | bash
/usr/share/mkinitrd/mkinitrd_command_generator.sh -l /boot/vmlinuz-generic-3.2.29 >> /etc/lilo.conf
/sbin/lilo

I installed LILO to the MBR (as I usually do). I also use the compact directive in /etc/lilo.conf to speed the boot process.

Configuration

SSD optimization

I don’t know how vital tweaking mount options for modern SSDs is anymore, but I figure it can’t hurt. I followed some of the recommendations from the Debian SSD Optimization article:

  • For the LVM partitions, use options discard,noatime,defaults.

  • In /etc/lvm/lvm.conf set issue_discards = 1.

Backlight

Adjusting the backlight did not work out of the box with the stock Slackware kernel. The Gentoo Wiki article explains how to get the backlight working (see the ‘Graphics Chip’ section). I won’t repeat the steps here.

After upgrading to a 3.6 kernel and applying a backlight patch from an Arch Linux patch set, it appears the backlight functions normally so you only require the above work-arounds if running the stock Slackware 3.2.29 kernel.

Hibernate

I have only used suspend-to-ram in the past but thought I would give hibernate (suspend-to-disk) a try. I followed the instructions in pm-utils README.SLACKWARE.

My swap partition is /dev/sda2. Specify the hibernate partition when building the initrd using the -h /dev/sda2 option. The script I used to generate an initrd is:

#!/bin/sh
KERNEL=3.6.5-gsl
mkinitrd -c -k $KERNEL -f ext4 -r /dev/vg1/root \
    -m usbhid:ehci-hcd:xhci-hcd:mbcache:jbd2:ext4 -L -u \
    -o /boot/initrd-$KERNEL.gz \
    -h /dev/sda2

Finally, add resume=/dev/sda2 to the append directive for each supported target in /etc/lilo.conf (ie., for each kernel whose initrd was built with the -h option).

Wireless resume

As mentioned in the introduction, when running the stock 3.2.29 kernel, the wireless device is disabled on resume (from suspend-to-ram).

$ /usr/sbin/rfkill list
...
1: phy0: Wireless LAN
        Soft blocked: yes
        Hard blocked: yes

You can re-enable wireless using the hardware wireless toggle (Fn-F2). The problem seems to relate to blocking the Bluetooth device also blocking the wireless device. The /usr/lib64/pm-utils/sleep.d/49bluetooth-generic hook calls rfkill block bluetooth on suspend and rfkill unblock bluetooth on resume.

As I don’t use any Bluetooth devices, I simply disabled the Bluetooth hook:

touch /etc/pm/sleep.d/49bluetooth-generic

I have since built 3.6.X kernels based on /testing/source/config-testing-3.6-rc4 and the problem may no longer exist. Resume now works without the Bluetooth hook override.

Cypress trackpad

The multi-touch features of the Cypress trackpad are not supported in the Linux kernel. The Ubuntu team have added support for the trackpad in the custom kernel used for Project Sputnik ( see here). There is an Arch Linux patch set for kernel 3.7-rc that has isolated the trackpad changes (along with a number of other patches).

I set about building a 3.6 kernel using the Slackware config from testing. The Arch trackpad patch would not compile without some minor changes (undefined function, missing includes in drivers/input/mouse/psmouse-base.c). Once fixed, I have tested with kernels 3.6.3, 3.6.5 and 3.6.6 and the multi-touch features that are important to me (tap-to-click, 2-finger scroll) are working.

You can download the patch here.

To apply, change to your kernel source directory and run:

cd linux-3.6.6/
patch -p0 -i path/to/cypress-trackpad.patch

I also applied revert-pch-backlight-registers.patch from the Arch patch set.

For convenience, I build the kernel on my desktop PC and create a Slackware package. The definitive guide for Slackware kernel building is found on docs.slackware.com but I will describe my process.

# Do all the work in the kernel/ directory.
cd ~/kernel

tar xf linux-3.6.6.tar.xz

# Create a build/ directory to contain the generated files.
mkdir build
# Create a directory for the kernel compilation.
mkdir build/3.6.6
# Create a directory for packaging the kernel and modules.
mkdir -p build/package/boot

cd linux-3.6.6
make O=../build/3.6.6 mrproper

# Use the Slackware 3.6-rc4 testing config as a starting point.
cp ../config-generic-3.6-rc4.x64 ../build/3.6.6/.config

# Update the config to 3.6.6
make O=../build/3.6.6 oldconfig

# Tweak the config if you like.  As you are building a custom kernel for a
# particular laptop, you can afford to deselect a heap of modules.
make O=../build/3.6.6 xconfig

# Compile the kernel
make -j 4 O=../build/3.6.6

# Install to the build/package directory.
INSTALL_MOD_PATH=../build/package make O=../build/3.6.6 modules_install
INSTALL_PATH=../build/package/boot make O=../build/3.6.6 install

# The 'install' target will run arch/x86/boot/install.sh to copy files to
# ../build/package/boot.  If you run this as root, it will run lilo, which you
# probably don't want.  It is safe to complete everything up to this point as
# a non-root user.

# Create the Slackware package
cd ../build/package
su
chown -R root.root .
/sbin/makepkg -l y -c n ../kernel-custom-3.6.6-xps-x86_64-gsl1.tgz

At this point, you can transfer your custom kernel to the XPS and install. Note that the build and source symlinks in /lib/modules/3.6.6-xps are broken. Not sure if this will be a problem, but if so, you can unpack the kernel source under /usr/src and fix the symlinks.

The next step is to create an initrd for the new kernel. The script I used to create the initrd is shown in the Hibernate section. Note that it includes the kernel version in the initrd file name so sit doesn’t conflict with a default initrd you might have created.

Finally, add or edit an entry in /etc/lilo.conf, being sure to include the initrd and, if using Hibernate, the resume partition.