Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Device node

Altera_Forum
Honored Contributor II
1,310 Views

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. 

 

Thanks
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
601 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
601 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
601 Views

You may check the "mdev" of busybox, which is similar to udev in creating dev nodes on the fly. 

 

- Hippo
0 Kudos
Altera_Forum
Honored Contributor II
601 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
601 Views

Hi, 

 

There is a post in Nioswiki answering my question. 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
601 Views

If the Kernel is configured appropriately, you can dynamically create a device note in your module's init code using alloc_chrdev_region(). 

 

-Michael
0 Kudos
Reply