#Keep a kernel patch after a kernel update

1 messages · Page 1 of 1 (latest)

pastel pilot
#

Hi! i'm using a kernel patch that i found on internet to fix an issue with my headset, the problem is whenever i update my kernel i have to do everything again. is there a way i can keep this even when the kernel update? this is my first time patching the linux kernel, sorry for being very bad. I heard about DKMS but i don't really know how it works. Here are the instructions i got to patch the kernel:

It's not so difficult. Install the kernel-devel package, get the linux sources (minor version should match to your installed kernel e.g. 6.0) - https://www.kernel.org/ - unpack sources, go to the directory, do suggested changes in sound/usb/endpoint.c (text editor) and:

  make -C /lib/modules/$(uname -r)/build M=$(pwd)/sound/usb modules

Find snd-usb-audio.ko (sound/usb/snd-usb-audio.ko) and replace /lib/modules/$(uname -r)/kernel/sound/usb/snd-usb-audio.ko (maybe with .xz suffix). Reboot. I suggest to move the original kernel module to a different place (outside /lib/modules tree) so you can restore it after tests.

and here is the change:

  diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
  index 4aaf0784940b..e10b92755a3b 100644
  --- a/sound/usb/endpoint.c
  +++ b/sound/usb/endpoint.c
  @@ -1412,6 +1412,8 @@ static int init_sample_rate(struct snd_usb_audio *chip,
                  return rate;
          if (clock && !clock->need_setup)
                  return 0;
  +       if ((ep->ep_num & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)
  +               goto __end;
 
          err = snd_usb_init_sample_rate(chip, ep->cur_audiofmt, rate);
          if (err < 0) {
  @@ -1420,6 +1422,7 @@ static int init_sample_rate(struct snd_usb_audio *chip,
                  return err;
          }
 
  +__end:
          if (clock)
                  clock->need_setup = false;
          return 0;

https://bugzilla.kernel.org/show_bug.cgi?id=216798

#

any help would be very appreciated :D

flint walrus
pastel pilot
#

Wdym?

pastel pilot
#

@flint walrus

flint walrus
#

Can you use a pacman hook to repatch the kernel every upgrade?

pastel pilot
#

ill try

#

do i have to use this package?

flint walrus
#

No

#

Just write your own

pastel pilot
#

i really have no idea how to do it :/

flint walrus
#

There's an arcwiki article on it

#

.aw pacmanhooks

lone doveBOT
flint walrus
#

.aw pacmanhook

lone doveBOT
flint walrus
#

Uh 1 min

pastel pilot
#

Hmm

#

So i have to create a pacman hook

#

That when it's done installing the kernel

#

It runs a script that patches it

flint walrus
#

Yeah

#

There Might be a better way, idk