blob: 37051e1d00d1cf74b8226904b2207a6f6542f805 [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(),
Jacob Whatleyd7acdc82017-08-31 13:17:31 -04007 and then comiles using mka() against cookies target.
xplodwild3e9d0bb2013-08-24 17:40:37 +01008- 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.
Pulser72e23242013-09-29 09:56:55 +010011- repopick: Utility to fetch changes from Gerrit.
xplodwild3e9d0bb2013-08-24 17:40:37 +010012EOF
13}
14
15function brunch()
16{
17 breakfast $*
18 if [ $? -eq 0 ]; then
Jacob Whatleyd7acdc82017-08-31 13:17:31 -040019 time mka cookies
xplodwild3e9d0bb2013-08-24 17:40:37 +010020 else
21 echo "No such item in brunch menu. Try 'breakfast'"
22 return 1
23 fi
24 return $?
25}
26
27function breakfast()
28{
29 target=$1
Archi7152fc42014-02-28 19:18:54 +010030 local variant=$2
xplodwild3e9d0bb2013-08-24 17:40:37 +010031
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
Archi7152fc42014-02-28 19:18:54 +010042 if [ -z "$variant" ]; then
Marko Mana77da942019-10-18 20:11:42 +020043 variant="user"
Archi7152fc42014-02-28 19:18:54 +010044 fi
45 lunch omni_$target-$variant
xplodwild3e9d0bb2013-08-24 17:40:37 +010046 fi
47 fi
48 return $?
49}
50
51alias bib=breakfast
52
Chirayu Desai3ac786f2013-06-30 10:04:25 +053053function 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
xplodwild3e9d0bb2013-08-24 17:40:37 +010071# Make using all available CPUs
72function mka() {
darkobasf3cc9952017-12-10 14:19:18 +000073 m "$@"
xplodwild3e9d0bb2013-08-24 17:40:37 +010074}
xplodwildcb52eae2013-08-29 20:18:18 +020075
76function 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}
Pulser72e23242013-09-29 09:56:55 +010090
91function repopick() {
92 set_stuff_for_environment
93 T=$(gettop)
94 $T/vendor/omni/build/tools/repopick.py $@
95}
96
mikeNGe114eb02018-03-09 09:13:26 +010097function 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
119function 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 Man57034c12018-03-09 09:14:17 +0100145# Enable SD-LLVM if available
146if [ -d $(gettop)/vendor/qcom/sdclang ]; then
147 export SDCLANG=true
frap129a111d062019-06-06 08:53:03 +0200148 export SDCLANG_PATH="vendor/qcom/sdclang/6.0/prebuilt/linux-x86_64/bin"
Marko Man57034c12018-03-09 09:14:17 +0100149 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"
frap129a111d062019-06-06 08:53:03 +0200152 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 Man57034c12018-03-09 09:14:17 +0100155fi