Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4566998
  • 博文数量: 385
  • 博客积分: 21208
  • 博客等级: 上将
  • 技术积分: 4393
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-30 13:40
文章分类

全部博文(385)

文章存档

2015年(1)

2014年(3)

2012年(16)

2011年(42)

2010年(1)

2009年(2)

2008年(34)

2007年(188)

2006年(110)

分类: LINUX

2006-12-26 13:05:11

udev


问:什么是udev?
答:udev是一种工具,它能够根据系统中的硬件设备的状态动态更新设备文件,包括设备文件的创建,删除等。设备文件通常放在/dev目录下。使用udev后,在/dev目录下就只包含系统中真正存在的设备。

问:udev支持什么内核?
答:udev只支持linux-2.6内核,因为udev严重依赖于sysfs文件系统提供的信息,而sysfs文件系统只在linux-2.6内核中才有。

问:udev是一个内核程序还是用户程序?
答:udev是一个用户程序(user-mode daemon)。

问:udev和devfs有什么差别?
答:udev能够实现所有devfs实现的功能。但udev运行在用户模式中,而devfs运行在内核中。据称:devfs具有一些不太容易解决的先天缺陷。

问:udev的配置文件放在哪里?
答:udev是一个用户模式程序。它的配置文件是/etc/udev/udev.conf。这个文件一般缺省有这样几项:
udev_root="/dev" ; udev产生的设备文件的根目录是/dev
udev_db="/dev/.udevdb" ; 通过udev产生的设备文件形成的数据库
udev_rules="/etc/udev/rules.d" ;用于指导udev工作的规则所在目录。
udev_log="err" ;当出现错误时,用syslog记录错误信息。
 
 
 
 udev  provides a dynamic device directory containing only the files for
       actually present devices. It creates or removes device node files  usu-
       ally located in the /dev directory, or it renames network interfaces.
       As  part  of the hotplug subsystem, udev is executed if a kernel device
       is added or removed from the system.  On device  creation,  udev  reads
       the  sysfs  directory  of the given device to collect device attributes
       like label, serial number or bus device number.  These  attributes  may
       be  used as keys to determine a unique name for the device.  udev main-
       tains a database for devices present on the system.
       On device removal, udev queries its database for the name of the device
       file to be deleted.
 
 
 
/etc/udev/rules.d/50-udev.rules  :
 
 
KERNEL="microcode",     SYMLINK="cpu/0/%k"
KERNEL="ram1",          SYMLINK="ram"
KERNEL="video0",        SYMLINK="video"
KERNEL="radio0",        SYMLINK="radio"
KERNEL="audio0",        SYMLINK="audio"
KERNEL="dsp0",          SYMLINK="dsp"
KERNEL="fb0",           SYMLINK="fb"
KERNEL="qft0",          SYMLINK="ftape"
KERNEL="isdnctrl0",     SYMLINK="isdnctrl"
KERNEL="mixer0",        SYMLINK="mixer"
KERNEL="ram0",          SYMLINK="ramdisk"
阅读(1939) | 评论(0) | 转发(0) |
0

上一篇:[转贴]Linux网络驱动程序

下一篇:使用xargs

给主人留下些什么吧!~~