Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器

首页 / 操作系统 / Linux / Linux Devices Driver读书笔记

01 An Introduction to Device Drivers

01章 An Introduction to Device Drivers

驱动的角色policy:     how to use capability Gnome ftp httpmechanism: what to be provided X Serv TCP/IP 内核介绍:任务,内存,文件管理,驱动,网络模块:char module:open, close, read, and write system calls block module         network module.安全与版本

02章 Building and Running Modules

2.1建立纯净的内核环境2.2helloworld,注意makefile的写法:
  1. obj-m:=hello.o   
  2. KERNELDIR:=/lib/modules/2.6.26-2-686/build   
  3. PWD :=$(shell pwd)   
  4. default:   
  5.         $(MAKE) -C $(KERNELDIR) M=$(PWD) modules  
2.3驱动和应用程序的区别:初始化与退出,只能调用内核函数,不调用库,唯一的例外是头文件<stdarg.h>,内核函数定义在内核源码树linux/include下用户空间和内核空间内核并发:获取当前进程current一些细节:由于内核栈很小(4096B),需要自己申请内存,不支持浮点运算2.4编译和加载讲解helloworld的makefile装载卸载模块 insmod=ld 注意kernel/module.c中为insmod安排内存,调用模块并初始化sys_为系统调用前缀lsmod =cat /proc//modules  =ls /sys/module版本依赖 必须为每个内核树重新编译,否则helloworld也会出错。