blob: 917dbedecb2bc961162ed6d16518ec987e2b3d21 [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.
xplodwild3e9d0bb2013-08-24 17:40:37 +010011EOF
12}
13
14function brunch()
15{
16 breakfast $*
17 if [ $? -eq 0 ]; then
18 time mka bacon
19 else
20 echo "No such item in brunch menu. Try 'breakfast'"
21 return 1
22 fi
23 return $?
24}
25
26function breakfast()
27{
28 target=$1
Archi7152fc42014-02-28 19:18:54 +010029 local variant=$2
xplodwild3e9d0bb2013-08-24 17:40:37 +010030 CUSTOM_DEVICES_ONLY="true"
31 unset LUNCH_MENU_CHOICES
32 add_lunch_combo full-eng
33 for f in `/bin/ls device/*/*/vendorsetup.sh 2> /dev/null`
34 do
35 echo "including $f"
36 . $f
37 done
38 unset f
39
40 if [ $# -eq 0 ]; then
41 # No arguments, so let's have the full menu
42 lunch
43 else
44 echo "z$target" | grep -q "-"
45 if [ $? -eq 0 ]; then
46 # A buildtype was specified, assume a full device name
47 lunch $target
48 else
49 # This is probably just the omni model name
Archi7152fc42014-02-28 19:18:54 +010050 if [ -z "$variant" ]; then
51 variant="userdebug"
52 fi
53 lunch omni_$target-$variant
xplodwild3e9d0bb2013-08-24 17:40:37 +010054 fi
55 fi
56 return $?
57}
58
59alias bib=breakfast
60
61# Make using all available CPUs
62function mka() {
63 case `uname -s` in
64 Darwin)
65 make -j `sysctl hw.ncpu|cut -d" " -f2` "$@"
66 ;;
67 *)
68 schedtool -B -n 1 -e ionice -n 1 make -j `cat /proc/cpuinfo | grep "^processor" | wc -l` "$@"
69 ;;
70 esac
71}
xplodwildcb52eae2013-08-29 20:18:18 +020072
73function pushboot() {
74 if [ ! -f $OUT/$* ]; then
75 echo "File not found: $OUT/$*"
76 return 1
77 fi
78
79 adb root
80 sleep 1
81 adb wait-for-device
82 adb remount
83
84 adb push $OUT/$* /$*
85 adb reboot
86}