微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

编译ubuntu的module

转载自:https://wiki.ubuntu.com/Kernel/Dev/KernelModuleRebuild

In your home directory (or chose your working directory).

$ sudo apt-get install linux-source
$ tar xjf /usr/src/linux-source-<version>.tar.bz2

$ mkdir build_module
$ cd ./linux-source-<version>
$ patch -p1 < </path to patch/xxx.patch>
$ make mrproper

From your home directory do
$ cp /lib/modules/`uname -r`/build/.config ./build_module/
$ cp /lib/modules/`uname -r`/build/Module.symvers ./build_module/
$ cp /lib/modules/`uname -r`/build/Makefile ./build_module/

$ cd ./linux-source-<version>
$ make O=../build_module outputmakefile
$ make O=../build_module archprepare
(If you encounter an error at this stage,run make mrproper and return to the last cp above and continue again from there)
$ make O=../build_module prepare
$ make O=../build_module modules SUBDirs=scripts
$ make O=../build_module modules SUBDirs=drivers/<patch to driver>/
$cd 

$ sudo cp ./build_module/drivers/<path>/<driver>.ko /lib/modules/`uname -r`/kernel/drivers/<path>/

原文地址:https://www.jb51.cc/ubuntu/354987.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