Просмотр исходного кода

ci(susfs): improve kernel patch application logic

Add support for LTS kernel variants and missing patches for specific sublevel ranges:
- Android 12 (5.10): Add LTS fdinfo patch for sublevel 251
- Android 13 (5.10): Add i2c-nomadik patch for sublevel 108-157 range
- Android 14 (6.1): Add base.c patch for all sublevels
- Android 15 (6.6): Add LTS task_mmu patch for sublevel 126 and rename patches for clarity
- Clean up comments and fix patch command syntax
TheWildJames 6 месяцев назад
Родитель
Сommit
9b766efb7b
1 измененных файлов с 55 добавлено и 31 удалено
  1. 55 31
      .github/actions/susfs/action.yml

+ 55 - 31
.github/actions/susfs/action.yml

@@ -76,115 +76,139 @@ runs:
         cp "${{ github.workspace }}/susfs4ksu/kernel_patches/fs/"* "${{ github.workspace }}/kernel/common/fs/"
         cp "${{ github.workspace }}/susfs4ksu/kernel_patches/include/linux/"* "${{ github.workspace }}/kernel/common/include/linux/"
         cp ${{ github.workspace }}/susfs4ksu/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch ./
-        patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch 
-        #|| true
+        patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
     
     - 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: |
-        # Android 12 5.10 fixes
         SUBLEVEL=${{ inputs.sublevel }}
         SUSFS_VERSION=${{ env.SUSFS_VERSION }}
-        
+
         if [[ "$SUBLEVEL" -le 209 ]]; then
           sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
-        fi 
+        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/fdinfo.c.patch ./
-          patch -p1 < fdinfo.c.patch
+          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
+
+        # lts fdinfo variant
+        if [[ "$SUBLEVEL" -eq 251 ]]; then
+          cp ${{ github.workspace }}/kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/a12-5.10/2_fdinfo.c.patch ./
+          patch -p1 < 2_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: |
-        # Android 13 5.10 fixes
         SUBLEVEL=${{ inputs.sublevel }}
         SUSFS_VERSION=${{ env.SUSFS_VERSION }}
-        
+
         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: |
-        # Android 13 5.15 fixes
         SUBLEVEL=${{ inputs.sublevel }}
         SUSFS_VERSION=${{ env.SUSFS_VERSION }}
-        
-        if [ "$SUBLEVEL" -le 41 ]; then
+
+        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: |
-        # Android 14 5.15 fixes
         SUBLEVEL=${{ inputs.sublevel }}
-        
+
         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: |
-        # Android 14 6.1 fixes
         SUBLEVEL=${{ inputs.sublevel }}
-        
+        SUSFS_VERSION=${{ env.SUSFS_VERSION }}
+
+        # 6.1 base patch is needed
+        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: |
-        # Android 15 6.6 fixes
         SUBLEVEL=${{ inputs.sublevel }}
         SUSFS_VERSION=${{ env.SUSFS_VERSION }}
-        
-        if [[ "$SUBLEVEL" -ge 98 ]]; then
+
+        # 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/task_mmu.c.patch ./
-          patch -p1 < task_mmu.c.patch
+          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
+
     - name: SUSFS Setup Complete
       shell: bash
       run: |
-        # SUSFS setup complete
+        # SUSFS setup complete