-
Notifications
You must be signed in to change notification settings - Fork 1
/
cross_compile
50 lines (40 loc) · 1.71 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
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
if [ ! $4 == "" ]; then
COMPILER_REV="-"$4"_linux"
else
COMPILER_REV="_linux"
fi
if [ ! -d $TOOLCHAIN_DIR/gcc-linaro-$COMPILER_ARCH-$TOOLCHAIN_VER-$COMPILER_VER$COMPILER_REV/$COMPILER_ARCH ]; then
wget --no-check-certificate https://launchpad.net/linaro-toolchain-binaries/trunk/$COMPILER_VER/+download/gcc-linaro-$COMPILER_ARCH-$TOOLCHAIN_VER-$COMPILER_VER$COMPILER_REV.tar.bz2
sudo mkdir -p $TOOLCHAIN_DIR
sudo tar jxvf gcc-linaro-$COMPILER_ARCH-$TOOLCHAIN_VER-$COMPILER_VER$COMPILER_REV.tar.bz2 -C $TOOLCHAIN_DIR
#rm gcc-linaro-$COMPILER_ARCH-$TOOLCHAIN_VER-$COMPILER_VER-$COMPILER_REV.tar.bz2
fi
echo $TOOLCHAIN_DIR/gcc-linaro-$COMPILER_ARCH-$TOOLCHAIN_VER-$COMPILER_VER$COMPILER_REV/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
wget --no-check-certificate https://dl.dropbox.com/u/95052256/prebuild/$COMPILER_ARCH-$COMPILER_VER.tar.bz2
sudo mkdir -p $TOOLCHAIN_DIR
sudo tar jxvf $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.7 2013.04 20130415`
# use aosp prebuilts
# export BUILD_CROSS_COMPILE=`check_and_get_aosp_prebuild arm-eabi 4.6`
# export compiler option
export USE_CFLAGS_OPTION=y