On Tue, Mar 11, 2014 at 1:31 PM, Kim Chan <ckim@xxxxxxxxxx> wrote: > > Yeah, I know mknod command. I just wanted to know if the register_chrdev > makes the file or not. It doesn't. Also note that this is the old way of registering a char device. New code should use cdev_add() etc. > 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? Yes, device nodes are needed for userspace code to access a device (the good ol "devices are also files" Unix paradigm! :)). I'm not sure how an in-kernel access will work (maybe via directly getting the corresponding cdec structure). > > 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. Correct. You will have to create those nodes manually. > > 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? I think you need to point getty or a shell to the correct tty before you can see o/p on the screen. Do you know which device file you're supposed to create for the LCD? If so, just use that in your inittab. Something like: ::askfirst:-/bin/sh HTH, -mandeep > ________________________________ > From : "Kernel" <bu.kernel@xxxxxxxxx> > Sent : 2014-03-11 14:44:09 ( +09:00 ) > To : Kim Chan <ckim@xxxxxxxxxx> > Cc : kernelnewbies@xxxxxxxxxxxxxxxxx <kernelnewbies@xxxxxxxxxxxxxxxxx> > Subject : Re: Does register_chrdev function make device file under /dev ? > > > > On Mar 10, 2014, at 10:25 PM, 김찬 <ckim@xxxxxxxxxx> 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@xxxxxxxxxxxxxxxxx > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies@xxxxxxxxxxxxxxxxx > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies