Przeglądaj źródła

Refactor build and preparation workflows: streamline input handling, remove variant options, and enhance bypass functionality in kernel build process

TheWildJames 3 miesięcy temu
rodzic
commit
c0a81bc8c6

+ 35 - 6
.github/actions/build-kernel/action.yml

@@ -1,5 +1,12 @@
 name: 'Build Kernel'
 description: 'Builds kernel using legacy build.sh or Bazel (kleaf)'
+inputs:
+  bypass:
+    description: 'Whether to add the bypass hack or not'
+    required: true
+  version:
+    description: 'Kernel config version (e.g., android14-6.1)'
+    required: true
 
 runs:
   using: composite
@@ -9,6 +16,25 @@ runs:
     working-directory: ${{ github.workspace }}/kernel
     run: |
       set -euo pipefail
+      if [ "${{ inputs.bypass }}" = "true" ]; then
+        if [[ ${{ inputs.version }} == "android14-6.1" || ${{ inputs.version }} == "android15-6.6" || ${{ inputs.version }} == "android16-6.12" ]]; then
+          TARGET_FILE="${{ github.workspace }}/kernel/common/kernel/module/version.c"
+        else
+          TARGET_FILE="${{ github.workspace }}/kernel/common/kernel/module.c"
+        fi
+
+        sed -i '/bad_version:/{:a;n;/return 0;/{s/return 0;/return 1;/;b};ba}' "$TARGET_FILE"
+
+        if ! grep -A 5 "bad_version:" "$TARGET_FILE" | grep -q "return 1;"; then
+          echo "Patch failed! 'return 1;' not found at bad_version:"
+          grep -A 10 "bad_version:" "$TARGET_FILE" || true
+          exit 1
+        fi
+      else
+        echo "Bypass hack not applied as per input parameter."
+      fi
+  
+      rm -rf "out"
 
       GKI_KCONFIG_FRAGMENT_PATH="${{ github.workspace }}/wild_gki.fragment"
       GKI_DEFCONFIG_WRAPPER_PATH="${{ github.workspace }}/wild_gki.wrap.sh"
@@ -38,12 +64,12 @@ runs:
         GKI_BUILD_CONFIG_FRAGMENT="${GKI_BUILD_CONFIG_FRAGMENT_PATH}" \
         BUILD_CONFIG=common/build.config.gki.aarch64 \
         build/build.sh -j"$(nproc)" \
-        CC="$CC" \
-        CXX="$CXX" \
-        HOSTCC="$HOSTCC" \
-        HOSTCXX="$HOSTCXX" \
-        LD="$LD" \
-        HOSTLD="$HOSTLD"
+        CC="/usr/bin/ccache clang" \
+        CXX="/usr/bin/ccache clang+" \
+        HOSTCC="/usr/bin/ccache clang" \
+        HOSTCXX="/usr/bin/ccache clang+" \
+        LD="${{ github.workspace }}/kernel/common/ld-wrapper" \
+        HOSTLD="${{ github.workspace }}/kernel/common/ld-wrapper"
       else
         cp "${{ github.workspace }}/wild_gki.fragment" common/arch/arm64/configs/wild_gki.fragment
         tools/bazel build \
@@ -53,3 +79,6 @@ runs:
           --disk_cache="$BAZEL_CACHE_DIR" \
           //common:kernel_aarch64
       fi
+
+      ls
+      ls out

+ 0 - 9
.github/actions/cache-setup/action.yml

@@ -44,11 +44,6 @@ runs:
         export CCACHE_DIR="/home/runner/.ccache"
         echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
         mkdir -p "$CCACHE_DIR"
-        
-        echo "CC=/usr/bin/ccache clang" >> "$GITHUB_ENV"
-        echo "CXX=/usr/bin/ccache clang++" >> "$GITHUB_ENV"
-        echo "HOSTCC=/usr/bin/ccache clang" >> "$GITHUB_ENV"
-        echo "HOSTCXX=/usr/bin/ccache clang++" >> "$GITHUB_ENV"
 
         export CCACHE_MAXSIZE="12G"
         echo CCACHE_MAXSIZE="$CCACHE_MAXSIZE" >> $GITHUB_ENV
@@ -129,10 +124,6 @@ runs:
         EOF
         chmod +x "${{ github.workspace }}/kernel/common/ld-wrapper"
 
