pub 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. export PATH=$PATH:/home/tronlong/T113/T113-i_v1.0/out/t113_i/tlt113-evm-emmc/longan/buildroot/host/bin
  2. #PRJS="PRJ_XIAN_AC_I1_O1_P4"
  3. #PRJS="PRJ_XIAN_AC_I1_O1_P8"
  4. #PRJS="PRJ_ITK_AC_I1_O1"
  5. #PRJS="PRJ_ITK_AC_I3_O1"
  6. #PRJS="PRJ_LITECH_AC_I1_O1"
  7. #PRJS="PRJ_LITECH_AC_I3_O1"
  8. #PRJS="PRJ_ANDERSON_AC_I3_O3"
  9. #PRJS="PRJ_USASL_AC_I3_O1"
  10. #PRJS="PRJ_USASL_AC_I3_O3"
  11. #PRJS="PRJ_HYPERTEC_AC_I3_O1"
  12. #PRJS="PRJ_INSPUR_DC_I_DC_O"
  13. #PRJS="PRJ_RELEASE_DC_I_DC_O"
  14. #PRJS="PRJ_RELEASE_AC_I1_O1"
  15. #PRJS="PRJ_RELEASE_AC_I3_O1"
  16. #PRJS="PRJ_RELEASE_AC_I3_O3"
  17. #PRJS="PRJ_STSC_I3_O3"
  18. #PRJS="PRJ_STSC_I3_O1_OLED"
  19. #PRJS="PRJ_SG_I3_O3"
  20. #PRJS="PRJ_ESOUTH_DC_I1_O4_RGB5"
  21. #PRJS="PRJ_TEST"
  22. #PRJS="PRJ_TEST_AC_I1_O1"
  23. #PRJS="PRJ_TEST_AC_I3_O1"
  24. #PRJS="PRJ_TEST_AC_I3_O3"
  25. #PRJS="PRJ_INST2302_DC_OLED"
  26. #PRJS="PRJ_INST2106_AC_I1_O1_OLED"
  27. PRJS="PRJ_YST_AC_I1_O1"
  28. #PRJS="PRJ_USASL_AC_I3_O1 PRJ_USASL_AC_I3_O3"
  29. #PRJS="PRJ_XIAN_AC_I1_O1_P4 PRJ_XIAN_AC_I1_O1_P8"
  30. #PRJS="PRJ_ITK_AC_I1_O1 PRJ_ITK_AC_I3_O1"
  31. #PRJS="PRJ_TEST_AC_I1_O1 PRJ_TEST_AC_I3_O1"
  32. #PRJS="PRJ_LITECH_AC_I1_O1 PRJ_LITECH_AC_I3_O1"
  33. #PRJS="PRJ_RELEASE_DC_I_DC_O PRJ_RELEASE_AC_I1_O1 PRJ_RELEASE_AC_I3_O1 PRJ_RELEASE_AC_I3_O3"
  34. #PRJS="PRJ_LITECH_AC_I1_O1 PRJ_LITECH_AC_I3_O1 PRJ_XIAN_AC_I1_O1_P4 PRJ_XIAN_AC_I1_O1_P8"
  35. #PRJS="PRJ_IP_AC_I3_O3"
  36. #PRJS="PRJ_IP_AC_I3_O1"
  37. #PRJS="PRJ_IP_AC_I1_O1"
  38. fulldir=$(realpath $0)
  39. curdir=$(dirname $fulldir)
  40. ip_flag=0
  41. custdir=$curdir/cust_data
  42. name=null
  43. rootdir=$curdir/output/t113i/pack_dir
  44. appdir=$rootdir/root/run/app
  45. function prj_enable()
  46. {
  47. fcfg=$curdir/pro/config/cfg.h
  48. fmak=$curdir/pro/CMakefile.txt
  49. #clear space
  50. sed -i 's|^[[:space:]]\(#define PRJ_*\)|\1|g' $fcfg
  51. #mask all PRJ_XXX define
  52. sed -i 's|^\(.*\)\(#define PRJ_*\)|//\2|g' $fcfg
  53. #enable the needed PRJ_XXX define
  54. sed -i "s|^//\(#define $1\s*$\)|\1|g" $fcfg
  55. }
  56. function prj_unmask()
  57. {
  58. prj=$1
  59. }
  60. function do_copy()
  61. {
  62. echo do_copy ...
  63. if [[ "$1" == "PRJ_IP_"* ]]; then
  64. ip_flag=1
  65. fi
  66. if [ $ip_flag -eq 1 ]; then
  67. rootdir=$curdir/output/t113s/pack_dir
  68. appdir=$rootdir/mnt/UDISK/app
  69. fi
  70. rm -rf $appdir/image_qt
  71. mkdir -p $appdir/image
  72. mkdir -p $appdir/cert
  73. cp -f $custdir/cert/server.* $appdir/cert/
  74. cp -f $custdir/changes.txt $appdir/
  75. cp -f $custdir/db/pdu_dat.db $appdir/
  76. cp -f $custdir/logo/logo_neuter.png $appdir/image/logo.png
  77. cp -f $custdir/qt/S90PDUApp $rootdir/etc/init.d/
  78. if [ $ip_flag -eq 1 ]; then
  79. cp -f $custdir/qt/IP/Qt_Test $appdir/
  80. else
  81. cp -f $custdir/qt/Qt_Test $appdir/
  82. fi
  83. if [ "$1" = "PRJ_XIAN_AC_I1_O1_P4" ]; then
  84. name=ac_in1_out1_p4_xian
  85. elif [ "$1" = "PRJ_XIAN_AC_I1_O1_P8" ]; then
  86. name=ac_in1_out1_p8_xian
  87. elif [ "$1" = "PRJ_ITK_AC_I1_O1" ]; then
  88. name=ac_in1_out1_russia_itk
  89. cp -f $custdir/db/pdu_dat_itk.db $appdir/pdu_dat.db
  90. cp -f $custdir/logo/logo_itk.png $appdir/image/logo.png
  91. elif [ "$1" = "PRJ_ITK_AC_I3_O1" ]; then
  92. name=ac_in3_out1_russia_itk
  93. cp -f $custdir/logo/logo_itk.png $appdir/image/logo.png
  94. elif [ "$1" = "PRJ_RELEASE_DC_I_DC_O" ]; then
  95. name=dc_in_dc_out_release
  96. elif [ "$1" = "PRJ_RELEASE_AC_I1_O1" ]; then
  97. name=ac_in1_out1_release
  98. elif [ "$1" = "PRJ_RELEASE_AC_I3_O1" ]; then
  99. name=ac_in3_out1_release
  100. elif [ "$1" = "PRJ_RELEASE_AC_I3_O3" ]; then
  101. name=ac_in3_out3_release
  102. elif [ "$1" = "PRJ_LITECH_AC_I1_O1" ]; then
  103. name=ac_in1_out1_litech
  104. cp -f $custdir/logo/logo_litech.png $appdir/image/logo.png
  105. elif [ "$1" = "PRJ_LITECH_AC_I3_O1" ]; then
  106. name=ac_in3_out1_litech
  107. cp -f $custdir/logo/logo_litech.png $appdir/image/logo.png
  108. elif [ "$1" = "PRJ_ANDERSON_AC_I3_O3" ]; then
  109. name=ac_in3_out3_anderson
  110. elif [ "$1" = "PRJ_USASL_AC_I3_O1" ]; then
  111. name=ac_in3_out1_usa_sl
  112. elif [ "$1" = "PRJ_USASL_AC_I3_O3" ]; then
  113. name=ac_in3_out3_usa_sl
  114. elif [ "$1" = "PRJ_HYPERTEC_AC_I3_O1" ]; then
  115. name=ac_in3_out1_hypertec
  116. cp -f $custdir/logo/logo_hypertec.png $appdir/image/logo.png
  117. elif [ "$1" = "PRJ_INSPUR_DC_I_DC_O" ]; then
  118. name=dc_in1_out1_inspur
  119. elif [ "$1" = "PRJ_STSC_I3_O3" ]; then
  120. name=ac_in3_out3_stsc
  121. elif [ "$1" = "PRJ_SG_I3_O3" ]; then
  122. name=ac_in2_out1_sg24016
  123. elif [ "$1" = "PRJ_TEST" ]; then
  124. name=ac_in3_out1_test
  125. elif [ "$1" = "PRJ_TEST_AC_I1_O1" ]; then
  126. name=ac_in1_out1_test
  127. elif [ "$1" = "PRJ_TEST_AC_I3_O1" ]; then
  128. name=ac_in3_out1_test
  129. elif [ "$1" = "PRJ_TEST_AC_I3_O3" ]; then
  130. name=ac_in3_out3_test
  131. elif [ "$1" = "PRJ_TEST" ]; then
  132. name=ac_in3_out1_test
  133. elif [ "$1" = "PRJ_IP_AC_I3_O3" ];then
  134. name=ac_in3_out3_ip
  135. elif [ "$1" = "PRJ_YST_AC_I1_O1" ];then
  136. name=ac_in1_out1_YST
  137. elif [ "$1" = "PRJ_INST2302_DC_OLED" ];then
  138. name=dc_in_dc_out_oled
  139. rm -f $appdir/Qt_Test
  140. elif [ "$1" = "PRJ_INST2106_AC_I1_O1_OLED" ];then
  141. name=ac_in1_out1_inst2106_oled
  142. rm -f $appdir/Qt_Test
  143. elif [ "$1" = "PRJ_STSC_I3_O1_OLED" ];then
  144. name=ac_in3_out1_stsc_oled
  145. rm -f $appdir/Qt_Test
  146. elif [ "$1" = "PRJ_ESOUTH_DC_I1_O4_RGB5" ];then
  147. name=dc_in1_out4_esouth_rgb5
  148. cp -f $custdir/qt/rgb/Qt_Test $appdir/
  149. cp -rf $custdir/qt/rgb/image_qt $appdir/
  150. cp -f $custdir/qt/rgb/S90PDUApp $rootdir/etc/init.d/
  151. elif [ "$1" = "PRJ_IP_AC_I3_O1" ];then
  152. name=ip_ac_in3_out1_release
  153. elif [ "$1" = "PRJ_IP_AC_I1_O1" ];then
  154. name=ip_ac_in1_out1_release
  155. else
  156. echo error! $RPJ not define!!!
  157. exit 1
  158. fi
  159. rm -rf $appdir/../web
  160. cp -rf $custdir/web/unique $appdir/../web
  161. prj_enable $1
  162. }
  163. function do_compile()
  164. {
  165. echo do_compile ...
  166. cd $curdir/pro
  167. rm -rf build; mkdir build; cd build
  168. if [[ "$1" == "PRJ_IP_"* ]];then
  169. cmake .. -DCHIP=t113s && make
  170. else
  171. cmake .. -DCHIP=t113i && make
  172. fi
  173. if [ $? -gt 0 ]; then
  174. exit 1
  175. fi
  176. }
  177. function do_pack()
  178. {
  179. echo do_pack ...
  180. if [[ "$1" == "PRJ_IP_"* ]];then
  181. $curdir/output/t113s/pack.sh
  182. else
  183. $curdir/output/t113i/pack.sh
  184. fi
  185. }
  186. function do_zip()
  187. {
  188. echo do_zip ...
  189. ztm=`date +%Y%m%d_%H%M%S`
  190. if [[ "$1" == "PRJ_IP_"* ]];then
  191. zname="upgrade_"$ztm"_$name"
  192. zdir=$curdir/output/t113s/push
  193. files="push.bat pdutar tools/*"
  194. cd $zdir; zip -q $zname.zip $files
  195. mv $zname.zip $curdir/output/t113s/
  196. else
  197. zname="upgrade_"$ztm"_$name"
  198. zdir=$curdir/output/t113i/push2
  199. files="push.bat pdutar tools/*"
  200. cd $zdir; zip -q $zname.zip $files
  201. mv $zname.zip $curdir/output/t113i/
  202. fi
  203. }
  204. function do_one()
  205. {
  206. do_copy $1
  207. do_compile $1
  208. do_pack $1
  209. do_zip $1
  210. }
  211. function do_all()
  212. {
  213. for s in $PRJS; do
  214. do_one $s
  215. done
  216. }
  217. do_all