build_all.sh 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. #!/bin/sh
  2. export Start_at=`date +%H:%M:%S`
  3. export PROJECT_ROOT=$PWD
  4. export curtitle="cmd:"$0
  5. export ret="0"
  6. export def_proj="EC800GCN_GA"
  7. export buildtype_src=$1
  8. export hardware_type="UIS8850DG"
  9. export ql_ext_flash="N"
  10. doneseg(){
  11. echo " "
  12. date +%Y/%m/%d
  13. echo "START TIME: $Start_at"
  14. echo "END TIME: `date +%H:%M:%S`"
  15. exit $ret
  16. }
  17. helpinfo(){
  18. echo "********************************************************************"
  19. echo "!!!!!!!!!!! Please input right build option !!!!!!!!!!!!!!"
  20. echo "********************************************************************"
  21. exit $ret
  22. }
  23. buildinfo(){
  24. echo "For your information:"
  25. echo "Usage: $0 r/new Project Version [VOLTE] [DSIM] [debug/release]"
  26. echo " $0 clean"
  27. echo " $0 h/-h"
  28. echo "Example:"
  29. echo " $0 new $def_proj your_version_label"
  30. echo " $0 new $def_proj your_version_label VOLTE SINGLESIM debug"
  31. echo " $0 new $def_proj your_version_label NOVOLTE DOUBLESIM release"
  32. echo " "
  33. echo "Note: Optional parameter: [VOLTE] [DSIM]"
  34. echo " The previous optional parameter is required for the latter optional parameter."
  35. echo " For example, If you need DOUBLESIM with NOVOLTE, please set [VOLTE] as NOVOLTE and [DSIM] as DOUBLESIM."
  36. echo " "
  37. echo " [VOLTE] option is for VoLTE feature, and NOVOLTE is default."
  38. echo " If you want volte, you can ignore [VOLTE] with SINGLESIM or set it as VOLTE. If you want no volte, please set [VOLTE] as NOVOLTE!"
  39. echo " [DSIM] option is for single or double sim card. and SINGLESIM is default."
  40. echo " DOUBLESIM is used for Dual SIM Dual Standby(DSDS), and SINGLESIM is used for single SIM or Dual SIM Single Standby(DSSS)."
  41. echo " furthermore, you should enable the CONFIG_QUEC_PROJECT_FEATURE_DSSS feature for DSSS."
  42. echo " Only determine the dual sim feautre when the dual sim feature is not saved in NV, "
  43. echo " when the dual sim feature is switched through ql_sim_set_ds_feature, the DOUBLESIM build option and "
  44. echo " CONFIG_QUEC_PROJECT_FEATURE_DSSS macro will not take effect."
  45. echo " "
  46. echo "you can get supported [Project] at the directory components\ql-config\build,"
  47. echo "the name of folders are supported [Project], as below:"
  48. echo "components/ql-config/build/"
  49. exit $ret
  50. }
  51. buildstart(){
  52. optionhelp=0
  53. if test $buildoption = "clean"
  54. then
  55. rm -rf out
  56. echo "cleaning done"
  57. doneseg
  58. elif test $buildoption = "r"
  59. then
  60. echo " "
  61. #buildseg
  62. elif test $buildoption = "new"
  63. then
  64. echo "cleaning..."
  65. rm -rf out
  66. echo "cleaning done"
  67. #buildseg
  68. else
  69. optionhelp=1
  70. doneseg
  71. fi
  72. }
  73. export COMPILER_VERSION="gcc-arm-none-eabi-9.2.1"
  74. PATH=$PROJECT_ROOT/prebuilts/linux/bin:$PATH
  75. PATH=$PROJECT_ROOT/prebuilts/linux/cmake/bin:$PATH
  76. PATH=$PROJECT_ROOT/prebuilts/linux/gcc-arm-none-eabi/${COMPILER_VERSION}/bin:$PATH
  77. PATH=$PROJECT_ROOT/prebuilts/linux/gcc-mips-rda-elf/bin:$PATH
  78. PATH=$PROJECT_ROOT/prebuilts/linux/gcc-rv32-elf/bin:$PATH
  79. PATH=$PROJECT_ROOT/prebuilts/linux/nanopb:$PATH
  80. PATH=$PROJECT_ROOT/tools:$PATH
  81. PATH=$PROJECT_ROOT/tools/linux:$PATH
  82. if test "$buildtype_src" = ""; then
  83. buildoption=new
  84. elif test "$buildtype_src" = "r"; then
  85. buildoption=r
  86. elif test "$buildtype_src" = "new"; then
  87. buildoption=new
  88. elif test "$buildtype_src" = "clean"; then
  89. buildoption=clean
  90. elif test "$buildtype_src" = "c"; then
  91. buildoption=clean
  92. elif test "$buildtype_src" = "h"; then
  93. buildoption=h
  94. elif test "$buildtype_src" = "-h"; then
  95. buildoption=h
  96. elif test "$buildtype_src" = "help"; then
  97. buildoption=h
  98. elif test "$buildtype_src" = "/h"; then
  99. buildoption=h
  100. elif test "$buildtype_src" = "/?"; then
  101. buildoption=h
  102. elif test "$buildtype_src" = "?"; then
  103. buildoption=h
  104. else
  105. echo "!!!unknown build type: $buildoption, should be r/new/clean/h/-h!!!"
  106. helpinfo
  107. fi
  108. if test "$buildoption" = "h"; then
  109. buildinfo
  110. fi
  111. if test "$buildoption" = "clean" -o "$buildoption" = "new"; then
  112. buildstart
  113. fi
  114. export ql_buildproj=$2
  115. if test "$ql_buildproj" = ""; then
  116. ql_buildproj=$def_proj
  117. fi
  118. if test "$ql_buildproj" = "EC800GCN_GA"; then
  119. hardware_type=UIS8850DG
  120. elif test "$ql_buildproj" = "EC800GCN_LD"; then
  121. hardware_type=UIS8850BM
  122. elif test "$ql_buildproj" = "EC800GCN_MD"; then
  123. hardware_type=UIS8850BM
  124. elif test "$ql_buildproj" = "EG800GEU_LD"; then
  125. hardware_type=UIS8850BM
  126. elif test "$ql_buildproj" = "EC800GCN_LB"; then
  127. hardware_type=UIS8850CM
  128. elif test "$ql_buildproj" = "EG800GCN_GB"; then
  129. hardware_type=UIS8850CM
  130. elif test "$ql_buildproj" = "EC600GCN_LC"; then
  131. hardware_type=UIS8850BM
  132. elif test "$ql_buildproj" = "EC600GCN_LA"; then
  133. hardware_type=UIS8850CM
  134. elif test "$ql_buildproj" = "EC600GCN_LD"; then
  135. hardware_type=UIS8850BM
  136. elif test "$ql_buildproj" = "EC600GCN_CD"; then
  137. hardware_type=UIS8850BM
  138. elif test "$ql_buildproj" = "EC600GCN_MD"; then
  139. hardware_type=UIS8850BM
  140. elif test "$ql_buildproj" = "EC600GCN_GA"; then
  141. hardware_type=UIS8850DG
  142. elif test "$ql_buildproj" = "EG700GCN_LC"; then
  143. hardware_type=UIS8850BM
  144. elif test "$ql_buildproj" = "EG700GCN_LD"; then
  145. hardware_type=UIS8850BM
  146. elif test "$ql_buildproj" = "EG700GCN_MD"; then
  147. hardware_type=UIS8850BM
  148. elif test "$ql_buildproj" = "EG700GCN_ND"; then
  149. hardware_type=UIS8850BM
  150. elif test "$ql_buildproj" = "EC200GCN_LE"; then
  151. hardware_type=UIS8850BM
  152. elif test "$ql_buildproj" = "EC200GCN_LF"; then
  153. hardware_type=UIS8850CM
  154. fi
  155. if test "$3" = ""; then
  156. echo "we need your version label..."
  157. helpinfo
  158. fi
  159. export volte_enable=$4
  160. export quec_dsim=$5
  161. echo $volte_enable $quec_dsim
  162. export ql_dsim_cfg="n"
  163. # set y for VSIM STD solution
  164. export ql_vsim_std="n"
  165. export modemdir="8850XG_cat1bis_gnss_ds_ab"
  166. export ims_delta_nv="n"
  167. export quec_ims_feature="n"
  168. export partitionfile="components/hal/config/8850/partinfo_8850_8m_opencpu.json"
  169. if test "$volte_enable" = ""; then
  170. volte_enable="NOVOLTE"
  171. fi
  172. if test "$quec_dsim" = "DOUBLESIM"; then
  173. ql_dsim_cfg="y"
  174. fi
  175. if test "$hardware_type" = "UIS8850DG"; then
  176. if test "$volte_enable" = "VOLTE"; then
  177. ims_delta_nv="y"
  178. quec_ims_feature="y"
  179. partitionfile="components/hal/config/8850/partinfo_8850_8m_opencpu.json"
  180. modemdir="8850XG_cat1bis_volte_gnss_ds_ab"
  181. else
  182. partitionfile="components/hal/config/8850/partinfo_8850_8m_opencpu_novolte.json"
  183. modemdir="8850XG_cat1bis_gnss_ds_ab"
  184. fi
  185. elif test "$hardware_type" = "UIS8850BM"; then
  186. if test "$ql_ext_flash" = "Y"; then
  187. partitionfile="components/hal/config/8850/partinfo_8850_4m_4m_opencpu_novolte.json"
  188. else
  189. partitionfile="components/hal/config/8850/partinfo_8850_4m_opencpu_novolte.json"
  190. fi
  191. modemdir="8850XM_cat1bis_ds_ab"
  192. elif test "$hardware_type" = "UIS8850CM"; then
  193. partitionfile="components/hal/config/8850/partinfo_8850_8m_opencpu_novolte.json"
  194. modemdir="8850CM_cat1bis_ds"
  195. fi
  196. if test "$ql_vsim_std" = "y"; then
  197. partitionfile="components/hal/config/8850/partinfo_8850_8m_quec_vsim_novolte.json"
  198. if test "$hardware_type" = "UIS8850BM"; then
  199. partitionfile="components/hal/config/8850/partinfo_8850_4m_quec_vsim_novolte.json"
  200. if test "$ql_ext_flash" = "Y"; then
  201. partitionfile="components/hal/config/8850/partinfo_8850_4m_4m_quec_vsim_novolte.json"
  202. fi
  203. fi
  204. fi
  205. python3 ./build_check.py --partinfo ${partitionfile}
  206. if [ $? != 0 ];then
  207. echo ""
  208. echo "****************************************************************"
  209. echo "xxxxxxxxxxxxxxxxx flash partition error xxxxxxxxxxxxxxxxxxxxxx"
  210. echo "****************************************************************"
  211. export ret=1
  212. doneseg
  213. fi
  214. export prepack_json_path="components/ql-config/download/prepack/ql_prepack.json"
  215. echo $PATH
  216. export buildver=$3
  217. buildver=${buildver^^}
  218. export outputtype=$6
  219. if test "$outputtype" != "debug";then
  220. outputtype="release"
  221. fi
  222. export _ccsdk_build="ON"
  223. export _OPEN_="OPEN_CPU"
  224. export BUILD_TARGET="8850DG_cat1_open"
  225. export BUILD_RELEASE_TYPE=$outputtype
  226. export ql_app_ver=${buildver}_APP
  227. export ql_app2_ver=${buildver}_APP2
  228. if test "$hardware_type" = "UIS8850BM"; then
  229. BUILD_TARGET="8850XM_cat1_open"
  230. elif test "$hardware_type" = "UIS8850CM"; then
  231. BUILD_TARGET="8850XM_cat1_open"
  232. fi
  233. if [ ! -d "${PROJECT_ROOT}/components/ql-config/build/${ql_buildproj}/${BUILD_TARGET}" ]; then
  234. echo " "
  235. echo "******************** ERROR ***********************"
  236. echo "your target.config is not exist:"
  237. echo " ${PROJECT_ROOT}/components/ql-config/build/${ql_buildproj}/${BUILD_TARGET}"
  238. echo "****************************************************************"
  239. echo " "
  240. ret=1
  241. buildinfo
  242. fi
  243. export KCONFIG_CONFIG=$PROJECT_ROOT/components/ql-config/build/${ql_buildproj}/${BUILD_TARGET}/target.config
  244. export target_out_dir=out/${BUILD_TARGET}_${BUILD_RELEASE_TYPE}
  245. export PROJECT_OUT=${PROJECT_ROOT}/$target_out_dir
  246. region=${ql_buildproj:6:2}
  247. if test "$region" = "CN"; then
  248. export IMS_DELTA_NV_ROOT=components/ql-kernel/modem/ims/cn
  249. elif test "$region" = "EU"; then
  250. export IMS_DELTA_NV_ROOT=components/ql-kernel/modem/ims/eu
  251. elif test "$region" = "LA"; then
  252. export IMS_DELTA_NV_ROOT=components/ql-kernel/modem/ims/la
  253. elif test "$region" = "AU"; then
  254. export IMS_DELTA_NV_ROOT=components/ql-kernel/modem/ims/au
  255. elif test "$region" = "GL"; then
  256. export IMS_DELTA_NV_ROOT=components/ql-kernel/modem/ims/gl
  257. else
  258. export IMS_DELTA_NV_ROOT=components/ql-kernel/modem/ims/xx
  259. fi
  260. echo ${IMS_DELTA_NV_ROOT}
  261. #if test -f prebuilts/modem/8910/${modemdir}/nvitem/*.prj; then
  262. # rm -rf prebuilts/modem/8910/${modemdir}/nvitem/*.prj
  263. #fi
  264. cp -r components/ql-config/build/${ql_buildproj}/nvitem/delta_static.nv components/nvitem/8850/default/deltanv/
  265. cp -r components/ql-config/build/${ql_buildproj}/nvitem/delta_rf.nv components/nvitem/8850/default/deltanv/
  266. cp -r components/ql-config/build/${ql_buildproj}/nvitem/delta_ims.nv components/nvitem/8850/default/deltanv/
  267. cp -r components/ql-config/build/${ql_buildproj}/nvitem/delta_simcard2.nv components/nvitem/8850/default/deltanv/
  268. #cp -r components/ql-config/build/${ql_buildproj}/quec_proj_config.h components/ql-kernel/inc
  269. #cp -r components/ql-config/build/${ql_buildproj}/quec_proj_config_at.h components/ql-kernel/inc
  270. cp -r components/ql-config/build/${ql_buildproj}/ql_libs/libql_at.a components/ql-kernel/libs
  271. if [ -d "$ROJECT_OUT" ]; then
  272. rm -rf ../../target/$target_out/
  273. fi
  274. mkdir -p $PROJECT_OUT
  275. sudo chmod -R 777 $PROJECT_OUT
  276. mkdir -p ${PROJECT_OUT}/include
  277. sudo chmod -R 777 ${PROJECT_OUT}/include
  278. cd out/${BUILD_TARGET}_${BUILD_RELEASE_TYPE}
  279. sudo chmod -R 777 ../../prebuilts
  280. sudo chmod -R 777 ../../out
  281. sudo chmod -R 777 ../../out/${BUILD_TARGET}_${BUILD_RELEASE_TYPE}
  282. sudo chmod -R 777 ../../tools
  283. sudo chmod -R 777 ../../tools/linux
  284. sudo chmod -R 777 ../../components/ql-config/build/${ql_buildproj}/${BUILD_TARGET}/
  285. cmake ../.. -G Ninja
  286. sudo chmod -R 777 ../../out/${BUILD_TARGET}_${BUILD_RELEASE_TYPE}
  287. sudo chmod -R 777 ../../out/${BUILD_TARGET}_${BUILD_RELEASE_TYPE}/vargen
  288. ninja
  289. if [ $? != 0 ];then
  290. cd $PROJECT_ROOT
  291. echo ""
  292. echo ""
  293. echo "******************** ERROR ***********************"
  294. echo "******************** ERROR ***********************"
  295. echo "****************************************************************"
  296. echo "xxxxxxxxxxxxxxxxxx build ended error xxxxxxxxxxxxxxxxxxxxxxx"
  297. echo "****************************************************************"
  298. echo "****************************************************************"
  299. export ret=1
  300. doneseg
  301. fi
  302. echo ""
  303. echo "******************** PASS ***********************"
  304. echo "************** build ended successfully ********************"
  305. echo "******************** PASS ***********************"
  306. echo ""
  307. python3 ../../build_check.py --partinfo ../../${partitionfile} --splimg ./hex/spl.img --splsignimg .\hex\spl.sign.img
  308. if [ $? != 0 ];then
  309. echo ""
  310. echo "******************** ERROR ***********************"
  311. echo "******************** FILE SIZE ERROR ***********************"
  312. export ret=1
  313. doneseg
  314. fi
  315. python3 ../../build_check.py --partinfo ../../${partitionfile} --coreimg ./hex/${BUILD_TARGET}.img
  316. if [ $? != 0 ];then
  317. echo ""
  318. echo "******************** ERROR ***********************"
  319. echo "******************** FILE SIZE ERROR ***********************"
  320. export ret=1
  321. doneseg
  322. fi
  323. python3 ../../build_check.py --partinfo ../../${partitionfile} --appimg ./hex/examples/${ql_app_ver}.img
  324. if [ $? != 0 ];then
  325. echo ""
  326. echo "******************** ERROR ***********************"
  327. echo "******************** FILE SIZE ERROR ***********************"
  328. export ret=1
  329. doneseg
  330. fi
  331. echo ""
  332. echo $ql_buildproj $buildver $BUILD_RELEASE_TYPE $volte_enable $quec_dsim
  333. export version_path=../../target/${ql_buildproj}_${buildver}
  334. if [ -d "${version_path}/" ]; then
  335. rm -rf ${version_path}/
  336. fi
  337. mkdir -p ${version_path}/prepack/
  338. mkdir -p ${version_path}/app/
  339. sudo chmod -R 777 ../../target
  340. rm -rf ../../out/${BUILD_TARGET}_${BUILD_RELEASE_TYPE}/vargen/${modemdir}/indeltanv
  341. cp -r ./hex/. $version_path/prepack/
  342. mv ${version_path}/prepack/${BUILD_TARGET}.elf ${version_path}/
  343. mv ${version_path}/prepack/${BUILD_TARGET}.map ${version_path}/
  344. mv ${version_path}/prepack/${BUILD_TARGET}*${BUILD_RELEASE_TYPE}.pac ${version_path}/
  345. mv ${version_path}/${BUILD_TARGET}*${BUILD_RELEASE_TYPE}.pac ${version_path}/${BUILD_TARGET}_${buildver}.pac
  346. cp -r ./target.cmake ${version_path}/prepack/
  347. cp -r ./hex/examples/*.* ${version_path}/app/
  348. export ql_prepack_opt=N
  349. if test -f ql_prepack.opt; then
  350. ql_prepack_opt=Y
  351. fi
  352. if test "$ql_prepack_opt" = "Y"; then
  353. #如果没生成merge.pac,并且报failed to copy APPIMG before PREPACK as APPIMG,或者预置文件失败等,要检查下ql_prepack.opt和prepack_json_path是否正确
  354. dtools pacmerge --id APPIMG,CP --id PREPACK,SPL ${version_path}/${BUILD_TARGET}_${buildver}.pac ${version_path}/app/${ql_app_ver}.pac ${version_path}/${BUILD_TARGET}_${buildver}_merge.pac
  355. else
  356. dtools pacmerge --id APPIMG,CP ${version_path}/${BUILD_TARGET}_${buildver}.pac ${version_path}/app/${ql_app_ver}.pac ${version_path}/${BUILD_TARGET}_${buildver}_merge.pac
  357. fi
  358. dtools pacmerge --id APPIMG2,CP ${version_path}/${BUILD_TARGET}_${buildver}.pac ${version_path}/app/${ql_app2_ver}.pac ${version_path}/${BUILD_TARGET}_${buildver}_merge_APPIMG2.pac
  359. python3 ../../tools/codesize.py --map ./hex/${BUILD_TARGET}.map
  360. mv ./outlib.csv $version_path/prepack/
  361. mv ./outobj.csv $version_path/prepack/
  362. mv ./outsect.csv $version_path/prepack/
  363. sudo chmod -R 777 $version_path
  364. echo "build complete!!!"