blob: 560c06a3ced497e50482f34eba586a67181fe19d [file] [log] [blame]
Joel Fernandes6c1ca312018-03-30 17:13:15 -07001#!/bin/bash -e
Joel Fernandes6c1ca312018-03-30 17:13:15 -07002
3script_full_path=$( cd "$(dirname "$0")" ; pwd -P )
4
5source $script_full_path/utils/android
6
Joel Fernandes83676b12018-03-30 23:33:47 -07007usage() {
8 echo "androdeb"
9 echo " prepare Prepare the device (when running for the first time)"
10 echo " shell Enter the androdeb shell environment and get to work!"
11 echo ""
12 echo " --tracers Enable tracing packages (perf and trace-cmd)"
13 echo " --compilers Enable compilers on the FS (gcc and clang)"
14 echo " --editors Enable vim, emacs and git packages"
15 echo " --scheduler scheduler testing tools (only rt-app for now)"
16 echo " --bcc Build and install BCC from source"
17 echo " --fullbuild Enable all of the above tools"
18 echo ""
19 echo " --kernelsrc path-to-kernel-sources (can be used for bcc)"
20 echo " --tempdir use a specific temporary directory"
21 echo " --distro Debian distro to base on (default is buster)"
22 exit 1
23}
24
Joel Fernandes6c1ca312018-03-30 17:13:15 -070025# Set default vars
26DISTRO=buster
Joel Fernandes83676b12018-03-30 23:33:47 -070027PACKAGES=""
Joel Fernandes6c1ca312018-03-30 17:13:15 -070028
29# Parse command line parameters
Joel Fernandes83676b12018-03-30 23:33:47 -070030PKG=0; if [ $# -lt 1 ]; then usage; fi
Joel Fernandes6c1ca312018-03-30 17:13:15 -070031POSITIONAL=()
32while [[ $# -gt 0 ]]
33do
34key="$1"
35
36case $key in
Joel Fernandes83676b12018-03-30 23:33:47 -070037 prepare)
38 PREP=1; shift || true; ;;
39 shell)
40 SHELL=1; shift || true; ;;
41 --tracers)
42 TRACERS=1; PKG=1; shift || true; ;;
43 --compilers)
44 COMPILERS=1; PKG=1 shift || true; ;;
45 --editors)
46 EDITORS=1; PKG=1 shift || true; ;;
47 --scheduler)
48 SCHEDULER=1; PKG=1 shift || true; ;;
49 --fullbuild)
50 FULLBUILD=1; PKG=1 shift || true; ;;
51 --bcc)
52 BCC=1; PKG=1 shift || true; ;;
53 --kernelsrc)
54 KERNELSRC="$2"; shift || true; shift || true; ;;
55 --tempdir)
56 TMPDIR="$2"; shift || true; shift || true; ;;
Joel Fernandes6c1ca312018-03-30 17:13:15 -070057 *) # unknown option
Joel Fernandes83676b12018-03-30 23:33:47 -070058 echo "Unknown option ($1)"; usage
Joel Fernandes6c1ca312018-03-30 17:13:15 -070059 ;;
60esac
61done
62
63set -- "${POSITIONAL[@]}" # restore positional parameters
64
Joel Fernandes83676b12018-03-30 23:33:47 -070065if [[ ! -z ${PREP+x} ]] && [[ $PKG -eq 0 ]]; then;
66 echo "Need to specifify something to prepare"; usage; fi
67
68##########################################################
69# PREPARE
70##########################################################
Joel Fernandes6c1ca312018-03-30 17:13:15 -070071# Where do we want to store temporary files
72if [[ -z ${TMPDIR+x} ]] || [[ ! -d "${TMPDIR}" ]]; then
Joel Fernandes83676b12018-03-30 23:33:47 -070073 TMPDIR=`mktemp`; fi
Joel Fernandes6c1ca312018-03-30 17:13:15 -070074
Joel Fernandes83676b12018-03-30 23:33:47 -070075echo $KERNELSRC
76echo $BCC
77echo $COMPILERS
78echo $TRACERS