MAKEALL 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. #!/bin/bash
  2. # Tool mainly for U-Boot Quality Assurance: build one or more board
  3. # configurations with minimal verbosity, showing only warnings and
  4. # errors.
  5. #
  6. # There are several ways to select which boards to build.
  7. #
  8. # Traditionally, architecture names (like "powerpc"), CPU family names
  9. # (like "mpc83xx") or board names can be specified on the command
  10. # line; without any arguments, MAKEALL defaults to building all Power
  11. # Architecture systems (i. e. same as for "MAKEALL powerpc").
  12. #
  13. # With the iontroduction of the board.cfg file, it has become possible
  14. # to provide additional selections. We use standard command line
  15. # options for this:
  16. #
  17. # -a or --arch : Select architecture
  18. # -c or --cpu : Select CPU family
  19. # -s or --soc : Select SoC type
  20. # -v or --vendor: Select board vendor
  21. #
  22. # Selections by these options are logically ANDed; if the same option
  23. # is used repeatedly, such selections are ORed. So "-v FOO -v BAR"
  24. # will select all configurations where the vendor is either FOO or
  25. # BAR. Any additional arguments specified on the command line are
  26. # always build additionally.
  27. #
  28. # Examples:
  29. #
  30. # - build all Power Architecture boards:
  31. #
  32. # MAKEALL -a powerpc
  33. # or
  34. # MAKEALL --arch powerpc
  35. # or
  36. # MAKEALL powerpc
  37. #
  38. # - build all PowerPC boards manufactured by vendor "esd":
  39. #
  40. # MAKEALL -a powerpc -v esd
  41. #
  42. # - build all PowerPC boards manufactured either by "keymile" or
  43. # "siemens":
  44. #
  45. # MAKEALL -a powerpc -v keymile -v siemens
  46. #
  47. # - build all Freescale boards with MPC83xx CPUs, plus all 4xx boards:
  48. #
  49. # MAKEALL -c mpc83xx -v freescale 4xx
  50. #
  51. #########################################################################
  52. SHORT_OPTS="a:c:v:s:"
  53. LONG_OPTS="arch:,cpu:,vendor:,soc:"
  54. # Option processing based on util-linux-2.13/getopt-parse.bash
  55. # Note that we use `"$@"' to let each command-line parameter expand to a
  56. # separate word. The quotes around `$@' are essential!
  57. # We need TEMP as the `eval set --' would nuke the return value of
  58. # getopt.
  59. TEMP=`getopt -o ${SHORT_OPTS} --long ${LONG_OPTS} \
  60. -n 'MAKEALL' -- "$@"`
  61. if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
  62. # Note the quotes around `$TEMP': they are essential!
  63. eval set -- "$TEMP"
  64. SELECTED=''
  65. while true ; do
  66. case "$1" in
  67. -a|--arch)
  68. # echo "Option ARCH: argument \`$2'"
  69. if [ "$opt_a" ] ; then
  70. opt_a="${opt_a%)} || \$2 == \"$2\")"
  71. else
  72. opt_a="(\$2 == \"$2\")"
  73. fi
  74. SELECTED='y'
  75. shift 2 ;;
  76. -c|--cpu)
  77. # echo "Option CPU: argument \`$2'"
  78. if [ "$opt_c" ] ; then
  79. opt_c="${opt_c%)} || \$3 == \"$2\")"
  80. else
  81. opt_c="(\$3 == \"$2\")"
  82. fi
  83. SELECTED='y'
  84. shift 2 ;;
  85. -s|--soc)
  86. # echo "Option SoC: argument \`$2'"
  87. if [ "$opt_s" ] ; then
  88. opt_s="${opt_s%)} || \$6 == \"$2\")"
  89. else
  90. opt_s="(\$6 == \"$2\")"
  91. fi
  92. SELECTED='y'
  93. shift 2 ;;
  94. -v|--vendor)
  95. # echo "Option VENDOR: argument \`$2'"
  96. if [ "$opt_v" ] ; then
  97. opt_v="${opt_v%)} || \$5 == \"$2\")"
  98. else
  99. opt_v="(\$5 == \"$2\")"
  100. fi
  101. SELECTED='y'
  102. shift 2 ;;
  103. --)
  104. shift ; break ;;
  105. *)
  106. echo "Internal error!" >&2 ; exit 1 ;;
  107. esac
  108. done
  109. # echo "Remaining arguments:"
  110. # for arg do echo '--> '"\`$arg'" ; done
  111. FILTER="\$1 !~ /^#/"
  112. [ "$opt_a" ] && FILTER="${FILTER} && $opt_a"
  113. [ "$opt_c" ] && FILTER="${FILTER} && $opt_c"
  114. [ "$opt_s" ] && FILTER="${FILTER} && $opt_s"
  115. [ "$opt_v" ] && FILTER="${FILTER} && $opt_v"
  116. if [ "$SELECTED" ] ; then
  117. SELECTED=$(awk '('"$FILTER"') { print $1 }' boards.cfg)
  118. fi
  119. #########################################################################
  120. # Print statistics when we exit
  121. trap exit 1 2 3 15
  122. trap print_stats 0
  123. # Determine number of CPU cores if no default was set
  124. : ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"}
  125. if [ "$BUILD_NCPUS" -gt 1 ]
  126. then
  127. JOBS="-j $((BUILD_NCPUS + 1))"
  128. else
  129. JOBS=""
  130. fi
  131. if [ "${CROSS_COMPILE}" ] ; then
  132. MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
  133. else
  134. MAKE=make
  135. fi
  136. if [ "${MAKEALL_LOGDIR}" ] ; then
  137. LOG_DIR=${MAKEALL_LOGDIR}
  138. else
  139. LOG_DIR="LOG"
  140. fi
  141. if [ ! "${BUILD_DIR}" ] ; then
  142. BUILD_DIR="."
  143. fi
  144. [ -d ${LOG_DIR} ] || mkdir ${LOG_DIR} || exit 1
  145. LIST=""
  146. # Keep track of the number of builds and errors
  147. ERR_CNT=0
  148. ERR_LIST=""
  149. TOTAL_CNT=0
  150. RC=0
  151. # Helper funcs for parsing boards.cfg
  152. boards_by_field()
  153. {
  154. awk \
  155. -v field="$1" \
  156. -v select="$2" \
  157. '($1 !~ /^#/ && $field == select) { print $1 }' \
  158. boards.cfg
  159. }
  160. boards_by_arch() { boards_by_field 2 "$@" ; }
  161. boards_by_cpu() { boards_by_field 3 "$@" ; }
  162. #########################################################################
  163. ## MPC5xx Systems
  164. #########################################################################
  165. LIST_5xx="$(boards_by_cpu mpc5xx)"
  166. #########################################################################
  167. ## MPC5xxx Systems
  168. #########################################################################
  169. LIST_5xxx="$(boards_by_cpu mpc5xxx)"
  170. #########################################################################
  171. ## MPC512x Systems
  172. #########################################################################
  173. LIST_512x="$(boards_by_cpu mpc512x)"
  174. #########################################################################
  175. ## MPC8xx Systems
  176. #########################################################################
  177. LIST_8xx="$(boards_by_cpu mpc8xx)"
  178. #########################################################################
  179. ## PPC4xx Systems
  180. #########################################################################
  181. LIST_4xx="$(boards_by_cpu ppc4xx)"
  182. #########################################################################
  183. ## MPC8220 Systems
  184. #########################################################################
  185. LIST_8220="$(boards_by_cpu mpc8220)"
  186. #########################################################################
  187. ## MPC824x Systems
  188. #########################################################################
  189. LIST_824x="$(boards_by_cpu mpc824x)"
  190. #########################################################################
  191. ## MPC8260 Systems (includes 8250, 8255 etc.)
  192. #########################################################################
  193. LIST_8260="$(boards_by_cpu mpc8260)"
  194. #########################################################################
  195. ## MPC83xx Systems (includes 8349, etc.)
  196. #########################################################################
  197. LIST_83xx="$(boards_by_cpu mpc83xx)"
  198. #########################################################################
  199. ## MPC85xx Systems (includes 8540, 8560 etc.)
  200. #########################################################################
  201. LIST_85xx="$(boards_by_cpu mpc85xx)"
  202. #########################################################################
  203. ## MPC86xx Systems
  204. #########################################################################
  205. LIST_86xx="$(boards_by_cpu mpc86xx)"
  206. #########################################################################
  207. ## 74xx/7xx Systems
  208. #########################################################################
  209. LIST_74xx_7xx="$(boards_by_cpu 74xx_7xx)"
  210. #########################################################################
  211. ## PowerPC groups
  212. #########################################################################
  213. LIST_TSEC=" \
  214. ${LIST_83xx} \
  215. ${LIST_85xx} \
  216. ${LIST_86xx} \
  217. "
  218. LIST_powerpc=" \
  219. ${LIST_5xx} \
  220. ${LIST_512x} \
  221. ${LIST_5xxx} \
  222. ${LIST_8xx} \
  223. ${LIST_8220} \
  224. ${LIST_824x} \
  225. ${LIST_8260} \
  226. ${LIST_83xx} \
  227. ${LIST_85xx} \
  228. ${LIST_86xx} \
  229. ${LIST_4xx} \
  230. ${LIST_74xx_7xx}\
  231. "
  232. # Alias "ppc" -> "powerpc" to not break compatibility with older scripts
  233. # still using "ppc" instead of "powerpc"
  234. LIST_ppc=" \
  235. ${LIST_powerpc} \
  236. "
  237. #########################################################################
  238. ## StrongARM Systems
  239. #########################################################################
  240. LIST_SA="$(boards_by_cpu sa1100)"
  241. #########################################################################
  242. ## ARM7 Systems
  243. #########################################################################
  244. LIST_ARM7=" \
  245. ap7 \
  246. ap720t \
  247. armadillo \
  248. B2 \
  249. ep7312 \
  250. evb4510 \
  251. impa7 \
  252. integratorap \
  253. lpc2292sodimm \
  254. modnet50 \
  255. SMN42 \
  256. "
  257. #########################################################################
  258. ## ARM9 Systems
  259. #########################################################################
  260. LIST_ARM9=" \
  261. a320evb \
  262. ap920t \
  263. ap922_XA10 \
  264. ap926ejs \
  265. ap946es \
  266. ap966 \
  267. cp920t \
  268. cp922_XA10 \
  269. cp926ejs \
  270. cp946es \
  271. cp966 \
  272. da830evm \
  273. da850evm \
  274. edb9301 \
  275. edb9302 \
  276. edb9302a \
  277. edb9307 \
  278. edb9307a \
  279. edb9312 \
  280. edb9315 \
  281. edb9315a \
  282. edminiv2 \
  283. guruplug \
  284. imx27lite \
  285. jadecpu \
  286. lpd7a400 \
  287. magnesium \
  288. mv88f6281gtw_ge \
  289. mx1ads \
  290. mx1fs2 \
  291. netstar \
  292. nhk8815 \
  293. nhk8815_onenand \
  294. omap1510inn \
  295. omap1610h2 \
  296. omap1610inn \
  297. omap5912osk \
  298. omap730p2 \
  299. openrd_base \
  300. rd6281a \
  301. sbc2410x \
  302. scb9328 \
  303. sheevaplug \
  304. smdk2400 \
  305. smdk2410 \
  306. spear300 \
  307. spear310 \
  308. spear320 \
  309. spear600 \
  310. suen3 \
  311. trab \
  312. VCMA9 \
  313. versatile \
  314. versatileab \
  315. versatilepb \
  316. voiceblue \
  317. davinci_dvevm \
  318. davinci_schmoogie \
  319. davinci_sffsdr \
  320. davinci_sonata \
  321. davinci_dm355evm \
  322. davinci_dm355leopard \
  323. davinci_dm365evm \
  324. davinci_dm6467evm \
  325. "
  326. #########################################################################
  327. ## ARM10 Systems
  328. #########################################################################
  329. LIST_ARM10=" \
  330. integratorcp \
  331. cp1026 \
  332. "
  333. #########################################################################
  334. ## ARM11 Systems
  335. #########################################################################
  336. LIST_ARM11=" \
  337. cp1136 \
  338. omap2420h4 \
  339. apollon \
  340. imx31_litekit \
  341. imx31_phycore \
  342. imx31_phycore_eet \
  343. mx31ads \
  344. mx31pdk \
  345. mx31pdk_nand \
  346. qong \
  347. smdk6400 \
  348. tnetv107x_evm \
  349. "
  350. #########################################################################
  351. ## ARMV7 Systems
  352. #########################################################################
  353. LIST_ARMV7=" \
  354. am3517_evm \
  355. ca9x4_ct_vxp \
  356. devkit8000 \
  357. igep0020 \
  358. igep0030 \
  359. mx51evk \
  360. omap3_beagle \
  361. omap3_overo \
  362. omap3_evm \
  363. omap3_pandora \
  364. omap3_sdp3430 \
  365. omap3_zoom1 \
  366. omap3_zoom2 \
  367. omap4_panda \
  368. omap4_sdp4430 \
  369. s5p_goni \
  370. smdkc100 \
  371. "
  372. #########################################################################
  373. ## AT91 Systems
  374. #########################################################################
  375. LIST_at91=" \
  376. afeb9260 \
  377. at91cap9adk \
  378. at91rm9200dk \
  379. at91rm9200ek \
  380. at91sam9260ek \
  381. at91sam9261ek \
  382. at91sam9263ek \
  383. at91sam9g10ek \
  384. at91sam9g20ek \
  385. at91sam9m10g45ek \
  386. at91sam9rlek \
  387. cmc_pu2 \
  388. CPUAT91 \
  389. CPU9260 \
  390. CPU9G20 \
  391. csb637 \
  392. eb_cpux9k2 \
  393. kb9202 \
  394. meesc \
  395. mp2usb \
  396. m501sk \
  397. otc570 \
  398. pm9261 \
  399. pm9263 \
  400. pm9g45 \
  401. SBC35_A9G20 \
  402. TNY_A9260 \
  403. TNY_A9G20 \
  404. "
  405. #########################################################################
  406. ## Xscale Systems
  407. #########################################################################
  408. LIST_pxa="$(boards_by_cpu pxa)
  409. polaris \
  410. trizepsiv \
  411. "
  412. LIST_ixp="$(boards_by_cpu ixp)
  413. pdnb3 \
  414. scpu \
  415. "
  416. #########################################################################
  417. ## ARM groups
  418. #########################################################################
  419. LIST_arm=" \
  420. ${LIST_SA} \
  421. ${LIST_ARM7} \
  422. ${LIST_ARM9} \
  423. ${LIST_ARM10} \
  424. ${LIST_ARM11} \
  425. ${LIST_ARMV7} \
  426. ${LIST_at91} \
  427. ${LIST_pxa} \
  428. ${LIST_ixp} \
  429. "
  430. #########################################################################
  431. ## MIPS Systems (default = big endian)
  432. #########################################################################
  433. LIST_mips4kc=" \
  434. incaip \
  435. qemu_mips \
  436. vct_platinum \
  437. vct_platinum_small \
  438. vct_platinum_onenand \
  439. vct_platinum_onenand_small \
  440. vct_platinumavc \
  441. vct_platinumavc_small \
  442. vct_platinumavc_onenand \
  443. vct_platinumavc_onenand_small \
  444. vct_premium \
  445. vct_premium_small \
  446. vct_premium_onenand \
  447. vct_premium_onenand_small \
  448. "
  449. LIST_mips5kc=" \
  450. purple \
  451. "
  452. LIST_au1xx0=" \
  453. dbau1000 \
  454. dbau1100 \
  455. dbau1500 \
  456. dbau1550 \
  457. dbau1550_el \
  458. gth2 \
  459. "
  460. LIST_mips=" \
  461. ${LIST_mips4kc} \
  462. ${LIST_mips5kc} \
  463. ${LIST_au1xx0} \
  464. "
  465. #########################################################################
  466. ## MIPS Systems (little endian)
  467. #########################################################################
  468. LIST_mips4kc_el=""
  469. LIST_mips5kc_el=""
  470. LIST_au1xx0_el=" \
  471. dbau1550_el \
  472. pb1000 \
  473. "
  474. LIST_mips_el=" \
  475. ${LIST_mips4kc_el} \
  476. ${LIST_mips5kc_el} \
  477. ${LIST_au1xx0_el} \
  478. "
  479. #########################################################################
  480. ## i386 Systems
  481. #########################################################################
  482. LIST_x86="$(boards_by_arch i386)
  483. sc520_eNET \
  484. "
  485. #########################################################################
  486. ## Nios-II Systems
  487. #########################################################################
  488. LIST_nios2="$(boards_by_arch nios2)
  489. nios2-generic \
  490. "
  491. #########################################################################
  492. ## MicroBlaze Systems
  493. #########################################################################
  494. LIST_microblaze="$(boards_by_arch microblaze)"
  495. #########################################################################
  496. ## ColdFire Systems
  497. #########################################################################
  498. LIST_coldfire="$(boards_by_arch m68k)
  499. astro_mcf5373l \
  500. cobra5272 \
  501. EB+MCF-EV123 \
  502. EB+MCF-EV123_internal \
  503. M52277EVB \
  504. M5235EVB \
  505. M5329AFEE \
  506. M5373EVB \
  507. M54451EVB \
  508. M54455EVB \
  509. M5475AFE \
  510. M5485AFE \
  511. "
  512. #########################################################################
  513. ## AVR32 Systems
  514. #########################################################################
  515. LIST_avr32="$(boards_by_arch avr32)"
  516. #########################################################################
  517. ## Blackfin Systems
  518. #########################################################################
  519. LIST_blackfin="$(boards_by_arch blackfin)
  520. bf527-ezkit-v2
  521. "
  522. #########################################################################
  523. ## SH Systems
  524. #########################################################################
  525. LIST_sh2=" \
  526. rsk7203 \
  527. "
  528. LIST_sh3=" \
  529. mpr2 \
  530. ms7720se \
  531. "
  532. LIST_sh4=" \
  533. ms7750se \
  534. ms7722se \
  535. MigoR \
  536. r7780mp \
  537. r2dplus \
  538. sh7763rdp \
  539. sh7785lcr \
  540. ap325rxa \
  541. espt \
  542. "
  543. LIST_sh=" \
  544. ${LIST_sh2} \
  545. ${LIST_sh3} \
  546. ${LIST_sh4} \
  547. "
  548. #########################################################################
  549. ## SPARC Systems
  550. #########################################################################
  551. LIST_sparc="$(boards_by_arch sparc)"
  552. #-----------------------------------------------------------------------
  553. build_target() {
  554. target=$1
  555. ${MAKE} distclean >/dev/null
  556. ${MAKE} -s ${target}_config
  557. ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
  558. | tee ${LOG_DIR}/$target.ERR
  559. # Check for 'make' errors
  560. if [ ${PIPESTATUS[0]} -ne 0 ] ; then
  561. RC=1
  562. fi
  563. if [ -s ${LOG_DIR}/$target.ERR ] ; then
  564. ERR_CNT=$((ERR_CNT + 1))
  565. ERR_LIST="${ERR_LIST} $target"
  566. else
  567. rm ${LOG_DIR}/$target.ERR
  568. fi
  569. TOTAL_CNT=$((TOTAL_CNT + 1))
  570. ${CROSS_COMPILE}size ${BUILD_DIR}/u-boot \
  571. | tee -a ${LOG_DIR}/$target.MAKELOG
  572. }
  573. build_targets() {
  574. for t in "$@" ; do
  575. # If a LIST_xxx var exists, use it. But avoid variable
  576. # expansion in the eval when a board name contains certain
  577. # characters that the shell interprets.
  578. case ${t} in
  579. *[-+=]*) list= ;;
  580. *) list=$(eval echo '${LIST_'$t'}') ;;
  581. esac
  582. if [ -n "${list}" ] ; then
  583. build_targets ${list}
  584. else
  585. build_target ${t}
  586. fi
  587. done
  588. }
  589. #-----------------------------------------------------------------------
  590. print_stats() {
  591. echo ""
  592. echo "--------------------- SUMMARY ----------------------------"
  593. echo "Boards compiled: ${TOTAL_CNT}"
  594. if [ ${ERR_CNT} -gt 0 ] ; then
  595. echo "Boards with warnings or errors: ${ERR_CNT} (${ERR_LIST} )"
  596. fi
  597. echo "----------------------------------------------------------"
  598. exit $RC
  599. }
  600. #-----------------------------------------------------------------------
  601. # Build target groups selected by options, plus any command line args
  602. set -- ${SELECTED} "$@"
  603. # run PowerPC by default
  604. [ $# = 0 ] && set -- powerpc
  605. build_targets "$@"