OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
4.5 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: target/psion-pda/build_image.sh
  5. # Copyright (C) 2006 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. . $base/misc/share/functions.in
  16. set -e
  17. arlo_ver="`sed -e 's,.*arlo-\(.*\).zip .*,\1,' \
  18. $base/target/$target/download.txt`"
  19. echo "Preparing root filesystem image from build result ..."
  20. rm -rf $imagelocation{,.squashfs}
  21. mkdir -p $imagelocation ; cd $imagelocation
  22. find $build_root -printf "%P\n" | sed '
  23. # stuff we never need
  24. /^TOOLCHAIN/ d;
  25. /^var\/adm/ d;
  26. /\/include/ d;
  27. /\/src/ d;
  28. /\.a$/ d;
  29. /\.o$/ d;
  30. /\.old$/ d;
  31. /\/games/ d;
  32. /\/local/ d;
  33. /^boot/ d;
  34. # stuff that would be nice - but is huge and only documentation
  35. /\/man/ d;
  36. /\/doc/ d;
  37. # /etc noise
  38. /^etc\/stone.d/ d;
  39. /^etc\/cron.d/ d;
  40. /^etc\/init.d/ d;
  41. /^etc\/profile.d/ d;
  42. /^etc\/sysconfig/ d;
  43. /^etc\/iproute2/ d;
  44. /^etc\/skel/ d;
  45. /^etc\/opt/ d;
  46. /^etc\/conf/ d;
  47. /^etc\/rc.d/ d;
  48. /^home/ d;
  49. /^mnt/ d;
  50. /^opt/ d;
  51. # rock net stuff
  52. /^lib\/network/ d;
  53. /^sbin\/ifup/ d;
  54. /^sbin\/ifdown/ d;
  55. /^sbin\/rocknet/ d;
  56. /^\/man\// d;
  57. /terminfo\/a\/ansi$/ { p; d; }
  58. /terminfo\/l\/linux$/ { p; d; }
  59. /terminfo\/x\/xterm$/ { p; d; }
  60. /terminfo\/n\/nxterm$/ { p; d; }
  61. /terminfo\/x\/xterm-color$/ { p; d; }
  62. /terminfo\/x\/xterm-8bit$/ { p; d; }
  63. /terminfo\/x\/screen$/ { p; d; }
  64. /terminfo\/v\/vt100$/ { p; d; }
  65. /terminfo\/v\/vt200$/ { p; d; }
  66. /terminfo\/v\/vt220$/ { p; d; }
  67. /terminfo/ d;
  68. # some big ncurses stuff
  69. /\/tack$/ d;
  70. /\/tic$/ d;
  71. /\/toe$/ d;
  72. /\/tput$/ d;
  73. /\/tset$/ d;
  74. /\/captoinfo$/ d;
  75. /\/input$/ d;
  76. ' > tar.input
  77. copy_with_list_from_file $build_root . $PWD/tar.input
  78. rm tar.input
  79. echo "Preparing root filesystem image from target defined files ..."
  80. rm -f sbin/init ; ln -s minit sbin/init
  81. rm -f bin/sh ; ln -s ash bin/sh
  82. copy_from_source $base/target/$target/rootfs .
  83. echo "Creating links for identical files ..."
  84. link_identical_files
  85. echo "Creating static device nodes in /dev ..."
  86. while read trg name ; do
  87. ln -s $trg $name
  88. done < <(cat <<-EOT
  89. kcore dev/core
  90. /proc/self/fd dev/fd
  91. fd/0 dev/stdin
  92. fd/1 dev/stdout
  93. fd/2 dev/stderr
  94. vcs0 dev/vcs
  95. EOT
  96. )
  97. while read type major minor name ; do
  98. if [ "$name" ] ; then
  99. mknod dev/$name $type $major $minor
  100. else
  101. echo "defect rule!"
  102. fi
  103. done < <(cat <<-EOT
  104. c 10 3 atibm
  105. c 14 4 audio
  106. c 14 20 audio1
  107. c 14 36 audio2
  108. c 14 52 audio3
  109. c 14 7 audioctl
  110. c 5 1 console
  111. c 14 3 dsp
  112. c 14 19 dsp1
  113. c 29 0 fb0
  114. c 1 7 full
  115. c 10 2 inportbm
  116. c 161 0 ircomm0
  117. c 161 1 ircomm1
  118. c 161 16 irlpt0
  119. c 161 17 irlpt1
  120. c 10 4 jbm
  121. c 1 2 kmem
  122. c 10 0 logibm
  123. b 7 0 loop0
  124. b 7 1 loop1
  125. b 7 2 loop2
  126. b 7 3 loop3
  127. c 6 0 lp0
  128. c 6 1 lp1
  129. c 6 2 lp2
  130. c 1 1 mem
  131. c 14 0 mixer
  132. c 14 16 mixer1
  133. c 1 3 null
  134. c 1 4 port
  135. c 5 2 ptmx
  136. c 2 0 ptyp0
  137. c 2 1 ptyp1
  138. c 2 2 ptyp2
  139. c 2 3 ptyp3
  140. c 2 4 ptyp4
  141. c 2 5 ptyp5
  142. c 2 6 ptyp6
  143. c 2 7 ptyp7
  144. c 2 8 ptyp8
  145. c 2 9 ptyp9
  146. c 2 10 ptypa
  147. c 2 11 ptypb
  148. c 2 12 ptypc
  149. c 2 13 ptypd
  150. c 2 14 ptype
  151. c 2 15 ptypf
  152. b 1 0 ram0
  153. b 1 1 ram1
  154. b 1 2 ram2
  155. b 1 3 ram3
  156. c 1 8 random
  157. c 14 6 sndstat
  158. c 10 11 tpanel
  159. c 5 0 tty
  160. c 4 0 tty0
  161. c 4 1 tty1
  162. c 4 10 tty10
  163. c 4 2 tty2
  164. c 4 3 tty3
  165. c 4 4 tty4
  166. c 4 5 tty5
  167. c 4 6 tty6
  168. c 4 7 tty7
  169. c 4 8 tty8
  170. c 4 9 tty9
  171. c 204 16 ttyAM0
  172. c 204 17 ttyAM1
  173. c 204 16 ttyS0
  174. c 204 17 ttyS1
  175. c 1 9 urandom
  176. c 7 0 vcs0
  177. c 7 1 vcs1
  178. c 7 2 vcs2
  179. c 7 3 vcs3
  180. c 7 4 vcs4
  181. c 7 5 vcs5
  182. c 7 6 vcs6
  183. c 7 7 vcs7
  184. c 7 8 vcs8
  185. c 7 9 vcs9
  186. c 1 5 zero
  187. EOT
  188. )
  189. # image size estimation ...
  190. s="`du -s -B 1 . | cut -f 1`"
  191. s="$(( (s + 128000) / 1024 ))"
  192. s="$(( s * 1024 ))"
  193. echo "Writing initrd image file ($s bytes)."
  194. tmpdir="`mktemp`" ; rm $tmpdir ; mkdir $tmpdir
  195. tmpfile="`mktemp`"
  196. dd if=/dev/zero of=$tmpfile bs=$s count=1 > $tmpfile
  197. mke2fs -m 0 -N 512 -qF $tmpfile > /dev/null
  198. mount -t ext2 $tmpfile $tmpdir -o loop
  199. rmdir $tmpdir/lost+found/
  200. copy_from_source . $tmpdir
  201. umount $tmpdir
  202. gzip -9 -c $tmpfile > ../initrd.gz
  203. rmdir $tmpdir ; rm -f $tmpfile
  204. du -sh . ../initrd.gz
  205. cd $imagelocation/..
  206. rm -rf epoc ; mkdir epoc ; cd epoc
  207. cp $build_root/boot/Image_* Image
  208. echo "Extracting ARLO ..."
  209. unzip $base/download/mirror/a/arlo-$arlo_ver.zip > /dev/null
  210. rm arlo/{copying,readme.html,example.cfg}
  211. cp $base/target/$target/arlo.cfg arlo/
  212. echo "The image is located at $imagelocation/.."