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 ...
随机推荐
- SQLITE3的锁以及事务
以下内容摘自<SQLITE权威指南>,下载地址http://download.csdn.net/detail/cxjchen/5643391 SQLITE的锁 在SQLite中,锁和事 ...
- typescript 自动编译 生成js文件
项目文件 <?xml version="1.0" encoding="utf-8"?><Project ToolsVersion=" ...
- c3p0--常见异常
获取资源timeout: 异常信息如下: Caused by: java.sql.SQLException: An attempt by a client to checkout a Connecti ...
- 什么是ODBC和JDBC?
jdbc是使用通过JAVA的数据库驱动直接和数据库相连,而jdbc-odbc连接的是ODBC的数据源,真正与数据库建立连接的是ODBC! 建议使用JDBC直接连接,同时最好使用连接池! JDBC 是 ...
- RabbitMq初探——消息分发
消息分发 前言 我们在用到消息队列的场景,一般是处理逻辑复杂,耗时,所以将同步改为异步处理,接入队列,下游处理耗时任务. 队列消息数量很大,且下游worker进程(消费者)处理耗时长,所以就有了任务的 ...
- python--变量,常量,用户交互
1.变量 概念:把程序运行过程中产生的中间值保存在内存,方便后面使用 命名规范: 1.字母,数字,下划线组成 2.不能用数字开头,且不能用纯数字 3.不能用python关键字 4.不要用中文 5.要有 ...
- ocp认证052最新题库-收集整理中-1
1..Which two are true about the Archive (ARCn) processes?❑ A) They automatically delete obsolete arc ...
- “全栈2019”Java第九十五章:方法中可以定义静态局部内部类吗?
难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...
- CTF web题型解题技巧
工具集 基础工具:Burpsuite,python,firefox(hackbar,foxyproxy,user-agent,swither等) 扫描工具:nmap,nessus,openvas sq ...
- 使用textarea标签代替input标签可以实现输入框的大小调节,自动换行,滚动条显示
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...