|
96 | 96 | ttl="$OP_TTL" |
97 | 97 | ip_set="$OP_IP_SET" |
98 | 98 | rust_build="$OP_RUST_BUILD" |
| 99 | + lto="$OP_LTO" |
99 | 100 | optimize='${{ inputs.optimize_level }}' |
100 | 101 | |
101 | 102 | errors=() |
@@ -196,6 +197,12 @@ runs: |
196 | 197 | errors+=("Input 'rust_build' contains invalid characters. Allowed: 'true' or 'false'. Got: '$rust_build'") |
197 | 198 | fi |
198 | 199 | |
| 200 | + if [[ -z "$lto" ]]; then |
| 201 | + errors+=("Input 'lto' cannot be empty") |
| 202 | + elif [[ "$lto" != "none" && "$lto" != "thin" && "$lto" != "full" ]]; then |
| 203 | + errors+=("Input 'lto' contains invalid characters. Allowed: 'thin', 'full' or 'none'. Got: '$lto'") |
| 204 | + fi |
| 205 | + |
199 | 206 | case "$optimize" in |
200 | 207 | O2|O3) ;; |
201 | 208 | *) errors+=("optimize_level must be O2 or O3. Got: '$optimize'"); ;; |
@@ -227,25 +234,6 @@ runs: |
227 | 234 | echo "✅ Dependencies installed" |
228 | 235 | echo "::endgroup::" |
229 | 236 |
|
230 | | - # - name: Setup RUST |
231 | | - # uses: actions-rust-lang/setup-rust-toolchain@v1 |
232 | | - # if: ${{ env.OP_RUST_BUILD == 'true' }} |
233 | | - # with: |
234 | | - # toolchain: "1.82.0" |
235 | | - |
236 | | - # - name: Show Rust version |
237 | | - # shell: bash |
238 | | - # if: ${{ env.OP_RUST_BUILD == 'true' }} |
239 | | - # run: rustc -V |
240 | | - |
241 | | - # - name: Install bindgen if you ever need it |
242 | | - # shell: bash |
243 | | - # if: ${{ env.OP_RUST_BUILD == 'true' }} |
244 | | - # run: | |
245 | | - # rustup toolchain install nightly |
246 | | - # rustup default nightly |
247 | | - # cargo +nightly install bindgen-cli --version 0.69.5 |
248 | | - |
249 | 237 | - name: Install bindgen only (no rustc) |
250 | 238 | shell: bash |
251 | 239 | if: ${{ env.OP_RUST_BUILD == 'true' }} |
@@ -400,7 +388,7 @@ runs: |
400 | 388 | RUSTC_FOUND=false |
401 | 389 | for base in "$KP/prebuilts" "$KP/prebuilts-master"; do |
402 | 390 | [ -d "$base/clang/host/linux-x86" ] || continue |
403 | | - latest=$(ls -d "$base"/clang/host/linux-x86/clang-r*/ 2>/dev/null | sort -V | head -n1 || true) |
| 391 | + latest=$(ls -d "$base"/clang/host/linux-x86/clang-r*/ 2>/dev/null | sort -V | tail -n1 || true) |
404 | 392 | if [ -n "$latest" ] && [ -x "$latest/bin/clang" ]; then |
405 | 393 | CLANG_BIN="$latest/bin" |
406 | 394 | CLANG_FOUND=true |
@@ -1048,8 +1036,6 @@ runs: |
1048 | 1036 | echo "::group::Add Build based configs" |
1049 | 1037 | cd "$CONFIG/kernel_platform" |
1050 | 1038 | cat >> common/arch/arm64/configs/gki_defconfig <<EOF |
1051 | | - CONFIG_LTO_CLANG_NONE=y |
1052 | | - CONFIG_LTO_CLANG=y |
1053 | 1039 | CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y |
1054 | 1040 | CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=n |
1055 | 1041 | CONFIG_OPTIMIZE_INLINING=y |
@@ -1220,6 +1206,32 @@ runs: |
1220 | 1206 | KCFLAGS_EXTRA="-O2" |
1221 | 1207 | fi |
1222 | 1208 | |
| 1209 | + case "${{ env.OP_LTO}}" in |
| 1210 | + "none") |
| 1211 | + scripts/config --file "$OUT/.config" -e LTO_CLANG |
| 1212 | + scripts/config --file "$OUT/.config" -e LTO_CLANG_NONE |
| 1213 | + scripts/config --file "$OUT/.config" -d LTO_CLANG_THIN |
| 1214 | + scripts/config --file "$OUT/.config" -d LTO_CLANG_FULL |
| 1215 | + ;; |
| 1216 | + "thin") |
| 1217 | + scripts/config --file "$OUT/.config" -e LTO_CLANG |
| 1218 | + scripts/config --file "$OUT/.config" -e LTO_CLANG_THIN |
| 1219 | + scripts/config --file "$OUT/.config" -d LTO_CLANG_NONE |
| 1220 | + scripts/config --file "$OUT/.config" -d LTO_CLANG_FULL |
| 1221 | + ;; |
| 1222 | + "full") |
| 1223 | + scripts/config --file "$OUT/.config" -e LTO_CLANG |
| 1224 | + scripts/config --file "$OUT/.config" -e LTO_CLANG_FULL |
| 1225 | + scripts/config --file "$OUT/.config" -d LTO_CLANG_NONE |
| 1226 | + scripts/config --file "$OUT/.config" -d LTO_CLANG_THIN |
| 1227 | + ;; |
| 1228 | + *) |
| 1229 | + echo "::error::Unsupported LTO option: ${{ env.OP_LTO}}" |
| 1230 | + exit 1 |
| 1231 | + ;; |
| 1232 | + esac |
| 1233 | + |
| 1234 | + |
1223 | 1235 | make O="$OUT" olddefconfig |
1224 | 1236 | |
1225 | 1237 | KCFLAGS="$KCFLAGS -Wno-error -pipe -fno-stack-protector ${KCFLAGS_EXTRA}" |
|
0 commit comments