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