-        # Setup cache directories
-        echo "LD=${{ github.workspace }}/kernel/common/ld-wrapper" >> "$GITHUB_ENV"
-        echo "HOSTLD=${{ github.workspace }}/kernel/common/ld-wrapper" >> "$GITHUB_ENV"
-        
         # Set size limit via environment (4GB)
         echo "LDCACHE_MAX_SIZE=4294967296" >> "$GITHUB_ENV"
 

+ 30 - 11
.github/actions/prepare-anykernel3/action.yml

@@ -12,20 +12,39 @@ inputs:
 runs:
   using: composite
   steps:
-    - shell: bash
-      run: |
-        set -euo pipefail
-
-        ANDROID_VERSION="${{ inputs.android_version }}"
-        KERNEL_VERSION="${{ inputs.kernel_version }}"
-        if [ -f "${{ github.workspace }}/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image" ]; then
+  - shell: bash
+    run: |
+      set -euo pipefail
+      if [ -f "${{ github.workspace }}/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image" ]; then
+        if [[ ${{ inputs.bypass }} == "true" ]]; then
+          cp "${{ github.workspace }}/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image" "${{ github.workspace }}/AnyKernel3/Bypass-Image"
+        else
           cp "${{ github.workspace }}/kernel/out/$ANDROID_VERSION-$KERNEL_VERSION/dist/Image" "${{ github.workspace }}/AnyKernel3/Image"
+        fi
           exit 0
         fi
-
-        if [ -f "${{ github.workspace }}/kernel/bazel-bin/common/kernel_aarch64/Image" ]; then
+      if [ -f "${{ github.workspace }}/kernel/bazel-bin/common/kernel_aarch64/Image" ]; then
+        if [[ ${{ inputs.bypass }} == "true" ]]; then
+          cp "${{ github.workspace }}/kernel/bazel-bin/common/kernel_aarch64/Image" "${{ github.workspace }}/AnyKernel3/Bypass-Image"
+        else
           cp "${{ github.workspace }}/kernel/bazel-bin/common/kernel_aarch64/Image" "${{ github.workspace }}/AnyKernel3/Image"
-          exit 0
         fi
+        exit 0
+      fi
+
+      exit 1
 
-        exit 1
+  - shell: bash
+    run: |
+      # Inject bypass toggle code into anykernel.sh
+      sed -i '/^# boot install$/i\
+      # Handle bypass image toggle\
+      if [ -f "ENABLE_BYPASS" ]; then\
+          if [ -f "Bypass-Image" ]; then\
+              mv Bypass-Image Image\
+              ui_print " " "  -> Using Bypass kernel image"\
+          else\
+              ui_print " " "  -> Bypass enabled but no Bypass-Image found, using regular Image if available"\
+          fi\
+      fi\
+      ' "${{ github.workspace }}/AnyKernel3/anykernel.sh"

+ 14 - 1
.github/config/RELEASE_NOTES.md

@@ -84,4 +84,17 @@ d. APatch: remove /data/adb contents to avoid leftover root conflicts after flas
 Flash the ZIP to the active slot using Kernel Flasher.
 Install the KernelSU‑Next Manager APK, same version as mentioned in the release notes.
 Open the KernelSU‑Next app.
-Reboot the device if you performed any cleanup in step 2
+Reboot the device if you performed any cleanup in step 2
+
+## Force Load Kernel Modules aka Bypass Mode — how to enable and what it does
+
+> [!IMPORTANT]
+> Most users do not need to do this so please try without this first! This has nothing to do with root detections and will not help you with them, this is for users who cannot boot my normal kernels and require this hack! 
+
+**How to enable:** 
+- To instruct the installer to use the bypass kernel when flashing, include an empty file named `ENABLE_BYPASS` at the root of the AnyKernel3 package (the ZIP) before flashing it to the device. You do not need to modify anykernel settings — just ensure `ENABLE_BYPASS` is present in the zip when you install it.
+
+**What it does:**
+- The Problem: Sometimes when installing a custom kernel, the device tries to load a kernel module that fails due to version mismatches, missing dependencies, or signature verification issues. This can cause boot failures or device instability.
+- The Solution: These versions change one line from false to true to force load the kernel module, bypassing the failure check that would normally prevent loading.
+

+ 2 - 1
.github/config/android14-6.1.json

