/dev/mouse and other devices

Gerard Beekmans gerard at linuxfromscratch.org
Wed Jul 25 18:26:24 PDT 2001


[ how to create device files - this email will make for a nice search
query result in the search engine (hopefully ;) ]

On Thu, Jul 26, 2001 at 01:33:31AM +0300, Florin Oprina wrote:
> hi all!
> 
> sorry if this is the wrong list, but for some unknown
> reasons I couldn't subscribe to lfs-apps list!
> 
> I installed LFS acording to the book. Next step was to
> add mouse support so I compilled gpm. But, and here
> comes my question, gpm complained that there is no
> /dev/mouse
> or
> /dev/ttyS0
> How on earth do I create these dev's? Tried
> MAKEDEV /dev/mouse
> but it was very uncooperative. It told me it doesn't
> know how to create it!
> And while I'm still at it, how do I create other
> devices, such as
> /dev/dsc
> or
> /dev/audio?

Others have given example commands with MAKEDEV. /dev/dsp and /dev/audio
should be created when you ran "MAKEDEV -v generic" as per LFS-Book's
instructions. ttyS0 should also be created, unless you are using quite
an old version of the LFS-Book that uses a different kind of MAKEDEV
script (which used to be a pretty bad one).

Aside from all this, you don't have to rely on MAKEDEV to create your
device interface files in the /dev directory. MAKEDEV is just a
front-end to the mknod command (stands for make node I believe). All you
need to know are three things
1) the type: block, character, character unbuffered and fifo
2) major number (only for block and character)
3) minor number (only for block and character)

You can obtain this from the Documentation/devices.txt file in the linux
kernel tree. Example on the /dev/dsp settings:

Somewhere in the file you'll see this heading:
 14 char        Open Sound System (OSS)

This means your major number is 14, the type is char(acter). Then you
see a list of items that fall under the major 14 category. dsp is:
	3 = /dev/dsp          Digital audio

So now you have all you need to run mknod with:
	mknod /dev/dsp c 14 3

And that's all. You may want to change the default permissions on the
file according to your requirements.

-- 
Gerard Beekmans
www.linuxfromscratch.org

-*- If Linux doesn't have the solution, you have the wrong problem -*-
-- 
Unsubscribe: send email to lfs-discuss-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message



More information about the lfs-dev mailing list