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(), |
Jacob Whatley | d7acdc8 | 2017-08-31 13:17:31 -0400 | [diff] [blame] | 7 | and then comiles using mka() against cookies target. |
xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 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 |
Jacob Whatley | d7acdc8 | 2017-08-31 13:17:31 -0400 | [diff] [blame] | 19 | time mka cookies |
xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 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 | |
Chirayu Desai | 3ac786f | 2013-06-30 10:04:25 +0530 | [diff] [blame] | 62 | function 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 | |
xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 80 | # Make using all available CPUs |
| 81 | function mka() { |
darkobas | f3cc995 | 2017-12-10 14:19:18 +0000 | [diff] [blame] | 82 | m "$@" |
xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 83 | } |
xplodwild | cb52eae | 2013-08-29 20:18:18 +0200 | [diff] [blame] | 84 | |
| 85 | function 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 | } |
Pulser | 72e2324 | 2013-09-29 09:56:55 +0100 | [diff] [blame] | 99 | |
| 100 | function repopick() { |
| 101 | set_stuff_for_environment |
| 102 | T=$(gettop) |
| 103 | $T/vendor/omni/build/tools/repopick.py $@ |
| 104 | } |
| 105 | |
mikeNG | e114eb0 | 2018-03-09 09:13:26 +0100 | [diff] [blame] | 106 | function aospremote() |
| 107 | { |
| 108 | if ! git rev-parse --git-dir &> /dev/null |
| 109 | then |
| 110 | echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up." |
| 111 | return 1 |
| 112 | fi |
| 113 | git remote rm aosp 2> /dev/null |
| 114 | local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##") |
| 115 | # Google moved the repo location in Oreo |
| 116 | if [ $PROJECT = "build/make" ] |
| 117 | then |
| 118 | PROJECT="build" |
| 119 | fi |
| 120 | if (echo $PROJECT | grep -qv "^device") |
| 121 | then |
| 122 | local PFX="platform/" |
| 123 | fi |
| 124 | git remote add aosp https://android.googlesource.com/$PFX$PROJECT |
| 125 | echo "Remote 'aosp' created" |
| 126 | } |
| 127 | |
| 128 | function cafremote() |
| 129 | { |
| 130 | if ! git rev-parse --git-dir &> /dev/null |
| 131 | then |
| 132 | echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up." |
| 133 | return 1 |
| 134 | fi |
| 135 | git remote rm caf 2> /dev/null |
| 136 | local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##") |
| 137 | # Google moved the repo location in Oreo |
| 138 | if [ $PROJECT = "build/make" ] |
| 139 | then |
| 140 | PROJECT="build" |
| 141 | fi |
| 142 | if [[ $PROJECT =~ "qcom/opensource" ]]; |
| 143 | then |
| 144 | PROJECT=$(echo $PROJECT | sed -e "s#qcom\/opensource#qcom-opensource#") |
| 145 | fi |
| 146 | if (echo $PROJECT | grep -qv "^device") |
| 147 | then |
| 148 | local PFX="platform/" |
| 149 | fi |
| 150 | git remote add caf https://source.codeaurora.org/quic/la/$PFX$PROJECT |
| 151 | echo "Remote 'caf' created" |
| 152 | } |
| 153 | |