fra*_*ans 6 linux fedora rpm kernel-modules update
编辑:我把克里斯蒂安的回答变成了一个自动完成所有事情的脚本:https : //github.com/frans-fuerst/magic/blob/master/fedora-activate-can.sh
我需要一些在 Linux 源代码中可用但在 Fedora 20 上停用的内核模块,我想知道让它们可用的最简单和最先进的方法是什么。(即 net/CAN 支持导致一些 can_* 模块)
我已经遵循了这个HowTo(并且还有更多非常相似的),但是“仅构建模块”部分似乎仅适用于尚未禁用的模块,因为在这种情况下甚至模块源都丢失了。
首先,我尝试遵循Out Of Tree Modules部分,但是在随附的该死的源代码树中,kernel-devel甚至缺少 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
Run Code Online (Sandbox Code Playgroud)
然后我构建并收到一些警告:
$ make -C /lib/modules/`uname -r`/build M=`pwd`/net/can modules
make: 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.ko
make: Leaving directory `<rpmbuild-BUILD-kernel-linux-dir>'
$ sudo make -C /lib/modules/`uname -r`/build M=`pwd`/net/can modules_install
make: Entering directory `<rpmbuild-BUILD-kernel-linux-dir>'
INSTALL <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-bcm.ko
Can't read private key
INSTALL <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-gw.ko
Can't read private key
INSTALL <rpmbuild-BUILD-kernel-linux-dir>/net/can/can-raw.ko
Can't read private key
INSTALL <rpmbuild-BUILD-kernel-linux-dir>/net/can/can.ko
Can't read private key
DEPMOD 3.14.8
make: Leaving directory `<rpmbuild-BUILD-kernel-linux-dir>'
Run Code Online (Sandbox Code Playgroud)
我刚跑步时没有收到第一个警告,make modules但这花费了我大约一个小时。
但在安装后,该.ko文件位于错误的目录(/usr/lib/modules/3.14.8而非/usr/lib/modules/3.14.8-200.fc20.x86_64)后depmod -a和modprobe can我得到
modprobe: ERROR: could not insert 'can': Exec format error
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我想我明白了,虽然它可能远非完美。
通过运行准备源代码
rpmbuild -bp --target=$(uname -m) kernel.spec
Run Code Online (Sandbox Code Playgroud)转到构建目录,例如:
cd ~/rpmbuild/BUILD/kernel-3.14.fc20/linux-3.14.8-200.fc20.x86_64
Run Code Online (Sandbox Code Playgroud)编辑Makefile并设置EXTRAVERSION为:
EXTRAVERSION = -200.fc20.x86_64
Run Code Online (Sandbox Code Playgroud)启用模块。我建议从configs目录下的相应文件开始(我使用了kernel-3.14.8-x86_64.config)。
为模块准备内核:
make modules_prepare
Run Code Online (Sandbox Code Playgroud)构建模块:
make M=drivers/net/can
Run Code Online (Sandbox Code Playgroud)利润!插入模块:
insmod can-dev.ko
Run Code Online (Sandbox Code Playgroud)| 归档时间: |
|
| 查看次数: |
7307 次 |
| 最近记录: |