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