Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patching the 5.12 Linux kernel to support new Intel hardware (e.g., Intel Iris Xe for Thinkpad X1 Titanium Yoga) on Ubuntu/Debian/Pop!_OS

Get a 5.12 Linux kernel with support for newer Intel hardware (e.g., Intel Iris Xe for Thinkpad X1 Titanium Yoga) on Ubuntu/Debian/Pop!_OS

Prologue: Do I need this?

I recently got a Thinkpad sporting an Intel® Core™ i5-1140G7 Processor 11. gen (1,80 GHz, Turbo Boost, 4 Cores, 8 Threads, 8 MB Cache with an Integrated Intel® Iris® Xe. Sadly graphics drivers did not work out-of-the-box and also not with the latets 5.12 kernel from xenmod. You can tell it's not working when graphics are slow, backlight adjustment buttons don't work and this is the output of inxi -G (you might need to sudo apt install inxi):

simon@pop-os:~$ inxi -G
Graphics:
  Device-1: Intel driver: N/A 
  Device-2: IMC Networks Integrated Camera type: USB driver: uvcvideo 
  Display: x11 server: X.Org 1.20.9 driver: fbdev unloaded: modesetting,vesa 
  resolution: 2256x1504~95Hz 
  OpenGL: renderer: llvmpipe (LLVM 11.0.0 256 bits) v: 4.5 Mesa 21.0.0 

Seems the hardware is too new and support will only come around in future kernel updates. I found a friendly frugalware developer(?) on the Lenovo support forum who did the work of collecting and backporting kernel patchs efrom 5.13 to the 5.12 kernel. It's been ~15 years since I compiled my last kernel, but I managed to apply the patches and compile a kernal that runs on my Ubuntu/Pop!_OS worked. This guide should work for all systems for which the xanmod kernel works. If you're in the same shoes hardware-wise, here's what I did:

Why so complicated?

I basically rebuild a patched version of the 5.12 kernel by xanmod. There may be an easier way, whereby you only rebuild the i915-module. I have no clue. That's for others to figure out. Let me know if you find a simpler way.

How long does that take?

Active work: 4 minutes

Watching the kernel compile: some hours (go get some fresh air)

Preparations

You might need to install a few things if you haven't already (see https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel):

sudo apt install libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf build-dep git zstd

Patching, compiling and installing the kernel

I have good experiences with the xanmod kernel, so I use that as base kernel source and config for 5.12 to start from. Follow these steps (You might have to add a few sudos):

  1. Go to whatever folder you want to work in. I did cd /usr/src
  2. Download the xanmod kernel source: git clone https://github.com/xanmod/linux.git and cd into that folder
  3. Download the i915-patch wget https://crazy.dev.frugalware.org/Intel-i915-backport-MSO-fixes-to-kernel-5.12.patch
  4. Apply the patch patch -p1 < Intel-i915-backport-MSO-fixes-to-kernel-5.12.patch
  5. Build the kernel make (takes > 2hrs)
  6. Go grab a coffee
  7. Install modules sudo make modules_install
  8. Install kernel sudo make install
  9. Reboot into your new kernel

Epilogue: This is a temporary fix.

In spite of everything running well now. I see this as a temporary fix and will switch to the Ubuntu version of 5.13 as soon as it comes out.

AT YOUR OWN RISK

I have no clue what I am doing, I am just hacking together pieces of code and commands I found online. If you follow my and fry you computer that's on you!

@Spicysauced

This comment has been minimized.

Copy link

@Spicysauced Spicysauced commented May 13, 2021

Maybe it would have been easier to use i915.force_probe=Last 4 characters of your iGPU device id in your kernel startup line :)
So for me its i915.force_probe=4c8a
Still temporary, but worked for me and others. I am also on PopOS 20.10 with an 11600k and I honestly dont understand how this isnt implemented in the default kernel yet.

@simonheb

This comment has been minimized.

Copy link
Owner Author

@simonheb simonheb commented May 14, 2021

Thanks for your feedback. Sadly this doesn't do the trick for all hardware. As you can see in the Lenovo Forum link I posted, all least among those who are on a Thinkpad x1 Titanium, patching the kernel is required.

@vukolic

This comment has been minimized.

Copy link

@vukolic vukolic commented May 16, 2021

Thanks @simonheb this was very helpful! Few suggestions: "<" seems to be missing in step 4 + you probably meant (in "Epilogue") updating to 5.13 once it is available (vs. 5.14) :)

@simonheb

This comment has been minimized.

Copy link
Owner Author

@simonheb simonheb commented May 17, 2021

You're right of course. I've not played around with kernels for so long, I was still assuming that odd versions are unstable, while this practice was apparently dropped almost 20 years ago... 👍

@Akash-Rayhan

This comment has been minimized.

Copy link

@Akash-Rayhan Akash-Rayhan commented Jul 2, 2021

In my case the terminal shows like that may be it got the driver but my brightness control hot keys are not working. It works on windows. I tried to upgrade kernel 5.13 but the issue still persists. I recently got new Lenovo Ideapad-5-15ITL05. On lenovo forum and also ubuntu bug list i reported about the bug but no one is replying anything. Can you please help me?
inxi -G
Graphics:
Device-1: Intel driver: i915 v: kernel
Display: x11 server: X.Org 1.20.9 driver: fbdev unloaded: modesetting,vesa
resolution: 1920x1080~60Hz
OpenGL: renderer: Mesa Intel UHD Graphics (TGL GT2) v: 4.6 Mesa 20.2.6

@simonheb

This comment has been minimized.

Copy link
Owner Author

@simonheb simonheb commented Jul 5, 2021

It seems your driver is fine. So changing the kernel will probably not help. Maybe it is related to the hotkey settings? I am not on Ubuntu so I cannot help you with this part. Sorry.

@Akash-Rayhan

This comment has been minimized.

Copy link

@Akash-Rayhan Akash-Rayhan commented Jul 9, 2021

Are you using pop os? I also installed the pop!_os 20.04 but the problem still persists.

@simonheb

This comment has been minimized.

Copy link
Owner Author

@simonheb simonheb commented Jul 12, 2021

Oh, yes. I am on pop.os. But since your inxi -G output indicate that the driver is successfully loaded, it seems that your problem is a different one. Sorry i have no idea where to look for a solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment