test_build_sample.sh 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. #!/bin/bash
  2. ########################################################
  3. # establish build environment and build options value
  4. # Please modify the following items according your build environment
  5. ARCH=arm
  6. if [ ! -z $1 ]; then
  7. ARCH=$1
  8. fi
  9. export AQROOT=`pwd`
  10. if [ -z $VIVANTE_SDK_DIR ]; then
  11. if [ ! -d "$AQROOT/sdk/drivers" ] || [ ! -d "$AQROOT/sdk/include" ]; then
  12. echo
  13. echo "ERROR: not found Vivante driver SDK."
  14. echo "Vivante driver SDK includes driver libraries and driver header files exported."
  15. echo
  16. echo "By default, VIVANTE_SDK_DIR=$AQROOT/sdk"
  17. echo "Your can just copy Vivante driver SDK to $AQROOT/sdk to make sure the tool-chain can find it, "
  18. echo "or export VIVANTE_SDK_DIR enironment varaible which directed to Vivante dirver SDK."
  19. echo "for example,"
  20. echo "export VIVANTE_SDK_DIR=$AQROOT/../DRIVER/build/sdk"
  21. echo
  22. echo
  23. exit
  24. fi
  25. fi
  26. export SDK_DIR=$AQROOT/build/sdk
  27. case "$ARCH" in
  28. arm)
  29. export ARCH_TYPE=$ARCH
  30. export CPU_TYPE=arm920
  31. export DFB_DIR=/home/software/Linux/dfb
  32. export CROSS_COMPILE=arm-none-linux-gnueabi-
  33. export TOOLCHAIN=/home/software/Linux/toolchain
  34. export LIB_DIR=$TOOLCHAIN/arm-none-linux-gnueabi/libc/usr/lib
  35. ;;
  36. arm-fsl)
  37. ARCH=arm
  38. export ARCH_TYPE=$ARCH
  39. export CPU_TYPE=cortex-a9
  40. export CPU_ARCH=armv7-a
  41. export KERNEL_DIR=/home/software/Linux/freescale/linux-3.0.35-c27cb385-20130116
  42. export CROSS_COMPILE=arm-fsl-linux-gnueabi-
  43. export TOOLCHAIN=/home/software/Linux/freescale/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain
  44. # export LIB_DIR=$TOOLCHAIN/arm-fsl-linux-gnueabi/libc/usr/lib
  45. ;;
  46. arm-yocto)
  47. ARCH=arm
  48. export ARCH_TYPE=$ARCH
  49. export CPU_TYPE=cortex-a9
  50. export CPU_ARCH=armv7-a
  51. export KERNEL_DIR=/home/software/Linux/YOCTO/L3.10.9_1.0.0_alpha_20131009
  52. export TOOLCHAIN=/home/software/Linux/YOCTO/poky/sysroots/x86_64-pokysdk-linux/usr
  53. export PATH=$TOOLCHAIN/bin:$TOOLCHAIN/bin/cortexa9hf-vfp-neon-poky-linux-gnueabi:$PATH
  54. export CROSS_COMPILE=arm-poky-linux-gnueabi-
  55. export ROOTFS=/home/software/Linux/YOCTO/x11-20130912221643
  56. export ROOTFS_USR=$ROOTFS/usr
  57. export CFLAGS="-D__ARM_PCS_VFP --sysroot=$ROOTFS"
  58. export LDFLAGS="--sysroot=$ROOTFS"
  59. export PFLAGS="--sysroot=$ROOTFS"
  60. export FPU=vfp
  61. export FLOAT_ABI=hard
  62. BUILD_GL4_DRI_BUILD=1
  63. ;;
  64. arm-his-eabi)
  65. ARCH=arm
  66. export ARCH_TYPE=$ARCH
  67. export CPU_TYPE=arm920
  68. export CROSS_COMPILE=arm-hisi_vfpv3d16-linux-
  69. export TOOLCHAIN=/opt/hisi-linux/x86-arm/gcc-4.4.0-uClibc-0.9.30.2-softvfpv3
  70. export LIB_DIR=/opt/hisi-linux/x86-arm/gcc-4.4.0-uClibc-0.9.30.2-softvfpv3/usr/lib
  71. ;;
  72. arm-his-oabi)
  73. ARCH=arm
  74. export ARCH_TYPE=$ARCH
  75. export CPU_TYPE=arm920
  76. export CROSS_COMPILE=arm-hismall-linux-
  77. export TOOLCHAIN=/opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28
  78. export LIB_DIR=/opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/usr/lib
  79. ;;
  80. unicore)
  81. export ARCH_TYPE=unicore
  82. export CPU_TYPE=0
  83. export CPU_ARCH=0
  84. export CROSS_COMPILE=unicore32-linux-
  85. export TOOLCHAIN=/home/software/Linux/uc4-1.0-beta-hard-RHELAS5
  86. export LIB_DIR=$TOOLCHAIN/unicore32-linux/lib
  87. ;;
  88. tensilica)
  89. export ARCH_TYPE=$ARCH
  90. export CPU_TYPE=0
  91. export CPU_ARCH=0
  92. CROSS_COMPILE=xtensa_venus-linux-
  93. TOOLCHAIN=/home/software/Linux/xtensa/staging_dir/usr
  94. LIB_DIR=$TOOLCHAIN/lib
  95. ;;
  96. ppc-be)
  97. export ARCH_TYPE=powerpc
  98. export CPU_TYPE=440
  99. # set ENNDIANNESS to build application with little-endian
  100. #export ENDIANNESS=-mlittle-endian
  101. export CROSS_COMPILE=ppc_4xx-
  102. export TOOLCHAIN=/home/software/eldk/usr
  103. export DEPMOD=$TOOLCHAIN/bin/depmod.pl
  104. export LIB_DIR=/home/software/eldk/ppc_4xx/lib
  105. ;;
  106. mips-le)
  107. export ARCH_TYPE=$ARCH
  108. export CPU_TYPE=0
  109. export ARCH_TYPE=mips
  110. export CPU_ARCH=34kf
  111. #
  112. # to build driver with little endin
  113. #
  114. export ENDIANNESS=-mel
  115. export CROSS_COMPILE=mips-linux-gnu-
  116. export TOOLCHAIN=/home/software/Linux/mips-4.4-5
  117. export LIB_DIR=$TOOLCHAIN/mips-linux-gnu/libc/el/usr/lib
  118. ;;
  119. mips-be)
  120. export ARCH_TYPE=$ARCH
  121. export CPU_TYPE=0
  122. export ARCH_TYPE=mips
  123. export CPU_ARCH=34kf
  124. #
  125. # to build driver with little endin
  126. #
  127. export ENDIANNESS=-meb
  128. export CROSS_COMPILE=mips-linux-gnu-
  129. export TOOLCHAIN=/home/software/Linux/mips-4.4-5
  130. export LIB_DIR=$TOOLCHAIN/lib
  131. ;;
  132. mips-le-24kc)
  133. export ARCH_TYPE=mips
  134. export CPU_ARCH=24kc
  135. export CPU_TYPE=0
  136. #
  137. # set build optons: little-endian
  138. #
  139. export ENDIANNESS=-mel
  140. export CROSS_COMPILE=mipsel-linux-gnu-
  141. export TOOLCHAIN=/home/software/Linux/tools-2.6.27
  142. export LIB_DIR=$TOOLCHAIN/lib
  143. ;;
  144. *)
  145. echo "ERROR: Unknown $ARCH, or not support so far"
  146. exit 1
  147. ;;
  148. esac;
  149. ########################################################
  150. # set special build options valule
  151. # You can modify the build options for different results according your requirement
  152. #
  153. # option value description default value
  154. # -------------------------------------------------------------------------------------
  155. # DEBUG 1 Enable debugging. 0
  156. # 0 Disable debugging.
  157. #
  158. # NO_DMA_COHERENT 1 Disable coherent DMA function. 0
  159. # 0 Enable coherent DMA function.
  160. #
  161. # Please set this to 1 if you are not sure what
  162. # it should be.
  163. #
  164. # ABI 0 Change application binary interface, default 0
  165. # is 0 which means no setting
  166. # aapcs-linux For example, build driver for Aspenite board
  167. #
  168. # LINUX_OABI 1 Enable this if build environment is ARM OABI. 0
  169. # 0 Normally disable it for ARM EABI or other machines.
  170. #
  171. # USE_VDK 1 Eanble this one when the applications 0
  172. # are using the VDK programming interface.
  173. # 0 Disable this one when the applications
  174. # are NOT using the VDK programming interface.
  175. #
  176. # Don't eanble gcdSTATIC_LINK (see below)
  177. # at the same time since VDK will load some
  178. # libraries dynamically.
  179. #
  180. # EGL_API_FB 1 Use the FBDEV as the GUI system for the EGL. 0
  181. # 0 Use X11 system as the GUI system for the EGL.
  182. #
  183. # EGL_API_DRI 1 Use DRI to support X accelerator. 0
  184. # EGL_API_FB must be 0.
  185. # 0 Do not use DRI to support X accelerator.
  186. #
  187. # EGL_API_DFB 1 Use directFB accelerator. 0
  188. # EGL_API_FB and EGL_API_DRI must be 0.
  189. # 0 Do not use DRI to support X accelerator.
  190. #
  191. # gcdSTATIC_LINK 1 Enable static linking. 0
  192. # 0 Disable static linking;
  193. #
  194. # Don't enable this one when you are building
  195. # GFX driver and HAL unit tests since both of
  196. # them need dynamic linking mechanisim.
  197. # And it must NOT be enabled when USE_VDK=1.
  198. #
  199. # USE_PLATFORM_DRIVER 1 Use platform driver model to build kernel 1
  200. # module on linux while kernel version is 2.6.
  201. # 0 Use legecy kernel driver model.
  202. #
  203. # DIRECTFB_MAJOR_VERSION 1
  204. # DIRECTFB_MINOR_VERSION 4
  205. # DIRECTFB_MICRO_VERSION 0 DirectFB version supported by GFX driver.
  206. # Currentlly we support DirectFB-1.4.0.
  207. #
  208. BUILD_OPTION_DEBUG=0
  209. BUILD_OPTION_ABI=0
  210. BUILD_OPTION_LINUX_OABI=0
  211. BUILD_OPTION_NO_DMA_COHERENT=0
  212. BUILD_OPTION_gcdSTATIC_LINK=0
  213. BUILD_OPTION_CUSTOM_PIXMAP=0
  214. BUILD_OPTION_USE_VDK=1
  215. if [ -z $BUILD_OPTION_EGL_API_FB ]; then
  216. BUILD_OPTION_EGL_API_FB=1
  217. fi
  218. if [ -z $BUILD_OPTION_EGL_API_DFB ]; then
  219. BUILD_OPTION_EGL_API_DFB=0
  220. fi
  221. if [ -z $BUILD_OPTION_EGL_API_DRI ]; then
  222. BUILD_OPTION_EGL_API_DRI=0
  223. fi
  224. if [ -z $BUILD_OPTION_USE_OPENCL ]; then
  225. BUILD_OPTION_USE_OPENCL=0
  226. fi
  227. if [ -z $BUILD_OPTION_USE_OPENVX ]; then
  228. BUILD_OPTION_USE_OPENVX=0
  229. fi
  230. if [ -z $BUILD_GL4_DRI_BUILD ]; then
  231. BUILD_GL4_DRI_BUILD=0
  232. fi
  233. BUILD_OPTION_DIRECTFB_MAJOR_VERSION=1
  234. BUILD_OPTION_DIRECTFB_MINOR_VERSION=4
  235. BUILD_OPTION_DIRECTFB_MICRO_VERSION=0
  236. BUILD_OPTIONS="NO_DMA_COHERENT=$BUILD_OPTION_NO_DMA_COHERENT"
  237. BUILD_OPTIONS="$BUILD_OPTIONS USE_VDK=$BUILD_OPTION_USE_VDK"
  238. BUILD_OPTIONS="$BUILD_OPTIONS EGL_API_FB=$BUILD_OPTION_EGL_API_FB"
  239. BUILD_OPTIONS="$BUILD_OPTIONS EGL_API_DFB=$BUILD_OPTION_EGL_API_DFB"
  240. BUILD_OPTIONS="$BUILD_OPTIONS EGL_API_DRI=$BUILD_OPTION_EGL_API_DRI"
  241. BUILD_OPTIONS="$BUILD_OPTIONS gcdSTATIC_LINK=$BUILD_OPTION_gcdSTATIC_LINK"
  242. BUILD_OPTIONS="$BUILD_OPTIONS ABI=$BUILD_OPTION_ABI"
  243. BUILD_OPTIONS="$BUILD_OPTIONS LINUX_OABI=$BUILD_OPTION_LINUX_OABI"
  244. BUILD_OPTIONS="$BUILD_OPTIONS DEBUG=$BUILD_OPTION_DEBUG"
  245. BUILD_OPTIONS="$BUILD_OPTIONS CUSTOM_PIXMAP=$BUILD_OPTION_CUSTOM_PIXMAP"
  246. BUILD_OPTIONS="$BUILD_OPTIONS USE_OPENCL=$BUILD_OPTION_USE_OPENCL"
  247. BUILD_OPTIONS="$BUILD_OPTIONS USE_OPENVX=$BUILD_OPTION_USE_OPENVX"
  248. BUILD_OPTIONS="$BUILD_OPTIONS DIRECTFB_MAJOR_VERSION=$BUILD_OPTION_DIRECTFB_MAJOR_VERSION"
  249. BUILD_OPTIONS="$BUILD_OPTIONS DIRECTFB_MINOR_VERSION=$BUILD_OPTION_DIRECTFB_MINOR_VERSION"
  250. BUILD_OPTIONS="$BUILD_OPTIONS DIRECTFB_MICRO_VERSION=$BUILD_OPTION_DIRECTFB_MICRO_VERSION"
  251. BUILD_OPTIONS="$BUILD_OPTIONS GL4_DRI_BUILD=$BUILD_GL4_DRI_BUILD"
  252. export PATH=$TOOLCHAIN/bin:$PATH
  253. ########################################################
  254. # clean/build driver and samples
  255. # build results will save to $SDK_DIR/
  256. #
  257. cd $AQROOT; make -j1 -f makefile.linux $BUILD_OPTIONS clean
  258. cd $AQROOT; make -j1 -f makefile.linux $BUILD_OPTIONS install 2>&1 | tee $AQROOT/linux_build.log
  259. ########################################################
  260. # other build/clean commands to build/clean specified items, eg.
  261. #
  262. # cd $AQROOT; make -f makefile.linux $BUILD_OPTIONS hal_test V_TARGET=clean || exit 1
  263. # cd $AQROOT; make -f makefile.linux $BUILD_OPTIONS hal_test V_TARGET=install || exit 1