Ubuntu – Installing Ubuntu on Surface pro 4


I have moved from win 10 to Ubuntu 16.04. I've tried following this article and this video, but still run into problems as the latest kernel version is 4.6.3.
I'm still running on the kernel that came installed with Ubuntu which is 4.4.0.

Long story short, my keyboard, touch pad, touch screen, volume and power buttons, the stylus, wifi indicator (top right corner) and camera are not working.
I've managed to get the Wifi and Bluetooth working.

Can anyone help me out with writing/finding some patches and re-compiling the kernel?

Please post all updates and issues on
My GitHub organization and any contribution is appreciated

deriver-config and Modules

To get the type cover working run SP4-1 script from deriver-config

Best Answer

I have a fairly nice Surface Pro 4 kernel running on my Ubuntu installation.

The Rundown

What works:

  • wifi/bluetooth
  • multi-touch
  • pen
  • trackpad on the typing cover

What works somewhat:

  • hibernate - after resume there is no touch or pen

What doesn't:

  • suspend (see the note on power saving below)
  • freeze (the more battery draining version of suspend/sleep that doesn't reliably work)
  • the typing cover

What I haven't tried:

  • the cameras

General idea

The general idea behind this kernel is to take the changes done by Hyungwoo Yang at https://github.com/ipts-linux-org/ipts-linux-new/wiki and apply them to the Ubuntu 4.9rc3 kernel. Here are the steps to get the kernel in order. The compilation process takes about 45 minutes using all the cores of the Surface 4. Cloning the kernel repositories requires about 1.5 gigs of disk space.

Steps to produce the kernel

  1. install Ubuntu 16.10 yakkety. to accomplish this you will need a USB hub that can handle both the ubuntu live-USB and the keyboard/mouse.

  2. boot linux with a USB keyboard.

  3. prepare the Ubuntu 4.9rc3 kernel.

    • clone the Ubuntu 4.9rc3 kernel (requires ~1.5gig of space):

      git clone git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack v4.9-rc3

    • download 6 patches: Patch1 Patch2 Patch3 Patch4 Patch5 Patch6

    • apply the patches to the kernel in order: do

      git am /path/to/THEPATCH.patch

      for each of the patches.

  4. create a patch with touch/pen support from the ipts-linux-new kernel.

    • clone the kernel (requires ~1.5gig of space) in another directory:

      git clone https://github.com/ipts-linux-org/ipts-linux-new.git

    • create the patch:

      git diff 0c183d92b20b5c84ca655b45ef57b3318b83eb9e > /path/to/ipts-linux-new_patch.txt

  5. apply the ipts-linux-new patch to v4.9rc3

    `cd /path/to/v4.9rc3`
    `patch -p1 < /path/to/ipts-linux-new_patch.txt`
    `git add .`
    `git commit -m 'Patch for Surface Pro 4 taken from ipts-linux-new.'`
  6. compile the kernel and make ubuntu .deb packages (copied from Ubuntu Kernel Compilation)

    cd /path/to/v4.9rc3

    • initialize the debian files:

      fakeroot debian/rules clean

    • configure the kernel you will build:

      fakeroot debian/rules editconfigs

      • Say yes only to the amd64 question. This will show the "menuconfig" curses interface. activate the following two options:
        • Device Drivers -> NVM express lock device (y)
        • Device Drivers -> Misc devices -> Intel Precise Touch & Stylus (m)
    • comment or remove "do_zfs = true" in "/path/to/v4.9rc3/debian.master/rules.d/amd64.mk"

    • rename the kernel by editing "/path/to/v4.9rc3/debian.master/changelog"

  7. compile the kernel (use more threads than processors to make it faster)

    `fakeroot debian/rules clean` #necessary, but I don't know why
    `DEB_BUILD_OPTIONS=parallel=5 fakeroot debian/rules binary-headers binary-generic binary-perarch`
  8. four new .debs should be created in the directory next to v4.9rc3. Install the .debs with the following command:

    `sudo dpkg -i linux-image-* linux-headers-4.9.0-040900rc3*`
  9. copy driver files from windows to linux:

    • copy driver files from "\Windows\INF\PreciseTouch\Intel" to the linux directory "/lib/firmware/intel/ipts". There should be at least 4 files with names similar to these:

      • iaPreciseTouchDescriptor.bin
      • SurfaceTouchServicingSFTConfigMSHW0078.bin
      • SurfaceTouchServicingDescriptorMSHW0078.bin
      • SurfaceTouchServicingKernelSKLMSHW0078.bin
    • Make symbolic links to these files:

      cd /lib/firmware/intel/ipts

      ln -s iaPreciseTouchDescriptor.bin intel_desc.bin

      ln -s SurfaceTouchServicingSFTConfigMSHW0078.bin config.bin

      ln -s SurfaceTouchServicingDescriptorMSHW0078.bin vendor_desc.bin

      ln -s SurfaceTouchServicingKernelSKLMSHW0078.bin vendor_kernel.bin

You should be able to boot the new kernel now. If the links are in the right place then touch and pen will work nicely.

Note on power saving

The missing suspend functionality is a major drawback. This is a due to the Microsoft "connected standby" fiasco: https://lwn.net/Articles/580451/. Freeze uses more battery (drains the battery maybe half as fast as if you had left the computer on), and doesn't seem to be reliable. With hibernate the state is successfully kept, but unfortunately, the touch and stylus functionalities do not work after resume.

Related Question