为什么在内核更新到 4.4.0-143-generic 后无法构建调谐卡驱动程序?

Ubu*_*ser 6 compiling kernel drivers

我使用特定品牌的电视调谐卡(TBS 技术)并且驱动程序不包含在内核中,因此必须在每次内核更新后重新构建。在将昨天的内核更新安装到 4.4.0-143-generic 之后,TBS 驱动程序无法构建,但如果我回到 4.4.0-142-generic,它们就可以工作。运行make时出现问题,特别是尝试构建名为videobuf-dma-sg.o的文件时,错误输出如下:

  CC [M]  /home/backend/Drivers/linux-tbs-drivers/v4l/videobuf-dma-sg.o
/home/backend/Drivers/linux-tbs-drivers/v4l/videobuf-dma-sg.c: In function 'videobuf_dma_init_user_locked':
/home/backend/Drivers/linux-tbs-drivers/v4l/videobuf-dma-sg.c:187:21: warning: passing argument 6 of 'get_user_pages' makes pointer from integer without a cast [-Wint-conversion]
         rw == READ, 1, /* force */
                     ^
In file included from include/linux/scatterlist.h:7:0,
                 from include/linux/dma-mapping.h:10,
                 from /home/backend/Drivers/linux-tbs-drivers/v4l/videobuf-dma-sg.c:28:
include/linux/mm.h:1222:6: note: expected 'struct page **' but argument is of type 'int'
 long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
      ^
/home/backend/Drivers/linux-tbs-drivers/v4l/videobuf-dma-sg.c:188:9: warning: passing argument 7 of 'get_user_pages' from incompatible pointer type [-Wincompatible-pointer-types]
         dma->pages, NULL);
         ^
In file included from include/linux/scatterlist.h:7:0,
                 from include/linux/dma-mapping.h:10,
                 from /home/backend/Drivers/linux-tbs-drivers/v4l/videobuf-dma-sg.c:28:
include/linux/mm.h:1222:6: note: expected 'struct vm_area_struct **' but argument is of type 'struct page **'
 long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
      ^
/home/backend/Drivers/linux-tbs-drivers/v4l/videobuf-dma-sg.c:185:8: error: too many arguments to function 'get_user_pages'
  err = get_user_pages(current, current->mm,
        ^
In file included from include/linux/scatterlist.h:7:0,
                 from include/linux/dma-mapping.h:10,
                 from /home/backend/Drivers/linux-tbs-drivers/v4l/videobuf-dma-sg.c:28:
include/linux/mm.h:1222:6: note: declared here
 long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
      ^
scripts/Makefile.build:291: recipe for target '/home/backend/Drivers/linux-tbs-drivers/v4l/videobuf-dma-sg.o' failed
make[3]: *** [/home/backend/Drivers/linux-tbs-drivers/v4l/videobuf-dma-sg.o] Error 1
Makefile:1454: recipe for target '_module_/home/backend/Drivers/linux-tbs-drivers/v4l' failed
make[2]: *** [_module_/home/backend/Drivers/linux-tbs-drivers/v4l] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-4.4.0-143-generic'
Makefile:51: recipe for target 'default' failed
make[1]: *** [default] Error 2
make[1]: Leaving directory '/home/backend/Drivers/linux-tbs-drivers/v4l'
Makefile:26: recipe for target 'all' failed
make: *** [all] Error 2
Run Code Online (Sandbox Code Playgroud)

我基本上遵循构建这些驱动程序的“配方”,所以我不知道实际问题是什么或如何解决它。我不知道这是否是该特定内核版本中的错误,或者是否发生了某些更改而将永远阻止驱动程序重建。我希望也许有一些比我更了解从源代码构建的好心人能给我一些关于这里发生的事情的线索,更重要的是,我可能需要做些什么来修复它。使用以前的 4.4.0-142 通用内核时,Make 运行得很好并且没有错误地完成。那么发生了什么变化,我想知道?

ubf*_*an1 7

改变的是 mm.h 文件的 get_user_pages() 接口。对基本内核代码(在 1 月)的这种更改终于在 4.4.0-143 Ubuntu 内核版本中发挥了作用。它给 Nvidia 驱动程序和一些 vm 驱动程序造成了各种各样的悲痛,但它们被重写了。其他驱动程序,例如您的驱动程序或 oem-hdmi-audio-dkms_0.1_all.deb 中的英特尔计算棒的 HDMI 音频驱动程序,可能会也可能不会重写。基本上你有三个选择:

  1. 继续使用 4.4.0-142 内核。放弃所有未来的内核补丁——在你的驱动程序被重写之前,4.4 系列对你来说已经死了。联系卡供应商,他们可能有一个新的驱动程序。
  2. 自己重写驱动。可能还不算太糟糕,看起来这个界面过去发生了变化,而现在的只是撤消了一些事情。除非您有一些内核代码经验,否则不要尝试。如果安全性和使用该卡对您来说至关重要,则可以聘请第三方开发人员来修复驱动程序。
  3. 花时间寻找具有驱动程序支持的更高版本的内核。HDMI 音频已在更高版本的内核中得到修复,例如 4.18,因此也许您可以升级操作系统/内核。再次与卡的供应商核对,他们可能知道哪些较新的内核包含工作驱动程序(如果有)。

有些机器在某个地方崩溃了,所以有人认为改变 LTS 内核接口是可以接受的。我个人认为他们错了,但我该说谁呢。这个改动是 Canonical 的上游,所以它被认为是一个功能,而不是一个错误,并且不太可能改变,因为一些旧的驱动程序不再工作了。


Ubu*_*ser 1

对于任何其他试图解决此特定问题的人,一个名为 CrazyCat 的用户已经为TBS 驱动程序提供了修复此问题的补丁/更新。TBS 驱动程序和软件更新论坛中也对此问题进行了讨论。