3

I have a kernel driver that fails to compile, I have a patch to fix it but every time I run dkms build ... the driver sources (in /usr/src) are restored, is there a way to add a custom patch to a dkms driver?

Alex
  • 2,546
  • 3
  • 20
  • 30

2 Answers2

1

It was simpler and took less time than I anticipated, as man 8 dkms says just put them in/usr/src/<module>-<module-version>/patches/and then add the file name of the patch indkms.conf of the module with PATCH[#]=

I wonder what will happen when the module is updated.

Alex
  • 2,546
  • 3
  • 20
  • 30
  • put it on hold (apt-mark hold ...) , at least you'll know when to check. – A.B Aug 11 '19 at 16:28
  • @A.B Thanks for the suggestion, it's the nvidia driver, if something goes wrong I should notice (Xorg won't work). I imagine that for a major change there will be a new directory (so no custom patch), while for a minor change `dkms.conf` could be overwritten, maybe the `patches/` directory will be deleted, nothing serious :-) – Alex Aug 11 '19 at 20:23
0

While the other answer should work, I was unable to get it to work. Instead I used PRE_BUILD=patch.sh in dkms.conf to invoke patch -p1 /path/to/mypatch.sh

arved
  • 1,112
  • 7
  • 14