From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] Device files and Buildroot
Date: Sat, 3 Dec 2011 09:25:53 +0100 [thread overview]
Message-ID: <20111203092553.0acf80a5@skate> (raw)
In-Reply-To: <CABkKHSacRwGaT0ajXySqPeV0aFzGthxLykC7LXOsut4SPjNsmA@mail.gmail.com>
Le Sat, 3 Dec 2011 01:25:41 +0100,
Aleksander Dutkowski <adutkowski@gmail.com> a ?crit :
> "System configuration --> Custom script to run before creating
> filesystem image" input is for specify a PATH to bash script.
> You you must simply create script, fill with mknod commands (remember
> - mknod can be ran only by root! so do 'sudo mknod')
No, no, no and no ! I'm sorry but this is totally horrible and is
definitely not the way of doing things with Buildroot.
With Buildroot, you have four ways of managing the device files
in /dev. The mechanism used to manage device files is configured from
System configuration -> /dev management. The four ways are :
* Static using device table. In this case the "System configuration ->
Path to the device tables" option gives a space-separated list of
files, each of which containing a list of devices to create at build
time in the root filesystem. By default, this list is defined to
just the target/generic/device_table_dev.txt, which creates some
basic device files. Those device files are created at *build* time
and are statically present in the root filesystem image generated by
Buildroot. All basic devices such as /dev/console, /dev/null and al.
are already present in the default device table. If you are in this
mode and want to add more device files, then you should add them to
target/generic/device_table_dev.txt, or better, create your own
additional device table in
board/<yourcompany>/<yourproject>/device_table.txt, and add it to
the space-separated list in "System configuration -> Path to the
device tables".
* Dynamic using devtmpfs only. Devtmpfs is a virtual filesystem
implemented in the Linux kernel that can be mounted in /dev. The
kernel will automatically create/remove device files from this
filesystem as devices appear/disappear from the system. devtmpfs
exists in the Linux kernel since 2.6.32. When this option is
selected *and* Buildroot is responsible for building the kernel,
then Buildroot ensures that the kernel is built with the appropriate
options to make devtmpfs work. When Buildroot is *not* responsible
for building the kernel (the user does it on its own), then the user
is responsible for making sure that CONFIG_DEVTMPFS and
CONFIG_DEVTMPFS_MOUNT are both enabled in the kernel configuration.
When this mode is used, no static device files are created in the
root filesystem: the device files are automatically created at boot
time by the kernel.
* Dynamic using mdev. This is exactly like with 'devtmpfs' (i.e,
devtmpfs is required for this mode to work), but Buildroot adds the
mdev utility into the mix. mdev is an utility bundled with Busybox
which gets executed when the kernel notifies that a device has been
added or removed from the system. Compared to a pure 'devtmpfs'
solution, it allows to execute arbitrary applications or shell
scripts when devices appear/disappear. mdev behaviour can be
configured from /etc/mdev.conf, refer to the Busybox documentation
for more details. Since this case relies on devtmpfs, there are no
static device files created in the root filesystem, and no device
table is used.
* Dynamic using udev. This is also exactly like with 'devtmpfs' (i.e,
devtmpfs is required for this mode to work), but Buildroot adds the
udev daemon into the mix. udev is the "device event manager" used in
all Linux desktop and server systems and can be seen as a
"full-featured" mdev. It is more configurable, provides a library
called libudev to allow applications to query for which devices are
available, etc.
So, no, do *NOT* ever use the post-build script to create device files.
Just understand how those device files work and the different mode
Buildroot provides to handle them.
If you need precisions or have questions on this topic, don't hesitate
to ask. We have many people on the list ready to answer your questions.
Best regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2011-12-03 8:25 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 20:51 [Buildroot] equivalent of a 'make modules' Jeff Krasky
2011-11-22 22:04 ` Thomas Petazzoni
2011-11-22 22:11 ` Jeff Krasky
2011-11-22 22:29 ` Thomas Petazzoni
2011-11-22 22:35 ` Jeff Krasky
2011-11-23 7:19 ` Thomas De Schampheleire
2011-11-23 21:38 ` [Buildroot] LIBFOO_SITE in .mk file Jeff Krasky
2011-11-23 22:43 ` Jeff Krasky
2011-11-24 8:15 ` Thomas De Schampheleire
2011-11-28 15:07 ` Jeff Krasky
2011-11-28 15:11 ` Thomas Petazzoni
2011-11-28 15:19 ` Jeff Krasky
2011-11-28 15:54 ` Thomas Petazzoni
2011-11-28 16:14 ` Jeff Krasky
2011-11-28 17:39 ` Michael S. Zick
2011-11-28 18:50 ` Jeff Krasky
2011-11-28 19:24 ` Michael S. Zick
2011-11-28 19:33 ` Jeff Krasky
2011-11-28 21:14 ` Jeff Krasky
2011-11-28 22:15 ` Jeff Krasky
2011-11-29 7:37 ` Thomas Petazzoni
2011-11-29 14:28 ` Jeff Krasky
2011-11-29 14:36 ` Thomas Petazzoni
2011-11-29 14:43 ` Jeff Krasky
2011-11-29 21:43 ` Jeff Krasky
2011-11-29 22:42 ` Jeff Krasky
2011-11-30 15:59 ` Jeff Krasky
2011-11-30 16:04 ` Thomas Petazzoni
2011-11-30 16:20 ` Jeff Krasky
2011-11-30 16:33 ` Thomas Petazzoni
2011-11-30 16:38 ` Jeff Krasky
2011-11-30 16:49 ` Michael S. Zick
2011-11-30 16:57 ` Jeff Krasky
2011-11-30 17:08 ` Michael S. Zick
2011-11-30 17:48 ` Thomas De Schampheleire
2011-11-30 17:58 ` Thomas Petazzoni
2011-11-30 18:11 ` Jeff Krasky
2011-11-30 19:31 ` Jeff Krasky
2011-11-30 19:44 ` Thomas De Schampheleire
2011-11-30 20:01 ` Jeff Krasky
2011-11-30 22:21 ` Thomas Petazzoni
[not found] ` <001201ccafb0$4b5e06e0$0400a8c0@dspcgrnzks9p98>
2011-11-30 22:49 ` Thomas Petazzoni
2011-11-30 22:54 ` Jeff Krasky
2011-12-01 8:11 ` Thomas Petazzoni
2011-12-01 14:58 ` Jeff Krasky
2011-12-01 15:03 ` Michael S. Zick
2011-12-01 15:55 ` Jeff Krasky
2011-12-01 16:16 ` Jeff Krasky
2011-12-01 16:33 ` Jeff Krasky
2011-12-01 16:52 ` Michael S. Zick
2011-12-01 18:15 ` Jeff Krasky
2011-12-01 22:56 ` Jeff Krasky
2011-12-02 7:50 ` Thomas De Schampheleire
2011-12-02 8:50 ` Thomas Petazzoni
2011-12-02 13:33 ` Michael S. Zick
2011-12-02 15:57 ` Jeff Krasky
2011-12-02 16:09 ` Quotient Remainder
2011-12-02 16:51 ` [Buildroot] Kernel panic - not syncing: Attempted to kill init! Jeff Krasky
2011-12-02 16:59 ` Jeff Krasky
2011-12-02 17:33 ` Tim Judd
2011-12-02 18:02 ` Jeff Krasky
2011-12-02 18:21 ` Aleksander Dutkowski
2011-12-02 18:30 ` Jeff Krasky
2011-12-03 0:25 ` Aleksander Dutkowski
2011-12-03 8:25 ` Thomas Petazzoni [this message]
2011-12-03 12:53 ` [Buildroot] Device files and Buildroot Trevor Woerner
2011-12-03 18:40 ` Thomas Petazzoni
2011-12-05 10:54 ` Aleksander Dutkowski
2011-12-08 21:30 ` Felipe Contreras
2011-12-08 23:49 ` Michael S. Zick
2011-12-09 18:49 ` Thomas Petazzoni
2011-12-02 18:31 ` [Buildroot] Kernel panic - not syncing: Attempted to kill init! Tim Judd
2011-12-02 18:24 ` Tim Judd
2011-11-29 14:54 ` [Buildroot] LIBFOO_SITE in .mk file Michael S. Zick
2011-11-29 7:35 ` Thomas Petazzoni
2011-11-28 18:55 ` Quotient Remainder
2011-11-28 19:02 ` Jeff Krasky
2011-11-29 7:31 ` Thomas Petazzoni
2011-11-23 8:25 ` [Buildroot] equivalent of a 'make modules' Thomas Petazzoni
2011-11-23 14:17 ` Jeff Krasky
2011-11-23 14:23 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111203092553.0acf80a5@skate \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox