xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 1 | function __print_omni_functions_help() { |
| 2 | cat <<EOF |
| 3 | Additional 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. |
xplodwild | cb52eae | 2013-08-29 20:18:18 +0200 | [diff] [blame] | 9 | - pushboot: Push a file from your OUT dir to your phone and |
| 10 | reboots it, using absolute path. |
Pulser | 72e2324 | 2013-09-29 09:56:55 +0100 | [diff] [blame^] | 11 | - repopick: Utility to fetch changes from Gerrit. |
xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 12 | EOF |
| 13 | } |
| 14 | |
| 15 | function 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 | |
| 27 | function breakfast() |
| 28 | { |
| 29 | target=$1 |
Archi | 7152fc4 | 2014-02-28 19:18:54 +0100 | [diff] [blame] | 30 | local variant=$2 |
xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 31 | 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 |
Archi | 7152fc4 | 2014-02-28 19:18:54 +0100 | [diff] [blame] | 51 | if [ -z "$variant" ]; then |
| 52 | variant="userdebug" |
| 53 | fi |
| 54 | lunch omni_$target-$variant |
xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 55 | fi |
| 56 | fi |
| 57 | return $? |
| 58 | } |
| 59 | |
| 60 | alias bib=breakfast |
| 61 | |
| 62 | # Make using all available CPUs |
| 63 | function mka() { |
| 64 | case `uname -s` in |
| 65 | Darwin) |
| 66 | make -j `sysctl hw.ncpu|cut -d" " -f2` "$@" |
| 67 | ;; |
| 68 | *) |
| 69 | schedtool -B -n 1 -e ionice -n 1 make -j `cat /proc/cpuinfo | grep "^processor" | wc -l` "$@" |
| 70 | ;; |
| 71 | esac |
| 72 | } |
xplodwild | cb52eae | 2013-08-29 20:18:18 +0200 | [diff] [blame] | 73 | |
| 74 | function pushboot() { |
| 75 | if [ ! -f $OUT/$* ]; then |
| 76 | echo "File not found: $OUT/$*" |
| 77 | return 1 |
| 78 | fi |
| 79 | |
| 80 | adb root |
| 81 | sleep 1 |
| 82 | adb wait-for-device |
| 83 | adb remount |
| 84 | |
| 85 | adb push $OUT/$* /$* |
| 86 | adb reboot |
| 87 | } |
Pulser | 72e2324 | 2013-09-29 09:56:55 +0100 | [diff] [blame^] | 88 | |
| 89 | function repopick() { |
| 90 | set_stuff_for_environment |
| 91 | T=$(gettop) |
| 92 | $T/vendor/omni/build/tools/repopick.py $@ |
| 93 | } |
| 94 | |