本次我们介绍如何在Ubuntu开发驱动.
首先需要下载Ubuntu对应kernel的源码(详细看这:https://blog.csdn.net/qq_23922117/article/details/108831625):
# 查看可用linux source
$ sudo apt-get update
$ apt-cache search linux-source
linux-source - Linux kernel source with Ubuntu patches
linux-source-4.4.0 - Linux kernel source for version 4.4.0 with Ubuntu patches
linux-source-4.10.0 - Linux kernel source for version 4.10.0 with Ubuntu patches
linux-source-4.11.0 - Linux kernel source for version 4.11.0 with Ubuntu patches
linux-source-4.13.0 - Linux kernel source for version 4.13.0 with Ubuntu patches
linux-source-4.15.0 - Linux kernel source for version 4.15.0 with Ubuntu patches
linux-source-4.8.0 - Linux kernel source for version 4.8.0 with Ubuntu patches
# 我们下载上面结果中版本比较高的4.15.0
$ sudo apt-get install linux-source-4.15.0
# 下载完成后,复制一份到我们的工作目录,解压和编译
$ sudo cp /usr/src/linux-source-4.15.0/linux-source-4.15.0