Compile Linux Kernel from source on openSUSE Tumbleweed for Surface Pro 3 Camera Functionality

11 Nov

Green TuxPreviously I wrote about running openSUSE Tumbleweed on the Microsoft Surface Pro 3. Within there I indicated that the camera didn’t work without applying the “Enable UVC 1.5 device detection” patch. However, I didn’t explain how to get this on your openSUSE Tumbleweed system.

Here are the steps I took to get the camera working with the patch from Laurent Pinchart.
Install pre-requisites
sudo zypper -n autoconf rpm-build gcc

Download Kernel
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.3.tar.xz

Decompress Kernel Archive
Note: this should be done somewhere within your home directory or somewhere your user has access to, this should not be done with elevated privileges
tar xvf linux-4.3.tar.xz -C ~/src/

Change Directory to Proper Directory
cd ~/src/linux-4.3/

Copy current .config configuration from running kernel
cp /boot/config-`uname -r` .config

Append verbiage to differentiate kernel naming
vim Makefile
Modify line "EXTRAVERSION =" to "EXTRAVERSION = -mssp3"

Build Kernel RPM
Note: this process will take a while, so feel free to do something else. Time to complete will depend on power of the build system. It took roughly 1.75 hours on the SP3.
make rpm

Once the build is completed you’ll see an output similar to the following:
Wrote: /home/ben/rpmbuild/SRPMS/kernel-4.3.0_spro3_1_default-2.src.rpm
Wrote: /home/ben/rpmbuild/RPMS/x86_64/kernel-4.3.0_spro3_1_default-2.x86_64.rpm
Wrote: /home/ben/rpmbuild/RPMS/x86_64/kernel-headers-4.3.0_spro3_1_default-2.x86_64.rpm
Wrote: /home/ben/rpmbuild/RPMS/x86_64/kernel-devel-4.3.0_spro3_1_default-2.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.TzRJcR
+ umask 022
+ cd /home/ben/rpmbuild/BUILD
+ cd kernel-4.3.0_spro3_1_default
+ rm -rf /home/ben/rpmbuild/BUILDROOT/kernel-4.3.0_spro3_1_default-2.x86_64
+ rm -rf filelists
rm kernel-4.3.0_spro3_1_default.tar.gz kernel.spec

Install the newly packaged Kernel RPM
sudo zypper -n in /home/ben/rpmbuild/RPMS/x86_64/kernel-4.3.0_spro3_1_default-2.x86_64.rpm

Change default boot option – SuSE Way
You can change the newly installed Kernel to be the default boot option by running the bootloader yast module:
kdesu yast2 bootloader
Click "Bootloader Options"
Drop down "Default Boot Section" to the newly installed kernel that isn't appended with -rpm
"Advanced options for openSUSE Tumbleweed>openSUSE Tumbleweed, with Linux 4.3.0-spro3-1-default"

Reboot your system
Reboot your system into the new kernel and test the cameras. Both the front and rear should be detected and usable.

Hope this was helpful.

If the patch by Laurent Pinchart isn’t applied upstream within the next 2 releases I’ll move forward to create a branch of kernel-default in OBS and create a repository for it.

ben.kevan

I am ben kevan.. Well yeah. .that's about it.

One thought on “Compile Linux Kernel from source on openSUSE Tumbleweed for Surface Pro 3 Camera Functionality

Leave a Reply

Your email address will not be published. Required fields are marked *