编译Linux驱动程序

本文介绍如何在Ubuntu12.10环境下编译Linux驱动程序,包括准备内核源码、设置内核源码路径及解决编译过程中遇到的错误和警告。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

基于Ubuntu 12.10,编译Linux驱动程序

1. 准备linux内核源码

此时,我要编译的驱动是基于Ubuntu 12.10内核的,所以我下载的是其对应的内核源码包:

linux_3.5.0-17.28.diff.gz

linux_3.5.0-17.28.dsc

linux_3.5.0.orig.tar.gz

使用命令dpkg-source -x linux_3.5.0-17.28.dsc解压内核源码包,并将diff包中的patch打上。

2. 设置内核源码正确的路径

# cd /root/linux-3.5.0

# ln -s /root/linux-3.5.0 /lib/modules/3.5.0-17-generic/build

3. 编译驱动程序

# cd /root/wifidriver

# make build

此时,可能遇到如下问题:

make[1]: Entering directory `/root/linux-3.5.0'

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.


  WARNING: Symbol version dump /root/linux-3.5.0/Module.symvers
           is missing; modules will have no dependencies and modversions.

  Building modules, stage 2.
/root/linux-3.5.0/scripts/Makefile.modpost:42: include/config/auto.conf: No such file or directory
make[2]: *** No rule to make target `include/config/auto.conf'.  Stop.
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/root/linux-3.5.0'
make: *** [default] Error 2

其中一个ERROR,需执行make oldconfig && make prepare

其中一个WARNING,需将/usr/src/linux-headers-3.5.0-17-generic/Module.symvers复制到/root/linux-3.5.0中,然后执行make oldconfig && make prepare && make scripts

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值