LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-23-2014, 01:01 PM   #1
david_8274
Member
 
Registered: Jun 2013
Location: California
Distribution: Ubuntu, Fedora
Posts: 75

Rep: Reputation: Disabled
How to add a device to Linux kernel


Hi,

I am working on a platform where loadable module is not an option(for security reason). When the kernel boots, if I look into /dev, I assume it shows all the device that are compiled as part of the kernel. My question is, how to I add a device to the kernel? For example, gpio driver source code is available in the /linux/driver/gpio directly. What do I need to do so it will be compiled as part of the kernel and, when the kernel boots, I will see a gpio device in /dev?

Thank you!
Wei Xu
 
Old 04-23-2014, 02:19 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Your assumption about the /dev directory is incorrect. A /dev node may exist when there is no driver or device, and a kernel driver may exist with no /dev/entry. The relationship between a driver in the kernel and an entry in /dev depends on the specific driver, the config file options chosen, and the code that runs after the kernel boots. The options are in .config in the kernel source root directory, and may also be copied to a file in /boot where the kernel is installed. One of the relevant options is CONFIG_DEVTMPFS, but there are others. It also depends on whether you run udev or MAKEDEV or something else to populate /dev. There are brief descriptions of the options in the Kconfig files in the kernel source and in Documentation/devices.txt.
 
  


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
How to get block device add/remove notification in kernel space ? karanb Linux - Kernel 1 11-28-2012 11:03 AM
lifekeeper error: DEVICE FAILURE on SCSI device '/dev/add' yuanjunliang Linux - Server 3 09-17-2009 04:24 PM
is it necessary to recompile the entire kernel to add support for a device as module kushalkoolwal Debian 9 05-24-2006 12:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:30 PM.

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