Forum Discussion
Altera_Forum
Honored Contributor
16 years agoDevice node
Hi,
Now after I boot uclinux I use the command mknod to create my "/dev/name(device)" to control my hardware. Also I have done a script to do it when the system's boot, but I would like to know if there is a command that creates this virtual folder when I load my device driver, some command that I can integrate inside my modul. At first I used the command "device_create" but It didn't go, maby I am wrong and I can't do this inside my module to create the folder in /dev associating the major number. Thanks6 Replies
- Altera_Forum
Honored Contributor
You can create a nod with the help of the romfs_list in ~/nios2-linux/uClinux-dist/vendors/Altera/nios2/romfs_list
just add it to the list - Altera_Forum
Honored Contributor
Thanks for the answer but I know it. In this way "/dev/driver" is always built, I ask for a command or something thats makes "dev/driver" appear at the same time when I do an insmod of the driver.
Lot of thanks anyway. - Altera_Forum
Honored Contributor
You may check the "mdev" of busybox, which is similar to udev in creating dev nodes on the fly.
- Hippo - Altera_Forum
Honored Contributor
Hi,
This is what I was looking for, thanks for the answer. I have tested the command mdev-s in the terminal, but I would like that It do it automatic when I insert a module. I have read the file “mdev.txt”, as I understand I have to introduce two lines of code(1- About hotplugging,2-mdev) in the init script( For me /etc/rc). The problem is when I recompiled to make the zImage again, lines of code that I have introduced were erased. I don't know if it is the correct "init script" or if I have to change something in menuconfig to preserve the code that I have introduced. Thanks a lot. - Altera_Forum
Honored Contributor
Hi,
There is a post in Nioswiki answering my question. Thanks - Altera_Forum
Honored Contributor
If the Kernel is configured appropriately, you can dynamically create a device note in your module's init code using alloc_chrdev_region().
-Michael