]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ti-machine-learning/ti-machine-learning.git/blob - build/build_timl.sh
dd2273c78333db0922cea5eb729d00ce01a94630
[ti-machine-learning/ti-machine-learning.git] / build / build_timl.sh
1 ################################################################################
2 #
3 # build_timl.sh
4 #
5 # Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 #
11 #    Redistributions of source code must retain the above copyright
12 #    notice, this list of conditions and the following disclaimer.
13 #
14 #    Redistributions in binary form must reproduce the above copyright
15 #    notice, this list of conditions and the following disclaimer in the
16 #    documentation and/or other materials provided with the
17 #    distribution.
18 #
19 #    Neither the name of Texasset -e Instruments Incorporated nor the names of
20 #    its contributors may be used to endorse or promote products derived
21 #    from this software without specific prior written permission.
22 #
23 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #
35 ################################################################################
37 ################################################################################
38 #
39 # USE
40 #
41 #    ./build_timl.sh <timl_dir> <mcsdk_hpc_dir> <output_dir>
42 #
43 # NOTES
44 #
45 #
46 #
47 ################################################################################
49 #!/bin/bash
50 set -e
53 ##################### Param check ##############################################
55 if [ $# -ne 3 ]; then
56   echo "Usage: $0 <timl_dir> <mcsdk_hpc_dir> <output_dir>";
57   exit 1;
58 fi
60 cd $1
61 TIML_DIR=`pwd`
62 cd - 
64 cd $2
65 MCSDK_HPC_DIR=`pwd`
66 cd -
68 cd $3
69 OUTPUT_DIR=`pwd`
70 cd -
72 [ ! -z $MCSDK_HPC_DIR ] || { echo "Error: $MCSDK_HPC_DIR not set!"; exit 1; }
73 [ ! -z $TIML_DIR ] || { echo "Error: $TIML_DIR not set!"; exit 1; }
74 [ ! -z $OUTPUT_DIR ] || { echo "Error: $OUTPUT_DIR not set!"; exit 1; }
77 ##################### env setup ##################################################
79 # two environment variables below need to be set by setup_hpc_env.sh
80 #export TI_OCL_INSTALL_DIR=/opt/ti/mcsdk-hpc_03_00_01_04/ti-opencl_0.14.0/
81 #export C6X_C_DIR=/home/uda0869574local/ti/c6000_7.6.0/include
83 cd $MCSDK_HPC_DIR/scripts
84 set +e
85 . setup_hpc_env.sh -s $TI_INSTALL_DIR:$TI_INSTALL_DIR/linaro -t $TARGET_ROOTDIR
86 set -e
88 echo "env" 
89 env
92 ####################### Generate TIML debian package  ############################
94 cd $TIML_DIR
95 echo "Generating Debian package ..."
96 TIML_VER=`cat build/build_version.txt`
97 tar -czf timl_$TIML_VER.tar.gz --exclude='*.git' --exclude="*.obj" --exclude="*.o" --exclude="*.a" --exclude="*.bin" --exclude="*~" --files-from=build/build_files.txt
98 mkdir timl_$TIML_VER
99 tar -xf timl_$TIML_VER.tar.gz -C timl_$TIML_VER
100 tar -czf timl_$TIML_VER.tar.gz timl_$TIML_VER
101 cp -v timl_$TIML_VER.tar.gz $OUTPUT_DIR
102 rm -r timl_$TIML_VER
105 ####################### Build TIML ###############################################
107 make build
110 ####################### Generate TIML IPK package ############################
112 echo "Generating IPK ..."
113 mkdir -pv ./ipk_install
114 make ipk DESTDIR=./ipk_install
116 $MCSDK_HPC_DIR/mkrel/ipk/create_ipk.sh $MCSDK_HPC_DIR/mkrel/ipk/linalg ./ipk_install
117 mv -v *.ipk $OUTPUT_DIR