blackmagic-14.2.1a1 not compiled over DKMS with kernel 6.4.0

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

lemurcard

  • Posts: 1
  • Joined: Tue Oct 01, 2024 11:21 am
  • Real Name: Petr Lemur

blackmagic-14.2.1a1 not compiled over DKMS with kernel 6.4.0

PostTue Oct 01, 2024 2:00 pm

blackmagic-io is fine but blackmagic kernel module failing in compile over dkms

uname -a
Linux host 6.4.0-150600.23.22-default #1 SMP PREEMPT_DYNAMIC Fri Sep 13 10:42:50 UTC 2024 (5c05eeb) x86_64

DKMS make.log for blackmagic-14.2.1a1 for kernel 6.4.0-150600.23.22-default (x86_64)
Tue Oct 1 01:20:25 PM CEST 2024
touch .bmd-support.o.cmd
make -C /lib/modules/6.4.0-150600.23.22-default/build M=/var/lib/dkms/blackmagic/14.2.1a1/build
make[1]: Entering directory '/usr/src/linux-6.4.0-150600.23.22-obj/x86_64/default'
CC [M] /var/lib/dkms/blackmagic/14.2.1a1/build/blackmagic_serial.o
CC [M] /var/lib/dkms/blackmagic/14.2.1a1/build/blackmagic_core.o
CC [M] /var/lib/dkms/blackmagic/14.2.1a1/build/blackmagic_lib.o
CC [M] /var/lib/dkms/blackmagic/14.2.1a1/build/blackmagic_gate.o
CC [M] /var/lib/dkms/blackmagic/14.2.1a1/build/blackmagic_dma.o
COPY /var/lib/dkms/blackmagic/14.2.1a1/build/bmd-support.o
/var/lib/dkms/blackmagic/14.2.1a1/build/blackmagic_lib.c: In function ‘dl_get_user_pages’:
/var/lib/dkms/blackmagic/14.2.1a1/build/blackmagic_lib.c:686:10: error: too many arguments to function ‘get_user_pages’
ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
^~~~~~~~~~~~~~
In file included from /usr/src/linux-6.4.0-150600.23.22/include/linux/scatterlist.h:8:0,
from /usr/src/linux-6.4.0-150600.23.22/include/linux/dmapool.h:14,
from /usr/src/linux-6.4.0-150600.23.22/include/linux/pci.h:1666,
from /var/lib/dkms/blackmagic/14.2.1a1/build/blackmagic_lib.c:30:
/usr/src/linux-6.4.0-150600.23.22/include/linux/mm.h:2457:6: note: declared here
long get_user_pages(unsigned long start, unsigned long nr_pages,
^~~~~~~~~~~~~~
make[2]: *** [/usr/src/linux-6.4.0-150600.23.22/scripts/Makefile.build:252: /var/lib/dkms/blackmagic/14.2.1a1/build/blackmagic_lib.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [../../../linux-6.4.0-150600.23.22/Makefile:2066: /var/lib/dkms/blackmagic/14.2.1a1/build] Error 2
make[1]: Leaving directory '/usr/src/linux-6.4.0-150600.23.22-obj/x86_64/default'
make: *** [Makefile:44: all] Error 2


problematic funcion is - too many arguments to function ‘get_user_pages’
ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 455
  • Joined: Mon Sep 04, 2017 4:05 am

Re: blackmagic-14.2.1a1 not compiled over DKMS with kernel 6

PostFri Oct 11, 2024 4:44 am

Hi Petr,

Please be aware that Linux kernel 6.4 is supported as early as Desktop Video 12.5. The extension -150600.23.22-default, suggests that it is distribution packaged kernel, which I believe is OpenSUSE 15.6? Please be aware that OpenSUSE is not a tested distribution for Desktop Video releases.

That said, you should be able to patch the blackmagic module sources and rebuild as follows:

As su, modify /usr/src/blackmagic-14.2.1a1/blackmagic_lib.c in editor. Replace lines 679-683:
Code: Select all
#if KERNEL_VERSION_OR_LATER(6, 5, 0)
      if (current_task == current)
         ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages);
      else
         ret = get_user_pages_remote(current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
with:
Code: Select all
#if KERNEL_VERSION_OR_LATER(6, 4, 0)
      if (current_task == current)
         ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages);
      else
         ret = get_user_pages_remote(current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL, NULL);
Then rebuild the blackmagic module with:
Code: Select all
$ sudo dkms build -m blackmagic -v 14.2.1a1
$ sudo dkms install -m blackmagic -v 14.2.1a1
Please be aware that these steps are specific to OpenSUSE 15.6. This change is not portable and will likely cause build issues with other distributions.

Regards
Cameron

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 2 guests