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 ...
随机推荐
- Apps: Help > Diagnostics > Custom Code > Personalize 查看LOV中的查询语句
Apps Menu Path: Help > Diagnostics > Custom Code > Personalize 查看LOV中的查询语句 一直有实施顾问询问我XXFo ...
- 数据集和JSON相互转换
使用DELPHI原生类实现数据集和JSON相互转换 JSON二要素:数组和对象.对象可以包含数组,数组可以包含对象.无层数限制.OLEVARIANT也类似,OLEVARIANT的一个元素又可以是OL ...
- 介绍 ASP.NET Identity - ASP.NET 应用程序的成员身份认证系统
ASP.NET Identity 是构建 ASP.NET web 应用程序的一种新的身份认证系统.ASP.NET Identity 可以让您的应用程序拥有登录功能,并可以轻松地自定义登录用户的相关数据 ...
- sql server partition分区与group by 分组
例子:在一个StudentScore表中,有序号ID,班级ClassId,学生姓名Name,性别Sex,语文成绩ChineseScore,数学成绩MathScore,平均成绩AverageScore等 ...
- 知识记录——Session与Cookie
Session: Session是“会话”的意思,然而,因为http协议是无状态的,那么每次客户端请求服务器端,服务器端都会以“崭新”的页面展示给客户端,这在静态的html页面中是不会存在任何影响,但 ...
- Syncthing源码解析 - 在Gogland中对Syncthing的各个模块进行调试?
Syncthing的模块很多,各自负责不同的功能,如何能够对各个模块进行调试?Syncthing开发者早就想到这个问题了,允许开发者对任意模块进行单独调试,也允许同时对所有模块调试,调试方式是打印各个 ...
- 获取 input type="file" 标签的内容,并使用ajax进行请求到服务器
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Vulnhub Breach1.0
1.靶机信息 下载链接 https://download.vulnhub.com/breach/Breach-1.0.zip 靶机说明 Breach1.0是一个难度为初级到中级的BooT2Root/C ...
- PHP中关于foreach的笔试题
1,php与C++的不同之处是PHP中变量没有局部作用域,只有函数作用域和全局作用域.如下函数,在php中,$name的作用域是函数test():在C++中$name的作用域是for循环体,for循环 ...
- 【bash】今天你坑队友了吗
需求: 压缩日志并删除压缩过的文件 很日常的运维需求!!! 好,来看代码 echo 'start' quke.log rm -f quke.log echo 'delete' 不管是初级运维还是高级运 ...