MAKEALL 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. #!/bin/bash
  2. # Print statistics when we exit
  3. trap exit 1 2 3 15
  4. trap print_stats 0
  5. # Determine number of CPU cores if no default was set
  6. : ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"}
  7. if [ "$BUILD_NCPUS" -gt 1 ]
  8. then
  9. JOBS="-j $((BUILD_NCPUS + 1))"
  10. else
  11. JOBS=""
  12. fi
  13. if [ "${CROSS_COMPILE}" ] ; then
  14. MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
  15. else
  16. MAKE=make
  17. fi
  18. if [ "${MAKEALL_LOGDIR}" ] ; then
  19. LOG_DIR=${MAKEALL_LOGDIR}
  20. else
  21. LOG_DIR="LOG"
  22. fi
  23. if [ ! "${BUILD_DIR}" ] ; then
  24. BUILD_DIR="."
  25. fi
  26. [ -d ${LOG_DIR} ] || mkdir ${LOG_DIR} || exit 1
  27. LIST=""
  28. # Keep track of the number of builds and errors
  29. ERR_CNT=0
  30. ERR_LIST=""
  31. TOTAL_CNT=0
  32. RC=0
  33. # Helper funcs for parsing boards.cfg
  34. boards_by_field()
  35. {
  36. awk \
  37. -v field="$1" \
  38. -v select="$2" \
  39. '($1 !~ /^#/ && $field == select) { print $1 }' \
  40. boards.cfg
  41. }
  42. boards_by_arch() { boards_by_field 2 "$@" ; }
  43. boards_by_cpu() { boards_by_field 3 "$@" ; }
  44. #########################################################################
  45. ## MPC5xx Systems
  46. #########################################################################
  47. LIST_5xx="$(boards_by_cpu mpc5xx)"
  48. #########################################################################
  49. ## MPC5xxx Systems
  50. #########################################################################
  51. LIST_5xxx="$(boards_by_cpu mpc5xxx)"
  52. #########################################################################
  53. ## MPC512x Systems
  54. #########################################################################
  55. LIST_512x="$(boards_by_cpu mpc512x)"
  56. #########################################################################
  57. ## MPC8xx Systems
  58. #########################################################################
  59. LIST_8xx="$(boards_by_cpu mpc8xx)"
  60. #########################################################################
  61. ## PPC4xx Systems
  62. #########################################################################
  63. LIST_4xx="$(boards_by_cpu ppc4xx)"
  64. #########################################################################
  65. ## MPC8220 Systems
  66. #########################################################################
  67. LIST_8220="$(boards_by_cpu mpc8220)"
  68. #########################################################################
  69. ## MPC824x Systems
  70. #########################################################################
  71. LIST_824x="$(boards_by_cpu mpc824x)"
  72. #########################################################################
  73. ## MPC8260 Systems (includes 8250, 8255 etc.)
  74. #########################################################################
  75. LIST_8260="$(boards_by_cpu mpc8260)"
  76. #########################################################################
  77. ## MPC83xx Systems (includes 8349, etc.)
  78. #########################################################################
  79. LIST_83xx="$(boards_by_cpu mpc83xx)"
  80. #########################################################################
  81. ## MPC85xx Systems (includes 8540, 8560 etc.)
  82. #########################################################################
  83. LIST_85xx="$(boards_by_cpu mpc85xx)"
  84. #########################################################################
  85. ## MPC86xx Systems
  86. #########################################################################
  87. LIST_86xx="$(boards_by_cpu mpc86xx)"
  88. #########################################################################
  89. ## 74xx/7xx Systems
  90. #########################################################################
  91. LIST_74xx_7xx="$(boards_by_cpu 74xx_7xx)"
  92. #########################################################################
  93. ## PowerPC groups
  94. #########################################################################
  95. LIST_TSEC=" \
  96. ${LIST_83xx} \
  97. ${LIST_85xx} \
  98. ${LIST_86xx} \
  99. "
  100. LIST_powerpc=" \
  101. ${LIST_5xx} \
  102. ${LIST_512x} \
  103. ${LIST_5xxx} \
  104. ${LIST_8xx} \
  105. ${LIST_8220} \
  106. ${LIST_824x} \
  107. ${LIST_8260} \
  108. ${LIST_83xx} \
  109. ${LIST_85xx} \
  110. ${LIST_86xx} \
  111. ${LIST_4xx} \
  112. ${LIST_74xx_7xx}\
  113. "
  114. # Alias "ppc" -> "powerpc" to not break compatibility with older scripts
  115. # still using "ppc" instead of "powerpc"
  116. LIST_ppc=" \
  117. ${LIST_powerpc} \
  118. "
  119. #########################################################################
  120. ## StrongARM Systems
  121. #########################################################################
  122. LIST_SA="$(boards_by_cpu sa1100)"
  123. #########################################################################
  124. ## ARM7 Systems
  125. #########################################################################
  126. LIST_ARM7=" \
  127. ap7 \
  128. ap720t \
  129. armadillo \
  130. B2 \
  131. ep7312 \
  132. evb4510 \
  133. impa7 \
  134. integratorap \
  135. lpc2292sodimm \
  136. modnet50 \
  137. SMN42 \
  138. "
  139. #########################################################################
  140. ## ARM9 Systems
  141. #########################################################################
  142. LIST_ARM9=" \
  143. a320evb \
  144. ap920t \
  145. ap922_XA10 \
  146. ap926ejs \
  147. ap946es \
  148. ap966 \
  149. cp920t \
  150. cp922_XA10 \
  151. cp926ejs \
  152. cp946es \
  153. cp966 \
  154. da830evm \
  155. da850evm \
  156. edb9301 \
  157. edb9302 \
  158. edb9302a \
  159. edb9307 \
  160. edb9307a \
  161. edb9312 \
  162. edb9315 \
  163. edb9315a \
  164. edminiv2 \
  165. guruplug \
  166. imx27lite \
  167. jadecpu \
  168. lpd7a400 \
  169. magnesium \
  170. mv88f6281gtw_ge \
  171. mx1ads \
  172. mx1fs2 \
  173. netstar \
  174. nhk8815 \
  175. nhk8815_onenand \
  176. omap1510inn \
  177. omap1610h2 \
  178. omap1610inn \
  179. omap5912osk \
  180. omap730p2 \
  181. openrd_base \
  182. rd6281a \
  183. sbc2410x \
  184. scb9328 \
  185. sheevaplug \
  186. smdk2400 \
  187. smdk2410 \
  188. spear300 \
  189. spear310 \
  190. spear320 \
  191. spear600 \
  192. suen3 \
  193. trab \
  194. VCMA9 \
  195. versatile \
  196. versatileab \
  197. versatilepb \
  198. voiceblue \
  199. davinci_dvevm \
  200. davinci_schmoogie \
  201. davinci_sffsdr \
  202. davinci_sonata \
  203. davinci_dm355evm \
  204. davinci_dm355leopard \
  205. davinci_dm365evm \
  206. davinci_dm6467evm \
  207. "
  208. #########################################################################
  209. ## ARM10 Systems
  210. #########################################################################
  211. LIST_ARM10=" \
  212. integratorcp \
  213. cp1026 \
  214. "
  215. #########################################################################
  216. ## ARM11 Systems
  217. #########################################################################
  218. LIST_ARM11=" \
  219. cp1136 \
  220. omap2420h4 \
  221. apollon \
  222. imx31_litekit \
  223. imx31_phycore \
  224. imx31_phycore_eet \
  225. mx31ads \
  226. mx31pdk \
  227. mx31pdk_nand \
  228. qong \
  229. smdk6400 \
  230. tnetv107x_evm \
  231. "
  232. #########################################################################
  233. ## ARMV7 Systems
  234. #########################################################################
  235. LIST_ARMV7=" \
  236. am3517_evm \
  237. ca9x4_ct_vxp \
  238. devkit8000 \
  239. igep0020 \
  240. igep0030 \
  241. mx51evk \
  242. omap3_beagle \
  243. omap3_overo \
  244. omap3_evm \
  245. omap3_pandora \
  246. omap3_sdp3430 \
  247. omap3_zoom1 \
  248. omap3_zoom2 \
  249. omap4_panda \
  250. omap4_sdp4430 \
  251. s5p_goni \
  252. smdkc100 \
  253. "
  254. #########################################################################
  255. ## AT91 Systems
  256. #########################################################################
  257. LIST_at91=" \
  258. afeb9260 \
  259. at91cap9adk \
  260. at91rm9200dk \
  261. at91rm9200ek \
  262. at91sam9260ek \
  263. at91sam9261ek \
  264. at91sam9263ek \
  265. at91sam9g10ek \
  266. at91sam9g20ek \
  267. at91sam9m10g45ek \
  268. at91sam9rlek \
  269. cmc_pu2 \
  270. CPUAT91 \
  271. CPU9260 \
  272. CPU9G20 \
  273. csb637 \
  274. eb_cpux9k2 \
  275. kb9202 \
  276. meesc \
  277. mp2usb \
  278. m501sk \
  279. otc570 \
  280. pm9261 \
  281. pm9263 \
  282. pm9g45 \
  283. SBC35_A9G20 \
  284. TNY_A9260 \
  285. TNY_A9G20 \
  286. "
  287. #########################################################################
  288. ## Xscale Systems
  289. #########################################################################
  290. LIST_pxa="$(boards_by_cpu pxa)
  291. polaris \
  292. trizepsiv \
  293. vpac270_nor \
  294. vpac270_onenand \
  295. "
  296. LIST_ixp="$(boards_by_cpu ixp)
  297. pdnb3 \
  298. scpu \
  299. "
  300. #########################################################################
  301. ## ARM groups
  302. #########################################################################
  303. LIST_arm=" \
  304. ${LIST_SA} \
  305. ${LIST_ARM7} \
  306. ${LIST_ARM9} \
  307. ${LIST_ARM10} \
  308. ${LIST_ARM11} \
  309. ${LIST_ARMV7} \
  310. ${LIST_at91} \
  311. ${LIST_pxa} \
  312. ${LIST_ixp} \
  313. "
  314. #########################################################################
  315. ## MIPS Systems (default = big endian)
  316. #########################################################################
  317. LIST_mips4kc=" \
  318. incaip \
  319. qemu_mips \
  320. vct_platinum \
  321. vct_platinum_small \
  322. vct_platinum_onenand \
  323. vct_platinum_onenand_small \
  324. vct_platinumavc \
  325. vct_platinumavc_small \
  326. vct_platinumavc_onenand \
  327. vct_platinumavc_onenand_small \
  328. vct_premium \
  329. vct_premium_small \
  330. vct_premium_onenand \
  331. vct_premium_onenand_small \
  332. "
  333. LIST_mips5kc=" \
  334. purple \
  335. "
  336. LIST_au1xx0=" \
  337. dbau1000 \
  338. dbau1100 \
  339. dbau1500 \
  340. dbau1550 \
  341. dbau1550_el \
  342. gth2 \
  343. "
  344. LIST_mips=" \
  345. ${LIST_mips4kc} \
  346. ${LIST_mips5kc} \
  347. ${LIST_au1xx0} \
  348. "
  349. #########################################################################
  350. ## MIPS Systems (little endian)
  351. #########################################################################
  352. LIST_mips4kc_el=""
  353. LIST_mips5kc_el=""
  354. LIST_au1xx0_el=" \
  355. dbau1550_el \
  356. pb1000 \
  357. "
  358. LIST_mips_el=" \
  359. ${LIST_mips4kc_el} \
  360. ${LIST_mips5kc_el} \
  361. ${LIST_au1xx0_el} \
  362. "
  363. #########################################################################
  364. ## i386 Systems
  365. #########################################################################
  366. LIST_x86="$(boards_by_arch i386)
  367. sc520_eNET \
  368. "
  369. #########################################################################
  370. ## Nios-II Systems
  371. #########################################################################
  372. LIST_nios2="$(boards_by_arch nios2)
  373. nios2-generic \
  374. "
  375. #########################################################################
  376. ## MicroBlaze Systems
  377. #########################################################################
  378. LIST_microblaze="$(boards_by_arch microblaze)"
  379. #########################################################################
  380. ## ColdFire Systems
  381. #########################################################################
  382. LIST_coldfire="$(boards_by_arch m68k)
  383. astro_mcf5373l \
  384. cobra5272 \
  385. EB+MCF-EV123 \
  386. EB+MCF-EV123_internal \
  387. M52277EVB \
  388. M5235EVB \
  389. M5329AFEE \
  390. M5373EVB \
  391. M54451EVB \
  392. M54455EVB \
  393. M5475AFE \
  394. M5485AFE \
  395. "
  396. #########################################################################
  397. ## AVR32 Systems
  398. #########################################################################
  399. LIST_avr32="$(boards_by_arch avr32)"
  400. #########################################################################
  401. ## Blackfin Systems
  402. #########################################################################
  403. LIST_blackfin="$(boards_by_arch blackfin)
  404. bf527-ezkit-v2
  405. "
  406. #########################################################################
  407. ## SH Systems
  408. #########################################################################
  409. LIST_sh2=" \
  410. rsk7203 \
  411. "
  412. LIST_sh3=" \
  413. mpr2 \
  414. ms7720se \
  415. "
  416. LIST_sh4=" \
  417. ms7750se \
  418. ms7722se \
  419. MigoR \
  420. r7780mp \
  421. r2dplus \
  422. sh7763rdp \
  423. sh7785lcr \
  424. ap325rxa \
  425. espt \
  426. "
  427. LIST_sh=" \
  428. ${LIST_sh2} \
  429. ${LIST_sh3} \
  430. ${LIST_sh4} \
  431. "
  432. #########################################################################
  433. ## SPARC Systems
  434. #########################################################################
  435. LIST_sparc="$(boards_by_arch sparc)"
  436. #-----------------------------------------------------------------------
  437. build_target() {
  438. target=$1
  439. ${MAKE} distclean >/dev/null
  440. ${MAKE} -s ${target}_config
  441. ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
  442. | tee ${LOG_DIR}/$target.ERR
  443. # Check for 'make' errors
  444. if [ ${PIPESTATUS[0]} -ne 0 ] ; then
  445. RC=1
  446. fi
  447. if [ -s ${LOG_DIR}/$target.ERR ] ; then
  448. ERR_CNT=$((ERR_CNT + 1))
  449. ERR_LIST="${ERR_LIST} $target"
  450. else
  451. rm ${LOG_DIR}/$target.ERR
  452. fi
  453. TOTAL_CNT=$((TOTAL_CNT + 1))
  454. ${CROSS_COMPILE}size ${BUILD_DIR}/u-boot \
  455. | tee -a ${LOG_DIR}/$target.MAKELOG
  456. }
  457. build_targets() {
  458. for t in "$@" ; do
  459. # If a LIST_xxx var exists, use it. But avoid variable
  460. # expansion in the eval when a board name contains certain
  461. # characters that the shell interprets.
  462. case ${t} in
  463. *[-+=]*) list= ;;
  464. *) list=$(eval echo '${LIST_'$t'}') ;;
  465. esac
  466. if [ -n "${list}" ] ; then
  467. build_targets ${list}
  468. else
  469. build_target ${t}
  470. fi
  471. done
  472. }
  473. #-----------------------------------------------------------------------
  474. print_stats() {
  475. echo ""
  476. echo "--------------------- SUMMARY ----------------------------"
  477. echo "Boards compiled: ${TOTAL_CNT}"
  478. if [ ${ERR_CNT} -gt 0 ] ; then
  479. echo "Boards with warnings or errors: ${ERR_CNT} (${ERR_LIST} )"
  480. fi
  481. echo "----------------------------------------------------------"
  482. exit $RC
  483. }
  484. #-----------------------------------------------------------------------
  485. #----- for now, just run PowerPC by default -----
  486. [ $# = 0 ] && set -- powerpc
  487. build_targets "$@"