mkdevs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. #!/bin/sh
  2. # mktazdevs.sh: Make device files for SliTaz GNU/Linux
  3. # 2007/01/25
  4. #
  5. # Script functions.
  6. status()
  7. {
  8. local CHECK=$?
  9. echo -en "\033[68G"
  10. if [ $CHECK = 0 ] ; then
  11. echo -e "\033[1mOK\033[0m"
  12. else
  13. echo -e "\033[1mFailed\033[0m"
  14. fi
  15. }
  16. # We do our work in the dev/ directory.
  17. if [ -z "$1" ] ; then
  18. echo "usage: `basename $0` path/to/dev"
  19. exit 1
  20. fi
  21. # script start.
  22. echo -n "Moving to $1... "
  23. cd $1
  24. status
  25. # make usfull directories.
  26. echo -n "Starting to build directories... "
  27. mkdir pts input net usb shm
  28. status
  29. # script start.
  30. #
  31. echo -n "Starting to build devices... "
  32. # input devs.
  33. #
  34. mknod input/event0 c 13 64
  35. mknod input/event1 c 13 65
  36. mknod input/event2 c 13 66
  37. mknod input/mouse0 c 13 32
  38. mknod input/mice c 13 63
  39. 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 dri c 10 63
  60. mknod ttyS0 c 4 64
  61. mknod audio c 14 4
  62. mknod beep c 10 128
  63. mknod ptmx c 5 2
  64. mknod nvram c 10 144
  65. ln -s /proc/kcore core
  66. # net/tun device
  67. #
  68. mknod net/tun c 10 200
  69. # framebuffer devs.
  70. #
  71. mknod fb0 c 29 0
  72. mknod fb1 c 29 32
  73. mknod fb2 c 29 64
  74. mknod fb3 c 29 96
  75. mknod fb4 c 29 128
  76. mknod fb5 c 29 160
  77. mknod fb6 c 29 192
  78. # usb/hiddev
  79. #
  80. mknod usb/hiddev0 c 180 96
  81. mknod usb/hiddev1 c 180 97
  82. mknod usb/hiddev2 c 180 98
  83. mknod usb/hiddev3 c 180 99
  84. mknod usb/hiddev4 c 180 100
  85. mknod usb/hiddev5 c 180 101
  86. mknod usb/hiddev6 c 180 102
  87. # IDE HD devs
  88. # with a fiew concievable partitions; you can do
  89. # more of them yourself as you need 'em.
  90. #
  91. # hda devs
  92. #
  93. mknod hda b 3 0
  94. mknod hda1 b 3 1
  95. mknod hda2 b 3 2
  96. mknod hda3 b 3 3
  97. mknod hda4 b 3 4
  98. mknod hda5 b 3 5
  99. mknod hda6 b 3 6
  100. mknod hda7 b 3 7
  101. mknod hda8 b 3 8
  102. mknod hda9 b 3 9
  103. # hdb devs
  104. #
  105. mknod hdb b 3 64
  106. mknod hdb1 b 3 65
  107. mknod hdb2 b 3 66
  108. mknod hdb3 b 3 67
  109. mknod hdb4 b 3 68
  110. mknod hdb5 b 3 69
  111. mknod hdb6 b 3 70
  112. mknod hdb7 b 3 71
  113. mknod hdb8 b 3 72
  114. mknod hdb9 b 3 73
  115. # hdc and hdd with cdrom symbolic link.
  116. #
  117. mknod hdc b 22 0
  118. mknod hdd b 22 64
  119. ln -s hdc cdrom
  120. # sda devs
  121. #
  122. mknod sda b 8 0
  123. mknod sda1 b 8 1
  124. mknod sda2 b 8 2
  125. mknod sda3 b 8 3
  126. mknod sda4 b 8 4
  127. mknod sda5 b 8 5
  128. mknod sda6 b 8 6
  129. mknod sda7 b 8 7
  130. mknod sda8 b 8 8
  131. mknod sda9 b 8 9
  132. ln -s sda1 flash
  133. # sdb devs
  134. #
  135. mknod sdb b 8 16
  136. mknod sdb1 b 8 17
  137. mknod sdb2 b 8 18
  138. mknod sdb3 b 8 19
  139. mknod sdb4 b 8 20
  140. mknod sdb5 b 8 21
  141. mknod sdb6 b 8 22
  142. mknod sdb7 b 8 23
  143. mknod sdb8 b 8 24
  144. mknod sdb9 b 9 25
  145. # Floppy device.
  146. #
  147. mknod fd0 b 2 0
  148. # loop devs
  149. #
  150. for i in `seq 0 7`; do
  151. mknod loop$i b 7 $i
  152. done
  153. # ram devs
  154. #
  155. for i in `seq 0 7`; do
  156. mknod ram$i b 1 $i
  157. done
  158. ln -s ram1 ram
  159. # tty devs
  160. #
  161. mknod tty c 5 0
  162. for i in `seq 0 7`; do
  163. mknod tty$i c 4 $i
  164. done
  165. # virtual console screen devs
  166. #
  167. for i in `seq 0 7`; do
  168. mknod vcs$i b 7 $i
  169. done
  170. ln -s vcs0 vcs
  171. # virtual console screen w/ attributes devs
  172. #
  173. for i in `seq 0 7`; do
  174. mknod vcsa$i b 7 $i
  175. done
  176. ln -s vcsa0 vcsa
  177. status
  178. # Symlinks.
  179. #
  180. ln -snf /proc/self/fd fd
  181. ln -snf /proc/self/fd/0 stdin
  182. ln -snf /proc/self/fd/1 stdout
  183. ln -snf /proc/self/fd/2 stderr
  184. # Changes permissions.
  185. #
  186. echo -n "Changing permissions on devices... "
  187. chmod 0666 ptmx
  188. chmod 0666 null
  189. chmod 0622 console
  190. chmod 0666 tty*
  191. status
  192. # script end
  193. echo ""
  194. echo "All devices are build..."
  195. date