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 | |
| 32 | if [ $# -eq 0 ]; then |
| 33 | # No arguments, so let's have the full menu |
| 34 | lunch |
| 35 | else |
| 36 | echo "z$target" | grep -q "-" |
| 37 | if [ $? -eq 0 ]; then |
| 38 | # A buildtype was specified, assume a full device name |
| 39 | lunch $target |
| 40 | else |
| 41 | # This is probably just the omni model name |
Archi | 7152fc4 | 2014-02-28 19:18:54 +0100 | [diff] [blame] | 42 | if [ -z "$variant" ]; then |
Marko Man | a77da94 | 2019-10-18 20:11:42 +0200 | [diff] [blame] | 43 | variant="user" |
Archi | 7152fc4 | 2014-02-28 19:18:54 +0100 | [diff] [blame] | 44 | fi |
| 45 | lunch omni_$target-$variant |
xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 46 | fi |
| 47 | fi |
| 48 | return $? |
| 49 | } |
| 50 | |
| 51 | alias bib=breakfast |
| 52 | |
Chirayu Desai | 3ac786f | 2013-06-30 10:04:25 +0530 | [diff] [blame] | 53 | function fixup_common_out_dir() { |
| 54 | common_out_dir=$(get_build_var OUT_DIR)/target/common |
| 55 | target_device=$(get_build_var TARGET_DEVICE) |
| 56 | if [ ! -z $ANDROID_FIXUP_COMMON_OUT ]; then |
| 57 | if [ -d ${common_out_dir} ] && [ ! -L ${common_out_dir} ]; then |
| 58 | mv ${common_out_dir} ${common_out_dir}-${target_device} |
| 59 | ln -s ${common_out_dir}-${target_device} ${common_out_dir} |
| 60 | else |
| 61 | [ -L ${common_out_dir} ] && rm ${common_out_dir} |
| 62 | mkdir -p ${common_out_dir}-${target_device} |
| 63 | ln -s ${common_out_dir}-${target_device} ${common_out_dir} |
| 64 | fi |
| 65 | else |
| 66 | [ -L ${common_out_dir} ] && rm ${common_out_dir} |
| 67 | mkdir -p ${common_out_dir} |
| 68 | fi |
| 69 | } |
| 70 | |
xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 71 | # Make using all available CPUs |
| 72 | function mka() { |
darkobas | f3cc995 | 2017-12-10 14:19:18 +0000 | [diff] [blame] | 73 | m "$@" |
xplodwild | 3e9d0bb | 2013-08-24 17:40:37 +0100 | [diff] [blame] | 74 | } |
xplodwild | cb52eae | 2013-08-29 20:18:18 +0200 | [diff] [blame] | 75 | |
| 76 | function pushboot() { |
| 77 | if [ ! -f $OUT/$* ]; then |
| 78 | echo "File not found: $OUT/$*" |
| 79 | return 1 |
| 80 | fi |
| 81 | |
| 82 | adb root |
| 83 | sleep 1 |
| 84 | adb wait-for-device |
| 85 | adb remount |
| 86 | |
| 87 | adb push $OUT/$* /$* |
| 88 | adb reboot |
| 89 | } |
Pulser | 72e2324 | 2013-09-29 09:56:55 +0100 | [diff] [blame] | 90 | |
| 91 | function repopick() { |
| 92 | set_stuff_for_environment |
| 93 | T=$(gettop) |
| 94 | $T/vendor/omni/build/tools/repopick.py $@ |
| 95 | } |
| 96 | |
mikeNG | e114eb0 | 2018-03-09 09:13:26 +0100 | [diff] [blame] | 97 | function aospremote() |
| 98 | { |
| 99 | if ! git rev-parse --git-dir &> /dev/null |
| 100 | then |
| 101 | echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up." |
| 102 | return 1 |
| 103 | fi |
| 104 | git remote rm aosp 2> /dev/null |
| 105 | local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##") |
| 106 | # Google moved the repo location in Oreo |
| 107 | if [ $PROJECT = "build/make" ] |
| 108 | then |
| 109 | PROJECT="build" |
| 110 | fi |
| 111 | if (echo $PROJECT | grep -qv "^device") |
| 112 | then |
| 113 | local PFX="platform/" |
| 114 | fi |
| 115 | git remote add aosp https://android.googlesource.com/$PFX$PROJECT |
| 116 | echo "Remote 'aosp' created" |
| 117 | } |
| 118 | |
| 119 | function cafremote() |
| 120 | { |
| 121 | if ! git rev-parse --git-dir &> /dev/null |
| 122 | then |
| 123 | echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up." |
| 124 | return 1 |
| 125 | fi |
| 126 | git remote rm caf 2> /dev/null |
| 127 | local PROJECT=$(pwd -P | sed -e "s#$ANDROID_BUILD_TOP\/##; s#-caf.*##; s#\/default##") |
| 128 | # Google moved the repo location in Oreo |
| 129 | if [ $PROJECT = "build/make" ] |
| 130 | then |
| 131 | PROJECT="build" |
| 132 | fi |
| 133 | if [[ $PROJECT =~ "qcom/opensource" ]]; |
| 134 | then |
| 135 | PROJECT=$(echo $PROJECT | sed -e "s#qcom\/opensource#qcom-opensource#") |
| 136 | fi |
| 137 | if (echo $PROJECT | grep -qv "^device") |
| 138 | then |
| 139 | local PFX="platform/" |
| 140 | fi |
| 141 | git remote add caf https://source.codeaurora.org/quic/la/$PFX$PROJECT |
| 142 | echo "Remote 'caf' created" |
| 143 | } |
| 144 | |
Marko Man | 57034c1 | 2018-03-09 09:14:17 +0100 | [diff] [blame] | 145 | # Enable SD-LLVM if available |
| 146 | if [ -d $(gettop)/vendor/qcom/sdclang ]; then |
| 147 | export SDCLANG=true |
frap129 | a111d06 | 2019-06-06 08:53:03 +0200 | [diff] [blame] | 148 | export SDCLANG_PATH="vendor/qcom/sdclang/6.0/prebuilt/linux-x86_64/bin" |
Marko Man | 57034c1 | 2018-03-09 09:14:17 +0100 | [diff] [blame] | 149 | export SDCLANG_LTO_DEFS="vendor/qcom/sdclang/sdllvm-lto-defs.mk" |
| 150 | export SDCLANG_CONFIG="vendor/qcom/sdclang/sdclang.json" |
| 151 | export SDCLANG_AE_CONFIG="vendor/qcom/sdclang/sdclangAE.json" |
frap129 | a111d06 | 2019-06-06 08:53:03 +0200 | [diff] [blame] | 152 | export SDCLANG_COMMON_FLAGS="-O3 -Wno-user-defined-warnings -Wno-vectorizer-no-neon -Wno-unknown-warning-option \ |
| 153 | -Wno-deprecated-register -Wno-tautological-type-limit-compare -Wno-sign-compare -Wno-gnu-folding-constant \ |
| 154 | -mllvm -arm-implicit-it=always -Wno-inline-asm -Wno-unused-command-line-argument -Wno-unused-variable" |
Marko Man | 57034c1 | 2018-03-09 09:14:17 +0100 | [diff] [blame] | 155 | fi |