diff options
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 66 |
1 files changed, 49 insertions, 17 deletions
diff --git a/envsetup.sh b/envsetup.sh index 6ad4600..84ec3e5 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -1,4 +1,4 @@ -function help() { +function hmm() { cat <<EOF Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment: - croot: Changes directory to the top of the tree. @@ -116,25 +116,40 @@ function setpaths() # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it. export ANDROID_EABI_TOOLCHAIN= - case $(get_build_var TARGET_ARCH) in + local ARCH=$(get_build_var TARGET_ARCH) + case $ARCH in x86) toolchaindir=x86/i686-linux-android-4.6/bin ;; - arm|*) toolchaindir=arm/arm-linux-androideabi-4.6/bin + arm) toolchaindir=arm/arm-linux-androideabi-4.6/bin + ;; + *) + echo "Can't find toolchain for unknown architecture: $ARCH" + toolchaindir=xxxxxxxxx ;; esac - if [ -d "$prebuiltdir/$toolchaindir" ]; then - export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir + if [ -d "$gccprebuiltdir/$toolchaindir" ]; then + export ANDROID_EABI_TOOLCHAIN=$gccprebuiltdir/$toolchaindir fi export ARM_EABI_TOOLCHAIN= - toolchaindir=toolchain/arm-eabi-4.4.3/bin - if [ -d "$prebuiltdir/$toolchaindir" ]; then - export ARM_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir + case $ARCH in + x86) toolchaindir=x86/i686-eabi-4.4.3/bin + ;; + arm) toolchaindir=arm/arm-eabi-4.6/bin + ;; + *) + echo "Can't find toolchain for unknown architecture: $ARCH" + toolchaindir=xxxxxxxxx + ;; + esac + if [ -d "$gccprebuiltdir/$toolchaindir" ]; then + export ARM_EABI_TOOLCHAIN=$gccprebuiltdir/$toolchaindir fi export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN export ANDROID_QTOOLS=$T/development/emulator/qtools - export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ARM_EABI_TOOLCHAIN$CODE_REVIEWS + export ANDROID_DEV_SCRIPTS=$T/development/scripts + export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ARM_EABI_TOOLCHAIN$CODE_REVIEWS:$ANDROID_DEV_SCRIPTS export PATH=$PATH$ANDROID_BUILD_PATHS unset ANDROID_JAVA_TOOLCHAIN @@ -152,6 +167,10 @@ function setpaths() unset ANDROID_HOST_OUT export ANDROID_HOST_OUT=$(get_abs_build_var HOST_OUT) + # needed for processing samples collected by perf counters + unset OPROFILE_EVENTS_DIR + export OPROFILE_EVENTS_DIR=$T/external/oprofile/events + # needed for building linux on MacOS # TODO: fix the path #export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include @@ -508,8 +527,8 @@ complete -F _lunch lunch # Run tapas with one ore more app names (from LOCAL_PACKAGE_NAME) function tapas() { - local variant=$(echo -n $(echo $* | xargs -n 1 echo | grep -E '^(user|userdebug|eng)$')) - local apps=$(echo -n $(echo $* | xargs -n 1 echo | grep -E -v '^(user|userdebug|eng)$')) + local variant=$(echo -n $(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$')) + local apps=$(echo -n $(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng)$')) if [ $(echo $variant | wc -w) -gt 1 ]; then echo "tapas: Error: Multiple build variants supplied: $variant" @@ -617,12 +636,17 @@ function mmm() T=$(gettop) if [ "$T" ]; then local MAKEFILE= + local MODULES= local ARGS= local DIR TO_CHOP local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/') local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/') for DIR in $DIRS ; do - DIR=`echo $DIR | sed -e 's:/$::'` + MODULES=`echo $DIR | sed -n -e 's/.*:\(.*$\)/\1/p' | sed 's/,/ /'` + if [ "$MODULES" = "" ]; then + MODULES=all_modules + fi + DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'` if [ -f $DIR/Android.mk ]; then TO_CHOP=`(cd -P -- $T && pwd -P) | wc -c | tr -d ' '` TO_CHOP=`expr $TO_CHOP + 1` @@ -649,7 +673,7 @@ function mmm() fi fi done - ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T $DASH_ARGS all_modules $ARGS + ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T $DASH_ARGS $MODULES $ARGS else echo "Couldn't locate the top of the tree. Try setting TOP." fi @@ -710,6 +734,14 @@ function gdbclient() local OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED) local OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED) local PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS) + local ARCH=$(get_build_var TARGET_ARCH) + local GDB + case "$ARCH" in + x86) GDB=i686-linux-android-gdb;; + arm) GDB=arm-linux-androideabi-gdb;; + *) echo "Unknown arch $ARCH"; return 1;; + esac + if [ "$OUT_ROOT" -a "$PREBUILTS" ]; then local EXE="$1" if [ "$EXE" ] ; then @@ -746,11 +778,11 @@ function gdbclient() fi echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS" - echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS" + echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS:$OUT_SO_SYMBOLS/hw:$OUT_SO_SYMBOLS/ssl/engines" echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT" echo >>"$OUT_ROOT/gdbclient.cmds" "" - $ANDROID_EABI_TOOLCHAIN/*-gdb -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE" + $ANDROID_TOOLCHAIN/$GDB -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE" else echo "Unable to determine build system output dir." fi @@ -914,7 +946,7 @@ function runhat() echo "Running hat on $localFile" echo "View the output by pointing your browser at http://localhost:7000/" echo "" - hat $localFile + hat -JXmx512m $localFile } function getbugreports() @@ -1013,7 +1045,7 @@ function godir () { echo "" fi local lines - lines=($(grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq)) + lines=($(\grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq)) if [[ ${#lines[@]} = 0 ]]; then echo "Not found" return |