insmod & mknod usage
why mknod is needed when we do insmod of device driver?
bcoz anyways insmod will call register_chrdev which will register the char dev with major number in the system. So why below command is needed: mknod \dev\chardev c 254 0 pls kindly answer me |
Under normal circumstances, 'mknod' should not be necessary. Infact, if you load the kenel module for a device driver that is associated with a device node if its /dev/ inode does not simply _appear_, odds are that it has failed to load or initialize properly.
Hint: do a # dmesg | tail after your insmod. If it is your own driver that is at issue, then you're missing a few steps in the register_*_chrdev_ calls during your _init. There are quite a few varations on how to do it, but lots of samples down in {kernel}/drivers/char/. |
Quote:
That means you mean to say if insmod works fine there is no need of executing mknod?? can you pls give me clarity Thank you |
If 'insmod' works, that means the _init() entry point of the driver has returned 0 for success, that is all it means. It is up the driver writer to make sure that during _init() the appriate device creation calls are made, and that they succeed.
Please search the web for LDDK (Linux Device Driver Kit) documentation if writing your own driver. |
Quote:
then i mknod \dev\chardev c 254 0 from the shell will this mknod command changes the major number which was assigned by register_chrdev fn by insmod?? |
if your device node /dev/chardev is not present after _init() then you're missing a step. register_chrdev alone is not enough... see the LDDK
You should not have to mknod. If no /dev/ entry shows up, then its unlikely you've gotten the plumbing to your file_operations correctly attatched to the node. For simplified char dev, search for 'miscdev'. |
Quote:
|
Quote:
|
All times are GMT -5. The time now is 12:07 PM. |