LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 08-01-2009, 11:39 AM   #1
zvivered
Member
 
Registered: Sep 2007
Posts: 294

Rep: Reputation: 23
Creating device files is /dev


I want to build a root file system from scratch for an x86 embedded target.
What is the best way of creating the files in /dev (e.g tty0,console) ?
My target has one compact flash disk (hda ?) which is divided into 2 partitions.
Should I manually create hda, hda1, hda2 ?

Thanks.
 
Old 08-01-2009, 12:19 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
busybox mdev command

I started by Googling for populating /dev embedded and followed a couple links, and ended up at the busybox website (HERE). Based on my reading, it looks like busybox's mdev command is a popular method for creating the /dev nodes during boot of an embedded device. I haven't done this myself; I just did a bit of searching to try to help you out, so I don't know that this is the *best* way, but it's *one* way; my apologies if this is not what you're looking for

from the busybox command help page:
Quote:
mdev
mdev [-s]

-s Scan /sys and populate /dev during system boot

Called with no options (via hotplug) it uses environment variables to determine which device to add/remove.

The mdev config file contains lines that look like:
hd[a-z][0-9]* 0:3 660

That's device name (with regex match), uid:gid, and permissions.

Optionally, that can be followed (on the same line) by a special character and a command line to run after creating/before deleting the corresponding device(s). The environment variable $MDEV indicates the active device node (which is useful if it's a regex match). For example:

hdc root:cdrom 660 *ln -s $MDEV cdrom

The special characters are @ (run after creating), $ (run before deleting), and * (run both after creating and before deleting). The commands run in the /dev directory, and use system() which calls /bin/sh.

Config file parsing stops on the first matching line. If no config entry is matched, devices are created with default 0:0 660. (Make the last line match .* to override this.)
 
  


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
Issue with creating /dev/nst device files. rqueneau Linux - General 1 03-16-2009 09:57 PM
Issue creating /dev/nst files rqueneau Linux - Hardware 0 03-16-2009 08:21 PM
mouse device files are missing from /dev kav Debian 5 10-07-2006 12:58 PM
Problem with USB Key and creating the /dev/sda1 block device Ben2210 Slackware 5 08-04-2004 02:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 06:20 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