Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

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


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, 03:19 PM   #2
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,848

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:03 PM
lifekeeper error: DEVICE FAILURE on SCSI device '/dev/add' yuanjunliang Linux - Server 3 09-17-2009 05:24 PM
is it necessary to recompile the entire kernel to add support for a device as module kushalkoolwal Debian 9 05-24-2006 01:16 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:26 PM.

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