Set up the environment for driver compiling in Debian
1、check the kernel version
$ uname -r
3.2.--amd64
2、install the source code
$ sudo apt-get install linux-source-3.2
then there would be a file in /usr/src
$ ls /usr/src | grep linux-source
linux-source-3.2.tar.bz2
3、decompress the .bz2
$ sudo tar xvf linux-source-3.2.tat.bz2
4、configure the files.
$ sudo make oldconfig
// or try the following method
$ sudo make menuconfig
$ sudo make xconfig
5、compile the kernel
$ sudo make bzImage
6、compile the modules
$ sudo make modules
7、install the modules
$ sudo make modules_install
8、reboot
$ sudo shutdown -r now
9、try a helloworld module
//hello.c
#include <linux/init.h>
#include <linux/module.h> MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(void)
{
printk(KERN_ALERT "Hello,world\n");
return ;
} static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye cruel world\n");
} module_init(hello_init);
module_exit(hello_exit);
Makefile
//Makefile
obj-m := hello.o
KERNELDIR := /lib/modules/3.2.46/build
PWD := $(shell pwd) modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
then enter make
$ sudo make
if the file hello.ko created, continue.
10、test the module.
$ sudo insmod hello.ko
$ sudo rmmod hello.ko
$ cat /var/log/syslog | tail -
Jun :: Debian NetworkManager[]: <info> Activation (eth0) Stage of (IPv6 Configure Timeout) started...
Jun :: Debian NetworkManager[]: <info> Activation (eth0) Stage of (IPv6 Configure Timeout) complete.
Jun :: Debian ntpdate[]: adjust time server 59.66.173.165 offset 0.222044 sec
Jun :: Debian kernel: [ 347.185953] Hello,world
Jun :: Debian kernel: [ 351.580155] Goodbye cruel world
more tips look at
http://hi.baidu.com/sgnkdomnrrejowr/item/5154dec4b94e4ddbef183b7c
Set up the environment for driver compiling in Debian的更多相关文章
- Hadoop生态圈-Sqoop部署以及基本使用方法
Hadoop生态圈-Sqoop部署以及基本使用方法 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. Sqoop(发音:skup)是一款开源的工具,主要用于在Hadoop(Hive)与 ...
- IBM CLI 和 ODBC
Installing and Configuring DB2 Clients Running CLI/ODBC Programs The DB2 Call Level Interface (CLI) ...
- Warensoft Stock Service Api客户端接口说明
Warensoft Stock Service Api客户端接口说明 Warensoft Stock Service Api Client Reference 可使用环境(Available Envi ...
- 基于Spring的Appium配置应用
本文主要是讲述,使用Spring框架,优化Appium的Driver调用,并将写在代码里的大量配置参数定义到配置文件当中,还可灵活的控制调用AndroidDriver还是IOSDriver. Spri ...
- nova file injection的原理和调试过程
file injection代码 file injection原理来讲是比较简单的,在nova boot命令中,有参数--file,是将文件inject到image中 nova boot --flav ...
- Linux(Ubuntu) OpenGL 开发环境
Linux(Ubuntu) OpenGL 开发环境 在 PC 平台上开发 OpenGL 可以使用的辅助工具有很多选择,这里我主要参考了 learnopengl 的配置,使用 GLFW 和 GLAD. ...
- [转]Ubuntu16.04下ralink rt3290驱动安装
出处:https://askubuntu.com/questions/253632/how-do-i-get-a-ralink-rt3290-wireless-card-working 解决为问题:L ...
- Learn golang: Top 30 Go Tutorials for Programmers Of All Levels
https://stackify.com/learn-go-tutorials/ What is Go Programming Language? Go, developed by Google in ...
- 利用Warensoft Stock Service编写高频交易软件--客户端驱动接口说明
Warensoft Stock Service Api客户端接口说明 Warensoft Stock Service Api Client Reference 本项目客户端驱动源码已经发布到GitHu ...
随机推荐
- 用 Servlet 进行上载的原理和实现
Servlet 是用 Java 编写的.协议和平台都独立的服务器端组件,使用请求/响应的模式,提供了一个基于 Java 的服务器解决方案.使用 Servlet 可以方便地处理在 HTML 页面表单中提 ...
- IEqualityComparer的使用
当我们用Linq操作我们自定义的对像数组时,我们会发现有些方法直接使用的话根本不起作用,比如:Distinct.Except.Intersect等扩展方法. 对于我们自定义的对象的比较,我们必须实现I ...
- ES6——Class 的基本使用
Class 语法. class 关键字声明一个类,之后以这个类来实例化对象. const Miaov=function(a,b){ this.a=a; this.b=b; return this; } ...
- NPOI 设置excel 边框
https://blog.csdn.net/xxs77ch/article/details/50232343
- UWP开发入门(四)——自定义CommandBar
各位好,再次回到UWP开发入门系列,刚回归可能有些不适应,所以今天我们讲个简单的,自定义CommandBar,说通俗点就是自定义类似AppBarButton的东西,然后扔到CommandBar中使用. ...
- jdk动态代理 案例
import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflec ...
- 苹果appID的获取方法
1.登陆 iTunes Connect iTunes Connect 2.选择我的app 3.选择相应的应用 4.查看结果
- CodeChef April Challenge 2019题解
传送门 \(Maximum\ Remaining\) 对于两个数\(a,b\),如果\(a=b\)没贡献,所以不妨假设\(a<b\),有\(a\%b=a\),而\(b\%a<a\).综上, ...
- 使用textarea标签代替input标签可以实现输入框的大小调节,自动换行,滚动条显示
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 如何自己写aspx过狗D盾一句话木马
hi,我是凉风,(以下内容纯属个人见解,如有不同的意见欢迎回复指出) ,本菜比发现aspx过狗的姿势不常见,不像php一样一抓一大把,于是我决定研究一下aspx 本文作者:i春秋签约作家——凉风 引用 ...