slitaz-tools view tinyutils/mktazdevs.sh @ rev 340
tazx: Moved doc to Handbook
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon May 04 23:12:18 2009 +0200 (2009-05-04) |
parents | db0e82bebc70 |
children |
line source
1 #!/bin/sh
2 # mktazdevs.sh: Make device files for SliTaz GNU/Linux
3 # 2007/10/02 - pankso@slitaz.org
4 #
6 # Script functions.
7 status()
8 {
9 local CHECK=$?
10 echo -en "\\033[70G[ "
11 if [ $CHECK = 0 ]; then
12 echo -en "\\033[1;33mOK"
13 else
14 echo -en "\\033[1;31mFailed"
15 fi
16 echo -e "\\033[0;39m ]"
17 }
19 # We do our work in the dev/ directory.
20 if [ -z "$1" ] ; then
21 echo "usage: `basename $0` path/to/dev"
22 exit 1
23 fi
25 # Script start.
26 echo -n "Moving to $1... "
27 cd $1
28 status
30 # Make useful directories.
31 echo -n "Starting to build directories... "
32 mkdir pts input net usb shm
33 status
35 # script start.
36 #
37 echo -n "Starting to build devices... "
39 # input devs.
40 #
41 mknod input/event0 c 13 64
42 mknod input/event1 c 13 65
43 mknod input/event2 c 13 66
44 mknod input/mouse0 c 13 32
45 mknod input/mice c 13 63
46 mknod input/ts0 c 254 0
48 # Miscellaneous one-of-a-kind stuff.
49 #
50 mknod logibm c 10 0
51 mknod psaux c 10 1
52 mknod inportbm c 10 2
53 mknod atibm c 10 3
54 mknod console c 5 1
55 mknod full c 1 7
56 mknod kmem c 1 2
57 mknod mem c 1 1
58 mknod null c 1 3
59 mknod port c 1 4
60 mknod random c 1 8
61 mknod urandom c 1 9
62 mknod zero c 1 5
63 mknod rtc c 10 135
64 mknod sr0 b 11 0
65 mknod sr1 b 11 1
66 mknod agpgart c 10 175
67 mknod dri c 10 63
68 mknod ttyS0 c 4 64
69 mknod audio c 14 4
70 mknod beep c 10 128
71 mknod ptmx c 5 2
72 mknod nvram c 10 144
73 ln -s /proc/kcore core
74 # PPP dev.
75 mknod ppp c 108 0
77 # net/tun device.
78 #
79 mknod net/tun c 10 200
81 # Framebuffer devs.
82 #
83 mknod fb0 c 29 0
84 mknod fb1 c 29 32
85 mknod fb2 c 29 64
86 mknod fb3 c 29 96
87 mknod fb4 c 29 128
88 mknod fb5 c 29 160
89 mknod fb6 c 29 192
91 # usb/hiddev.
92 #
93 mknod usb/hiddev0 c 180 96
94 mknod usb/hiddev1 c 180 97
95 mknod usb/hiddev2 c 180 98
96 mknod usb/hiddev3 c 180 99
97 mknod usb/hiddev4 c 180 100
98 mknod usb/hiddev5 c 180 101
99 mknod usb/hiddev6 c 180 102
101 # IDE HD devs.
102 # With a few conceivable partitions, you can do
103 # more of them yourself as you need 'em.
104 #
106 # hda devs.
107 #
108 mknod hda b 3 0
109 mknod hda1 b 3 1
110 mknod hda2 b 3 2
111 mknod hda3 b 3 3
112 mknod hda4 b 3 4
113 mknod hda5 b 3 5
114 mknod hda6 b 3 6
115 mknod hda7 b 3 7
116 mknod hda8 b 3 8
117 mknod hda9 b 3 9
119 # hdb devs.
120 #
121 mknod hdb b 3 64
122 mknod hdb1 b 3 65
123 mknod hdb2 b 3 66
124 mknod hdb3 b 3 67
125 mknod hdb4 b 3 68
126 mknod hdb5 b 3 69
127 mknod hdb6 b 3 70
128 mknod hdb7 b 3 71
129 mknod hdb8 b 3 72
130 mknod hdb9 b 3 73
132 # hdc and hdd.
133 #
134 mknod hdc b 22 0
135 mknod hdd b 22 64
137 # sda devs.
138 #
139 mknod sda b 8 0
140 mknod sda1 b 8 1
141 mknod sda2 b 8 2
142 mknod sda3 b 8 3
143 mknod sda4 b 8 4
144 mknod sda5 b 8 5
145 mknod sda6 b 8 6
146 mknod sda7 b 8 7
147 mknod sda8 b 8 8
148 mknod sda9 b 8 9
149 ln -s sda1 flash
151 # sdb devs.
152 #
153 mknod sdb b 8 16
154 mknod sdb1 b 8 17
155 mknod sdb2 b 8 18
156 mknod sdb3 b 8 19
157 mknod sdb4 b 8 20
158 mknod sdb5 b 8 21
159 mknod sdb6 b 8 22
160 mknod sdb7 b 8 23
161 mknod sdb8 b 8 24
162 mknod sdb9 b 9 25
164 # Floppy device.
165 #
166 mknod fd0 b 2 0
168 # loop devs.
169 #
170 for i in `seq 0 7`; do
171 mknod loop$i b 7 $i
172 done
174 # ram devs.
175 #
176 for i in `seq 0 7`; do
177 mknod ram$i b 1 $i
178 done
179 ln -s ram1 ram
181 # tty devs.
182 #
183 mknod tty c 5 0
184 for i in `seq 0 7`; do
185 mknod tty$i c 4 $i
186 done
188 # Virtual console screen devs.
189 #
190 for i in `seq 0 7`; do
191 mknod vcs$i b 7 $i
192 done
193 ln -s vcs0 vcs
195 # Virtual console screen w/ attributes devs.
196 #
197 for i in `seq 0 7`; do
198 mknod vcsa$i b 7 $i
199 done
200 ln -s vcsa0 vcsa
202 status
204 # Symlinks.
205 #
206 ln -snf /proc/self/fd fd
207 ln -snf /proc/self/fd/0 stdin
208 ln -snf /proc/self/fd/1 stdout
209 ln -snf /proc/self/fd/2 stderr
211 # Change permissions.
212 #
213 echo -n "Changing permissions on devices... "
214 chmod 0666 ptmx
215 chmod 0666 null
216 chmod 0622 console
217 chmod 0666 tty*
218 status
220 # Script end.
221 echo -n "All devices are built..."
222 status