blob: ab2dcc87e6b62aeec58eef1760d381d35f84ff8a [file] [log] [blame]
xplodwild3e9d0bb2013-08-24 17:40:37 +01001function __print_omni_functions_help() {
2cat <<EOF
3Additional OmniROM functions:
4- breakfast: Setup the build environment, but only list
5 devices we support.
6- brunch: Sets up build environment using breakfast(),
7 and then comiles using mka() against bacon target.
8- mka: Builds using SCHED_BATCH on all processors.
xplodwildcb52eae2013-08-29 20:18:18 +02009- pushboot: Push a file from your OUT dir to your phone and
10 reboots it, using absolute path.
Pulser72e23242013-09-29 09:56:55 +010011- repopick: Utility to fetch changes from Gerrit.
xplodwild3e9d0bb2013-08-24 17:40:37 +010012EOF
13}
14
15function brunch()
16{
17 breakfast $*
18 if [ $? -eq 0 ]; then
19 time mka bacon
20 else
21 echo "No such item in brunch menu. Try 'breakfast'"
22 return 1
23 fi
24 return $?
25}
26
27function breakfast()
28{
29 target=$1
Archi7152fc42014-02-28 19:18:54 +010030 local variant=$2
xplodwild3e9d0bb2013-08-24 17:40:37 +010031 CUSTOM_DEVICES_ONLY="true"
32 unset LUNCH_MENU_CHOICES
33 add_lunch_combo full-eng
34 for f in `/bin/ls device/*/*/vendorsetup.sh 2> /dev/null`
35 do
36 echo "including $f"
37 . $f
38 done
39 unset f
40
41 if [ $# -eq 0 ]; then
42 # No arguments, so let's have the full menu
43 lunch
44 else
45 echo "z$target" | grep -q "-"
46 if [ $? -eq 0 ]; then
47 # A buildtype was specified, assume a full device name
48 lunch $target
49 else
50 # This is probably just the omni model name
Archi7152fc42014-02-28 19:18:54 +010051 if [ -z "$variant" ]; then
52 variant="userdebug"
53 fi
54 lunch omni_$target-$variant
xplodwild3e9d0bb2013-08-24 17:40:37 +010055 fi
56 fi
57 return $?
58}
59
60alias bib=breakfast
61
Chirayu Desai3ac786f2013-06-30 10:04:25 +053062function fixup_common_out_dir() {
63 common_out_dir=$(get_build_var OUT_DIR)/target/common
64 target_device=$(get_build_var TARGET_DEVICE)
65 if [ ! -z $ANDROID_FIXUP_COMMON_OUT ]; then
66 if [ -d ${common_out_dir} ] && [ ! -L ${common_out_dir} ]; then
67 mv ${common_out_dir} ${common_out_dir}-${target_device}
68 ln -s ${common_out_dir}-${target_device} ${common_out_dir}
69 else
70 [ -L ${common_out_dir} ] && rm ${common_out_dir}
71 mkdir -p ${common_out_dir}-${target_device}
72 ln -s ${common_out_dir}-${target_device} ${common_out_dir}
73 fi
74 else
75 [ -L ${common_out_dir} ] && rm ${common_out_dir}
76 mkdir -p ${common_out_dir}
77 fi
78}
79
xplodwild3e9d0bb2013-08-24 17:40:37 +010080# Make using all available CPUs
81function mka() {
82 case `uname -s` in
83 Darwin)
84 make -j `sysctl hw.ncpu|cut -d" " -f2` "$@"
85 ;;
86 *)
87 schedtool -B -n 1 -e ionice -n 1 make -j `cat /proc/cpuinfo | grep "^processor" | wc -l` "$@"
88 ;;
89 esac
90}
xplodwildcb52eae2013-08-29 20:18:18 +020091
92function pushboot() {
93 if [ ! -f $OUT/$* ]; then
94 echo "File not found: $OUT/$*"
95 return 1
96 fi
97
98 adb root
99 sleep 1
100 adb wait-for-device
101 adb remount
102
103 adb push $OUT/$* /$*
104 adb reboot
105}
Pulser72e23242013-09-29 09:56:55 +0100106
107function repopick() {
108 set_stuff_for_environment
109 T=$(gettop)
110 $T/vendor/omni/build/tools/repopick.py $@
111}
112