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 ...
随机推荐
- Appium 之处理首次启动手机App时的系统权限弹框
一般首次启动一个手机App时都会有系统权限弹框,如下图所示: 权限弹窗上面的按钮都是固定的,只需要定位到“ALLOW”按钮,点击就可以了,代码如下: 这里主要用selenium里面的显示等待模块(We ...
- android分屏
上手了Android N Preview,第一个不能错过的新特性就是App分屏的支持.Android7.0原生系统就可以支持两个App横屏并排或者竖屏上下摆放了.第二个新特性就是在Android TV ...
- mybatis如何直接 执行传入的任意sql语句 并按照顺序取出查询的结果集
需求: 1.直接执行前端传来的任何sql语句,parameterType="String", 2.对于任何sql语句,其返回值类型无法用resultMap在xml文件里配置或者返回 ...
- PPI协议(西门子PLCS7-200)
西门子PLC S7-200 PPI协议报文,9600,偶校验,8数据位,1停止位 读取vb100寄存器:PC发送报文68 1B 1B 68 2 0 6C 32 1 0 0 0 0 0 E 0 0 4 ...
- 使用 pdf.js 查看发票时,显示不了台头和印章的解决办法
系统中使用了 pdf.js 来查看 PDF 文件,发现在查看 电子发票时, 缺失了很多信息, 刚开始以为是 PDF.JS 的 BUG, 后来调试发现只需要在 IIS 里添加一个 bcmap 后缀的 m ...
- SQL Union 和Union All 的区别
Union与Union All的区别 如果我们需要将两个select语句的结果作为一个整体显示出来,我们就需要用到union或者union all关键字.union(或称为联合)的作用是将多个结果合并 ...
- Java--下载历史版本登录账户
目前在官网下载低于jdk1.8的java jdk的时候需要登陆,这边分享一个账号,方便下载 2696671285@qq.com 密码:Oracle123 转自-- jdk下载以前版本需要的账号(转) ...
- Atom打造优雅的MarkDown 编辑器
1.下载Atom https://atom.io/ 2.安装Atom 双击自动安装,会默认安装到C盘,无法修改. 3.安装simplified-chinese-menu 插件 这是一个可以将软件汉化的 ...
- 【OCP认证12c题库】CUUG 071题库考试原题及答案(28)
28.choose the best answer Evaluate the following SQL statement: SQL> SELECT promo_id, promo_categ ...
- AI下载步骤
ai下载地址:https://www.adobe.com/cn/creativecloud/catalog/desktop.html?promoid=PTYTQ77P&mv=other 破解器 ...