@@ -111,7 +111,8 @@
     },
     {
       "sublevel": "145",
-      "date": "2025-09"
+      "date": "2025-09",
+      "variant": "TheWildJames"
     },
     {
       "sublevel": "157",

+ 12 - 0
.github/workflows/build.yml

@@ -325,6 +325,9 @@ jobs:
         SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }}
         KBUILD_BUILD_TIMESTAMP: ${{ env.KBUILD_BUILD_TIMESTAMP }}
       uses: ./.github/actions/build-kernel
+      with:
+        version: ${{ inputs.version }}
+        bypass: false
 
     - name: Get Cache Stats
       uses: ./.github/actions/cache-stats
@@ -385,6 +388,15 @@ jobs:
         compression_level: 9
         github_token: ${{ secrets.GITHUB_TOKEN }}
 
+    - name: Build Kernel
+      env:
+        SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }}
+        KBUILD_BUILD_TIMESTAMP: ${{ env.KBUILD_BUILD_TIMESTAMP }}
+      uses: ./.github/actions/build-kernel
+      with:
+        bypass: true
+        version: ${{ inputs.version }}
+
     - name: Prepare AnyKernel3 Zip
       uses: ./.github/actions/prepare-anykernel3
       with:

+ 0 - 16
.github/workflows/main.yml

@@ -44,15 +44,6 @@ on:
           - NONE
           - FULL
         default: FULL
-      variant:
-        description: "Build Variant"
-        type: choice
-        options:
-          - All
-          - Normal
-          - Bypass
-          - Wild
-        default: Normal
       use_repo:
         description: "Use repo for downloading kernel source"
         type: boolean
@@ -69,7 +60,6 @@ jobs:
     with:
       config_file: .github/config/android12-5.10.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
-      variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
     secrets: inherit
 
@@ -79,7 +69,6 @@ jobs:
     with:
       config_file: .github/config/android13-5.10.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
-      variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
     secrets: inherit
 
@@ -89,7 +78,6 @@ jobs:
     with:
       config_file: .github/config/android13-5.15.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
-      variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
     secrets: inherit
 
@@ -99,7 +87,6 @@ jobs:
     with:
       config_file: .github/config/android14-5.15.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
-      variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
     secrets: inherit
 
@@ -109,7 +96,6 @@ jobs:
     with:
       config_file: .github/config/android14-6.1.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
-      variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
     secrets: inherit
 
@@ -119,7 +105,6 @@ jobs:
     with:
       config_file: .github/config/android15-6.6.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
-      variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
     secrets: inherit
 
@@ -129,7 +114,6 @@ jobs:
     with:
       config_file: .github/config/android16-6.12.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
-      variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
     secrets: inherit
 

+ 3 - 15
.github/workflows/prepare.yml

@@ -11,10 +11,6 @@ on:
         description: "Feature Set"
         required: false
         type: string
-      variant:
-        description: "Build Variant (All, Normal, Bypass, Wild)"
-        required: false
-        type: string
       use_repo:
         description: "Use repo for downloading kernel source"
         required: false
@@ -41,30 +37,22 @@ jobs:
 
           CONFIG_JSON=$(cat "${{ inputs.config_file }}" | jq -c .)
 
-          # Build the variant list as a JSON array
-          if [ "${{ inputs.variant }}" = "All" ] || [ -z "${{ inputs.variant }}" ]; then
-            VARIANTS='["Normal","Bypass","Wild"]'
-          else
-            VARIANTS=$(jq -cn --arg v "${{ inputs.variant }}" '[$v]')
-          fi
-
           # Build { "include": [ {android_version:..., kernel_version:..., sublevel:..., os_patch_level:..., variant: ...}, ... ] }
+          # Always include Normal, and add any explicit per-item variant from the config.
           FINAL=$(jq -cn \
-            --argjson cfg "$CONFIG_JSON" \
-            --argjson variants "$VARIANTS" '
+            --argjson cfg "$CONFIG_JSON" '
             ($cfg.version | split("-")) as $version_parts
             | {
               include: (
                 [
                   $cfg.include[] as $item
-                  | $variants[] as $build_variant
                   | {
                       version: $cfg.version,
                       android_version: $version_parts[0],
                       kernel_version: $version_parts[1],
                       sublevel: $item.sublevel,
                       os_patch_level: $item.date,
-                      variant: $build_variant
+                      variant: "Normal"
                     }
                 ]
                 + [