linux – 使内核模块可用,已在Fedora上停用

linux – 使内核模块可用,已在Fedora上停用,第1张

概述编辑:我把Cristians的答案变成了一个自动完成所有 *** 作的脚本: https://github.com/frans-fuerst/magic/blob/master/fedora-activate-can.sh 我需要一些内核模块,这些模块可以在Linux源代码中使用,但在Fedora 20上停用,我想知道什么是最容易和最前进的方法来使它们可用. (即然后net / CAN支持导致一些can_ 编辑:我把Cristians的答案变成了一个自动完成所有 *** 作的脚本: https://github.com/frans-fuerst/magic/blob/master/fedora-activate-can.sh

我需要一些内核模块,这些模块可以在linux源代码中使用,但在Fedora 20上停用,我想知道什么是最容易和最前进的方法来使它们可用. (即然后net / CAN支持导致一些can_ *模块)

>是否有fedora-repos / rpms可以使停用的模块可用?
>或者我必须手动编译这些模块吗?
>在这种情况下 – 是否有一些机制可以在内核更新的情况下自动执行此 *** 作,或者我是否必须反复编译它们?

我已经遵循了this HowTo(并且还有更多类似的东西)但是“仅构建模块”部分似乎仅适用于尚未禁用的模块,因为在这种情况下甚至缺少模块源.

以下是我按照上述HowTo尝试的内容:

首先,我尝试按照Out Of Tree Modules部分进行 *** 作,但是在内核开发的该死的源代码树中,甚至缺少CAN支持的来源.
所以我尝试从src.rpm构建模块:

$yumdownloader --source kernel$sudo yum-builddep kernel-3.14.8-200.fc20.src.rpm$rpm -Uvh kernel-3.14.8-200.fc20.src.rpm$cd ~/rpmbuild/Specs$rpmbuild -bp --target=$(uname -m) kernel.special$cd ~/rpmbuild/BUILD/<kerneldir>/<linuxdir>$<configure the kernel using menuconfig>$make prepare

然后我建立并得到一些警告:

$make -C /lib/modules/`uname -r`/build M=`pwd`/net/can modulesmake: Entering directory `<rpmbuild-BUILD-kernel-linux-dir>'  WARNING: Symbol version dump <rpmbuild-BUILD-kernel-linux-dir>/Module.symvers           is missing; modules will have no dependencIEs and modversions.  CC [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/bcm.o  CC [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/gw.o  CC [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/raw.o  CC [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/af_can.o  CC [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/proc.o  LD [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/can.o  LD [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-raw.o  LD [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-bcm.o  LD [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-gw.o  Building modules,stage 2.  MODPOST 4 modules  CC      <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-bcm.mod.o  LD [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-bcm.ko  CC      <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-gw.mod.o  LD [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-gw.ko  CC      <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-raw.mod.o  LD [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-raw.ko  CC      <rpmbuild-BUILD-kernel-linux-dir>/net/can/can.mod.o  LD [M]  <rpmbuild-BUILD-kernel-linux-dir>/net/can/can.komake: Leaving directory `<rpmbuild-BUILD-kernel-linux-dir>'$sudo make -C /lib/modules/`uname -r`/build M=`pwd`/net/can modules_installmake: Entering directory `<rpmbuild-BUILD-kernel-linux-dir>'  INSTALL <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-bcm.koCan't read private key  INSTALL <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-gw.koCan't read private key  INSTALL <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-raw.koCan't read private key  INSTALL <rpmbuild-BUILD-kernel-linux-dir>/net/can/can.koCan't read private key  DEPMOD  3.14.8make: Leaving directory `<rpmbuild-BUILD-kernel-linux-dir>'

我刚刚运行make模块时没有收到第一个警告,但这花了我大约一个小时.

但是,安装后,.ko文件位于错误的目录中
(/usr/lib/modules/3.14.8而不是/usr/lib/modules/3.14.8-200.fc20.x86_64)并且在depmod -a和modprobe之后我可以得到

modprobe: ERROR: Could not insert 'can': Exec format error

我究竟做错了什么?

解决方法 我想我得到了它,虽然它可能远非完美.

>通过运行准备源代码

rpmbuild -bp --target=$(uname -m) kernel.spec

>转到构建目录,例如:

cd ~/rpmbuild/BUILD/kernel-3.14.fc20/linux-3.14.8-200.fc20.x86_64

>编辑Makefile并将EXTRAVERSION设置为:

EXTRAVERSION = -200.fc20.x86_64

>启用模块.我建议从configs目录下的相应文件开始(我使用了kernel-3.14.8-x86_64.config).
>为模块准备内核:

make modules_prepare

>构建模块:

make M=drivers/net/can

>利润!插入模块:

insmod can-dev.ko
总结

以上是内存溢出为你收集整理的linux – 使内核模块可用,已在Fedora上停用全部内容,希望文章能够帮你解决linux – 使内核模块可用,已在Fedora上停用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/yw/1039466.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-24
下一篇2022-05-24

发表评论

登录后才能评论

评论列表(0条)

    保存