From 59339b806af1c8b0a57ca3e46f3f8c409f763d63 Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Mon, 3 Nov 2025 03:49:56 +0800 Subject: [PATCH] Revert "ci: use ddk for faster ci, manual gki image build" This reverts commit 33d1f1839583ed37073ff355dad46232379edb3e. --- .github/workflows/build-gki-image.yml | 37 ------ .github/workflows/build-kernel-a12.yml | 112 ----------------- .github/workflows/build-kernel-a13.yml | 147 ----------------------- .github/workflows/build-kernel-a14.yml | 159 ------------------------- .github/workflows/build-kernel-a15.yml | 132 -------------------- .github/workflows/build-kernel-a16.yml | 105 ---------------- .github/workflows/build-lkm.yml | 79 ++++++++++-- .github/workflows/build-manager.yml | 78 +++++++++++- .github/workflows/clippy.yml | 2 +- .github/workflows/ddk-lkm.yml | 84 ------------- .github/workflows/deploy-website.yml | 67 ----------- .github/workflows/gki-kernel-mock.yml | 79 ++++++++++++ .github/workflows/gki-kernel.yml | 11 +- .github/workflows/ksud.yml | 27 ++++- .github/workflows/shellcheck.yml | 2 +- .gitignore | 1 + kernel/.vscode/c_cpp_properties.json | 11 -- kernel/.vscode/generate_compdb.py | 92 -------------- kernel/.vscode/settings.json | 35 ------ kernel/.vscode/tasks.json | 16 --- kernel/Makefile | 42 ++----- kernel/core_hook.c | 4 +- 22 files changed, 258 insertions(+), 1064 deletions(-) delete mode 100644 .github/workflows/build-gki-image.yml delete mode 100644 .github/workflows/build-kernel-a12.yml delete mode 100644 .github/workflows/build-kernel-a13.yml delete mode 100644 .github/workflows/build-kernel-a14.yml delete mode 100644 .github/workflows/build-kernel-a15.yml delete mode 100644 .github/workflows/build-kernel-a16.yml delete mode 100644 .github/workflows/ddk-lkm.yml delete mode 100644 .github/workflows/deploy-website.yml create mode 100644 .github/workflows/gki-kernel-mock.yml delete mode 100644 kernel/.vscode/c_cpp_properties.json delete mode 100644 kernel/.vscode/generate_compdb.py delete mode 100644 kernel/.vscode/settings.json delete mode 100644 kernel/.vscode/tasks.json diff --git a/.github/workflows/build-gki-image.yml b/.github/workflows/build-gki-image.yml deleted file mode 100644 index 065022cb..00000000 --- a/.github/workflows/build-gki-image.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build Android GKI Image -on: - workflow_call: - workflow_dispatch: - inputs: - debug: - description: 'Build debug kernel' - required: false - type: boolean - default: false - -jobs: - build-a12-kernel: - uses: ./.github/workflows/build-kernel-a12.yml - secrets: inherit - with: - debug: ${{ github.event.inputs.debug || false }} - build-a13-kernel: - uses: ./.github/workflows/build-kernel-a13.yml - secrets: inherit - with: - debug: ${{ github.event.inputs.debug || false }} - build-a14-kernel: - uses: ./.github/workflows/build-kernel-a14.yml - secrets: inherit - with: - debug: ${{ github.event.inputs.debug || false }} - build-a15-kernel: - uses: ./.github/workflows/build-kernel-a15.yml - secrets: inherit - with: - debug: ${{ github.event.inputs.debug || false }} - build-a16-kernel: - uses: ./.github/workflows/build-kernel-a16.yml - secrets: inherit - with: - debug: ${{ github.event.inputs.debug || false }} diff --git a/.github/workflows/build-kernel-a12.yml b/.github/workflows/build-kernel-a12.yml deleted file mode 100644 index 7dc6c00e..00000000 --- a/.github/workflows/build-kernel-a12.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: Build Kernel - Android 12 -on: - # push: - # branches: ["main", "ci", "checkci"] - # paths: - # - ".github/workflows/deps/gki/build-kernel-a12.yml" - # - ".github/workflows/deps/gki/gki-kernel.yml" - # - ".github/scripts/build_a12.sh" - # - "kernel/**" - workflow_call: - inputs: - debug: - description: 'Build debug kernel' - required: false - type: boolean - default: false -jobs: - build-kernel: - if: github.event_name != 'pull_request' && github.ref != 'refs/heads/checkci' - strategy: - matrix: - include: - - sub_level: 209 - os_patch_level: 2024-05 - - sub_level: 218 - os_patch_level: 2024-08 - - sub_level: 226 - os_patch_level: 2024-11 - - sub_level: 233 - os_patch_level: 2025-02 - - sub_level: 236 - os_patch_level: 2025-05 - uses: ./.github/workflows/gki-kernel.yml - secrets: inherit - with: - version: android12-5.10 - version_name: android12-5.10.${{ matrix.sub_level }} - tag: android12-5.10-${{ matrix.os_patch_level }} - os_patch_level: ${{ matrix.os_patch_level }} - patch_path: "5.10" - debug: ${{ inputs.debug || false }} - - upload-artifacts: - needs: build-kernel - runs-on: ubuntu-latest - if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' || github.ref == 'refs/heads/ci' }} - env: - CHAT_ID: ${{ secrets.CHAT_ID }} - BOT_TOKEN: ${{ secrets.BOT_TOKEN }} - MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }} - COMMIT_MESSAGE: ${{ github.event.head_commit.message }} - COMMIT_URL: ${{ github.event.head_commit.url }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - - - uses: actions/checkout@v4 - with: - path: KernelSU - fetch-depth: 0 - - - name: List artifacts - run: | - tree - - - name: Download prebuilt toolchain - run: | - AOSP_MIRROR=https://android.googlesource.com - BRANCH=main-kernel-build-2024 - git clone $AOSP_MIRROR/platform/prebuilts/build-tools -b $BRANCH --depth 1 build-tools - git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools - git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 - pip3 install telethon - - - name: Set boot sign key - env: - BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }} - run: | - if [ ! -z "$BOOT_SIGN_KEY" ]; then - echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem - fi - - - name: Bot session cache - id: bot_session_cache - uses: actions/cache@v4 - if: false - with: - path: scripts/ksubot.session - key: ${{ runner.os }}-bot-session - - - name: Build boot images - run: | - export AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool - export GZIP=$GITHUB_WORKSPACE/build-tools/path/linux-x86/gzip - export LZ4=$GITHUB_WORKSPACE/build-tools/path/linux-x86/lz4 - export MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py - export UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py - cd $GITHUB_WORKSPACE/KernelSU - export VERSION=$(($(git rev-list --count HEAD) + 10200)) - echo "VERSION: $VERSION" - cd - - bash $GITHUB_WORKSPACE/KernelSU/.github/scripts/build_a12.sh - - - name: Display structure of boot files - run: ls -R - - - name: Upload images artifact - uses: actions/upload-artifact@v4 - with: - name: boot-images-android12 - path: Image-android12*/*.img.gz diff --git a/.github/workflows/build-kernel-a13.yml b/.github/workflows/build-kernel-a13.yml deleted file mode 100644 index 4a4ab1ac..00000000 --- a/.github/workflows/build-kernel-a13.yml +++ /dev/null @@ -1,147 +0,0 @@ -name: Build Kernel - Android 13 -on: - # push: - # branches: ["main", "ci", "checkci"] - # paths: - # - ".github/workflows/deps/gki/build-kernel-a13.yml" - # - ".github/workflows/deps/gki/gki-kernel.yml" - # - ".github/scripts/build_a13.sh" - # - "kernel/**" - workflow_call: - inputs: - debug: - description: 'Build debug kernel' - required: false - type: boolean - default: false -jobs: - build-kernel: - if: github.event_name != 'pull_request' && github.ref != 'refs/heads/checkci' - strategy: - matrix: - include: - - version: "5.10" - sub_level: 209 - os_patch_level: 2024-05 - - version: "5.10" - sub_level: 210 - os_patch_level: 2024-06 - - version: "5.10" - sub_level: 214 - os_patch_level: 2024-07 - - version: "5.10" - sub_level: 218 - os_patch_level: 2024-08 - - version: "5.10" - sub_level: 223 - os_patch_level: 2024-11 - - version: "5.10" - sub_level: 228 - os_patch_level: 2025-01 - - version: "5.10" - sub_level: 234 - os_patch_level: 2025-03 - - version: "5.15" - sub_level: 148 - os_patch_level: 2024-05 - - version: "5.15" - sub_level: 149 - os_patch_level: 2024-07 - - version: "5.15" - sub_level: 151 - os_patch_level: 2024-08 - - version: "5.15" - sub_level: 153 - os_patch_level: 2024-09 - - version: "5.15" - sub_level: 167 - os_patch_level: 2024-11 - - version: "5.15" - sub_level: 178 - os_patch_level: 2024-11 - - version: "5.15" - sub_level: 170 - os_patch_level: 2025-01 - - version: "5.15" - sub_level: 178 - os_patch_level: 2025-03 - uses: ./.github/workflows/gki-kernel.yml - secrets: inherit - with: - version: android13-${{ matrix.version }} - version_name: android13-${{ matrix.version }}.${{ matrix.sub_level }} - tag: android13-${{ matrix.version }}-${{ matrix.os_patch_level }} - os_patch_level: ${{ matrix.os_patch_level }} - patch_path: ${{ matrix.version }} - debug: ${{ inputs.debug || false }} - - upload-artifacts: - needs: build-kernel - runs-on: ubuntu-latest - if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' || github.ref == 'refs/heads/ci' }} - env: - CHAT_ID: ${{ secrets.CHAT_ID }} - BOT_TOKEN: ${{ secrets.BOT_TOKEN }} - MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }} - COMMIT_MESSAGE: ${{ github.event.head_commit.message }} - COMMIT_URL: ${{ github.event.head_commit.url }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - - - uses: actions/checkout@v4 - with: - path: KernelSU - fetch-depth: 0 - - - name: List artifacts - run: | - tree - - - name: Download prebuilt toolchain - run: | - AOSP_MIRROR=https://android.googlesource.com - BRANCH=main-kernel-build-2024 - git clone $AOSP_MIRROR/platform/prebuilts/build-tools -b $BRANCH --depth 1 build-tools - git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools - git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 - pip3 install telethon - - - name: Set boot sign key - env: - BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }} - run: | - if [ ! -z "$BOOT_SIGN_KEY" ]; then - echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem - fi - - - name: Bot session cache - id: bot_session_cache - uses: actions/cache@v4 - if: false - with: - path: scripts/ksubot.session - key: ${{ runner.os }}-bot-session - - - name: Build boot images - run: | - export AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool - export GZIP=$GITHUB_WORKSPACE/build-tools/path/linux-x86/gzip - export LZ4=$GITHUB_WORKSPACE/build-tools/path/linux-x86/lz4 - export MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py - export UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py - cd $GITHUB_WORKSPACE/KernelSU - export VERSION=$(($(git rev-list --count HEAD) + 10200)) - echo "VERSION: $VERSION" - cd - - bash $GITHUB_WORKSPACE/KernelSU/.github/scripts/build_a13.sh - - - name: Display structure of boot files - run: ls -R - - - name: Upload images artifact - uses: actions/upload-artifact@v4 - with: - name: boot-images-android13 - path: Image-android13*/*.img.gz diff --git a/.github/workflows/build-kernel-a14.yml b/.github/workflows/build-kernel-a14.yml deleted file mode 100644 index 0c71b390..00000000 --- a/.github/workflows/build-kernel-a14.yml +++ /dev/null @@ -1,159 +0,0 @@ -name: Build Kernel - Android 14 -on: - # push: - # branches: ["main", "ci", "checkci"] - # paths: - # - ".github/workflows/deps/gki/build-kernel-a14.yml" - # - ".github/workflows/deps/gki/gki-kernel.yml" - # - ".github/scripts/build_a13.sh" - # - "kernel/**" - workflow_call: - inputs: - debug: - description: 'Build debug kernel' - required: false - type: boolean - default: false -jobs: - build-kernel: - if: github.event_name != 'pull_request' && github.ref != 'refs/heads/checkci' - strategy: - matrix: - include: - - version: "5.15" - sub_level: 148 - os_patch_level: 2024-05 - - version: "5.15" - sub_level: 149 - os_patch_level: 2024-06 - - version: "5.15" - sub_level: 153 - os_patch_level: 2024-07 - - version: "5.15" - sub_level: 158 - os_patch_level: 2024-08 - - version: "5.15" - sub_level: 164 - os_patch_level: 2024-09 - - version: "5.15" - sub_level: 167 - os_patch_level: 2024-11 - - version: "5.15" - sub_level: 170 - os_patch_level: 2025-01 - - version: "5.15" - sub_level: 178 - os_patch_level: 2025-03 - - version: "6.1" - sub_level: 75 - os_patch_level: 2024-05 - - version: "6.1" - sub_level: 78 - os_patch_level: 2024-06 - - version: "6.1" - sub_level: 84 - os_patch_level: 2024-07 - - version: "6.1" - sub_level: 90 - os_patch_level: 2024-08 - - version: "6.1" - sub_level: 93 - os_patch_level: 2024-09 - - version: "6.1" - sub_level: 99 - os_patch_level: 2024-10 - - version: "6.1" - sub_level: 112 - os_patch_level: 2024-11 - - version: "6.1" - sub_level: 115 - os_patch_level: 2024-12 - - version: "6.1" - sub_level: 118 - os_patch_level: 2025-01 - - version: "6.1" - sub_level: 128 - os_patch_level: 2025-03 - - version: "6.1" - sub_level: 134 - os_patch_level: 2025-05 - uses: ./.github/workflows/gki-kernel.yml - secrets: inherit - with: - version: android14-${{ matrix.version }} - version_name: android14-${{ matrix.version }}.${{ matrix.sub_level }} - tag: android14-${{ matrix.version }}-${{ matrix.os_patch_level }} - os_patch_level: ${{ matrix.os_patch_level }} - patch_path: ${{ matrix.version }} - debug: ${{ inputs.debug || false }} - - upload-artifacts: - needs: build-kernel - runs-on: ubuntu-latest - if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' || github.ref == 'refs/heads/ci' }} - env: - CHAT_ID: ${{ secrets.CHAT_ID }} - BOT_TOKEN: ${{ secrets.BOT_TOKEN }} - MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }} - COMMIT_MESSAGE: ${{ github.event.head_commit.message }} - COMMIT_URL: ${{ github.event.head_commit.url }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - - - uses: actions/checkout@v4 - with: - path: KernelSU - fetch-depth: 0 - - - name: List artifacts - run: | - tree - - - name: Download prebuilt toolchain - run: | - AOSP_MIRROR=https://android.googlesource.com - BRANCH=main-kernel-build-2024 - git clone $AOSP_MIRROR/platform/prebuilts/build-tools -b $BRANCH --depth 1 build-tools - git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools - git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 - pip3 install telethon - - - name: Set boot sign key - env: - BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }} - run: | - if [ ! -z "$BOOT_SIGN_KEY" ]; then - echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem - fi - - - name: Bot session cache - id: bot_session_cache - uses: actions/cache@v4 - if: false - with: - path: scripts/ksubot.session - key: ${{ runner.os }}-bot-session - - - name: Build boot images - run: | - export AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool - export GZIP=$GITHUB_WORKSPACE/build-tools/path/linux-x86/gzip - export LZ4=$GITHUB_WORKSPACE/build-tools/path/linux-x86/lz4 - export MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py - export UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py - cd $GITHUB_WORKSPACE/KernelSU - export VERSION=$(($(git rev-list --count HEAD) + 10200)) - echo "VERSION: $VERSION" - cd - - bash $GITHUB_WORKSPACE/KernelSU/.github/scripts/build_a13.sh - - - name: Display structure of boot files - run: ls -R - - - name: Upload images artifact - uses: actions/upload-artifact@v4 - with: - name: boot-images-android14 - path: Image-android14*/*.img.gz diff --git a/.github/workflows/build-kernel-a15.yml b/.github/workflows/build-kernel-a15.yml deleted file mode 100644 index 7f113e35..00000000 --- a/.github/workflows/build-kernel-a15.yml +++ /dev/null @@ -1,132 +0,0 @@ -name: Build Kernel - Android 15 -on: - # push: - # branches: ["main", "ci", "checkci"] - # paths: - # - ".github/workflows/deps/gki/build-kernel-a15.yml" - # - ".github/workflows/deps/gki/gki-kernel.yml" - # - ".github/scripts/build_a13.sh" - # - "kernel/**" - workflow_call: - inputs: - debug: - description: 'Build debug kernel' - required: false - type: boolean - default: false -jobs: - build-kernel: - if: github.event_name != 'pull_request' && github.ref != 'refs/heads/checkci' - strategy: - matrix: - include: - - version: "6.6" - sub_level: 30 - os_patch_level: 2024-08 - - version: "6.6" - sub_level: 46 - os_patch_level: 2024-09 - - version: "6.6" - sub_level: 50 - os_patch_level: 2024-10 - - version: "6.6" - sub_level: 56 - os_patch_level: 2024-11 - - version: "6.6" - sub_level: 57 - os_patch_level: 2024-12 - - version: "6.6" - sub_level: 58 - os_patch_level: 2025-01 - - version: "6.6" - sub_level: 66 - os_patch_level: 2025-02 - - version: "6.6" - sub_level: 77 - os_patch_level: 2025-03 - - version: "6.6" - sub_level: 82 - os_patch_level: 2025-04 - - version: "6.6" - sub_level: 87 - os_patch_level: 2025-05 - uses: ./.github/workflows/gki-kernel.yml - secrets: inherit - with: - version: android15-${{ matrix.version }} - version_name: android15-${{ matrix.version }}.${{ matrix.sub_level }} - tag: android15-${{ matrix.version }}-${{ matrix.os_patch_level }} - os_patch_level: ${{ matrix.os_patch_level }} - patch_path: ${{ matrix.version }} - debug: ${{ inputs.debug || false }} - - upload-artifacts: - needs: build-kernel - runs-on: ubuntu-latest - if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' || github.ref == 'refs/heads/ci' }} - env: - CHAT_ID: ${{ secrets.CHAT_ID }} - BOT_TOKEN: ${{ secrets.BOT_TOKEN }} - MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }} - COMMIT_MESSAGE: ${{ github.event.head_commit.message }} - COMMIT_URL: ${{ github.event.head_commit.url }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - - - uses: actions/checkout@v4 - with: - path: KernelSU - fetch-depth: 0 - - - name: List artifacts - run: | - tree - - - name: Download prebuilt toolchain - run: | - AOSP_MIRROR=https://android.googlesource.com - BRANCH=main-kernel-build-2024 - git clone $AOSP_MIRROR/platform/prebuilts/build-tools -b $BRANCH --depth 1 build-tools - git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools - git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 - pip3 install telethon - - - name: Set boot sign key - env: - BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }} - run: | - if [ ! -z "$BOOT_SIGN_KEY" ]; then - echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem - fi - - - name: Bot session cache - id: bot_session_cache - uses: actions/cache@v4 - if: false - with: - path: scripts/ksubot.session - key: ${{ runner.os }}-bot-session - - - name: Build boot images - run: | - export AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool - export GZIP=$GITHUB_WORKSPACE/build-tools/path/linux-x86/gzip - export LZ4=$GITHUB_WORKSPACE/build-tools/path/linux-x86/lz4 - export MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py - export UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py - cd $GITHUB_WORKSPACE/KernelSU - export VERSION=$(($(git rev-list --count HEAD) + 10200)) - echo "VERSION: $VERSION" - cd - - bash $GITHUB_WORKSPACE/KernelSU/.github/scripts/build_a13.sh - - - name: Display structure of boot files - run: ls -R - - - name: Upload images artifact - uses: actions/upload-artifact@v4 - with: - name: boot-images-android15 - path: Image-android15*/*.img.gz diff --git a/.github/workflows/build-kernel-a16.yml b/.github/workflows/build-kernel-a16.yml deleted file mode 100644 index 3f2d0bdd..00000000 --- a/.github/workflows/build-kernel-a16.yml +++ /dev/null @@ -1,105 +0,0 @@ -name: Build Kernel - Android 16 -on: - # push: - # branches: ["main", "ci", "checkci"] - # paths: - # - ".github/workflows/deps/gki/build-kernel-a16.yml" - # - ".github/workflows/deps/gki/gki-kernel.yml" - # - ".github/scripts/build_a13.sh" - # - "kernel/**" - workflow_call: - inputs: - debug: - description: 'Build debug kernel' - required: false - type: boolean - default: false -jobs: - build-kernel: - if: github.event_name != 'pull_request' && github.ref != 'refs/heads/checkci' - strategy: - matrix: - include: - - version: "6.12" - sub_level: 38 - os_patch_level: 2025-08 - uses: ./.github/workflows/gki-kernel.yml - secrets: inherit - with: - version: android16-${{ matrix.version }} - version_name: android16-${{ matrix.version }}.${{ matrix.sub_level }} - tag: android16-${{ matrix.version }}-${{ matrix.os_patch_level }} - os_patch_level: ${{ matrix.os_patch_level }} - patch_path: ${{ matrix.version }} - debug: ${{ inputs.debug || false }} - - upload-artifacts: - needs: build-kernel - runs-on: ubuntu-latest - if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' || github.ref == 'refs/heads/ci' }} - env: - CHAT_ID: ${{ secrets.CHAT_ID }} - BOT_TOKEN: ${{ secrets.BOT_TOKEN }} - MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }} - COMMIT_MESSAGE: ${{ github.event.head_commit.message }} - COMMIT_URL: ${{ github.event.head_commit.url }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - steps: - - name: Download artifacts - uses: actions/download-artifact@v6 - - - uses: actions/checkout@v5 - with: - path: KernelSU - fetch-depth: 0 - - - name: List artifacts - run: | - tree - - - name: Download prebuilt toolchain - run: | - AOSP_MIRROR=https://android.googlesource.com - BRANCH=main-kernel-build-2024 - git clone $AOSP_MIRROR/platform/prebuilts/build-tools -b $BRANCH --depth 1 build-tools - git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools - git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 - pip3 install telethon - - - name: Set boot sign key - env: - BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }} - run: | - if [ ! -z "$BOOT_SIGN_KEY" ]; then - echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem - fi - - - name: Bot session cache - id: bot_session_cache - uses: actions/cache@v4 - if: false - with: - path: scripts/ksubot.session - key: ${{ runner.os }}-bot-session - - - name: Build boot images - run: | - export AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool - export GZIP=$GITHUB_WORKSPACE/build-tools/path/linux-x86/gzip - export LZ4=$GITHUB_WORKSPACE/build-tools/path/linux-x86/lz4 - export MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py - export UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py - cd $GITHUB_WORKSPACE/KernelSU - export VERSION=$(($(git rev-list --count HEAD) + 10200)) - echo "VERSION: $VERSION" - cd - - bash $GITHUB_WORKSPACE/KernelSU/.github/scripts/build_a13.sh - - - name: Display structure of boot files - run: ls -R - - - name: Upload images artifact - uses: actions/upload-artifact@v5 - with: - name: boot-images-android16 - path: Image-android16*/*.img.gz diff --git a/.github/workflows/build-lkm.yml b/.github/workflows/build-lkm.yml index a07a64e0..2218dd47 100644 --- a/.github/workflows/build-lkm.yml +++ b/.github/workflows/build-lkm.yml @@ -1,20 +1,77 @@ name: Build LKM for KernelSU on: workflow_call: + inputs: + upload: + required: true + type: boolean + default: true + description: "Whether to upload to branch" + secrets: + # username:github_pat + TOKEN: + required: true workflow_dispatch: + inputs: + upload: + required: true + type: boolean + default: true + description: "Whether to upload to branch" jobs: build-lkm: strategy: matrix: - kmi: - - android12-5.10 - - android13-5.10 - - android13-5.15 - - android14-5.15 - - android14-6.1 - - android15-6.6 - - android16-6.12 - uses: ./.github/workflows/ddk-lkm.yml + include: + - version: "android12-5.10" + sub_level: 240 + os_patch_level: 2025-09 + - version: "android13-5.10" + sub_level: 238 + os_patch_level: 2025-07 + - version: "android13-5.15" + sub_level: 189 + os_patch_level: 2025-09 + - version: "android14-5.15" + sub_level: 185 + os_patch_level: 2025-07 + - version: "android14-6.1" + sub_level: 145 + os_patch_level: 2025-09 + - version: "android15-6.6" + sub_level: 98 + os_patch_level: 2025-09 + #- version: "android16-6.12" + # sub_level: 38 + # os_patch_level: 2025-09 + # uses: ./.github/workflows/gki-kernel-mock.yml when debugging + uses: ./.github/workflows/gki-kernel.yml with: - kmi: ${{ matrix.kmi }} - ddk_release: '20251016' + version: ${{ matrix.version }} + version_name: ${{ matrix.version }}.${{ matrix.sub_level }} + tag: ${{ matrix.version }}-${{ matrix.os_patch_level }} + os_patch_level: ${{ matrix.os_patch_level }} + build_lkm: true + + push-to-branch: + needs: [build-lkm] + runs-on: ubuntu-latest + if: ${{ inputs.upload }} + steps: + - name: Download all workflow run artifacts + uses: actions/download-artifact@v4 + with: + path: bin/ + merge-multiple: true + - name: Push to branch LKM + run: | + cd bin + git config --global init.defaultBranch lkm + git init + git remote add origin https://${{ secrets.TOKEN }}@github.com/${{ github.repository }} + git config --local user.name "github-actions[bot]" + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + find . -type f + git add . + git commit -m "Upload LKM from ${{ github.sha }}" -m "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + git push --force --set-upstream origin lkm diff --git a/.github/workflows/build-manager.yml b/.github/workflows/build-manager.yml index a5accfbf..70205c09 100644 --- a/.github/workflows/build-manager.yml +++ b/.github/workflows/build-manager.yml @@ -5,7 +5,6 @@ on: branches: [ "main", "ci" ] paths: - '.github/workflows/build-manager.yml' - - '.github/workflows/build-lkm.yml' - 'manager/**' - 'kernel/**' - 'userspace/ksud/**' @@ -16,13 +15,77 @@ on: paths: - 'manager/**' workflow_call: - + workflow_dispatch: + inputs: + build_lkm: + required: true + type: choice + default: "auto" + options: + - "true" + - "false" + - "auto" + description: "Whether to build lkm" + upload_lkm: + required: true + type: boolean + default: true + description: "Whether to upload lkm" jobs: + check-build-lkm: + runs-on: ubuntu-latest + outputs: + build_lkm: ${{ steps.check-build.outputs.build_lkm }} + upload_lkm: ${{ steps.check-build.outputs.upload_lkm }} + steps: + - name: check build + id: check-build + run: | + if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ "${{ inputs.build_lkm }}" != "auto" ]; then + kernel_changed="${{ inputs.build_lkm }}" + else + kernel_changed=true + mkdir tmp + cd tmp + git config --global init.defaultBranch bot + git config --global user.name 'Bot' + git config --global user.email 'bot@github.shirkneko.io' + git init . + git remote add origin https://github.com/${{ github.repository }} + CURRENT_COMMIT="${{ github.event.head_commit.id }}" + git fetch origin $CURRENT_COMMIT --depth=1 + git fetch origin lkm --depth=1 + LKM_COMMIT="$(git log --format=%B -n 1 origin/lkm | head -n 1)" + LKM_COMMIT="${LKM_COMMIT#Upload LKM from }" + LKM_COMMIT=$(echo "$LKM_COMMIT" | tr -d '[:space:]') + echo "LKM_COMMIT=$LKM_COMMIT" + git fetch origin "$LKM_COMMIT" --depth=1 + git diff --quiet "$LKM_COMMIT" "$CURRENT_COMMIT" -- kernel :!kernel/setup.sh .github/workflows/build-lkm.yml .github/workflows/build-kernel-*.yml && kernel_changed=false + cd .. + rm -rf tmp + fi + if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == 'refs/heads/main' ]; then + need_upload=true + elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + need_upload="${{ inputs.upload_lkm }}" + else + need_upload=false + fi + echo "kernel changed: $kernel_changed" + echo "need upload: $need_upload" + echo "build_lkm=$kernel_changed" >> "$GITHUB_OUTPUT" + echo "upload_lkm=$need_upload" >> "$GITHUB_OUTPUT" + build-lkm: + needs: check-build-lkm uses: ./.github/workflows/build-lkm.yml + if: ${{ needs.check-build-lkm.outputs.build_lkm == 'true' }} + with: + upload: ${{ needs.check-build-lkm.outputs.upload_lkm == 'true' }} secrets: inherit build-susfs: - needs: build-lkm + if: ${{ always() }} + needs: [ check-build-lkm, build-lkm ] strategy: matrix: include: @@ -34,7 +97,8 @@ jobs: os: ${{ matrix.os }} build-user_scanner: - needs: build-lkm + if: ${{ always() }} + needs: [ check-build-lkm, build-lkm ] strategy: matrix: include: @@ -46,7 +110,8 @@ jobs: os: ${{ matrix.os }} build-ksud: - needs: build-lkm + if: ${{ always() }} + needs: [ check-build-lkm, build-lkm ] strategy: matrix: include: @@ -60,8 +125,11 @@ jobs: with: target: ${{ matrix.target }} os: ${{ matrix.os }} + pack_lkm: true + pull_lkm: ${{ needs.check-build-lkm.outputs.build_lkm != 'true' }} build-manager: + if: ${{ always() }} needs: build-ksud runs-on: ubuntu-latest defaults: diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index a59d1d1d..bafb41a1 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -34,4 +34,4 @@ jobs: - name: Run clippy run: | cross clippy --manifest-path userspace/ksud/Cargo.toml --target aarch64-linux-android --release - cross clippy --manifest-path userspace/ksud/Cargo.toml --target x86_64-linux-android --release \ No newline at end of file + cross clippy --manifest-path userspace/ksud/Cargo.toml --target x86_64-linux-android --release diff --git a/.github/workflows/ddk-lkm.yml b/.github/workflows/ddk-lkm.yml deleted file mode 100644 index 51db41ba..00000000 --- a/.github/workflows/ddk-lkm.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Build KernelSU Kernel Module - -on: - workflow_call: - inputs: - kmi: - description: 'KMI version' - required: true - type: string - ddk_release: - description: 'DDK release version' - required: false - default: '20251016' - type: string - -jobs: - build-kernelsu-ko: - name: Build kernelsu.ko for ${{ inputs.kmi }} - runs-on: ubuntu-latest - container: - image: ghcr.io/ylarod/ddk:${{ inputs.kmi }}-${{ inputs.ddk_release }} - options: --privileged - - steps: - - name: Checkout source code - uses: actions/checkout@v4 - - - name: Get version info from GitHub API - id: version - run: | - REPO_OWNER="SukiSU-Ultra" - REPO_NAME="SukiSU-Ultra" - REPO_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" - KSU_VERSION_API="3.2.0" - - GITHUB_VERSION=$(curl -s "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') - GITHUB_COMMIT_COUNT=$(curl -sI "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/commits?sha=$REPO_BRANCH&per_page=1" | grep -i '^link:' | sed -n 's/.*page=\([0-9]*\)>; rel="last".*/\1/p') - - KSU_VERSION=$((10000 + GITHUB_COMMIT_COUNT + 700)) - - FAKE_HASH=$(curl -s "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/commits/$REPO_BRANCH" | grep '"sha":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/' | cut -c1-8) - - KSU_VERSION_FULL="v${GITHUB_VERSION:-$KSU_VERSION_API}-${FAKE_HASH}@$REPO_BRANCH" - - echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV - echo "KSU_VERSION_FULL=$KSU_VERSION_FULL" >> $GITHUB_ENV - - echo "Branch: $REPO_BRANCH" - echo "Version: $KSU_VERSION" - echo "Full Version: $KSU_VERSION_FULL" - - - name: Build kernelsu.ko - env: - CI_KSU_VERSION: ${{ env.KSU_VERSION }} - CI_KSU_VERSION_FULL: ${{ env.KSU_VERSION_FULL }} - run: | - git config --global --add safe.directory /__w/SukiSU-Ultra/SukiSU-Ultra - - cd kernel - - echo "=== Building kernelsu.ko for KMI: ${{ inputs.kmi }} ===" - - CONFIG_KSU=m CONFIG_KPROBES=y CONFIG_KSU_KPROBES_HOOK=y CONFIG_KSU_MANUAL_SU=y make - - echo "=== Build completed ===" - - # Create output directory in GitHub workspace - mkdir -p /github/workspace/out - - # Copy with KMI-specific naming - OUTPUT_NAME="${{ inputs.kmi }}_kernelsu.ko" - cp kernelsu.ko "/github/workspace/out/$OUTPUT_NAME" - - echo "Copied to: /github/workspace/out/$OUTPUT_NAME" - ls -la "/github/workspace/out/$OUTPUT_NAME" - echo "Size: $(du -h "/github/workspace/out/$OUTPUT_NAME" | cut -f1)" - llvm-strip -d "/github/workspace/out/$OUTPUT_NAME" - echo "Size after stripping: $(du -h "/github/workspace/out/$OUTPUT_NAME" | cut -f1)" - - - name: Upload kernelsu.ko artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ inputs.kmi }}-lkm - path: /github/workspace/out/${{ inputs.kmi }}_kernelsu.ko diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml deleted file mode 100644 index 4174daf6..00000000 --- a/.github/workflows/deploy-website.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Deploy Website - -on: - push: - branches: - - main - - website - paths: - - '.github/workflows/deploy-website.yml' - - 'website/**' - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: pages - cancel-in-progress: false - -jobs: - # Build job - build: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./website - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Not needed if lastUpdated is not enabled - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: latest - cache: yarn # or pnpm / yarn - cache-dependency-path: website/yarn.lock - - name: Setup Pages - uses: actions/configure-pages@v5 - - name: Install dependencies - run: yarn install --frozen-lockfile - - name: Build with VitePress - run: | - yarn docs:build - touch docs/.vitepress/dist/.nojekyll - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: website/docs/.vitepress/dist - - # Deployment job - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - needs: build - runs-on: ubuntu-latest - name: Deploy - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/gki-kernel-mock.yml b/.github/workflows/gki-kernel-mock.yml new file mode 100644 index 00000000..205d1d0e --- /dev/null +++ b/.github/workflows/gki-kernel-mock.yml @@ -0,0 +1,79 @@ +name: GKI Kernel Build + +on: + workflow_call: + inputs: + version: + required: true + type: string + description: > + Output directory of gki, + for example: android12-5.10 + version_name: + required: true + type: string + description: > + With SUBLEVEL of kernel, + for example: android12-5.10.66 + tag: + required: true + type: string + description: > + Part of branch name of common kernel manifest, + for example: android12-5.10-2021-11 + os_patch_level: + required: false + type: string + description: > + Patch level of common kernel manifest, + for example: 2021-11 + default: 2022-05 + patch_path: + required: false + type: string + description: > + Directory name of .github/patches/ + for example: 5.10 + use_cache: + required: false + type: boolean + default: true + embed_ksud: + required: false + type: string + default: ksud-aarch64-linux-android + description: > + Artifact name of prebuilt ksud to be embedded + for example: ksud-aarch64-linux-android + debug: + required: false + type: boolean + default: false + build_lkm: + required: false + type: boolean + default: false + secrets: + BOOT_SIGN_KEY: + required: false + CHAT_ID: + required: false + BOT_TOKEN: + required: false + MESSAGE_THREAD_ID: + required: false + +jobs: + mock_build: + name: Mock build ${{ inputs.version_name }} + runs-on: ubuntu-latest + steps: + - name: Create mocking ko + run: | + echo "${{ inputs.version }}_kernelsu.ko" > ${{ inputs.version }}_kernelsu.ko + - name: Upload LKM + uses: actions/upload-artifact@v4 + if: ${{ inputs.build_lkm == true }} + with: + name: ${{ inputs.version }}-lkm + path: ./*_kernelsu.ko diff --git a/.github/workflows/gki-kernel.yml b/.github/workflows/gki-kernel.yml index 7061c4ae..21bb6346 100644 --- a/.github/workflows/gki-kernel.yml +++ b/.github/workflows/gki-kernel.yml @@ -103,7 +103,7 @@ jobs: cd $GITHUB_WORKSPACE sudo apt-get install repo -y mkdir android-kernel && cd android-kernel - repo init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${{ inputs.tag }} --repo-rev=v2.16 + repo init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${{ inputs.tag }} --repo-rev=v2.35 REMOTE_BRANCH=$(git ls-remote https://android.googlesource.com/kernel/common ${{ inputs.tag }}) DEFAULT_MANIFEST_PATH=.repo/manifests/default.xml if grep -q deprecated <<< $REMOTE_BRANCH; then @@ -198,11 +198,9 @@ jobs: - name: Make working directory clean to avoid dirty working-directory: android-kernel run: | - # Fix bazel build error - if [ -f common/BUILD.bazel ]; then - [ -f android/abi_gki_protected_exports_aarch64 ] || sed -i '/^[[:space:]]*"protected_exports_list"[[:space:]]*:[[:space:]]*"android\/abi_gki_protected_exports_aarch64",$/d' common/BUILD.bazel + if [ -e common/BUILD.bazel ]; then + sed -i '/^[[:space:]]*"protected_exports_list"[[:space:]]*:[[:space:]]*"android\/abi_gki_protected_exports_aarch64",$/d' common/BUILD.bazel fi - rm common/android/abi_gki_protected_exports_* || echo "No protected exports!" git config --global user.email "bot@kernelsu.org" git config --global user.name "KernelSUBot" @@ -211,9 +209,6 @@ jobs: - name: Build Kernel/LKM working-directory: android-kernel - env: - CI_KSU_VERSION: ${{ env.KSU_VERSION }} - CI_KSU_VERSION_FULL: ${{ env.KSU_VERSION_FULL }} run: | if [ ! -z ${{ vars.EXPECTED_SIZE }} ] && [ ! -z ${{ vars.EXPECTED_HASH }} ]; then export KSU_EXPECTED_SIZE=${{ vars.EXPECTED_SIZE }} diff --git a/.github/workflows/ksud.yml b/.github/workflows/ksud.yml index 44d2967f..7d1ea16c 100644 --- a/.github/workflows/ksud.yml +++ b/.github/workflows/ksud.yml @@ -9,6 +9,10 @@ on: required: false type: string default: ubuntu-latest + pull_lkm: + required: false + type: boolean + default: true pack_lkm: required: false type: boolean @@ -25,14 +29,27 @@ jobs: with: fetch-depth: 0 - - name: Download artifacts + - name: Pull lkms from branch + if: ${{ inputs.pack_lkm && inputs.pull_lkm }} + uses: actions/checkout@v4 + with: + ref: lkm + path: lkm + + - name: Download lkms from artifacts + if: ${{ inputs.pack_lkm && !inputs.pull_lkm }} uses: actions/download-artifact@v4 - - - name: Prepare LKM fies - if: ${{ inputs.pack_lkm }} + + - name: Prepare LKM files + if: ${{ inputs.pack_lkm && inputs.pull_lkm }} + run: | + cp lkm/*_kernelsu.ko ./userspace/ksud/bin/aarch64/ + + - name: Prepare LKM files + if: ${{ inputs.pack_lkm && !inputs.pull_lkm }} run: | cp android*-lkm/*_kernelsu.ko ./userspace/ksud/bin/aarch64/ - + - name: Setup rustup run: | rustup update stable diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index f864e05f..e4287380 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -16,7 +16,7 @@ on: jobs: shellcheck: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 54963dbb..b6ce1a41 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea +.vscode CLAUDE.md .DS_Store diff --git a/kernel/.vscode/c_cpp_properties.json b/kernel/.vscode/c_cpp_properties.json deleted file mode 100644 index f6613702..00000000 --- a/kernel/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "cStandard": "c11", - "intelliSenseMode": "gcc-arm64", - "compileCommands": "${workspaceFolder}/compile_commands.json" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/kernel/.vscode/generate_compdb.py b/kernel/.vscode/generate_compdb.py deleted file mode 100644 index 88669138..00000000 --- a/kernel/.vscode/generate_compdb.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python3 - -from __future__ import print_function, division - -import argparse -import fnmatch -import functools -import json -import math -import multiprocessing -import os -import re -import sys - - -CMD_VAR_RE = re.compile(r'^\s*(?:saved)?cmd_(\S+)\s*:=\s*(.+)\s*$', re.MULTILINE) -SOURCE_VAR_RE = re.compile(r'^\s*source_(\S+)\s*:=\s*(.+)\s*$', re.MULTILINE) - - -def print_progress_bar(progress): - progress_bar = '[' + '|' * int(50 * progress) + '-' * int(50 * (1.0 - progress)) + ']' - print('\r', progress_bar, "{0:.1%}".format(progress), end='\r', file=sys.stderr) - - -def parse_cmd_file(out_dir, cmdfile_path): - with open(cmdfile_path, 'r') as cmdfile: - cmdfile_content = cmdfile.read() - - commands = { match.group(1): match.group(2) for match in CMD_VAR_RE.finditer(cmdfile_content) } - sources = { match.group(1): match.group(2) for match in SOURCE_VAR_RE.finditer(cmdfile_content) } - - return [{ - 'directory': out_dir, - 'command': commands[o_file_name], - 'file': source, - 'output': o_file_name - } for o_file_name, source in sources.items()] - - -def gen_compile_commands(cmd_file_search_path, out_dir): - print("Building *.o.cmd file list...", file=sys.stderr) - - out_dir = os.path.abspath(out_dir) - - if not cmd_file_search_path: - cmd_file_search_path = [out_dir] - - cmd_files = [] - for search_path in cmd_file_search_path: - if (os.path.isdir(search_path)): - for cur_dir, subdir, files in os.walk(search_path): - cmd_files.extend(os.path.join(cur_dir, cmdfile_name) for cmdfile_name in fnmatch.filter(files, '*.o.cmd')) - else: - cmd_files.extend(search_path) - - if not cmd_files: - print("No *.o.cmd files found in", ", ".join(cmd_file_search_path), file=sys.stderr) - return - - print("Parsing *.o.cmd files...", file=sys.stderr) - - n_processed = 0 - print_progress_bar(0) - - compdb = [] - pool = multiprocessing.Pool() - try: - for compdb_chunk in pool.imap_unordered(functools.partial(parse_cmd_file, out_dir), cmd_files, chunksize=int(math.sqrt(len(cmd_files)))): - compdb.extend(compdb_chunk) - n_processed += 1 - print_progress_bar(n_processed / len(cmd_files)) - - finally: - pool.terminate() - pool.join() - - print(file=sys.stderr) - print("Writing compile_commands.json...", file=sys.stderr) - - with open('compile_commands.json', 'w') as compdb_file: - json.dump(compdb, compdb_file, indent=1) - - -def main(): - cmd_parser = argparse.ArgumentParser() - cmd_parser.add_argument('-O', '--out-dir', type=str, default=os.getcwd(), help="Build output directory") - cmd_parser.add_argument('cmd_file_search_path', nargs='*', help="*.cmd file search path") - gen_compile_commands(**vars(cmd_parser.parse_args())) - - -if __name__ == '__main__': - main() diff --git a/kernel/.vscode/settings.json b/kernel/.vscode/settings.json deleted file mode 100644 index 6f8776a1..00000000 --- a/kernel/.vscode/settings.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "files.exclude": { - "**/*.o.cmd": true, - "**/*.ko.cmd": true, - "**/*.mod.cmd": true, - "**/*.cmd": true, - "**/*.order": true, - "**/*.symvers": true, - "**/*.o": true, - "**/*.mod": true, - "**/android-wuwa.mod.c": true, - "**/android-wuwa.lds": true, - "**/.*.*.cmd": true, - "**/.*.d": true, - "**/.*.S": true - }, - "[c]": { - "editor.detectIndentation": false, - "editor.tabSize": 4, - "editor.insertSpaces": true, - "editor.rulers": [80,100] - }, - "files.associations": { - "*.h": "c", - "ratio": "c", - "array": "c", - "string_view": "c", - "initializer_list": "c", - "random": "cpp" - }, - "editor.indentSize": 4, - "editor.insertSpaces": true, - "editor.detectIndentation": false, - "clangd.path": "/opt/ddk/clang/clang-r450784e/bin/clangd" -} diff --git a/kernel/.vscode/tasks.json b/kernel/.vscode/tasks.json deleted file mode 100644 index 4ed9adba..00000000 --- a/kernel/.vscode/tasks.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "Generate compile_commands.json", - "type": "process", - "command": "python", - "args": [ - "${workspaceRoot}/.vscode/generate_compdb.py" - ], - "problemMatcher": [] - } - ] -} \ No newline at end of file diff --git a/kernel/Makefile b/kernel/Makefile index 0844d9f6..249c9dbd 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -36,12 +36,6 @@ ifeq ($(CONFIG_KSU),m) ccflags-y += -DKSU_MODULE endif -KDIR := $(KDIR) -MDIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) - -$(info -- KDIR: $(KDIR)) -$(info -- MDIR: $(MDIR)) - REPO_OWNER := SukiSU-Ultra REPO_NAME := SukiSU-Ultra @@ -54,13 +48,6 @@ CURL_BIN := /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin curl KSU_GITHUB_VERSION := $(shell $(CURL_BIN) -s "https://api.github.com/repos/$(REPO_OWNER)/$(REPO_NAME)/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') KSU_GITHUB_VERSION_COMMIT := $(shell $(CURL_BIN) -sI "https://api.github.com/repos/$(REPO_OWNER)/$(REPO_NAME)/commits?sha=$(REPO_BRANCH)&per_page=1" | grep -i "link:" | sed -n 's/.*page=\([0-9]*\)>; rel="last".*/\1/p') -ifdef CI_KSU_VERSION - KSU_VERSION := $(CI_KSU_VERSION) - KSU_VERSION_FULL := $(CI_KSU_VERSION_FULL) - $(info -- $(REPO_NAME) version (CI override): $(KSU_VERSION)) - $(info -- $(REPO_NAME) full version (CI override): $(KSU_VERSION_FULL)) -else - ifeq ($(findstring $(srctree),$(src)),$(srctree)) KSU_SRC := $(src) else @@ -103,7 +90,6 @@ else KSU_VERSION_FULL := $(call get_ksu_version_full,$(KSU_GITHUB_VERSION)) $(info -- $(REPO_NAME) version (Github): $(KSU_VERSION_FULL)) endif -endif ccflags-y += -DKSU_VERSION=$(KSU_VERSION) ccflags-y += -DKSU_VERSION_FULL=\"$(KSU_VERSION_FULL)\" @@ -135,19 +121,15 @@ $(info -- SukiSU: CONFIG_KSU_MANUAL_HOOK) endif KERNEL_VERSION := $(VERSION).$(PATCHLEVEL) -VERSION := $(or $(VERSION),0) -PATCHLEVEL := $(or $(PATCHLEVEL),0) - -# Check for GKI 2.0 (5.10+ or 6.x+) -ifeq ($(shell \ - [ "$(VERSION)" -gt 5 ] || { [ "$(VERSION)" -eq 5 ] && [ "$(PATCHLEVEL)" -ge 10 ]; } || \ - [ "$(VERSION)" -ge 6 ]; echo $$?),0) -KERNEL_TYPE := GKI 2.0 -# Check for GKI 1.0 (5.4) -else ifeq ($(VERSION)-$(PATCHLEVEL),5-4) -KERNEL_TYPE := GKI 1.0 -else KERNEL_TYPE := Non-GKI +# Check for GKI 2.0 (5.10+ or 6.x+) +ifneq ($(shell test \( $(VERSION) -ge 5 -a $(PATCHLEVEL) -ge 10 \) -o $(VERSION) -ge 6; echo $$?),0) +# Check for GKI 1.0 (5.4) +ifeq ($(shell test $(VERSION)-$(PATCHLEVEL) = 5-4; echo $$?),0) +KERNEL_TYPE := GKI 1.0 +endif +else +KERNEL_TYPE := GKI 2.0 endif $(info -- KERNEL_VERSION: $(KERNEL_VERSION)) $(info -- KERNEL_TYPE: $(KERNEL_TYPE)) @@ -172,12 +154,4 @@ endif ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion -Wno-gcc-compat ccflags-y += -Wno-declaration-after-statement -Wno-unused-function - -all: - make -C $(KDIR) M=$(MDIR) modules -compdb: - python3 $(MDIR)/.vscode/generate_compdb.py -O $(KDIR) $(MDIR) -clean: - make -C $(KDIR) M=$(MDIR) clean - # Keep a new line here!! Because someone may append config diff --git a/kernel/core_hook.c b/kernel/core_hook.c index cff3f788..37559858 100644 --- a/kernel/core_hook.c +++ b/kernel/core_hook.c @@ -420,8 +420,8 @@ static void sulog_prctl_cmd(uid_t uid, unsigned long cmd) int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5) { - // if success, we modify the arg5 as result! - __maybe_unused u32 *result = (u32 *)arg5; + // if success, we modify the arg5 as result! + __maybe_unused u32 *result = (u32 *)arg5; __maybe_unused u32 reply_ok = KERNEL_SU_OPTION; if (likely(ksu_is_current_proc_umounted()))