Does register_chrdev function make device file under /dev ?

Kim Chan ckim at etri.re.kr
Tue Mar 11 04:01:26 EDT 2014


Yeah, I know mknod command. I just wanted to know if the register_chrdev makes the file or not.
To my understanding, device file is needed when a user program wants to access the device and we don't need to generate the device file for us to use the device in kernel. Is my understanding correct?

For example, busybox (a user program) starts shell on tty2-4 by default. (as the assumed default inittab below)
tty2::askfirst:-/bin/sh
tty3::askfirst:-/bin/sh
tty4::askfirst:-/bin/sh
I have had some mknod commands before in /etc/init.d/rcS to make tty2~tty4 device files, but when I remove them for test, I can see busybox (almost sure it's coming from busybox) complaining that it cannot find the tty2~tty4 device files.

I am trying to open a shell on my LCD (is it going to be tty2 ? I don't know) and I'm not sure if I have to make vcs1 vcs2 vcs3 files. And I don't know how to switch to LCD shell. during the boot, the texts come out on the LCD but I cannot see the texts (printf) from busybox. and cannot see the shell on LCD. When I press the keyboad, it looks like it's connected to tty1(I can see using prints on uart window). Can anybody tell me some direction?
________________________________
From : "Kernel" <bu.kernel at gmail.com>
Sent : 2014-03-11 14:44:09 ( +09:00 )
To : Kim Chan <ckim at etri.re.kr>
Cc : kernelnewbies at kernelnewbies.org <kernelnewbies at kernelnewbies.org>
Subject : Re: Does register_chrdev function make device file under /dev ?



On Mar 10, 2014, at 10:25 PM, 김찬 <ckim at etri.re.kr<mailto:ckim at etri.re.kr>> wrote:

Hi,

This should be a basic question.
Does the regisetr_chrdev function make the device file under /dev directory?
I am running linux on our embedded system and inside vcs_init, register_chrdev is called as below.

int __init vcs_init(void)
{
        unsigned int i;
        if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops))
                panic("unable to get major %d for vcs device", VCS_MAJOR);

I can see the function is returning ok but I don't see any vcs* file under /dev.
Does it only register the device on /sys or /proc directory and not under /dev?
Thanks in advance.

Chan


You have to create a device file using 'mknod'

Ex: mknod -m 666 /dev/vcs c <major no> <minor no>


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org<mailto:Kernelnewbies at kernelnewbies.org>
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140311/2ff2dfe9/attachment-0001.html 


More information about the Kernelnewbies mailing list