-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcross_compile
60 lines (47 loc) · 1.92 KB
/
cross_compile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
TOOLCHAIN_DIR=/opt/toolchains
# linaro compiler
# url: https://launchpad.net/linaro-toolchain-binaries/trunk/
check_and_get_linaro()
{
COMPILER_ARCH=$1
TOOLCHAIN_VER=$2
COMPILER_VER=$3
COMPILER_REV=$4
if [ "${COMPILER_REV}" != "" ]; then
COMPILER_NAME=gcc-linaro-${COMPILER_ARCH}-${TOOLCHAIN_VER}-${COMPILER_VER}-${COMPILER_REV}_linux
else
COMPILER_NAME=gcc-linaro-${COMPILER_ARCH}-${TOOLCHAIN_VER}-${COMPILER_VER}_linux
fi
if [ ! -d ${TOOLCHAIN_DIR}/${COMPILER_NAME}/${COMPILER_ARCH} ]; then
if [ ! -e ${COMPILER_NAME}.tar.bz2 ]; then
wget --no-check-certificate https://launchpad.net/linaro-toolchain-binaries/trunk/${COMPILER_VER}/+download/${COMPILER_NAME}.tar.bz2
fi
sudo mkdir -p ${TOOLCHAIN_DIR}
sudo tar jxf ${COMPILER_NAME}.tar.bz2 -C ${TOOLCHAIN_DIR}
#rm ${COMPILER_NAME}
fi
echo ${TOOLCHAIN_DIR}/${COMPILER_NAME}/bin/${COMPILER_ARCH}-
}
# aosp compiler
check_and_get_aosp_prebuild()
{
COMPILER_ARCH=$1
COMPILER_VER=$2
if [ ! -d ${TOOLCHAIN_DIR}/${COMPILER_ARCH}-${COMPILER_VER} ]; then
#(temprary)getting from dropbox
if [ "${COMPILER_VER}" = "4.8" ]; then
wget --no-check-certificate https://dl.dropboxusercontent.com/u/63613486/toolchains/${COMPILER_ARCH}-${COMPILER_VER}.tar.bz2
else
wget --no-check-certificate https://dl.dropbox.com/u/95052256/prebuild/${COMPILER_ARCH}-${COMPILER_VER}.tar.bz2
fi
sudo mkdir -p ${TOOLCHAIN_DIR}
sudo tar jxf ${COMPILER_ARCH}-${COMPILER_VER}.tar.bz2 -C ${TOOLCHAIN_DIR}
fi
echo ${TOOLCHAIN_DIR}/${COMPILER_ARCH}-${COMPILER_VER}/bin/${COMPILER_ARCH}-
}
# use linaro compiler
# export BUILD_CROSS_COMPILE=`check_and_get_linaro arm-linux-gnueabihf 4.8 2013.10`
# use aosp prebuilts
export BUILD_CROSS_COMPILE=`check_and_get_aosp_prebuild arm-eabi 4.8`
# export compiler option
export USE_CFLAGS_OPTION=y