linux driver 02 note

1.  The printk function 

2. insmod  rmmod command

    modprobe

    lsmod works by reading the /proc/modules virtual file.

    Information on currently loaded modules can also be found in the sysfs virtual filesystem under /sys/module.

3. klogd tools  

4. /var/log/messages

5. The Current Process

    printk(KERN_INFO "The process is \"%s\" (pid %i)\n",current->comm, current->pid);

6.Compiling and Loading

   The kernel build system is a complex beast, and we just look at a tiny piece of it. The files
found in the Documentation/kbuild directory in the kernel source are required reading
for anybody wanting to understand all that is really going on beneath the surface.

  The first is to ensure that you have sufficiently current versions of the
compiler, module utilities, and other necessary tools. The file Documentation/Changes
in the kernel documentation directory always lists the required tool versions;

7.The Kernel Symbol Table

   EXPORT_SYMBOL(name);
   EXPORT_SYMBOL_GPL(name);

   When a module is loaded, any symbol exported by the module becomes part of the kernel symbol table.
In the usual case, a module implements its own functionality without the need to
export any symbols at all. You need to export symbols, however, whenever other
modules may benefit from using them.

8. The various MODULE_ declarations

Other descriptive definitions that can be contained within a module include
MODULE_AUTHOR (stating who wrote the module), MODULE_DESCRIPTION (a human-readable
statement of what the module does), MODULE_VERSION (for a code revision number;
see the comments in <linux/module.h> for the conventions to use in creating
version strings), MODULE_ALIAS (another name by which this module can be known),
and MODULE_DEVICE_TABLE (to tell user space about which devices the module supports).

9.Error Handling During Initialization



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值