diff --git a/.github/workflows/kernelsu-los21.yml b/.github/workflows/kernelsu-los21.yml deleted file mode 100644 index 60c65b87f718..000000000000 --- a/.github/workflows/kernelsu-los21.yml +++ /dev/null @@ -1,212 +0,0 @@ -name: Build OnePlus-Sm8150-Kernel-LOS21 -on: -# workflow_dispatch: -# schedule: - # Run once a week on Sunday at midnight. See http://crontab.guru -# - cron: '0 21 * * *' - push: - branches: - - oneplus/LOS_SM8150_14.0 - pull_request: - branches: - - oneplus/LOS_SM8150_14.0 - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: write - env: - CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" - CCACHE_NOHASHDIR: "true" - CCACHE_MAXSIZE: "2G" - CCACHE_HARDLINK: "true" - steps: - - name: Set up ccache - uses: hendrikmuhs/ccache-action@v1.2 - - name: Remove unnecessary files - run: | - sudo rm -rf /opt/ghc - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf /usr/share/dotnet - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - name: Install dependencies - run: | - sudo apt-get update -y - sudo apt install gcc-aarch64-linux-gnu -y - sudo apt install gcc-arm-linux-gnueabi -y - sudo apt install clang-14 -y - sudo apt install binutils make python3 libssl-dev build-essential bc bison flex unzip libssl-dev ca-certificates xz-utils mkbootimg cpio device-tree-compiler git git-lfs -y - git clone https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9 aarch64 --depth=1 - git clone https://github.com/grm34/proton-clang -b ZenMaxBuilder clang --depth=1 - git clone https://github.com/snowwolf725/AnyKernel3 -b oneplus7 --depth=1 - rm -rf AnyKernel3/.git - - - name: Checkout Android 10 kernel source - run: | - git clone --recurse-submodules https://github.com/snowwolf725/android_kernel_oneplus_sm8150 -b oneplus/OOS_SM8150_10.0 --depth=1 kernel - - name: Get Version - id: get_version - run: | - cd kernel/KernelSU - git pull - git rev-list --count HEAD - echo "VERSION=$(expr $(git rev-list --count HEAD) + 10200)" >> $GITHUB_OUTPUT - cd ../../ - - name: Build Kernel - run: | - export KERNEL_DEFCONFIG="blu_spark_defconfig" - export KERNEL_CMDLINE="ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-gnu- CROSS_COMPILE_ARM32=arm-linux-gnueabi- LLVM=1 LLVM_IAS=1 O=out" - export PATH=$(pwd)/clang/bin/:$(pwd)/aarch64/bin/:$PATH - export ARCH=arm64 - export SUBARCH=arm64 - export LD=ld.lld - export BRAND_SHOW_FLAG=oneplus - export TARGET_PRODUCT=msmnile - cd kernel - make $KERNEL_CMDLINE $KERNEL_DEFCONFIG - make $KERNEL_CMDLINE -j$(nproc --all) - cp out/arch/arm64/boot/Image ../AnyKernel3 - cd .. - - name: Create AK3 zip for android 10 - run: | - cd AnyKernel3 - zip -r ../OP7-OOS10-kernel-SU-${{ steps.get_version.outputs.VERSION }}.zip * - cd .. - - name: Checkout Android 11 kernel source - run: | - rm -rf kernel - git clone --recurse-submodules https://github.com/snowwolf725/android_kernel_oneplus_sm8150 -b oneplus/OOS_SM8150_11.0 --depth=1 kernel - cd kernel/KernelSU - git pull - cd ../../ - - name: Setup OOS 11 - run: | - export KERNEL_DEFCONFIG="blu_spark_defconfig" - export KERNEL_CMDLINE="ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-androidkernel- CROSS_COMPILE_ARM32=arm-linux-gnueabi- LLVM=1 LLVM_IAS=1 O=out" - export PATH=$(pwd)/clang/bin/:$(pwd)/aarch64/bin/:$PATH - export ARCH=arm64 - export SUBARCH=arm64 - export LD=ld.lld - export BRAND_SHOW_FLAG=oneplus - export TARGET_PRODUCT=msmnile - cd kernel - make $KERNEL_CMDLINE CC="ccache clang-14" $KERNEL_DEFCONFIG - make $KERNEL_CMDLINE CC="ccache clang-14" -j$(nproc --all) - cp out/arch/arm64/boot/Image ../AnyKernel3 - cd .. - - name: Create AK3 zip for android 11 - run: | - cd AnyKernel3 - zip -r ../OP7-OOS11-kernel-SU-${{ steps.get_version.outputs.VERSION }}.zip * - cd .. - - name: Checkout Android 12 kernel source - run: | - rm -rf kernel - git clone --recurse-submodules https://github.com/snowwolf725/android_kernel_oneplus_sm8150 -b oneplus/OOS_SM8150_12.0 --depth=1 kernel - cd kernel/KernelSU - git pull - cd ../../ - - name: Setup OOS 12 - run: | - export KERNEL_DEFCONFIG="vendor/sm8150-perf_defconfig" - export KERNEL_CMDLINE="ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-androidkernel- CROSS_COMPILE_ARM32=arm-linux-gnueabi- LLVM=1 LLVM_IAS=1 O=out" - export PATH=$(pwd)/clang/bin/:$(pwd)/aarch64/bin/:$PATH - export ARCH=arm64 - export SUBARCH=arm64 - export LD=ld.lld - export BRAND_SHOW_FLAG=oneplus - export TARGET_PRODUCT=msmnile - cd kernel - make $KERNEL_CMDLINE CC="ccache clang" $KERNEL_DEFCONFIG - make $KERNEL_CMDLINE CC="ccache clang" -j$(nproc --all) - cp out/arch/arm64/boot/Image ../AnyKernel3 - cd .. - - name: Create AK3 zip for android 12 - run: | - cd AnyKernel3 - zip -r ../OP7-OOS12-kernel-SU-${{ steps.get_version.outputs.VERSION }}.zip * - cd .. - - name: Checkout Android 13 kernel source - run: | - rm -rf kernel - git clone --recurse-submodules https://github.com/snowwolf725/android_kernel_oneplus_sm8150 -b oneplus/LOS_SM8150_13.0 --depth=1 kernel - cd kernel/KernelSU - git pull - cd ../../ - - name: Setup LOS 20 - run: | - export KERNEL_DEFCONFIG="vendor/sm8150-perf_defconfig" - export KERNEL_CMDLINE="ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-androidkernel- CROSS_COMPILE_ARM32=arm-linux-gnueabi- LLVM=1 LLVM_IAS=1 CONFIG_BUILD_ARM64_DT_OVERLAY=n O=out" - export PATH=$(pwd)/clang/bin/:$(pwd)/aarch64/bin/:$PATH - export ARCH=arm64 - export SUBARCH=arm64 - export LD=ld.lld - export BRAND_SHOW_FLAG=oneplus - export TARGET_PRODUCT=msmnile - cd kernel - make $KERNEL_CMDLINE CC="ccache clang" $KERNEL_DEFCONFIG - make $KERNEL_CMDLINE CC="ccache clang" -j$(nproc --all) - cp out/arch/arm64/boot/Image ../AnyKernel3 - cd .. - - name: Create AK3 zip for android 13 - run: | - cd AnyKernel3 - zip -r ../OP7-LOS20-kernel-SU-${{ steps.get_version.outputs.VERSION }}.zip * - cd .. - - name: Upload Kernel-SU 13 - uses: actions/upload-artifact@v4 - with: - name: OP7-LOS20-kernel-SU-${{ steps.get_version.outputs.VERSION }} - path: "AnyKernel3/*" - - name: Checkout Android 14 kernel source - run: | - rm -rf kernel - git clone --recurse-submodules https://github.com/snowwolf725/android_kernel_oneplus_sm8150 -b oneplus/LOS_SM8150_14.0 --depth=1 kernel - cd kernel/KernelSU - git pull - cd ../../ - - name: Setup LOS 21 - run: | - export KERNEL_DEFCONFIG="lineage_sm8150_defconfig" - export KERNEL_CMDLINE="ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-androidkernel- CROSS_COMPILE_ARM32=arm-linux-gnueabi- LLVM=1 LLVM_IAS=1 CONFIG_BUILD_ARM64_DT_OVERLAY=n O=out" - export PATH=$(pwd)/clang/bin/:$(pwd)/aarch64/bin/:$PATH - export ARCH=arm64 - export SUBARCH=arm64 - export LD=ld.lld - export BRAND_SHOW_FLAG=oneplus - export TARGET_PRODUCT=msmnile - cd kernel - git config --global user.email "bot@kernelsu.org" - git config --global user.name "KernelSUBot" - git add -A && git commit -a -m "Add KernelSU" - make $KERNEL_CMDLINE CC="ccache clang" $KERNEL_DEFCONFIG - make $KERNEL_CMDLINE CC="ccache clang" -j$(nproc --all) - cp out/arch/arm64/boot/Image ../AnyKernel3 - cd .. - - name: Create AK3 zip for android 14 - run: | - cd AnyKernel3 - zip -r ../OP7-LOS21-kernel-SU-${{ steps.get_version.outputs.VERSION }}.zip * - cd .. - - name: Upload Kernel-SU 14 - uses: actions/upload-artifact@v4 - with: - name: OP7-LOS21-kernel-SU-${{ steps.get_version.outputs.VERSION }} - path: "AnyKernel3/*" - - name: Upload to Release - uses: softprops/action-gh-release@v2 - with: - files: | - OP7-OOS10-kernel-SU-${{ steps.get_version.outputs.VERSION }}.zip - OP7-OOS11-kernel-SU-${{ steps.get_version.outputs.VERSION }}.zip - OP7-OOS12-kernel-SU-${{ steps.get_version.outputs.VERSION }}.zip - OP7-LOS20-kernel-SU-${{ steps.get_version.outputs.VERSION }}.zip - OP7-LOS21-kernel-SU-${{ steps.get_version.outputs.VERSION }}.zip - name: OnePlus7_kernelsu-${{ steps.get_version.outputs.VERSION }} - tag_name: ${{ steps.get_version.outputs.VERSION }} - body: | - Device: Oneplus 7/Oneplus 7Pro/Oneplus 7T/Oneplus 7TPro - Target: OOS10, OOS11, OOS12, LOS20, LOS21 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sukisu-los21.yml b/.github/workflows/sukisu-los21.yml new file mode 100644 index 000000000000..b5858837d5e0 --- /dev/null +++ b/.github/workflows/sukisu-los21.yml @@ -0,0 +1,198 @@ +name: Build OnePlus-Sm8150-Kernel-LOS21 + +on: + workflow_dispatch: + inputs: + ZRAM: + description: 'Enable ZRAM support' + default: 'false' + VFS: + description: 'Enable VFS hook support' + default: 'false' + push: + branches: + - oneplus/LOS_SM8150_14.0 + pull_request: + branches: + - oneplus/LOS_SM8150_14.0 + +jobs: + build: + runs-on: ubuntu-22.04 + permissions: + contents: write + + env: + ANDROID_VERSION: android14 + KERNEL_VERSION: 4.14.355 + ZRAM: ${{ github.event.inputs.ZRAM }} + VFS: ${{ github.event.inputs.VFS }} + CCACHE_COMPILERCHECK: '%compiler% -dumpmachine; %compiler% -dumpversion' + CCACHE_NOHASHDIR: 'true' + CCACHE_MAXSIZE: '2G' + CCACHE_HARDLINK: 'true' + + steps: + - name: Set up ccache + uses: hendrikmuhs/ccache-action@v1.2 + + - id: cache-aarch64 + name: Cache AArch64 prebuilt toolchain + uses: actions/cache@v3 + with: + path: aarch64/ + key: ${{ runner.os }}-aarch64-prebuilt-${{ hashFiles('aarch64/version.txt') }} + restore-keys: | + ${{ runner.os }}-aarch64-prebuilt- + + - id: cache-clang + name: Cache Clang toolchain + uses: actions/cache@v3 + with: + path: clang/ + key: ${{ runner.os }}-clang-ZenMaxBuilder + restore-keys: | + ${{ runner.os }}-clang- + + - name: Clean up disk space + run: | + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf /usr/share/dotnet + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt install -y \ + gcc-aarch64-linux-gnu \ + gcc-arm-linux-gnueabi \ + clang-14 \ + binutils make python3 libssl-dev build-essential bc bison flex unzip ca-certificates xz-utils mkbootimg cpio device-tree-compiler git git-lfs + + - name: Setup AnyKernel3 + run: | + git clone https://github.com/snowwolf725/AnyKernel3 -b oneplus7 --depth=1 + rm -rf AnyKernel3/.git + + - name: Clone AArch64 toolchain (if not cached) + if: steps.cache-aarch64.outputs.cache-hit != 'true' + run: | + rm -rf aarch64 + git clone https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9.git aarch64 --depth=1 + cd aarch64 && git rev-parse HEAD > version.txt + + - name: Clone Clang toolchain (if not cached) + if: steps.cache-clang.outputs.cache-hit != 'true' + run: | + rm -rf clang + git clone https://github.com/grm34/proton-clang -b ZenMaxBuilder clang --depth=1 + + - name: Checkout kernel source + run: | + rm -rf kernel + git clone https://github.com/Ninjona/android_kernel_oneplus_sm8150 \ + -b oneplus/LOS_SM8150_14.0 --depth=1 kernel + + - name: Integrate SukiSU patches + run: | + cd kernel + # Install KernelSU + curl -sSL https://raw.githubusercontent.com/SukiSU-Ultra/SukiSU-Ultra/main/kernel/setup.sh | bash -s susfs-main + + # Calculate KSU version + pushd KernelSU >/dev/null + REV_COUNT=$(git rev-list --count main) + popd >/dev/null + KSU_VERSION=$((REV_COUNT + 10606)) + echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV + + # Update Makefile version + sed -i "s/^DKSU_VERSION=.*/DKSU_VERSION=${KSU_VERSION}/" Makefile + + # Get patches + mkdir -p patches + cd patches + git clone --single-branch -b kernel-${KERNEL_VERSION%.*} https://gitlab.com/simonpunk/susfs4ksu.git --depth=1 + git clone https://github.com/ShirkNeko/SukiSU_patch.git --depth=1 + cd .. + + # Apply SUSFS patch + patch -p1 < patches/susfs4ksu/kernel_patches/50_add_susfs_in_kernel-4.14.patch || true + + # Copy SUSFS files + cp -r patches/susfs4ksu/kernel_patches/common/fs/* fs/ 2>/dev/null || : + cp -r patches/susfs4ksu/kernel_patches/common/include/linux/* include/linux/ 2>/dev/null || : + + # Apply optional patches + if [ "$ZRAM" = "true" ]; then + cp patches/SukiSU_patch/other/zram/lz4k/include/linux/* include/linux/ + cp patches/SukiSU_patch/other/zram/lz4k/lib/* lib/ + cp patches/SukiSU_patch/other/zram/lz4k/crypto/* crypto/ + patch -p1 -F3 < patches/SukiSU_patch/other/zram/zram_patch/${KERNEL_VERSION}/lz4kd.patch || true + fi + + patch -p1 -F3 < patches/SukiSU_patch/69_hide_stuff.patch + + if [ "$VFS" = "true" ]; then + patch -p1 -F3 < patches/SukiSU_patch/hooks/syscall_hooks.patch + fi + + # Update defconfig + DEFCONFIG=arch/arm64/configs/lineage_sm8150_defconfig + echo -e "\n# KernelSU configuration" >> "$DEFCONFIG" + echo "CONFIG_KSU=y" >> "$DEFCONFIG" + echo "CONFIG_KPM=y" >> "$DEFCONFIG" + + if [ "$VFS" = "false" ]; then + echo "CONFIG_KPROBES=y" >> "$DEFCONFIG" + echo "CONFIG_KSU_SUSFS_SUS_SU=y" >> "$DEFCONFIG" + else + echo "CONFIG_KSU_MANUAL_HOOK=y" >> "$DEFCONFIG" + echo "CONFIG_KSU_SUSFS=y" >> "$DEFCONFIG" + # ... (other VFS configs remain same) + fi + + if [ "$ZRAM" = "true" ]; then + echo -e "\n# ZRAM configuration" >> "$DEFCONFIG" + echo "CONFIG_ZSMALLOC=y" >> "$DEFCONFIG" + echo "CONFIG_ZRAM=y" >> "$DEFCONFIG" + # ... (other ZRAM configs remain same) + fi + + - name: Build kernel + run: | + export KERNEL_DEFCONFIG="lineage_sm8150_defconfig" + export PATH="$(pwd)/clang/bin:$(pwd)/aarch64/bin:$PATH" + export ARCH=arm64 + export CLANG_TRIPLE="aarch64-linux-gnu-" + export CROSS_COMPILE="aarch64-linux-androidkernel-" + export CROSS_COMPILE_ARM32="arm-linux-gnueabi-" + export LLVM=1 + export LLVM_IAS=1 + + cd kernel + make O=out CC="ccache clang" $KERNEL_DEFCONFIG + make -j$(nproc --all) O=out CC="ccache clang" + cp out/arch/arm64/boot/Image ../AnyKernel3 + + - name: Create flashable zip + run: | + cd AnyKernel3 + zip -r9 OP7-LOS21.zip * -x .gitignore + + - name: Upload release artifact + uses: softprops/action-gh-release@v2 + with: + files: AnyKernel3/OP7-LOS21.zip + tag_name: build-${{ github.run_number }} + name: SukiSU-v${{ github.run_number }} + body: | + Device: OnePlus 7/7 Pro/7T/7T Pro + Android: LineageOS 21 (Android 14) + Features: + - KernelSU ${{ env.KSU_VERSION }} + - ZRAM: ${{ env.ZRAM }} + - VFS Hooks: ${{ env.VFS }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitmodules b/.gitmodules index f9b87ec29ea8..4b82e88094e1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ -[submodule "KernelSU"] - path = KernelSU - url = https://github.com/tiann/KernelSU [submodule "kali-nethunter-kernel"] path = kali-nethunter-kernel url = https://gitlab.com/kalilinux/nethunter/build-scripts/kali-nethunter-kernel.git +[submodule "SukiSU"] + path = SukiSU + url = https://github.com/SukiSU-Ultra/SukiSU-Ultra.git diff --git a/KernelSU b/KernelSU deleted file mode 160000 index 825b14635fe1..000000000000 --- a/KernelSU +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 825b14635fe1699cf815c375ce36eec6e6c79e08 diff --git a/SukiSU b/SukiSU new file mode 160000 index 000000000000..7c4d8da7d114 --- /dev/null +++ b/SukiSU @@ -0,0 +1 @@ +Subproject commit 7c4d8da7d1144cb9072ba7a1d4779b099998f39c diff --git a/arch/arm64/configs/lineage_sm8150_defconfig b/arch/arm64/configs/lineage_sm8150_defconfig index ba3bc43c22bb..f9c8ecc17508 100644 --- a/arch/arm64/configs/lineage_sm8150_defconfig +++ b/arch/arm64/configs/lineage_sm8150_defconfig @@ -753,3 +753,6 @@ CONFIG_RMNET_SHS=y CONFIG_KPROBES=y CONFIG_HAVE_KPROBES=y CONFIG_KPROBE_EVENTS=y +CONFIG_KPM=y +CONFIG_KALLSYMS=y +CONFIG_KALLSYMS_ALL=y diff --git a/drivers/Kconfig b/drivers/Kconfig index 325d9af9b78a..93bcd17d2eaa 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -227,5 +227,4 @@ source "drivers/esoc/Kconfig" source "drivers/infrared_proximity/Kconfig" -source "drivers/kernelsu/Kconfig" endmenu diff --git a/drivers/kernelsu b/drivers/kernelsu deleted file mode 120000 index 9e51d0d62734..000000000000 --- a/drivers/kernelsu +++ /dev/null @@ -1 +0,0 @@ -../KernelSU/kernel \ No newline at end of file