slitaz-base-files view rootfs/sbin/mktazdevs.sh @ rev 270

Small improvements. libtaz.sh: move notes from script to readme, re-organize and simplify code, different separators allowed; libtaz.txt: wrote few new examples.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Apr 30 02:00:25 2015 +0300 (2015-04-30)
parents c17d58ea0ead
children af25e2951d08
line source
1 #!/bin/sh
2 #
3 # mktazdevs.sh: Make device files for SliTaz GNU/Linux
4 # 2007/10/02 - 2014 <pankso@slitaz.org>
5 #
6 # As of SliTaz 5.0 we have a radicaly minimal /dev tree for ARM and we
7 # use mdev to create devices nodes on the fly. On i486 we use udev and
8 # mount a devtmpfs on /dev, minimal tree for udev is in: /lib/udev/devices
9 # This script yet be usefull to rescue a broken system but may be removed.
10 #
11 . /lib/libtaz.sh
13 # We do our work in the dev/ directory.
14 if [ -z "$1" ] ; then
15 echo "usage: `basename $0` path/to/dev"
16 exit 1
17 fi
19 # Script start.
20 echo -n "Moving to $1..."
21 cd $1
22 status
24 # Make useful directories.
25 echo -n "Starting to build directories... "
26 mkdir pts input net usb shm
27 status
29 echo -n "Starting to build devices... "
31 # Input devs.
32 #
33 mknod input/event0 c 13 64
34 mknod input/event1 c 13 65
35 mknod input/event2 c 13 66
36 mknod input/mouse0 c 13 32
37 mknod input/mice c 13 63
38 mknod input/ts0 c 254 0
40 # Miscellaneous one-of-a-kind stuff.
41 #
42 mknod logibm c 10 0
43 mknod psaux c 10 1
44 mknod inportbm c 10 2
45 mknod atibm c 10 3
46 mknod console c 5 1
47 mknod full c 1 7
48 mknod kmem c 1 2
49 mknod mem c 1 1
50 mknod null c 1 3
51 mknod port c 1 4
52 mknod random c 1 8
53 mknod urandom c 1 9
54 mknod zero c 1 5
55 mknod rtc c 10 135
56 mknod sr0 b 11 0
57 mknod sr1 b 11 1
58 mknod agpgart c 10 175
59 mknod ttyS0 c 4 64
60 mknod audio c 14 4
61 mknod beep c 10 128
62 mknod ptmx c 5 2
63 mknod nvram c 10 144
64 ln -s /proc/kcore core
65 # DSP
66 mknod -m 0666 dsp c 14 3
67 # PPP dev.
68 mknod ppp c 108 0
70 # net/tun device.
71 #
72 mknod net/tun c 10 200
74 # Framebuffer devs.
75 #
76 mknod fb0 c 29 0
77 mknod fb1 c 29 32
78 mknod fb2 c 29 64
79 mknod fb3 c 29 96
80 mknod fb4 c 29 128
81 mknod fb5 c 29 160
82 mknod fb6 c 29 192
84 # usb/hiddev.
85 #
86 mknod usb/hiddev0 c 180 96
87 mknod usb/hiddev1 c 180 97
88 mknod usb/hiddev2 c 180 98
89 mknod usb/hiddev3 c 180 99
90 mknod usb/hiddev4 c 180 100
91 mknod usb/hiddev5 c 180 101
92 mknod usb/hiddev6 c 180 102
94 # IDE HD devs.
95 # With a few conceivable partitions, you can do
96 # more of them yourself as you need 'em.
97 #
99 # hda devs.
100 #
101 mknod hda b 3 0
102 mknod hda1 b 3 1
103 mknod hda2 b 3 2
104 mknod hda3 b 3 3
105 mknod hda4 b 3 4
106 mknod hda5 b 3 5
107 mknod hda6 b 3 6
108 mknod hda7 b 3 7
109 mknod hda8 b 3 8
110 mknod hda9 b 3 9
112 # hdb devs.
113 #
114 mknod hdb b 3 64
115 mknod hdb1 b 3 65
116 mknod hdb2 b 3 66
117 mknod hdb3 b 3 67
118 mknod hdb4 b 3 68
119 mknod hdb5 b 3 69
120 mknod hdb6 b 3 70
121 mknod hdb7 b 3 71
122 mknod hdb8 b 3 72
123 mknod hdb9 b 3 73
125 # hdc and hdd.
126 #
127 mknod hdc b 22 0
128 mknod hdd b 22 64
130 # sda devs.
131 #
132 mknod sda b 8 0
133 mknod sda1 b 8 1
134 mknod sda2 b 8 2
135 mknod sda3 b 8 3
136 mknod sda4 b 8 4
137 mknod sda5 b 8 5
138 mknod sda6 b 8 6
139 mknod sda7 b 8 7
140 mknod sda8 b 8 8
141 mknod sda9 b 8 9
142 ln -s sda1 flash
144 # sdb devs.
145 #
146 mknod sdb b 8 16
147 mknod sdb1 b 8 17
148 mknod sdb2 b 8 18
149 mknod sdb3 b 8 19
150 mknod sdb4 b 8 20
151 mknod sdb5 b 8 21
152 mknod sdb6 b 8 22
153 mknod sdb7 b 8 23
154 mknod sdb8 b 8 24
155 mknod sdb9 b 9 25
157 # Floppy device.
158 #
159 mknod fd0 b 2 0
161 # loop devs.
162 #
163 for i in `seq 0 7`; do
164 mknod loop$i b 7 $i
165 done
167 # ram devs.
168 #
169 for i in `seq 0 7`; do
170 mknod ram$i b 1 $i
171 done
172 ln -s ram1 ram
174 # tty devs.
175 #
176 mknod tty c 5 0
177 for i in `seq 0 7`; do
178 mknod tty$i c 4 $i
179 done
181 # Virtual console screen devs.
182 #
183 for i in `seq 0 7`; do
184 mknod vcs$i c 7 $i
185 done
186 ln -s vcs0 vcs
188 # Virtual console screen w/ attributes devs.
189 #
190 for i in `seq 0 7`; do
191 mknod vcsa$i c 7 $(($i + 128))
192 done
193 ln -s vcsa0 vcsa
195 status
197 # Symlinks.
198 #
199 ln -snf /proc/self/fd fd
200 ln -snf /proc/self/fd/0 stdin
201 ln -snf /proc/self/fd/1 stdout
202 ln -snf /proc/self/fd/2 stderr
204 # Changes permissions.
205 #
206 echo -n "Changing permissions on devices... "
207 chmod 0666 ptmx
208 chmod 0666 null
209 chmod 0622 console
210 chmod 0666 tty*
211 status
213 # Script end.
214 echo -n "All devices are built..."
215 status