blob: 2aca176fe8f17bc7c27fb63f7b5688d5a51f650f [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() {
Luca Stefani9c02a9b2017-08-17 20:34:44 +020082 m -j "$@"
xplodwild3e9d0bb2013-08-24 17:40:37 +010083}
xplodwildcb52eae2013-08-29 20:18:18 +020084
85function pushboot() {
86 if [ ! -f $OUT/$* ]; then
87 echo "File not found: $OUT/$*"
88 return 1
89 fi
90
91 adb root
92 sleep 1
93 adb wait-for-device
94 adb remount
95
96 adb push $OUT/$* /$*
97 adb reboot
98}
Pulser72e23242013-09-29 09:56:55 +010099
100function repopick() {
101 set_stuff_for_environment
102 T=$(gettop)
103 $T/vendor/omni/build/tools/repopick.py $@
104}
105