Quellcode durchsuchen

ci: refactor SUSFS patch setup into reusable GitHub Action

Remove obsolete "Install linker tools" step that was conditionally disabled
and extract SUSFS patch application logic from main workflow into a dedicated
composite action. This improves maintainability by centralizing version-specific
patch handling and reduces duplication across workflow steps.
TheWildJames vor 6 Monaten
Ursprung
Commit
5848ebcb54
2 geänderte Dateien mit 152 neuen und 17 gelöschten Zeilen
  1. 142 0
      .github/actions/susfs-patches/action.yml
  2. 10 17
      .github/workflows/build.yml

+ 142 - 0
.github/actions/susfs-patches/action.yml

@@ -0,0 +1,142 @@
+name: Setup SUSFS
+description: Clone and apply SUSFS patches with version-specific fixes
+inputs:
+  android_version:
+    description: 'Android version (e.g., android15)'
+    required: true
+  kernel_version:
+    description: 'Kernel version (e.g., 6.6)'
+    required: true
+  os_patch_level:
+    description: 'OS patch level (e.g., 2024-07)'
+    required: true
+  sublevel:
+    description: 'Kernel sublevel'
+    required: true
+
+runs:
+  using: composite
+  steps:
+    - name: Apply Android 12 5.10 Fixes
+      if: inputs.android_version == 'android12' && inputs.kernel_version == '5.10'
+      shell: bash
+      working-directory: ${{ github.workspace }}/kernel/common
+      run: |
+        SUBLEVEL=${{ env.SUBLEVEL }}
+        SUSFS_VERSION=${{ env.SUSFS_VERSION }}
+        exit 0
+        if [[ "$SUBLEVEL" -le 209 ]]; then
+          sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
+        fi
+
+        # non-lts fdinfo variant
+        if [[ "$SUBLEVEL" -le 117 ]]; then
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a12-5.10/1_fdinfo.c.patch ./
+          patch -p1 < 1_fdinfo.c.patch
+        fi
+
+        if [[ "$SUBLEVEL" -le 43 ]]; then
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a12-5.10/base.c.patch ./
+          patch -p1 < base.c.patch
+        fi
+
+    - name: Apply Android 13 5.10 Fixes
+      if: inputs.android_version == 'android13' && inputs.kernel_version == '5.10'
+      shell: bash
+      working-directory: ${{ github.workspace }}/kernel/common
+      run: |
+        SUBLEVEL=${{ env.SUBLEVEL }}
+        SUSFS_VERSION=${{ env.SUSFS_VERSION }}
+        exit 0
+        if [[ "$SUBLEVEL" -le 107 ]]; then
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a13-5.10/fdinfo.c.patch ./
+          patch -p1 < fdinfo.c.patch
+        fi
+
+        # needed for 149/157 range
+        if [[ "$SUBLEVEL" -ge 108 && "$SUBLEVEL" -le 157 ]]; then
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a13-5.10/i2c-nomadik.c.patch ./
+          patch -p1 < i2c-nomadik.c.patch
+        fi
+
+        if [[ "$SUBLEVEL" -le 209 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
+          sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
+        fi
+
+    - name: Apply Android 13 5.15 Fixes
+      if: inputs.android_version == 'android13' && inputs.kernel_version == '5.15'
+      shell: bash
+      working-directory: ${{ github.workspace }}/kernel/common
+      run: |
+        SUBLEVEL=${{ env.SUBLEVEL }}
+        SUSFS_VERSION=${{ env.SUSFS_VERSION }}
+        exit 0
+        if [[ "$SUBLEVEL" -le 41 ]]; then
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a13-5.15/namespace.c.patch ./
+          patch -p1 < namespace.c.patch
+
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a13-5.15/fdinfo.c.patch ./
+          patch -p1 < fdinfo.c.patch
+
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a13-5.15/open.c.patch ./
+          patch -p1 < open.c.patch
+
+          sed -i 's|is_i_uid_not_allowed(i_uid_into_mnt(i_user_ns(inode), inode).val)))|is_i_uid_not_allowed(inode->i_uid.val)))|g' fs/susfs.c
+        fi
+
+        if [[ "$SUBLEVEL" -le 148 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
+          sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
+        fi
+
+    - name: Apply Android 14 5.15 Fixes
+      if: inputs.android_version == 'android14' && inputs.kernel_version == '5.15'
+      shell: bash
+      working-directory: ${{ github.workspace }}/kernel/common
+      run: |
+        SUBLEVEL=${{ env.SUBLEVEL }}
+        exit 0
+        if [[ "$SUBLEVEL" -le 148 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
+          sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
+        fi
+
+    - name: Apply Android 14 6.1 Fixes
+      if: inputs.android_version == 'android14' && inputs.kernel_version == '6.1'
+      shell: bash
+      working-directory: ${{ github.workspace }}/kernel/common
+      run: |
+        SUBLEVEL=${{ env.SUBLEVEL }}
+        SUSFS_VERSION=${{ env.SUSFS_VERSION }}
+        exit 0
+        # 6.1 base patch is needed0
+        #cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a14-6.1/base.c.patch ./
+        #patch -p1 < base.c.patch
+
+        if [[ "$SUBLEVEL" -le 75 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
+          sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
+        fi
+
+    - name: Apply Android 15 6.6 Fixes
+      if: inputs.android_version == 'android15' && inputs.kernel_version == '6.6'
+      shell: bash
+      working-directory: ${{ github.workspace }}/kernel/common
+      run: |
+        SUBLEVEL=${{ env.SUBLEVEL }}
+        SUSFS_VERSION=${{ env.SUSFS_VERSION }}
+        exit 0
+        # base patch needed for all non-lts ranges seen (30..118 except 126-lts)
+        if [[ "$SUBLEVEL" -le 118 ]]; then
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a15-6.6/base.c.patch ./
+          patch -p1 < base.c.patch
+        fi
+
+        # non-lts task_mmu variant
+        if [[ "$SUBLEVEL" -le 58 ]]; then
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a15-6.6/1_task_mmu.c.patch ./
+          patch -p1 < 1_task_mmu.c.patch
+        fi
+
+        # lts task_mmu variant
+        if [[ "$SUBLEVEL" -eq 126 ]]; then
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a15-6.6/2_task_mmu.c.patch ./
+          patch -p1 < 2_task_mmu.c.patch
+        fi

+ 10 - 17
.github/workflows/build.yml

@@ -60,12 +60,7 @@ jobs:
         
         
         # Everything after the android version is the patch level
         # Everything after the android version is the patch level
         OS_PATCH_LEVEL="$REST"
         OS_PATCH_LEVEL="$REST"
-        
-        # Special handling for "X" sublevel (LTS builds)
-        if [[ "$SUB_LEVEL" == "X" ]]; then
-             echo "Detected LTS build with wildcard sublevel"
-        fi
-
+  
         echo "Parsed: KERNEL=$KERNEL_VERSION, SUB=$SUB_LEVEL, ANDROID=$ANDROID_VERSION, PATCH=$OS_PATCH_LEVEL"
         echo "Parsed: KERNEL=$KERNEL_VERSION, SUB=$SUB_LEVEL, ANDROID=$ANDROID_VERSION, PATCH=$OS_PATCH_LEVEL"
         
         
         # Set environment variables for subsequent steps and shell scripts
         # Set environment variables for subsequent steps and shell scripts
@@ -96,17 +91,6 @@ jobs:
         rmz_version: "3.1.1"  # Required when rm_cmd is 'rmz'
         rmz_version: "3.1.1"  # Required when rm_cmd is 'rmz'
         testing: false
         testing: false
 
 
-    - name: Install linker tools
-      if: steps.parse.outputs.kernel_version == '5.10' && false
-      run: |
-        sudo apt-get update
-        sudo apt-get install -y binutils lld
-        echo "ld.lld --version"  # Log verification
-        export PATH="/usr/bin:$PATH"
-        which ld  # Should show /usr/bin/ld
-        ld --version  # Verify GNU ld works
-        echo "PATH=$PATH" >> $GITHUB_ENV  # Persist for step
-
     - name: Setup Build Environment
     - name: Setup Build Environment
       run: |
       run: |
         mkdir -p "$GITHUB_WORKSPACE/kernel"
         mkdir -p "$GITHUB_WORKSPACE/kernel"
@@ -211,6 +195,15 @@ jobs:
         sublevel: ${{ steps.extract.outputs.sublevel }}
         sublevel: ${{ steps.extract.outputs.sublevel }}
         susfs_commit: ${{ inputs.susfs_commit }}
         susfs_commit: ${{ inputs.susfs_commit }}
 
 
+    - name: Setup SUSFS Patches
+      if: contains(inputs.feature_set, 'SUSFS')
+      uses: ./.github/actions/susfs-patches
+      with:
+        android_version: ${{ steps.parse.outputs.android_version }}
+        kernel_version: ${{ steps.parse.outputs.kernel_version }}
+        os_patch_level: ${{ steps.parse.outputs.os_patch_level }}
+        sublevel: ${{ steps.extract.outputs.sublevel }}
+
     - name: Setup Baseband Guard
     - name: Setup Baseband Guard
       if: contains(inputs.feature_set, 'BBG')
       if: contains(inputs.feature_set, 'BBG')
       uses: ./.github/actions/bbg
       uses: ./.github/actions/bbg