Kernel 3.16 with MST support for Debian experimental
Mendix recently gave me a ThinkPad T440s. This is an amazing machine, however, to use more than one external display through a docking station or through the mini-displayport connector you have to use DisplayPort Multi Stream Transport (MST). If you’re on Windows this is no problem (I assume), but on Linux you’re out of luck for now. While support has been built by David Airlie of Red Hat, it has yet to appear in a stable kernel (3.17 will include the changes) and only a couple distributions included it so far. In this post I’ll show you how I got it to run on Debian testing with kernel from experimental, that I patched using David Airlie’s Linux repository.
We’ll follow this how-to from wiki.debian.org but skip some steps.
Start with a fully upgraded Debian system:
sudo apt-get dist-upgrade.
Start fetching the linux kernel from a location that has the necessary changes:
git clone git://people.freedesktop.org/~airlied/linux
Obtain the packages needed to compile the kernel:
sudo apt-get install devscripts equivs wget fakeroot build-essential libncurses5-dev
Installing a kernel from experimental
So, here is what I was running so far: Debian testing with kernel 3.16 from experimental. To do this, you need to include these lines in your /etc/apt/sources.list
deb http://ftp.nl.debian.org/debian/ experimental main non-free contrib deb-src http://ftp.nl.debian.org/debian/ experimental main non-free contrib
To prevent that all your packages are upgraded to the wild wild west of Debian experimental you need to create a pin in a file like /etc/apt/preferences.d/no-experimental-please the contents:
Package: * Pin: release a=experimental Pin-Priority: 50
This ensures that everything from experimental gets a lower priority, so it won’t be installed. Verify that the pin works and you won’t upgrade everything by running a dry-run dist-upgrade:
apt-get dist-upgrade -s.
apt-get update and search for the newest kernel packages (3.16 at this time):
$ apt-cache search 3.16 | grep ^linux ... linux-headers-3.16-trunk-amd64 ... linux-image-3.16-trunk-amd64 ...
We’re going to install the kernel image and the header files:
sudo apt-get install linux-headers-3.16-trunk-amd64 linux-image-3.16-trunk-amd64
Now we have a fancy new kernel, but we need to apply some patches!
Getting a patch ready
Go to the directory you’ve cloned the linux kernel in and run
git checkout drm-i915-mst-v3.16. You can see that David neatly rebased his changes on top of the 3.16 release, so we can get a patch ready with
git diff v3.16..drm-i915-mst-v3.16 > ~/mst-patch-on-3.16.
Getting the kernel source and applying the patch
Now we’re going to a new directory and get the source of the debian linux kernel:
apt-get source linux. Verify that this version matches the kernel you we’re trying to patch.
Run the following:
cd linux-* sudo apt-get build-dep linux sed -i -e 's/^abiname:.*/&+mst.1/' debian/config/defines # change the name of the packages so they don't clash with the system packages quilt new mst-patch for i in $(patch -p1 --dry-run < ~/mst-patch-on-3.16 | cut -d' ' -f3); do quilt add $i; done patch -p1 < ~/mst-patch-on-3.16 quilt refresh make -f debian/rules source # fails the first time make -f debian/rules source dch --local +mst.1
Now write a fancy changelog for this patch, mine looked like this:
linux (3.16-1~exp1+mst.1) UNRELEASED; urgency=medium * Add displayport mst patch from http://cgit.freedesktop.org/~airlied -- Jouke Waleson <firstname.lastname@example.org> Sat, 06 Sep 2014 19:49:22 +0200
This will be added to the file
Now we’re going to build this kernel for one platform only.
fakeroot make -f debian/rules.gen setup_amd64_none_amd64 fakeroot make -f debian/rules.gen binary-arch_amd64_none_amd64 binary-indep -j$(nproc)
A long wait later (30 minutes on my system) you will have a couple of .deb files, install the required ones:
sudo dpkg -i linux-headers-3.16-trunk+mst.1-amd64_3.16-1~exp1+mst.1_amd64.deb linux-headers-3.16-trunk+mst.1-common_3.16-1~exp1+mst.1_amd64.deb linux-image-3.16-trunk+mst.1-amd64_3.16-1~exp1+mst.1_amd64.deb
If everything went right so far, you can now reboot and choose this kernel in grub!
Here is the output from xrandr after rebooting:
$ xrandr Screen 0: minimum 8 x 8, current 5520 x 1080, maximum 32767 x 32767 eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 173mm 1920x1080 60.05*+ 59.93 1680x1050 59.95 59.88 1600x1024 60.17 1400x1050 59.98 1280x1024 60.02 1440x900 59.89 1280x960 60.00 1360x768 59.80 59.96 1152x864 60.00 1024x768 60.00 800x600 60.32 56.25 640x480 59.94 DP1 disconnected (normal left inverted right x axis y axis) HDMI1 disconnected (normal left inverted right x axis y axis) DP2 disconnected (normal left inverted right x axis y axis) HDMI2 disconnected (normal left inverted right x axis y axis) DP3 disconnected (normal left inverted right x axis y axis) DP4 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 531mm x 299mm 1920x1080 60.00*+ 50.00 59.94 1600x1200 60.00 1680x1050 59.88 1280x1024 75.02 60.02 1440x900 74.98 59.90 1280x960 60.00 1280x800 59.91 1152x864 75.00 1280x720 60.00 50.00 59.94 1024x768 75.08 70.07 60.00 832x624 74.55 800x600 72.19 75.00 60.32 56.25 720x576 50.00 720x480 60.00 59.94 640x480 75.00 72.81 66.67 60.00 59.94 720x400 70.08 DP5 connected 1680x1050+3840+0 (normal left inverted right x axis y axis) 459mm x 296mm 1680x1050 59.88*+ 1280x1024 75.02 60.02 1280x960 60.00 1152x864 75.00 1024x768 75.08 70.07 60.00 832x624 74.55 800x600 72.19 75.00 60.32 56.25 640x480 75.00 72.81 66.67 60.00 720x400 70.08 VIRTUAL1 disconnected (normal left inverted right x axis y axis)
Great success, epic win, etcetera.