embedded-test.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819
  1. #!/bin/sh
  2. # Copyright © 2014
  3. # Waldemar Brodkorb <wbx@openadk.org>
  4. #
  5. # Provided that these terms and disclaimer and all copyright notices
  6. # are retained or reproduced in an accompanying document, permission
  7. # is granted to deal in this work without restriction, including un‐
  8. # limited rights to use, publicly perform, distribute, sell, modify,
  9. # merge, give away, or sublicence.
  10. #
  11. # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
  12. # the utmost extent permitted by applicable law, neither express nor
  13. # implied; without malicious intent or gross negligence. In no event
  14. # may a licensor, author or contributor be held liable for indirect,
  15. # direct, other damage, loss, or other issues arising in any way out
  16. # of dealing in the work, even if advised of the possibility of such
  17. # damage or existence of a defect, except proven that it results out
  18. # of said person’s immediate fault when using the work as intended.
  19. #
  20. # Alternatively, this work may be distributed under the Terms of the
  21. # General Public License, any version as published by the Free Soft‐
  22. # ware Foundation.
  23. # architecture specific notes:
  24. # mips64n32/mips64eln32 produces segfaults on boot
  25. # sheb network card get no ip
  26. adk_arch_list_uclibcng="arm armhf m68k-nommu mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc-nofpu sh sheb sparc x86 x86_64 xtensa"
  27. adk_arch_list_uclibc="arm armhf mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc-nofpu sh sheb sparc x86 x86_64"
  28. adk_arch_list_musl="arm armhf mips mipsel ppc-nofpu sh sheb x86 x86_64"
  29. adk_arch_list_glibc="aarch64 arm armhf mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc-nofpu ppc64 sh sheb sparc sparc64 x86 x86_64"
  30. br_arch_list_uclibcng="arcle arcbe bfin arm mips mipsel mips64 mips64el ppc sh sparc x86 x86_64 xtensa"
  31. br_arch_list_uclibc="arcle arcbe bfin arm mips mipsel mips64 mips64el ppc sh sparc x86 x86_64 xtensa"
  32. br_arch_list_musl="arm mips mipsel ppc sh x86 x86_64"
  33. br_arch_list_glibc="aarch64 arm mips mipsel mips64 mips64el ppc sh sparc x86 x86_64"
  34. topdir=$(pwd)
  35. tools='make git wget xz cpio tar awk sed'
  36. f=0
  37. for tool in $tools; do
  38. if ! which $tool >/dev/null; then
  39. echo "Checking if $tool is installed... failed"
  40. f=1
  41. fi
  42. done
  43. if [ $f -eq 1 ];then exit 1; fi
  44. help() {
  45. cat >&2 <<EOF
  46. Syntax: $0 -v <vendor> -l <libc> -s <source> -a <arch>
  47. Explanation:
  48. -v: vendor for buildsystem (openadk|buildroot)
  49. -l: c library to use (uclibc-ng|musl|glibc|uclibc)
  50. -a: architecture to check
  51. -u: update vendor source via git pull
  52. -s: use directory with source for C library
  53. -d: enable debug
  54. -c: clean build directory before build
  55. -n: set NTP server for test run
  56. -b: only run basic bootup test
  57. -t: run libc testsuite
  58. -p: run Linux test project (LTP)
  59. -h: help text
  60. EOF
  61. }
  62. clean=0
  63. shell=0
  64. update=0
  65. debug=0
  66. boot=0
  67. ltp=0
  68. test=0
  69. gcc=0
  70. ntp=time.fu-berlin.de
  71. while getopts "hgptumdcbn:a:v:s:l:" ch; do
  72. case $ch in
  73. b)
  74. boot=1
  75. ;;
  76. p)
  77. ltp=1
  78. ;;
  79. t)
  80. test=1
  81. ;;
  82. m)
  83. shell=1
  84. ;;
  85. g)
  86. gcc=1
  87. ;;
  88. c)
  89. clean=1
  90. ;;
  91. u)
  92. update=1
  93. ;;
  94. s)
  95. source=$OPTARG
  96. ;;
  97. d)
  98. debug=1
  99. ;;
  100. l)
  101. libc=$OPTARG
  102. ;;
  103. n)
  104. ntp=$OPTARG
  105. ;;
  106. a)
  107. archlist=$OPTARG
  108. ;;
  109. v)
  110. vendor=$OPTARG
  111. ;;
  112. h)
  113. help
  114. exit 1
  115. ;;
  116. esac
  117. done
  118. shift $((OPTIND - 1))
  119. if [ -z $vendor ];then
  120. echo "You need to provide a vendor/buildsystem"
  121. echo "Either openadk or buildroot is supported."
  122. exit 1
  123. fi
  124. if [ -z $libc ];then
  125. echo "You need to provide a C library"
  126. echo "Either uclibc-ng, musl, glibc or uClibc is supported."
  127. exit 1
  128. fi
  129. case $libc in
  130. uclibc-ng)
  131. version=1.0.0rc1
  132. gitversion=git
  133. libver=uClibc-ng-${gitversion}
  134. ;;
  135. uclibc)
  136. version=0.9.33.2
  137. gitversion=0.9.34-git
  138. libver=uClibc-${gitversion}
  139. ;;
  140. glibc)
  141. version=2.19
  142. gitversion=2.19.90
  143. libver=glibc-${gitversion}
  144. ;;
  145. musl)
  146. version=1.1.4
  147. gitversion=git
  148. libver=musl-${gitversion}
  149. ;;
  150. *)
  151. echo "c library not supported"
  152. exit 1
  153. esac
  154. if [ -z $archlist ];then
  155. if [ $vendor = "openadk" ];then
  156. case $libc in
  157. uclibc-ng)
  158. archlist=$adk_arch_list_uclibcng
  159. ;;
  160. uclibc)
  161. archlist=$adk_arch_list_uclibc
  162. ;;
  163. glibc)
  164. archlist=$adk_arch_list_glibc
  165. ;;
  166. musl)
  167. archlist=$adk_arch_list_musl
  168. ;;
  169. *)
  170. exit 1
  171. ;;
  172. esac
  173. fi
  174. if [ $vendor = "buildroot" ];then
  175. case $libc in
  176. uclibc-ng)
  177. archlist=$br_arch_list_uclibcng
  178. ;;
  179. uclibc)
  180. archlist=$br_arch_list_uclibc
  181. ;;
  182. glibc)
  183. archlist=$br_arch_list_glibc
  184. ;;
  185. musl)
  186. archlist=$br_arch_list_musl
  187. ;;
  188. *)
  189. exit 1
  190. ;;
  191. esac
  192. fi
  193. fi
  194. case $vendor in
  195. openadk)
  196. echo "Using OpenADK to check $libc on $archlist"
  197. vendor_git=http://git.openadk.org/openadk.git
  198. ;;
  199. buildroot)
  200. echo "Using buildroot to check $libc on $archlist"
  201. vendor_git=http://git.buildroot.net/git/buildroot.git
  202. ;;
  203. *)
  204. echo "Vendor $vendor not supported"
  205. exit 1
  206. ;;
  207. esac
  208. if [ ! -d $vendor ];then
  209. git clone $vendor_git
  210. if [ $? -ne 0 ];then
  211. echo "Cloning from $vendor_git failed."
  212. exit 1
  213. fi
  214. if [ "$vendor" = "buildroot" ];then
  215. wget http://downloads.uclibc-ng.org/buildroot-uClibc-ng.patch
  216. (cd buildroot && patch -p1 <../buildroot-uClibc-ng.patch)
  217. fi
  218. else
  219. if [ $update -eq 1 ];then
  220. (cd $vendor && git pull)
  221. if [ $? -ne 0 ];then
  222. echo "Updating from $vendor_git failed."
  223. exit 1
  224. fi
  225. fi
  226. fi
  227. if [ ! -z $source ];then
  228. usrc=$(mktemp -d /tmp/XXXX)
  229. cp -a $source $usrc/$libver
  230. echo "Creating source tarball $vendor/dl/${libver}.tar.xz"
  231. mkdir -p $topdir/$vendor/dl 2>/dev/null
  232. (cd $usrc && tar cJf $topdir/$vendor/dl/${libver}.tar.xz ${libver} )
  233. fi
  234. runtest() {
  235. arch=$1
  236. qemu=qemu-system-${arch}
  237. qemu_args=
  238. qemu_append="ntp_server=$ntp"
  239. if [ $debug -eq 0 ];then
  240. qemu_append="$qemu_append quiet"
  241. fi
  242. if [ $shell -eq 1 ];then
  243. qemu_append="$qemu_append shell"
  244. fi
  245. suffix=
  246. psuffix=
  247. libdir=lib
  248. march=${arch}
  249. case ${arch} in
  250. arm)
  251. cpu_arch=arm
  252. qemu_machine=vexpress-a9
  253. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118"
  254. suffix=eabi
  255. psuffix=$suffix
  256. ;;
  257. armhf)
  258. cpu_arch=arm
  259. march=arm
  260. qemu=qemu-system-${cpu_arch}
  261. qemu_machine=vexpress-a9
  262. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118"
  263. suffix=eabihf
  264. psuffix=$suffix
  265. ;;
  266. mips)
  267. cpu_arch=mips
  268. qemu_machine=malta
  269. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  270. ;;
  271. mipsel)
  272. cpu_arch=mipsel
  273. march=mips
  274. qemu_machine=malta
  275. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  276. ;;
  277. mips64)
  278. cpu_arch=mips64
  279. qemu_machine=malta
  280. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  281. suffix=abi32
  282. psuffix=o32
  283. ;;
  284. mips64n32)
  285. cpu_arch=mips64
  286. march=mips64
  287. qemu=qemu-system-${cpu_arch}
  288. qemu_machine=malta
  289. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  290. suffix=abin32
  291. psuffix=n32
  292. ;;
  293. mips64n64)
  294. cpu_arch=mips64
  295. march=mips64
  296. qemu=qemu-system-${cpu_arch}
  297. qemu_machine=malta
  298. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  299. suffix=abi64
  300. psuffix=n64
  301. ;;
  302. mips64el)
  303. cpu_arch=mips64el
  304. march=mips64
  305. qemu_machine=malta
  306. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  307. suffix=abi32
  308. psuffix=o32
  309. ;;
  310. mips64eln32)
  311. cpu_arch=mips64el
  312. march=mips64
  313. qemu=qemu-system-${cpu_arch}
  314. qemu_machine=malta
  315. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  316. suffix=abin32
  317. psuffix=n32
  318. ;;
  319. mips64eln64)
  320. cpu_arch=mips64el
  321. march=mips64
  322. qemu=qemu-system-${cpu_arch}
  323. qemu_machine=malta
  324. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  325. suffix=abi64
  326. psuffix=n64
  327. ;;
  328. ppc-nofpu)
  329. cpu_arch=ppc
  330. march=ppc
  331. qemu=qemu-system-${cpu_arch}
  332. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  333. qemu_machine=bamboo
  334. ;;
  335. ppc)
  336. cpu_arch=ppc
  337. march=ppc
  338. qemu=qemu-system-${cpu_arch}
  339. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  340. qemu_machine=mac99
  341. ;;
  342. powerpc64|ppc64)
  343. cpu_arch=ppc64
  344. qemu=qemu-system-${cpu_arch}
  345. qemu_machine=pseries
  346. ;;
  347. sh)
  348. cpu_arch=sh4
  349. qemu=qemu-system-${cpu_arch}
  350. qemu_machine=r2d
  351. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  352. ;;
  353. sheb)
  354. cpu_arch=sh4eb
  355. march=sh
  356. qemu=qemu-system-${cpu_arch}
  357. qemu_machine=r2d
  358. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  359. ;;
  360. sparc)
  361. cpu_arch=sparc
  362. qemu_machine=SS-5
  363. ;;
  364. sparc64)
  365. cpu_arch=sparc64
  366. qemu_machine=sun4u
  367. qemu_args="${qemu_args} -net nic,model=virtio -net user"
  368. ;;
  369. x86)
  370. cpu_arch=i686
  371. qemu=qemu-system-i386
  372. qemu_machine=pc
  373. qemu_args="${qemu_args} -cpu pentium2"
  374. ;;
  375. x86_64)
  376. cpu_arch=x86_64
  377. qemu_machine=pc
  378. libdir=lib64
  379. ;;
  380. x86_64_x32)
  381. cpu_arch=x86_64
  382. qemu=qemu-system-${cpu_arch}
  383. qemu_machine=pc
  384. libdir=libx32
  385. suffix=x32
  386. ;;
  387. xtensa)
  388. cpu_arch=xtensa
  389. qemu=qemu-system-${cpu_arch}
  390. qemu_machine=lx60
  391. qemu_args="${qemu_args} -cpu dc232b"
  392. ;;
  393. *)
  394. echo "architecture ${arch} not supported"; exit 1;;
  395. esac
  396. if ! which $qemu >/dev/null; then
  397. echo "Checking if $qemu is installed... failed"
  398. exit 1
  399. fi
  400. qemuver=$(${qemu} -version|awk '{ print $4 }')
  401. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  402. echo "Your qemu version is too old. Please update to 2.1 or greater"
  403. exit 1
  404. fi
  405. case $libc in
  406. uclibc-ng)
  407. prefix=uclibc
  408. ;;
  409. glibc)
  410. prefix=gnu
  411. ;;
  412. *)
  413. prefix=$libc
  414. ;;
  415. esac
  416. cross=${cpu_arch}-${vendor}-linux-${prefix}${suffix}
  417. if [ -z $psuffix ];then
  418. TCPATH=${topdir}/${vendor}/toolchain_qemu-${march}_${libc}_${cpu_arch}
  419. else
  420. TCPATH=${topdir}/${vendor}/toolchain_qemu-${march}_${libc}_${cpu_arch}_${psuffix}
  421. fi
  422. export PATH="${TCPATH}/usr/bin:$PATH"
  423. if ! which ${cross}-gcc >/dev/null; then
  424. echo "Checking if ${cross}-gcc is installed... failed"
  425. exit 1
  426. fi
  427. echo "Starting test for ${arch}"
  428. echo "Generating root filesystem for test run"
  429. root=$(mktemp -d /tmp/XXXX)
  430. if [ ! -f openadk/firmware/qemu-${march}_${libc}/qemu-${march}-${libc}-initramfsarchive.tar.gz ];then
  431. echo "No root filesystem available for architecture ${arch}"
  432. exit 1
  433. fi
  434. tar -xf openadk/firmware/qemu-${march}_${libc}/qemu-${march}-${libc}-initramfsarchive.tar.gz -C $root
  435. if [ $2 -eq 0 ];then
  436. cat > ${root}/run.sh << EOF
  437. #!/bin/sh
  438. uname -a
  439. rdate -n \$ntp_server
  440. file /bin/busybox
  441. for i in \$(ls /lib/*.so|grep -v libgcc);do
  442. size \$i
  443. done
  444. exit
  445. EOF
  446. fi
  447. if [ $2 -eq 1 ];then
  448. cat > ${root}/run.sh << EOF
  449. #!/bin/sh
  450. uname -a
  451. rdate -n \$ntp_server
  452. /opt/ltp/runltp
  453. exit
  454. EOF
  455. fi
  456. if [ $2 -eq 2 ];then
  457. case $libc in
  458. uclibc-ng|uclibc)
  459. cat > ${root}/run.sh << EOF
  460. #!/bin/sh
  461. uname -a
  462. rdate -n \$ntp_server
  463. cd /opt/$libc/test
  464. CROSS_COMPILE=": ||" make UCLIBC_ONLY=y -k run
  465. exit
  466. EOF
  467. ;;
  468. musl|glibc)
  469. cat > ${root}/run.sh << EOF
  470. #!/bin/sh
  471. uname -a
  472. rdate -n \$ntp_server
  473. cd /opt/libc-test
  474. make run
  475. exit
  476. EOF
  477. ;;
  478. esac
  479. fi
  480. chmod u+x ${root}/run.sh
  481. kernel=openadk/firmware/qemu-${march}_${libc}/qemu-${march}-initramfsarchive-kernel
  482. echo "Creating initramfs filesystem"
  483. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  484. rm -rf $root
  485. echo "Now running the tests in qemu for architecture ${arch}"
  486. echo "${qemu} -M ${qemu_machine} ${qemu_args} -append ${qemu_append} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic -initrd initramfs.${arch}"
  487. ${qemu} -M ${qemu_machine} ${qemu_args} -append "${qemu_append}" -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic -initrd initramfs.${arch} | tee REPORT.${arch}.${libc}
  488. if [ $? -eq 0 ];then
  489. echo "Test for ${arch} finished. See REPORT.${arch}.${libc}"
  490. echo
  491. else
  492. echo "Test failed for ${arch} with ${libc}."
  493. echo
  494. fi
  495. }
  496. create_buildroot_defconfig_arcle() {
  497. cat > configs/arcle_defconfig << EOD
  498. BR2_arcle=y
  499. BR2_TOOLCHAIN_BUILDROOT_UCLIBC_NG=y
  500. BR2_KERNEL_HEADERS_3_15=y
  501. BR2_DEFAULT_KERNEL_HEADERS="3.15.6"
  502. BR2_BINUTILS_VERSION_2_24=y
  503. BR2_GCC_VERSION_4_8_X=y
  504. BR2_TOOLCHAIN_HAS_THREADS=y
  505. EOD
  506. }
  507. create_buildroot_defconfig_arcbe() {
  508. cat > configs/arcbe_defconfig << EOD
  509. BR2_arcle=y
  510. BR2_TOOLCHAIN_BUILDROOT_UCLIBC_NG=y
  511. BR2_KERNEL_HEADERS_3_15=y
  512. BR2_DEFAULT_KERNEL_HEADERS="3.15.6"
  513. BR2_BINUTILS_VERSION_2_24=y
  514. BR2_GCC_VERSION_4_8_X=y
  515. BR2_TOOLCHAIN_HAS_THREADS=y
  516. EOD
  517. }
  518. create_buildroot_defconfig_bfin() {
  519. cat > configs/bfin_defconfig << EOD
  520. BR2_bfin=y
  521. BR2_BINFMT_FDPIC=y
  522. BR2_bf609=y
  523. BR2_TOOLCHAIN_BUILDROOT_UCLIBC_NG=y
  524. BR2_KERNEL_HEADERS_3_15=y
  525. BR2_DEFAULT_KERNEL_HEADERS="3.15.6"
  526. BR2_BINUTILS_VERSION_2_22=y
  527. BR2_GCC_VERSION_4_5_X=y
  528. BR2_TOOLCHAIN_HAS_THREADS=y
  529. EOD
  530. }
  531. build_buildroot() {
  532. cd buildroot
  533. case $1 in
  534. arcle)
  535. create_buildroot_defconfig_arcle
  536. make arcle_defconfig
  537. make clean all
  538. ;;
  539. arcbe)
  540. create_buildroot_defconfig_arcbe
  541. make arcbe_defconfig
  542. make clean all
  543. ;;
  544. arm)
  545. make qemu_arm_vexpress_defconfig
  546. make clean all
  547. ;;
  548. bfin)
  549. create_buildroot_defconfig_bfin
  550. make bfin_defconfig
  551. make clean all
  552. ;;
  553. mips)
  554. make qemu_mips_malta_defconfig
  555. make clean all
  556. ;;
  557. mipsel)
  558. make qemu_mipsel_malta_defconfig
  559. make clean all
  560. ;;
  561. mips64)
  562. make qemu_mips64_malta_defconfig
  563. make clean all
  564. ;;
  565. mips64el)
  566. make qemu_mips64el_malta_defconfig
  567. make clean all
  568. ;;
  569. ppc)
  570. make qemu_ppc_mpc8544ds_defconfig
  571. make clean all
  572. ;;
  573. sh)
  574. make qemu_sh4_r2d_defconfig
  575. make clean all
  576. ;;
  577. sparc)
  578. make qemu_sparc_ss10_defconfig
  579. make clean all
  580. ;;
  581. x86)
  582. make qemu_x86_defconfig
  583. make clean all
  584. ;;
  585. x86_64)
  586. make qemu_x86_64_defconfig
  587. make clean all
  588. ;;
  589. xtensa)
  590. make qemu_xtensa_lx60_defconfig
  591. make clean all
  592. ;;
  593. *)
  594. echo "architecture not supported in buildroot"
  595. exit 1
  596. ;;
  597. esac
  598. if [ $? -ne 0 ];then
  599. echo "build failed"
  600. exit 1
  601. fi
  602. cd ..
  603. }
  604. build_openadk() {
  605. cd openadk
  606. # start with a clean dir
  607. if [ $clean -eq 1 ];then
  608. make cleandir
  609. fi
  610. DEFAULT="ADK_TARGET_LIBC=$libc ADK_TARGET_FS=initramfsarchive ADK_TARGET_COLLECTION=test"
  611. if [ $debug -eq 1 ];then
  612. DEFAULT="$DEFAULT VERBOSE=1"
  613. fi
  614. if [ ! -z $source ];then
  615. DEFAULT="$DEFAULT ADK_NO_CHECKSUM=y ADK_LIBC_GIT=y"
  616. fi
  617. if [ $2 -eq 0 ];then
  618. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  619. fi
  620. if [ $2 -eq 1 ];then
  621. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  622. fi
  623. if [ $2 -eq 2 ];then
  624. case $libc in
  625. uclibc-ng)
  626. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  627. ;;
  628. uclibc)
  629. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_TESTSUITE=y"
  630. ;;
  631. glibc)
  632. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  633. ;;
  634. musl)
  635. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  636. ;;
  637. *)
  638. echo "test suite not available"
  639. exit 1
  640. ;;
  641. esac
  642. make package=$libc clean
  643. fi
  644. if [ $2 -eq 3 ];then
  645. case $libc in
  646. uclibc-ng)
  647. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  648. ;;
  649. uclibc)
  650. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NATIVE=y"
  651. ;;
  652. musl)
  653. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  654. ;;
  655. glibc)
  656. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  657. ;;
  658. *)
  659. echo "native build not available"
  660. exit 1
  661. ;;
  662. esac
  663. fi
  664. case $1 in
  665. aarch64)
  666. make $DEFAULT ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=arm-fm defconfig all
  667. ;;
  668. arm)
  669. make $DEFAULT ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_ABI=eabi ADK_TARGET_ENDIAN=little defconfig all
  670. ;;
  671. armhf)
  672. make $DEFAULT ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_ABI=eabihf ADK_TARGET_ENDIAN=little defconfig all
  673. ;;
  674. m68k-nommu)
  675. make $DEFAULT ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k defconfig all
  676. ;;
  677. mips)
  678. make $DEFAULT ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big defconfig all
  679. ;;
  680. mipsel)
  681. make $DEFAULT ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little defconfig all
  682. ;;
  683. mips64)
  684. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32 defconfig all
  685. ;;
  686. mips64n32)
  687. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32 defconfig all
  688. ;;
  689. mips64n64)
  690. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64 defconfig all
  691. ;;
  692. mips64el)
  693. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32 defconfig all
  694. ;;
  695. mips64eln32)
  696. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32 defconfig all
  697. ;;
  698. mips64eln64)
  699. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64 defconfig all
  700. ;;
  701. ppc-nofpu)
  702. make $DEFAULT ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc defconfig all
  703. ;;
  704. sh)
  705. make $DEFAULT ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little defconfig all
  706. ;;
  707. sheb)
  708. make $DEFAULT ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big defconfig all
  709. ;;
  710. *)
  711. make $DEFAULT ADK_TARGET_ARCH=$1 ADK_TARGET_SYSTEM=qemu-$1 defconfig all
  712. ;;
  713. esac
  714. if [ $? -ne 0 ];then
  715. echo "build failed"
  716. exit 1
  717. fi
  718. cd ..
  719. }
  720. echo "compiling base system and toolchain"
  721. if [ "$vendor" = "buildroot" ];then
  722. for arch in ${archlist}; do
  723. build_buildroot $arch 0
  724. done
  725. fi
  726. if [ "$vendor" = "openadk" ];then
  727. for arch in ${archlist}; do
  728. build_openadk $arch 99
  729. if [ $boot -eq 1 ];then
  730. case $arch in
  731. aarch64|m68k-nommu|ppc|sheb|mips64eln32|mips64n32)
  732. echo "runtime tests disabled for $arch."
  733. ;;
  734. *)
  735. build_openadk $arch 0
  736. runtest $arch 0
  737. ;;
  738. esac
  739. fi
  740. if [ $ltp -eq 1 ];then
  741. case $arch in
  742. aarch64|m68k-nommu|ppc|sheb|mips64eln32|mips64n32)
  743. echo "runtime tests disabled for $arch."
  744. ;;
  745. *)
  746. build_openadk $arch 1
  747. runtest $arch 1
  748. ;;
  749. esac
  750. fi
  751. if [ $test -eq 1 ];then
  752. case $arch in
  753. aarch64|m68k-nommu|ppc|sheb|mips64eln32|mips64n32)
  754. echo "runtime tests disabled for $arch."
  755. ;;
  756. *)
  757. build_openadk $arch 2
  758. runtest $arch 2
  759. ;;
  760. esac
  761. fi
  762. if [ $gcc -eq 1 ];then
  763. case $arch in
  764. aarch64|m68k-nommu|ppc|sheb|mips64eln32|mips64n32)
  765. echo "runtime tests disabled for $arch."
  766. ;;
  767. *)
  768. build_openadk $arch 3
  769. runtest $arch 3
  770. ;;
  771. esac
  772. fi
  773. done
  774. fi
  775. echo "All tests finished."
  776. exit 0