Kernel 5.18 and Zorin

Please see below for the pastebin containing the diffstat for the driver patch I want to add to my kernel. (At least that's how I think I should say it.)

That said, I have been searching for ways to apply this patch to my kernel, but I have no clue where to start. After my last post, I dug a little deeper into the files in the "tar ball" and found a readme which echoes what I found when searching for ways to patch a kernel. The readme mentions that using the patch command is obsolete and recommends using Git instead.

I think my question now is: How do I use Git to apply a patch to my kernel?
@Aravisian Can you provide a little guidance on what my next step should be to get this platform driver working now that I have a kernel which supports it?

Yes. That is good advice i do that on test machine but first i need a host operating system. Then i need install virtual machine install there next host. Then i need create 3 x size a lfs partition it depends gcc. Then i need installing a ssh on virtual machine and i need connection from primary host to the second host. Then from this two host i creating full operating system and then from this system i create a image.iso
Something like that. It takes some time, for people who are expert it is 2 days.

Believe me, if I had any, I would have offered it.
I have modified and repackaged kernels and I have compiled kernels... I have never patched a kernel. You would think it would be simple.
But I have never done it and do not know the next step, either.

My next words are "I will look into this." Well, I have been... and I have run into the same problem that you have. Documentation on it is vague and largely unhelpful.

I come across plenty of posts from people that say that they did so in response to another... never any mention of how.
It probably is pretty simple, once you know how.
I will keep looking into it.

1 Like

Thank you Aravisian, your help with everything is much appreciated and I don't mean to press but I do hope you find something.

I have been continuing my research and will post it here if I find anything. I might have to ask on another site like askUbuntu.

Thank you again!

1 Like

I need to know anyway.

But it is frustrating. It amazes me how often that when someone does finally ask, the provided answer is to perform the procedure that they are asking how to do.
Case in point:

The O.P. asks directly and simply: "HOW Do I patch my kernel?"
The answer provided:

You'll have to install the appropriate kernel source, apply the patch, then rebuild.

Pure... Genius.

Another one: The O.P. asked, again, how to PATCH. The provided answer gives a great detail on how to compile from source- without mentioning how to apply a patch at all...

This may take a little time.


You can trying find on discord channel LFS. Linux From Scratch there is a man with nickname Berzekula he sitting with kernel 13 years - that means he start in 2010
They are people who know that things better also

This guide on this webside is near from the book Robert Love Linux Kernel Development

Just trying to remember to keep this alive while we wait for any developments in applying a patch to kernel for driver package support. Bump.

1 Like

I am glad you did- because I was trying to find this thread earlier today.

Any chance there's been a solution for this? Still have no way to manage fan speeds and temp on this PC. Though I do have both fans "detected" (I think) using psensor:

Would love to be able to do more on this installation of Zorin, but that is greatly hindered by a crazy high temp threshold at which the fans activate/turn on/speed up.

Thanks for all your hard work on this OS and I hope we can find a way to include driver support into our kernels. <3

AskUbuntu post

Patching the Linux kernel:

While I have done this, it has been a while. And when it comes to trying to safely talk someone through it, it jangles my nerves.

In the time that has passed, I wonder if the Liquorix or TuxInvader kernels have been updated to include this patch?

That is an interesting question and I am all for checking if they did before I proceed, but I would have no clue where to look or start figuring out. I'm assuming their documentation?

I will do a few searches in the morning and try to find out.

I do want to say I am reluctant to believe that they did, if only for the fact that this particular issue wouldn't seem that widespread - due to the computer on which I'm experiencing the driver support issues being shipped with Window$ as a default - and also because I don't imagine many people out there try to install or use Linux on these gaming machines.
In my mind, gaming laptops are used for just that purpose - gaming - by users whom I imagine don't care about experimenting with Linux or other OS's on them. I imagine that they only care that the computer runs their games as perfectly as possible.
There's also the thought that Linux support for games is also not as developed either, I think. I could be selling the world short and be completely wrong here too, I'm okay with that.

Probably seems like I'm just repeating myself so I'll give it a rest.

I should say though, that as I write this, with only the browser open, my thermals are averaging around 70-79 deg. celsius. Seems way too hot for something as simple as replying to a post on a forum? But I am also as inexperienced in Linux as I am in games - a "noob". I just thought that Linux in general is supposed to run a great deal cooler than Windows. I can't remember where I picked up that idea though.

Apologies for the rambling. It's late. Thank you for continuing to look into this!

To address the post you graciously found and posted here; I found the same documentation elsewhere and actually tried it.

Just today, after posting here, I went to chatGPT and got some of my answers and successfully managed to create a patch file with git format-patch -1 (appending the hash from the commit's URL) after cloning the commit's git repository to my "/usr/src/" directory and cd'ing to that new directory.

The command it suggested to run ended up being git format-patch -1 286e937efbc7177c114e80aae9b402131e3886c1 - the hash embedded in the URL - while in that cloned directory.
Now I have my patch file which is meant to be run with the patch -p1 < path/to/patch-x.y.z command, and that ended up being: patch -p1 < /usr/src/platform-drivers-x86/0001-platform-x86-hp-wmi-support-omen-thermal-profile-pol.patch <--- the patch file.

But I didn't know where (which directory) to run that patch command in. Nowhere in the documentation you posted, nor anywhere in my searches and findings, have I seen any instruction on where to run this command. Or, if we are supposed to copy the patch file into another directory which contains the main kernel source. I was getting errors like: "can't find file to patch at input line 27
Perhaps you used the wrong -p or --strip option?"
So I tried running the same patch command while within the new cloned directory and while inside the kernel's source directory: No joy. When asked which directory do I need to be in when issuing the patch command and the answer was: "To patch the kernel you are currently running, you need to be in the root directory of the kernel source code. Typically, the source code for the kernel is located in /usr/src/linux"...
The only problem is, I don't have the "/linux" sub-directory that was indicated. So that's when I took a wild guess and just ran it in the currently used kernel's directory: cd /usr/src/linux-headers-6.2.1-060201-generic.

Once I did that (ran patch -p1 < /usr/src/platform-drivers-x86/0001-platform-x86-hp-wmi-support-omen-thermal-profile-pol.patch in the "usr/src/linux-headers-6.2.1-060201-generic", all that seems to happen is the terminal hangs forever with a blinking cursor, never returning with a success or fail message, just an endless blinking cursor - same thing when I tried to run the command with the --verbose or -v flags. I opened up system monitor and top and noticed high cpu usage, but all it seemed to be was the "tracker-store" and "tracker-extract" processes (system indexing). I was thinking these processes might have high CPU usage due to new files being moved to different directories which triggered indexing, but no matter how long I let the Terminal stay open, there was still no return message - just the lone, blinking cursor on a new line; it didn't even go back to the $USER@ beginner line (I don't know the correct terminology, sorry)

I just kinda gave up after a couple hours too, I'm sorry I don't have more for you on this. I hope sense can be gleaned from this posting :confused:


Oh, I also forgot to mention: I tried one other thing with the patch file (0001-platform-x86-hp-wmi-support-omen-thermal-profile-pol.patch) that I created in the cloned repository's directory with git format-patch -1 286e937efbc7177c114e80aae9b402131e3886c1 - I attempted to drag it into the /usr/src/linux-headers-6.2.1-060201-generic directory and ran the same command to patch with patch -p1 < /usr/src/platform-drivers-x86/0001-platform-x86-hp-wmi-support-omen-thermal-profile-pol.patch. What I got was more than just a blinking cursor on a new line:

GNU patch 2.7.6
Copyright (C) 2003, 2009-2012 Free Software Foundation, Inc.
Copyright (C) 1988 Larry Wall

License GPLv3+: GNU GPL version 3 or later <>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Larry Wall and Paul Eggert

This is the header of the commit/patch file... but I can view that if I just go to the website or open up the file in my favorite text editor. There was no lines after that which indicated a success or failure to apply the patch.

I'm so at a loss right now, but it seems like I'm getting a little closer, if not a little more adept/knowledgeable with patching kernels...

In Linux Terminal, when you run an operation command that calls on software, as long as you specify the path of the destination files, you can run the command from any directory.
If the path is not specified, then it will look for the file within the directory from which you ran the command. If not found it will give the not found error.
patch -p1 this should be, I think patch -p 1
Your path sould be the location of kernel /usr/src/linux-headers-6.2.1-060201-generic > (to the difference - where ever you have your patch.)

Never got this error, for any directory in which I issued the patch command.

With each attempt, I negated this possibility by simply dragging the patch file into the terminal, which provided the path by default between single quotation marks, e.g. '/usr/src/linux-headers-6.2.1-060201-generic' rather than just /linux-headers...

In any documentation or posts online that I've read to date about this, I've only ever seen the patch -p1 variant, not the -p 1 you mentioned with spacing - this includes the readme file within the cloned patch files, which subsequently mirrors the same instructions in the kernel documentation and the post you provided above.
Also in the documentation: Since this is unlikely to match the name of the kernel source dir on your local machine [...] you should change into your kernel source directory and then strip the first element of the path from filenames in the patch file when applying it (the -p1 argument to patch does this.

I could be wrong.

The screenshot below shows that the kernel patch commit was cloned into my /usr/src/linux-headers-6.2.1-060201-generic directory - that cloned directory was named platform-drivers-x86. You can also see the patch file below this new directory (highlighted/selected), which I dragged out of the cloned patch directory to place into the kernel source directory.

With this configuration and placement of files, running the patch p1 < command would give me the aforementioned return in the Terminal:

Copyright (C) 2003, 2009-2012 Free Software Foundation, Inc.
Copyright (C) 1988 Larry Wall

License GPLv3+: GNU GPL version 3 or later <>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Larry Wall and Paul Eggert

This implies that it must be being read.

In this thread, you can see that in that totally unrelated problem, a simple solution was found long into the thread - Which is odd. I almost always ask first thing: "How did you install it?" due to flatpak and snap being sandboxed as they are.
Yet, it went right over my head that time.

As of late, my eyes seem to be glazing over. Your experience does not match mine... And I am seeing a lot of threads like that all over the forum. Sorry for not being much help. I have kind of been a bit overwhelmed and when I try to focus on the forum - I can't seem to keep my focus.

I have read your post four times in succession, then tried to picture it and the processes that follow - then my mind goes Blank.

I think I need a vacation.

I've gotten a little further:

My command:

patch -p1 --verbose --dry-run -d /usr/src/linux-headers-6.2.1-060201-generic -i '/home/aj/Downloads/platform-drivers-x86/0001-platform-x86-hp-wmi-support-omen-thermal-profile-pol.patch'

My terminal output:

Hmm...  Looks like a unified diff to me...
can't find file to patch at input line 27
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|From 286e937efbc7177c114e80aae9b402131e3886c1 Mon Sep 17 00:00:00 2001
|From: Enver Balalic <>
|Date: Mon, 14 Mar 2022 13:14:53 +0100
|Subject: [PATCH] platform/x86: hp-wmi: support omen thermal profile policy v1
|As it turns out, these laptops have 2 thermal profile versions.
|A previous patch added support for v0, this patch adds support
|for v1 thermal policies that are in use on some devices.
|We obtain the thermal policy version by querying the get system
|design data WMI call and looking at the fourth byte it returns,
|except if the system board DMI Board ID is in a specific array
|that the windows command center app overrides to thermal policy
|v0 for some reason.
|Signed-off-by: Enver Balalic <>
|Reviewed-by: Hans de Goede <>
|Signed-off-by: Hans de Goede <>
| drivers/platform/x86/hp-wmi.c | 81 +++++++++++++++++++++++++++++------
| 1 file changed, 67 insertions(+), 14 deletions(-)
|diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
|index 1f9d6e1de5af..0e9a25b56e0e 100644
|--- a/drivers/platform/x86/hp-wmi.c
|+++ b/drivers/platform/x86/hp-wmi.c
File to patch: 

It is asking me to enter the name(s) of the file(s) that the patch is supposed to modify. This information should be included in the patch file itself, typically in the header section, but I don't see it unless I'm missing something. I opened up the patch file with a text editor to check which file is being patched and I see some paths that look to be pointing to a file named hp-wmi.c, but I don't know if that is true or not.

It also occurs to me that this patch is meant to modify many files in different directories within the kernel's source directory, in which case, I would be required to enter each and every single one in that prompt. Probably not the way this patch command was meant to be run, which leads me to believe that my kernel's source directory at /usr/src/linux-headers-6.2.1-060201-generic needs a whole new directory with the same structure as seen in this path in the patch file: a/drivers/platform/x86/hp-wmi.c.

Would this imply that I need to have something like: usr/src/linux-headers-6.2.1-060201-generic/a/drivers/platform/x86 and then create a blank .TXT named hp-wmi.c?

Without creating the "a" directory, I did try to navigate into the .../linux-headers-6.2.1-060201-generic/drivers/platform/x86 folder and create this file, then calling that file in the Terminal prompt I mentioned above, but it still says that the directory or file does not exist.

I assume that once I know the file name, I just enter it at the prompt and press enter - I just don't know what I'm supposed to do to get the file I need, into the directory that is being patched.

Below is the text of the patch file:

Can you take a look to see if you can identify the name/directory of the file to which I'm meant to point the patch file?

Thank you for even trying @Aravisian, that's all that really matters. Don't stress it at all.

Is ChatGPT an effective for finding solutions?