Skip to content

Commit 3faf5c1

Browse files
committed
Add LTO control to config
1 parent 4b5b958 commit 3faf5c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+87
-22
lines changed

.github/actions/action.yml

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ runs:
9696
ttl="$OP_TTL"
9797
ip_set="$OP_IP_SET"
9898
rust_build="$OP_RUST_BUILD"
99+
lto="$OP_LTO"
99100
optimize='${{ inputs.optimize_level }}'
100101
101102
errors=()
@@ -196,6 +197,12 @@ runs:
196197
errors+=("Input 'rust_build' contains invalid characters. Allowed: 'true' or 'false'. Got: '$rust_build'")
197198
fi
198199
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+
199206
case "$optimize" in
200207
O2|O3) ;;
201208
*) errors+=("optimize_level must be O2 or O3. Got: '$optimize'"); ;;
@@ -227,25 +234,6 @@ runs:
227234
echo "✅ Dependencies installed"
228235
echo "::endgroup::"
229236
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-
249237
- name: Install bindgen only (no rustc)
250238
shell: bash
251239
if: ${{ env.OP_RUST_BUILD == 'true' }}
@@ -400,7 +388,7 @@ runs:
400388
RUSTC_FOUND=false
401389
for base in "$KP/prebuilts" "$KP/prebuilts-master"; do
402390
[ -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)
404392
if [ -n "$latest" ] && [ -x "$latest/bin/clang" ]; then
405393
CLANG_BIN="$latest/bin"
406394
CLANG_FOUND=true
@@ -1048,8 +1036,6 @@ runs:
10481036
echo "::group::Add Build based configs"
10491037
cd "$CONFIG/kernel_platform"
10501038
cat >> common/arch/arm64/configs/gki_defconfig <<EOF
1051-
CONFIG_LTO_CLANG_NONE=y
1052-
CONFIG_LTO_CLANG=y
10531039
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
10541040
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=n
10551041
CONFIG_OPTIMIZE_INLINING=y
@@ -1220,6 +1206,32 @@ runs:
12201206
KCFLAGS_EXTRA="-O2"
12211207
fi
12221208
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+
12231235
make O="$OUT" olddefconfig
12241236
12251237
KCFLAGS="$KCFLAGS -Wno-error -pipe -fno-stack-protector ${KCFLAGS_EXTRA}"

configs/oos14/OP-ACE-3-PRO.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"android_version": "android14",
77
"kernel_version": "6.1",
88
"os_version": "OOS14",
9+
"lto": "thin",
910
"rust_build": false,
1011
"disk_cleanup": true,
1112
"hmbird": false,

configs/oos14/OP-PAD-PRO.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"android_version": "android14",
77
"kernel_version": "6.1",
88
"os_version": "OOS14",
9+
"lto": "thin",
910
"rust_build": false,
1011
"disk_cleanup": true,
1112
"hmbird": false,

configs/oos14/OP11.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"android_version": "android13",
77
"kernel_version": "5.15",
88
"os_version": "OOS14",
9+
"lto": "thin",
910
"rust_build": false,
1011
"disk_cleanup": true,
1112
"hmbird": false,

configs/oos14/OP11r.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"android_version": "android12",
77
"kernel_version": "5.10",
88
"os_version": "OOS14",
9+
"lto": "thin",
910
"rust_build": false,
1011
"disk_cleanup": true,
1112
"hmbird": false,

configs/oos14/OP12.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"android_version": "android14",
77
"kernel_version": "6.1",
88
"os_version": "OOS14",
9+
"lto": "thin",
910
"rust_build": false,
1011
"disk_cleanup": true,
1112
"hmbird": false,

configs/oos15/OP-ACE-2-PRO.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"android_version": "android13",
77
"kernel_version": "5.15",
88
"os_version": "OOS15",
9+
"lto": "thin",
910
"rust_build": false,
1011
"disk_cleanup": false,
1112
"hmbird": false,

configs/oos15/OP-ACE-2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"android_version": "android12",
77
"kernel_version": "5.10",
88
"os_version": "OOS15",
9+
"lto": "thin",
910
"rust_build": false,
1011
"disk_cleanup": false,
1112
"hmbird": false,

configs/oos15/OP-ACE-3-PRO.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"android_version": "android14",
77
"kernel_version": "6.1",
88
"os_version": "OOS15",
9+
"lto": "thin",
910
"rust_build": false,
1011
"disk_cleanup": false,
1112
"hmbird": false,

configs/oos15/OP-ACE-3.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"android_version": "android13",
77
"kernel_version": "5.15",
88
"os_version": "OOS15",
9+
"lto": "thin",
910
"rust_build": false,
1011
"disk_cleanup": false,
1112
"hmbird": false,

0 commit comments

Comments
 (0)