Skip to content

Build OnePlus_SukiSU Ultra All #1

Build OnePlus_SukiSU Ultra All

Build OnePlus_SukiSU Ultra All #1

Workflow file for this run

name: Build OnePlus_SukiSU Ultra All
on:
workflow_dispatch:
inputs:
CPU:
type: choice
description: "分支"
required: true
default: sm8550
options:
- sm7550
- sm7675
- sm8450
- sm8475
- sm8550
- sm8650
- sm8750
FEIL:
type: choice
description: "配置文件"
required: true
default: oneplus_ace2_pro_v
options:
- oneplus_nord_ce4_v
- oneplus_ace_3v_v
- oneplus_nord_4_v
- oneplus_10_pro_v
- oneplus_10t_v
- oneplus_11r_v
- oneplus_ace2_v
- oneplus_ace_pro_v
- oneplus_11_v
- oneplus_12r_v
- oneplus_ace2_pro_v
- oneplus_ace3_v
- oneplus_open_v
- oneplus12_v
- oneplus_13r
- oneplus_ace3_pro_v
- oneplus_ace5
- oneplus_pad2_v
- oneplus_13
- oneplus_13t
- oneplus_ace5_pro
- oneplus_ace_6
- oneplus_pad_2_pro
- oneplus_pad_3
- GitHub有bug可能不显示最后一项,误使用此项
CPUD:
type: choice
description: "处理器代号"
required: true
default: kalama
options:
- crow
- waipio
- kalama
- pineapple
- sun
ANDROID_VERSION:
type: choice
description: "内核安卓版本"
required: true
default: android15
options:
- android12
- android13
- android14
- android15
KERNEL_VERSION:
type: choice
description: "内核版本"
required: true
default: "5.15"
options:
- "5.10"
- "5.15"
- "6.1"
- "6.6"
BUILD_METHOD:
type: choice
description: "编译方式"
required: true
default: gki
options:
- gki
- perf
SUSFS_CI:
type: boolean
description: "下载SUSFS模块是否使用CI构建?"
required: true
default: true
VFS:
type: boolean
description: "是否启用手动钩子?"
required: true
default: true
KPM:
type: boolean
description: "是否启用KPM?"
required: true
default: true
ZRAM:
type: boolean
description: "是否启用添加更多的ZRAM算法?"
required: true
default: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 8192
temp-reserve-mb: 2048
swap-size-mb: 8192
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
- name: Configure Git
run: |
git config --global user.name "Numbersf"
git config --global user.email "[email protected]"
- name: Install dependencies
run: |
sudo apt update && sudo apt upgrade -y
sudo apt install -y python3 git curl
- name: Show selected inputs debug
run: |
echo "Selected CPU: ${{ github.event.inputs.CPU }}"
echo "Selected FEIL: ${{ github.event.inputs.FEIL }}"
echo "Selected CPUD: ${{ github.event.inputs.CPUD }}"
echo "Selected ANDROID_VERSION: ${{ github.event.inputs.ANDROID_VERSION }}"
echo "Selected KERNEL_VERSION: ${{ github.event.inputs.KERNEL_VERSION }}"
echo "Selected BUILD_METHOD: ${{ github.event.inputs.BUILD_METHOD }}"
echo "Selected SUSFS_CI: ${{ github.event.inputs.SUSFS_CI }}"
echo "Selected ZRAM: ${{ github.event.inputs.ZRAM }}"
echo "Selected VFS: ${{ github.event.inputs.VFS }}"
echo "Selected KPM: ${{ github.event.inputs.KPM }}"
- name: Install repo tool
run: |
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/repo
chmod a+x ~/repo
sudo mv ~/repo /usr/local/bin/repo
- name: Initialize repo and sync
run: |
mkdir kernel_workspace && cd kernel_workspace
repo init -u https://github.com/OnePlusOSS/kernel_manifest.git -b refs/heads/oneplus/${{ github.event.inputs.CPU }} -m ${{ github.event.inputs.FEIL }}.xml --depth=1
repo sync
if [ -e kernel_platform/common/BUILD.bazel ]; then
sed -i '/^[[:space:]]*"protected_exports_list"[[:space:]]*:[[:space:]]*"android\/abi_gki_protected_exports_aarch64",$/d' kernel_platform/common/BUILD.bazel
fi
if [ -e kernel_platform/msm-kernel/BUILD.bazel ]; then
sed -i '/^[[:space:]]*"protected_exports_list"[[:space:]]*:[[:space:]]*"android\/abi_gki_protected_exports_aarch64",$/d' kernel_platform/msm-kernel/BUILD.bazel
fi
rm kernel_platform/common/android/abi_gki_protected_exports_* || echo "No protected exports!"
rm kernel_platform/msm-kernel/android/abi_gki_protected_exports_* || echo "No protected exports!"
# 删除 -dirty 后缀
- name: Force remove -dirty suffix
run: |
cd kernel_workspace/kernel_platform
sed -i 's/ -dirty//g' common/scripts/setlocalversion
sed -i 's/ -dirty//g' msm-kernel/scripts/setlocalversion
sed -i 's/ -dirty//g' external/dtc/scripts/setlocalversion
sed -i '$i res=$(echo "$res" | sed '\''s/-dirty//g'\'')' common/scripts/setlocalversion
git add -A
git commit -m "Force remove -dirty suffix from kernel version"
# 添加 SukiSU Ultra
- name: Add KernelSU-SukiSU Ultra
run: |
cd kernel_workspace/kernel_platform
curl -LSs "https://raw.githubusercontent.com/SukiSU-Ultra/SukiSU-Ultra/main/kernel/setup.sh" | bash -s susfs-main
cd ./KernelSU
KSU_VERSION=$(expr $(/usr/bin/git rev-list --count main) "+" 10606)
echo "KSUVER=$KSU_VERSION" >> $GITHUB_ENV
export KSU_VERSION=$KSU_VERSION
sed -i "s/DKSU_VERSION=12800/DKSU_VERSION=${KSU_VERSION}/" kernel/Makefile
- name: Apply Patches SukiSU Ultra
run: |
cd kernel_workspace
git clone https://gitlab.com/simonpunk/susfs4ksu.git -b gki-${{ github.event.inputs.ANDROID_VERSION }}-${{ github.event.inputs.KERNEL_VERSION }}
git clone https://github.com/ShirkNeko/SukiSU_patch.git
cd kernel_platform
echo "正在给内核打susfs补丁"
cp ../susfs4ksu/kernel_patches/50_add_susfs_in_gki-${{ github.event.inputs.ANDROID_VERSION }}-${{ github.event.inputs.KERNEL_VERSION }}.patch ./common/
cp ../susfs4ksu/kernel_patches/fs/* ./common/fs/
cp ../susfs4ksu/kernel_patches/include/linux/* ./common/include/linux/
if [ "${{ github.event.inputs.ZRAM }}" = "true" ]; then
echo "正在给内核打zram补丁"
cp -r ../SukiSU_patch/other/zram/lz4k/include/linux/* ./common/include/linux
cp -r ../SukiSU_patch/other/zram/lz4k/lib/* ./common/lib
cp -r ../SukiSU_patch/other/zram/lz4k/crypto/* ./common/crypto
cp -r ../SukiSU_patch/other/zram/lz4k_oplus ./common/lib/
fi
cd ./common
patch -p1 < 50_add_susfs_in_gki-${{ github.event.inputs.ANDROID_VERSION }}-${{ github.event.inputs.KERNEL_VERSION }}.patch || true
echo "完成"
- name: Apply Hide Stuff Patches
run: |
cd kernel_workspace/kernel_platform/common
cp ../../SukiSU_patch/69_hide_stuff.patch ./
echo "正在打隐藏应用补丁"
patch -p1 -F 3 < 69_hide_stuff.patch
- name: Apply VFS
run: |
cd kernel_workspace/kernel_platform/common
if [ "${{ github.event.inputs.VFS }}" = "true" ]; then
cp ../../SukiSU_patch/hooks/syscall_hooks.patch ./
echo "正在打vfs补丁"
patch -p1 -F 3 < syscall_hooks.patch
echo "vfs_patch完成"
fi
- name: Apply LZ4KD
run: |
cd kernel_workspace/kernel_platform/common
if [ "${{ github.event.inputs.ZRAM }}" = "true" ]; then
cp ../../SukiSU_patch/other/zram/zram_patch/${{ github.event.inputs.KERNEL_VERSION }}/lz4kd.patch ./
echo "正在打lz4kd补丁"
patch -p1 -F 3 < lz4kd.patch || true
echo '完成LZ4KD补丁'
fi
# 配置信息
- name: Add Configuration Settings
run: |
cd kernel_workspace/kernel_platform
CONFIG_FILE=./common/arch/arm64/configs/gki_defconfig
KERNEL_VERSION="${{ github.event.inputs.KERNEL_VERSION }}"
# SukiSU Ultra config
echo "CONFIG_KSU=y" >> "$CONFIG_FILE"
echo "CONFIG_KPM=y" >> "$CONFIG_FILE"
if [ "${{ github.event.inputs.VFS }}" = "false" ]; then
echo "CONFIG_KPROBES=y" >> "$CONFIG_FILE"
fi
# VFS config
if [ "${{ github.event.inputs.VFS }}" = "true" ]; then
echo "CONFIG_KSU_SUSFS_SUS_SU=n" >> "$CONFIG_FILE"
echo "CONFIG_KSU_MANUAL_HOOK=y" >> "$CONFIG_FILE"
fi
if [ "${{ github.event.inputs.VFS }}" = "false" ]; then
echo "CONFIG_KSU_SUSFS_SUS_SU=y" >> "$CONFIG_FILE"
fi
# SUSFS config
if [ "${{ github.event.inputs.VFS }}" = "true" ]; then
echo "CONFIG_KSU_SUSFS=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_SUS_PATH=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_SUS_MOUNT=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_SUS_KSTAT=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_SUS_OVERLAYFS=n" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_TRY_UMOUNT=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_SPOOF_UNAME=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_ENABLE_LOG=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y" >> "$CONFIG_FILE"
echo "CONFIG_KSU_SUSFS_OPEN_REDIRECT=y" >> "$CONFIG_FILE"
fi
# Remove check_defconfig
sed -i 's/check_defconfig//' ./common/build.config.gki
# LZ4KD配置
if [ "${{ github.event.inputs.ZRAM }}" = "true" ]; then
CONFIG_FILE=./common/arch/arm64/configs/gki_defconfig
if [ "${{ github.event.inputs.KERNEL_VERSION }}" = "5.10" ]; then
echo "CONFIG_ZSMALLOC=y" >> "$CONFIG_FILE"
echo "CONFIG_ZRAM=y" >> "$CONFIG_FILE"
echo "CONFIG_MODULE_SIG=n" >> "$CONFIG_FILE"
echo "CONFIG_CRYPTO_LZO=y" >> "$CONFIG_FILE"
echo "CONFIG_ZRAM_DEF_COMP_LZ4KD=y" >> "$CONFIG_FILE"
fi
if [ "${{ github.event.inputs.KERNEL_VERSION }}" != "6.6" ] && [ "${{ github.event.inputs.KERNEL_VERSION }}" != "5.10" ]; then
if grep -q "CONFIG_ZSMALLOC" -- "$CONFIG_FILE"; then
sed -i 's/CONFIG_ZSMALLOC=m/CONFIG_ZSMALLOC=y/g' "$CONFIG_FILE"
else
echo "CONFIG_ZSMALLOC=y" >> "$CONFIG_FILE"
fi
sed -i 's/CONFIG_ZRAM=m/CONFIG_ZRAM=y/g' "$CONFIG_FILE"
fi
if [ "${{ github.event.inputs.KERNEL_VERSION }}" = "6.6" ]; then
echo "CONFIG_ZSMALLOC=y" >> "$CONFIG_FILE"
sed -i 's/CONFIG_ZRAM=m/CONFIG_ZRAM=y/g' "$CONFIG_FILE"
fi
if [ "${{ github.event.inputs.ANDROID_VERSION }}" = "android14" ] || [ "${{ github.event.inputs.ANDROID_VERSION }}" = "android15" ]; then
if [ -e ./common/modules.bzl ]; then
sed -i 's/"drivers\/block\/zram\/zram\.ko",//g; s/"mm\/zsmalloc\.ko",//g' "./common/modules.bzl"
fi
if [ -e ./msm-kernel/modules.bzl ]; then
sed -i 's/"drivers\/block\/zram\/zram\.ko",//g; s/"mm\/zsmalloc\.ko",//g' "./msm-kernel/modules.bzl"
echo "CONFIG_ZSMALLOC=y" >> "msm-kernel/arch/arm64/configs/${{ github.event.inputs.CPUD }}-GKI.config"
echo "CONFIG_ZRAM=y" >> "msm-kernel/arch/arm64/configs/${{ github.event.inputs.CPUD }}-GKI.config"
fi
echo "CONFIG_MODULE_SIG_FORCE=n" >> "$CONFIG_FILE"
elif [ "${{ github.event.inputs.KERNEL_VERSION }}" = "5.10" ] || [ "${{ github.event.inputs.KERNEL_VERSION }}" = "5.15" ]; then
rm "common/android/gki_aarch64_modules"
touch "common/android/gki_aarch64_modules"
fi
if grep -q "CONFIG_ZSMALLOC=y" "$CONFIG_FILE" && grep -q "CONFIG_ZRAM=y" "$CONFIG_FILE"; then
echo "CONFIG_CRYPTO_LZ4HC=y" >> "$CONFIG_FILE"
echo "CONFIG_CRYPTO_LZ4K=y" >> "$CONFIG_FILE"
echo "CONFIG_CRYPTO_LZ4KD=y" >> "$CONFIG_FILE"
echo "CONFIG_CRYPTO_842=y" >> "$CONFIG_FILE"
echo "CONFIG_ZRAM_WRITEBACK=y" >> "$CONFIG_FILE"
fi
fi
- name: Build kernel
if: ${{ github.event.inputs.CPU == 'sm8650' || github.event.inputs.CPU == 'sm7675' }}
run: |
cd kernel_workspace
./kernel_platform/build_with_bazel.py -t ${{ github.event.inputs.CPUD }} ${{ github.event.inputs.BUILD_METHOD }}
- name: Fallback build kernel
if: ${{ github.event.inputs.CPU != 'sm8650' && github.event.inputs.CPU != 'sm7675' }}
run: |
cd kernel_workspace
LTO=thin SYSTEM_DLKM_RE_SIGN=0 BUILD_SYSTEM_DLKM=0 KMI_SYMBOL_LIST_STRICT_MODE=0 ./kernel_platform/oplus/build/oplus_build_kernel.sh ${{ github.event.inputs.CPUD }} ${{ github.event.inputs.BUILD_METHOD }}
- name: Make AnyKernel3
run: |
git clone https://github.com/Numbersf/AnyKernel3 --depth=1
rm -rf ./AnyKernel3/.git
dir1="kernel_workspace/kernel_platform/out/msm-kernel-${{ github.event.inputs.CPUD }}-${{ github.event.inputs.BUILD_METHOD }}/dist/"
dir2="kernel_workspace/kernel_platform/bazel-out/k8-fastbuild/bin/msm-kernel/${{ github.event.inputs.CPUD }}_gki_kbuild_mixed_tree/"
dir3="kernel_workspace/kernel_platform/out/msm-${{ github.event.inputs.CPUD }}-${{ github.event.inputs.CPUD }}-${{ github.event.inputs.BUILD_METHOD }}/dist/"
dir4="kernel_workspace/kernel_platform/out/msm-kernel-${{ github.event.inputs.CPUD }}-${{ github.event.inputs.BUILD_METHOD }}/gki_kernel/common/arch/arm64/boot/"
dir5="kernel_workspace/kernel_platform/out/msm-${{ github.event.inputs.CPUD }}-${{ github.event.inputs.CPUD }}-${{ github.event.inputs.BUILD_METHOD }}/gki_kernel/common/arch/arm64/boot/"
target1="./AnyKernel3/"
target2="./kernel_workspace/kernel"
# 查找 Image 文件
if find "$dir1" -name "Image" | grep -q "Image"; then
image_path="$dir1"Image
elif find "$dir2" -name "Image" | grep -q "Image"; then
image_path="$dir2"Image
elif find "$dir3" -name "Image" | grep -q "Image"; then
image_path="$dir3"Image
elif find "$dir4" -name "Image" | grep -q "Image"; then
image_path="$dir4"Image
elif find "$dir5" -name "Image" | grep -q "Image"; then
image_path="$dir5"Image
else
image_path=$(find "./kernel_workspace/kernel_platform/common/out/" -name "Image" | head -n 1)
fi
# 拷贝 Image
if [ -n "$image_path" ] && [ -f "$image_path" ]; then
mkdir -p "$dir1"
if [ "$(realpath "$image_path")" != "$(realpath "$dir1"Image)" ]; then
cp "$image_path" "$dir1"
else
echo "源文件与目标相同,跳过复制"
fi
cp "$dir1"Image ./AnyKernel3/Image
else
echo "未找到 Image 文件,构建可能失败"
exit 1
fi
# 可选复制其它新文件(如果存在)
if [ "${{ github.event.inputs.CPU }}" = "sm8750" ]; then
for file in dtbo.img system_dlkm.erofs.img vendor_dlkm.img vendor_boot.img; do
if [ -f "$dir1$file" ]; then
target_name="$file"
# 特殊处理 system_dlkm.erofs.img 的目标名
if [ "$file" = "system_dlkm.erofs.img" ]; then
target_name="system_dlkm.img"
fi
cp "$dir1$file" "./AnyKernel3/$target_name"
else
echo "$file 不存在,跳过复制"
fi
done
fi
- name: Apply patch_linux and replace Image
if: ${{ github.event.inputs.KPM == 'true' }}
run: |
cd /home/runner/work/Action_OnePlus_MKSU_SUSFS/Action_OnePlus_MKSU_SUSFS/kernel_workspace/kernel_platform/out/msm-kernel-${{ github.event.inputs.CPUD }}-${{ github.event.inputs.BUILD_METHOD }}/dist
curl -LSs "https://raw.githubusercontent.com/ShirkNeko/SukiSU_patch/refs/heads/main/kpm/patch_linux" -o patch_linux
chmod +x patch_linux
./patch_linux
rm -f Image
mv oImage Image
cp Image $GITHUB_WORKSPACE/AnyKernel3/Image
# 下载 SUSFS 模块(CI)
- name: Download Latest SUSFS Module from CI
if: ${{ github.event.inputs.SUSFS_CI == 'true' }}
run: |
LATEST_RUN_ID=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/sidex15/susfs4ksu-module/actions/runs?status=success" | \
jq -r '.workflow_runs[] | select(.head_branch == "v1.5.2+") | .id' | head -n 1)
if [ -z "$LATEST_RUN_ID" ]; then
echo "No successful run found for branch v1.5.2+"
exit 1
fi
ARTIFACT_URL=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/sidex15/susfs4ksu-module/actions/runs/$LATEST_RUN_ID/artifacts" | jq -r '.artifacts[0].archive_download_url')
curl -L -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -o ksu_module_susfs.zip "$ARTIFACT_URL"
cp ksu_module_susfs.zip ./AnyKernel3/
# 下载 SUSFS 模块(Release)
- name: Download Latest SUSFS Module from Release
if: ${{ github.event.inputs.SUSFS_CI == 'false' }}
run: |
wget https://github.com/sidex15/ksu_module_susfs/releases/latest/download/ksu_module_susfs_1.5.2+.zip
cp ksu_module_susfs_1.5.2+.zip ./AnyKernel3/
- name: Set suffix
id: suffix
run: |
echo "value=${{ github.event.inputs.KPM == 'true' && '_KPM' || '' }}${{ github.event.inputs.VFS == 'true' && '_VFS' || '' }}${{ github.event.inputs.ZRAM == 'true' && '_LZ4KD' || '' }}" >> $GITHUB_OUTPUT
- name: Remove _uv suffix from FEIL
id: feil_clean
run: |
clean_feil="${{ github.event.inputs.FEIL }}"
clean_feil="${clean_feil%_v}" # 去掉结尾的 _v(如果有)
clean_feil="${clean_feil%_u}" # 去掉结尾的 _u(如果有)
echo "value=$clean_feil" >> $GITHUB_OUTPUT
- name: Upload AnyKernel3
uses: actions/upload-artifact@v4
with:
name: AnyKernel3_SukiSUUltra_${{ env.KSUVER }}_${{ steps.feil_clean.outputs.value }}${{ steps.suffix.outputs.value }}
path: ./AnyKernel3/*