LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-19-2007, 01:23 PM   #1
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
using mknod


I'm writing a kernel module device driver for a digital signal processor that is connected to a linux system on the PCI bus. My driver is working to this point, and now I need to make it visible to userspace, which means I have to create a node in /dev using mknod.

I have identified the device as a character device, and I have specified that it has a major number of 09, which I then tell the kernel to use. This is fine with the kernel.

Now, to use mknod, I have to have a minor number available too. However I don't tell the kernel what the minor number is, and I don't see anyplace where the kernel tells me.

With block devices in the case of a hard drive, the minor number will refer to the partition number on the hard drive. The disk itself has the minor number 0 and each partition gets a sequential number.

Using this as an analogy, am I safe in specifying a minor number of 0 for this dsp? Or is there some other rule I would use with a character device to specify the minor number?

edit: I did specify a minor number of 0 and the system seems to be happy with that. So I suppose it is OK. Would like to know, though, what the rules are because I don't want to get bit by a subtlety down the road; this dsp is real time, the system will be embedded, and I have plenty of other issues to work through.

Last edited by jiml8; 07-19-2007 at 08:41 PM.
 
Old 07-20-2007, 10:33 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
You've had a look at ../Documentation/devices.txt ???
 
Old 07-22-2007, 04:26 PM   #3
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Original Poster
Rep: Reputation: 116Reputation: 116
Actually, I did look at that awhile back and decided that I could use major number 09 for some reason or other which I didn't document and don't recall.

Upon review, though, it would seem I'm telling the system this dsp is a scsi tape drive. Might not be a good plan...though the embedded device will never see a scsi tape device connected to it...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HD / mknod issue fasta Debian 7 08-08-2006 12:39 AM
mknod Basel Linux From Scratch 1 09-03-2005 02:13 PM
mknod Infinite_Pizza Linux - Software 2 04-14-2005 08:59 PM
mknod or devfs? rose_bud4201 *BSD 5 05-07-2004 01:29 AM
mknod watashiwaotaku7 Linux - Software 1 01-23-2003 10:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration