How to properly patch a kernel?

Hi all, good to be here learning quite a bit with linux but am stuck with patching linux kernels.

I am trying to switch to linux, but as a gamer it is difficult to make a full switch. I then heard about vfio and gave it a shot and got manjaro up and running with a windows vm. was making progress then I found out about amd vega reset bug the hard way :P. so I was wondering if that vega reset patch still works or has it not worked for awhile?

I tried patching in kbuntu with different kernels but the result is still the same. I get a glowing black screen when booting the new kernel. I tried editing the grub file with “nofb nomodeset”, etc but nothing works. I hosed the system and have to load a backup I made in clonezilla prior to fiddling around with stuff.

I downloaded the kernels src, copied current .config, pacthed with “patch -p1 < vega-fix.patch” and installed all the build tools. But still same result, black screen in kbuntu and manjaro.

any ideas? I will try again when I get home later and able to post logs.
thanks

Are you sure you built the kernel and installed it correctly?
You can verify with: uname -a
You also can check the content of /boot for the new kernel.

Let’s start with you pointing to which guide you used. Arch Based systems and Debian based systems use different initcpio and distro specific patches ontop of the vanilla kernel. Also, what boot loader are you using?

hi sorry for the late reply, im using mx linux (debian)

I was following the debian guide and here is my current way of doing it

  1. download current kernel source not sure exact command
    sudo apt install linux-source5.6

  2. copy to home folder

  3. extract and patch source
    patch -p1 < fix-reset-vega.patch

  4. make current .config file
    just copy current config from /boot to source folder then rename to .config

  5. build the source using command
    make -j8 deb-pkg LOCALVERSION=-custom KDEB_PKGVERSION=$(make kernelversion)-1

  6. everything compiles but failed building .deb package building
    ----error-----
    make[2]: *** [debian/rules:6: build] Error 2
    dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
    make[1]: *** [scripts/Makefile.package:77: deb-pkg] Error 2
    make: *** [Makefile:1438: deb-pkg] Error 2

there’s the kernel in the directory before it in tar.gz format.
linux5.6.tar.gz
linux5.6.dsc
linux5.6-diff.gz

no header files either. please help
sorry for not formatting with the code tags, did not see the option

ok after scouring the internet I learned that the error is because the source is using lz4 compression for the .deb files. I did not have lz4 compression installed, so all I had to do is install the lz4 compression tool

apt install liblz4-tool

deb files are made, hopefully this works heh. also why is this not included with debian releases?

and for sanity sake next time, how do I change compression from lz4 to gzip or whatever debian uses?

1 Like

That is weird. I assume because it is not pure debian, your source may be not following the debian standard thus the different compression.

Did you install build-essentials. Also usually when you download a Debian source you would use apt-get source --download-only <package>. You can also compile some sources by using apt-get source --compile <package>.