17 |
Here's a typical code snippet from the init script: |
Here's a typical code snippet from the init script: |
18 |
[0] mount -t proc proc /proc |
[0] mount -t proc proc /proc |
19 |
[1] mount -t sysfs sysfs /sys |
[1] mount -t sysfs sysfs /sys |
20 |
[2] echo /bin/mdev > /proc/sys/kernel/hotplug |
[2] echo /sbin/mdev > /proc/sys/kernel/hotplug |
21 |
[3] mdev -s |
[3] mdev -s |
22 |
|
|
23 |
Alternatively, without procfs the above becomes: |
Alternatively, without procfs the above becomes: |
24 |
[1] mount -t sysfs sysfs /sys |
[1] mount -t sysfs sysfs /sys |
25 |
[2] sysctl -w kernel.hotplug=/bin/mdev |
[2] sysctl -w kernel.hotplug=/sbin/mdev |
26 |
[3] mdev -s |
[3] mdev -s |
27 |
|
|
28 |
|
|
33 |
[6] mount -t devpts devpts /dev/pts |
[6] mount -t devpts devpts /dev/pts |
34 |
|
|
35 |
The simple explanation here is that [1] you need to have /sys mounted before |
The simple explanation here is that [1] you need to have /sys mounted before |
36 |
executing mdev. Then you [2] instruct the kernel to execute /bin/mdev whenever |
executing mdev. Then you [2] instruct the kernel to execute /sbin/mdev whenever |
37 |
a device is added or removed so that the device node can be created or |
a device is added or removed so that the device node can be created or |
38 |
destroyed. Then you [3] seed /dev with all the device nodes that were created |
destroyed. Then you [3] seed /dev with all the device nodes that were created |
39 |
while the system was booting. |
while the system was booting. |
79 |
<device regex> <uid>:<gid> <octal permissions> [=path] [@|$|*<command>] |
<device regex> <uid>:<gid> <octal permissions> [=path] [@|$|*<command>] |
80 |
or |
or |
81 |
<device regex> <uid>:<gid> <octal permissions> [>path] [@|$|*<command>] |
<device regex> <uid>:<gid> <octal permissions> [>path] [@|$|*<command>] |
82 |
|
|
83 |
|
For example: |
84 |
|
---8<--- |
85 |
|
# block devices |
86 |
|
([hs]d[a-z]) root:disk 660 >disk/%1/0 |
87 |
|
([hs]d[a-z])([0-9]+) root:disk 660 >disk/%1/%2 |
88 |
|
mmcblk([0-9]+) root:disk 660 >disk/mmc/%1/0 |
89 |
|
mmcblk([0-9]+)p([0-9]+) root:disk 660 >disk/mmc/%1/%2 |
90 |
|
# network devices |
91 |
|
(tun|tap) root:network 660 >net/%1 |
92 |
|
---8<--- |
93 |
|
|
94 |
The special characters have the meaning: |
The special characters have the meaning: |
95 |
@ Run after creating the device. |
@ Run after creating the device. |
96 |
$ Run before removing the device. |
$ Run before removing the device. |
134 |
|
|
135 |
If you want to activate this feature, execute "echo >/dev/mdev.seq" prior to |
If you want to activate this feature, execute "echo >/dev/mdev.seq" prior to |
136 |
setting mdev to be the hotplug handler. This writes single '\n' to the file. |
setting mdev to be the hotplug handler. This writes single '\n' to the file. |
137 |
NB: mdev recognizes /dev/mdev.seq consisting of single '\n' characher |
NB: mdev recognizes /dev/mdev.seq consisting of single '\n' character |
138 |
as a special case. IOW: this will not make your first hotplug event |
as a special case. IOW: this will not make your first hotplug event |
139 |
to stall for two seconds. |
to stall for two seconds. |