1#!/bin/bash -e 2 3source ${ANDROID_BUILD_TOP}/build/envsetup.sh 4 5TARGET_ARCH=$(get_build_var TARGET_ARCH) 6TARGET_OUT=$(get_build_var TARGET_OUT) 7TARGET_OUT_EXECUTABLES=$(get_build_var TARGET_OUT_EXECUTABLES) 8TARGET_OUT_DATA=$(get_build_var TARGET_OUT_DATA) 9HOST_OS=$(get_build_var HOST_OS) 10HOST_ARCH=$(get_build_var HOST_ARCH) 11HOST_OUT=$(get_build_var HOST_OUT) 12 13function prepare() 14{ 15 BITS=$1 16 shift 17 18 NATIVETEST=${TARGET_OUT_DATA}/nativetest 19 if [ "${BITS}" = 64 ]; then 20 NATIVETEST=${NATIVETEST}64 21 fi 22 23 if [ ${TARGET_ARCH} = arm -o ${TARGET_ARCH} = mips -o ${TARGET_ARCH} = x86 ]; then 24 LINKER=${TARGET_OUT_EXECUTABLES}/linker 25 else 26 LINKER="${TARGET_OUT_EXECUTABLES}/linker64 ${TARGET_OUT_EXECUTABLES}/linker" 27 fi 28 29 if [ ${TARGET_ARCH} = x86 -o ${TARGET_ARCH} = x86_64 ]; then 30 m -j ${LINKER} ${TARGET_OUT}/etc/hosts ${TARGET_OUT_EXECUTABLES}/sh $@ 31 32 if [ ! -d /system ]; then 33 echo "Attempting to create /system"; 34 sudo mkdir -p -m 0777 /system; 35 fi 36 ( 37 cd ${ANDROID_BUILD_TOP} 38 mkdir -p ${TARGET_OUT_DATA}/local/tmp 39 ln -fs `realpath ${TARGET_OUT}/bin` /system/ 40 ln -fs `realpath ${TARGET_OUT}/etc` /system/ 41 ln -fs `realpath ${TARGET_OUT}/lib` /system/ 42 if [ -d "${TARGET_OUT}/lib64" ]; then 43 ln -fs `realpath ${TARGET_OUT}/lib64` /system/; 44 fi 45 ) 46 fi 47} 48