-
Notifications
You must be signed in to change notification settings - Fork 5
/
build-oss.sh
195 lines (158 loc) · 4.59 KB
/
build-oss.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/bin/bash
echo ""
echo "LineageOS 20.x Unified Buildbot - LeaOS version"
echo "Executing in 5 seconds - CTRL-C to exit"
echo ""
sleep 5
if [ $# -lt 1 ]
then
echo "Not enough arguments - exiting"
echo ""
exit 1
fi
MODE=${1}
if [ ${MODE} != "device" ] && [ ${MODE} != "treble" ]
then
echo "Invalid mode - exiting"
echo ""
exit 1
fi
NOSYNC=false
for var in "${@:2}"
do
if [ ${var} == "nosync" ]
then
NOSYNC=true
fi
done
echo "Building with NoSync : $NOSYNC - Mode : ${MODE}"
# Abort early on error
set -eE
trap '(\
echo;\
echo \!\!\! An error happened during script execution;\
echo \!\!\! Please check console output for bad sync,;\
echo \!\!\! failed patch application, etc.;\
echo\
)' ERR
WITHOUT_CHECK_API=true
WITH_SU=true
START=`date +%s`
BUILD_DATE="$(date +%Y%m%d)"
prep_build() {
echo "Preparing local manifests"
mkdir -p .repo/local_manifests
if [ ${MODE} == "device" ]
then
cp ./lineage_build_leaos/local_manifests_oss/*.xml .repo/local_manifests
else
cp ./lineage_build_leaos/local_manifests_leaos/*.xml .repo/local_manifests
fi
echo ""
echo "Syncing repos"
repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
echo ""
echo "Setting up build environment"
source build/envsetup.sh &> /dev/null
mkdir -p ./build-output
echo ""
repopick 321337 -f # Deprioritize important developer notifications
repopick 321338 -f # Allow disabling important developer notifications
repopick 321339 -f # Allow disabling USB notifications
repopick 340916 # SystemUI: add burnIn protection
repopick 342860 # codec2: Use numClientBuffers to control the pipeline
repopick 342861 # CCodec: Control the inputs to avoid pipeline overflow
repopick 342862 # [WA] Codec2: queue a empty work to HAL to wake up allocation thread
repopick 342863 # CCodec: Use pipelineRoom only for HW decoder
repopick 342864 # codec2: Change a Info print into Verbose
}
apply_patches() {
echo "Applying patch group ${1}"
bash ./lineage_build_leaos/apply_patches.sh ./lineage_patches_leaos/${1}
}
prep_device() {
# EMUI 8
# cd hardware/lineage/compat
# git fetch https://github.com/LineageOS/android_hardware_lineage_compat refs/changes/13/361913/9
# git cherry-pick FETCH_HEAD
# cd ../../../
# EMUI 9
unzip -o ./vendor/huawei/hi6250-9-common/proprietary/vendor/firmware/isp_dts.zip -d ./vendor/huawei/hi6250-9-common/proprietary/vendor/firmware
# EMUI 8
unzip -o ./vendor/huawei/hi6250-8-common/proprietary/vendor/firmware/isp_dts.zip -d ./vendor/huawei/hi6250-8-common/proprietary/vendor/firmware
}
prep_treble() {
apply_patches patches_treble_prerequisite
apply_patches patches_treble_td
}
finalize_device() {
:
}
finalize_treble() {
rm -f device/*/sepolicy/common/private/genfs_contexts
cd device/phh/treble
git clean -fdx
bash generate.sh lineage
cd ../../..
}
build_device() {
# croot
#TEMPORARY_DISABLE_PATH_RESTRICTIONS=true
#export TEMPORARY_DISABLE_PATH_RESTRICTIONS
#breakfast ${1}
#mka bootimage 2>&1 | tee make_anne.log
brunch ${1}
mv $OUT/lineage-*.zip ./build-output/LeaOS-OSS-20.0-$BUILD_DATE-${1}.zip
}
build_treble() {
case "${1}" in
("64VN") TARGET=arm64_bvN;;
("64VS") TARGET=arm64_bvS;;
("64GN") TARGET=arm64_bgN;;
(*) echo "Invalid target - exiting"; exit 1;;
esac
lunch lineage_${TARGET}-userdebug
make -j$(nproc --all) systemimage
mv $OUT/system.img ./build-output/LeaOS-20.0-$BUILD_DATE-${TARGET}.img
}
if ${NOSYNC}
then
echo "ATTENTION: syncing/patching skipped!"
echo ""
echo "Setting up build environment"
source build/envsetup.sh &> /dev/null
echo ""
else
echo "Prep build"
prep_build
prep_${MODE}
echo "Applying patches"
if [ ${MODE} == "device" ]
then
apply_patches patches_device
apply_patches patches_device_iceows
else
apply_patches patches_platform
apply_patches patches_treble
apply_patches patches_platform_personal
apply_patches patches_treble_personal
apply_patches patches_treble_iceows
fi
finalize_${MODE}
echo ""
fi
for var in "${@:2}"
do
if [ ${var} == "nosync" ]
then
continue
fi
echo "Starting personal " || echo " build for ${MODE} ${var}"
build_${MODE} ${var}
done
ls ./build-output | grep 'LeaOS' || true
END=`date +%s`
ELAPSEDM=$(($(($END-$START))/60))
ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60))
echo "Buildbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds"
echo ""