LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 11-21-2008, 05:08 AM   #1
maheshstms
LQ Newbie
 
Registered: Jun 2006
Posts: 10

Rep: Reputation: 0
Creating dev node from Kernel


Hi,
I am new to kernel programming,
A device node needs to be created, How do we create a device node within driver.

Is there any to create a device node programatically from driver

thanks
Mahesh
 
Old 11-21-2008, 11:27 PM   #2
WildPossum
Member
 
Registered: Feb 2004
Location: Sydney - Australia
Distribution: Ubuntu, OpenSUSE, Mythbuntu, Embedded Linux
Posts: 46

Rep: Reputation: 18
These days with the new kernels > 2.4.10 you use Udev to create the device node in /dev.
During compile time, the identity of the supported dev is generated as part of the driver module object. Have a look at ../drivers/net/tulip/xircom_cb.c for example. The snippet:
<code>
static struct pci_device_id xircom_pci_table[] = {
{0x115d, 0x0003, PCI_ANY_ID, PCI_ANY_ID,},
{0.....

/* Mark the device table */
MODULE_DEVICE_TABLE(pci, xircom_pci_table);
</code>

This declares that the driver can support any card having a PCI vendor ID of 0x115D, and a PCI device ID of 0x0003.
When you install the driver, the depmod utility looks insde the module image and dicphers the ID's present in the table.
It then add an entry into /lib/modules/..kernel vers../modules.alias.

So, use Udev rules and modprobe information to generate a device node. It is the only supported way of programmaticly adding device nodes.
You'll find more than enough information under Udev.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No hiddev node in /dev superandrzej Slackware 5 10-13-2007 12:25 AM
Disappearing dev node? iansworld Linux - Software 3 04-18-2007 06:51 PM
USB hotplug: how do I get the same /dev node every time? georgekm Linux - General 5 03-29-2005 06:25 PM
I can`t create a device node in /dev gcasados Slackware 8 02-21-2005 05:17 AM
"unable to find device node for /dev/x in /dev!" during install zombiedeth *BSD 0 02-02-2004 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration