action.yml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. name: Setup SUSFS
  2. description: Clone and apply SUSFS patches with version-specific fixes
  3. inputs:
  4. android_version:
  5. description: 'Android version (e.g., android15)'
  6. required: true
  7. kernel_version:
  8. description: 'Kernel version (e.g., 6.6)'
  9. required: true
  10. os_patch_level:
  11. description: 'OS patch level (e.g., 2024-07)'
  12. required: true
  13. sublevel:
  14. description: 'Kernel sublevel'
  15. required: true
  16. kernel_root:
  17. description: 'Path to kernel root directory'
  18. required: true
  19. kernel_patches:
  20. description: 'Path to kernel_patches directory'
  21. required: true
  22. susfs4ksu:
  23. description: 'Path to susfs4ksu directory'
  24. required: true
  25. runs:
  26. using: composite
  27. steps:
  28. - name: Setup SUSFS Branch
  29. shell: bash
  30. run: |
  31. echo "========================================"
  32. echo " Setting up SUSFS "
  33. echo "========================================"
  34. SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
  35. # Use downloaded SUSFS artifact
  36. if [ -d "susfs_cache/$SUSFS_BRANCH" ]; then
  37. echo "Using downloaded SUSFS branch: $SUSFS_BRANCH"
  38. cp -r "susfs_cache/$SUSFS_BRANCH" susfs4ksu
  39. else
  40. echo "ERROR: SUSFS branch $SUSFS_BRANCH not found in downloaded artifacts"
  41. echo "Available branches:"
  42. ls -d susfs_cache/* 2>/dev/null || echo "No branches found"
  43. exit 1
  44. fi
  45. SUSFS_VERSION="2.0.0"
  46. echo "SUSFS_VERSION=$SUSFS_VERSION" >> $GITHUB_ENV
  47. - name: Apply Base SUSFS Patches
  48. shell: bash
  49. working-directory: ${{ inputs.kernel_root }}/common
  50. run: |
  51. echo "Applying SUSFS base patches..."
  52. cp "${{ inputs.susfs4ksu }}/kernel_patches/fs/"* "${{ inputs.kernel_root }}/common/fs/"
  53. cp "${{ inputs.susfs4ksu }}/kernel_patches/include/linux/"* "${{ inputs.kernel_root }}/common/include/linux/"
  54. cp ${{ inputs.susfs4ksu }}/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch ./
  55. patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
  56. echo "✓ Base SUSFS patches applied"
  57. - name: Apply Android 12 5.10 Fixes
  58. if: inputs.android_version == 'android12' && inputs.kernel_version == '5.10'
  59. shell: bash
  60. working-directory: ${{ inputs.kernel_root }}/common
  61. run: |
  62. echo "Applying Android 12 5.10 specific fixes..."
  63. SUBLEVEL=${{ inputs.sublevel }}
  64. SUSFS_VERSION=${{ env.SUSFS_VERSION }}
  65. if [[ "$SUBLEVEL" -le 209 ]]; then
  66. sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
  67. fi
  68. if [[ "$SUBLEVEL" -le 117 ]]; then
  69. cp ${{ inputs.kernel_patches }}/wild/susfs_fix_patches/v${SUSFS_VERSION}/a12-5.10/fdinfo.c.patch ./
  70. patch -p1 < fdinfo.c.patch
  71. fi
  72. if [[ "$SUBLEVEL" -le 43 ]]; then
  73. cp ${{ inputs.kernel_patches }}/wild/susfs_fix_patches/v${SUSFS_VERSION}/a12-5.10/base.c.patch ./
  74. patch -p1 < base.c.patch
  75. fi
  76. echo "✓ Android 12 5.10 fixes applied"
  77. - name: Apply Android 13 5.10 Fixes
  78. if: inputs.android_version == 'android13' && inputs.kernel_version == '5.10'
  79. shell: bash
  80. working-directory: ${{ inputs.kernel_root }}/common
  81. run: |
  82. echo "Applying Android 13 5.10 specific fixes..."
  83. SUBLEVEL=${{ inputs.sublevel }}
  84. SUSFS_VERSION=${{ env.SUSFS_VERSION }}
  85. if [[ "$SUBLEVEL" -le 107 ]]; then
  86. cp ${{ inputs.kernel_patches }}/wild/susfs_fix_patches/v${SUSFS_VERSION}/a13-5.10/fdinfo.c.patch ./
  87. patch -p1 < fdinfo.c.patch
  88. fi
  89. if [[ "$SUBLEVEL" -le 209 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
  90. sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
  91. fi
  92. echo "✓ Android 13 5.10 fixes applied"
  93. - name: Apply Android 13 5.15 Fixes
  94. if: inputs.android_version == 'android13' && inputs.kernel_version == '5.15'
  95. shell: bash
  96. working-directory: ${{ inputs.kernel_root }}/common
  97. run: |
  98. echo "Applying Android 13 5.15 specific fixes..."
  99. SUBLEVEL=${{ inputs.sublevel }}
  100. SUSFS_VERSION=${{ env.SUSFS_VERSION }}
  101. if [ "$SUBLEVEL" -le 41 ]; then
  102. cp ${{ inputs.kernel_patches }}/wild/susfs_fix_patches/v${SUSFS_VERSION}/a13-5.15/namespace.c.patch ./
  103. patch -p1 < namespace.c.patch
  104. cp ${{ inputs.kernel_patches }}/wild/susfs_fix_patches/v${SUSFS_VERSION}/a13-5.15/fdinfo.c.patch ./
  105. patch -p1 < fdinfo.c.patch
  106. cp ${{ inputs.kernel_patches }}/wild/susfs_fix_patches/v${SUSFS_VERSION}/a13-5.15/open.c.patch ./
  107. patch -p1 < open.c.patch
  108. 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
  109. fi
  110. if [[ "$SUBLEVEL" -le 148 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
  111. sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
  112. fi
  113. echo "✓ Android 13 5.15 fixes applied"
  114. - name: Apply Android 14 5.15 Fixes
  115. if: inputs.android_version == 'android14' && inputs.kernel_version == '5.15'
  116. shell: bash
  117. working-directory: ${{ inputs.kernel_root }}/common
  118. run: |
  119. echo "Applying Android 14 5.15 specific fixes..."
  120. SUBLEVEL=${{ inputs.sublevel }}
  121. if [[ "$SUBLEVEL" -le 148 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
  122. sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
  123. fi
  124. echo "✓ Android 14 5.15 fixes applied"
  125. - name: Apply Android 14 6.1 Fixes
  126. if: inputs.android_version == 'android14' && inputs.kernel_version == '6.1'
  127. shell: bash
  128. working-directory: ${{ inputs.kernel_root }}/common
  129. run: |
  130. echo "Applying Android 14 6.1 specific fixes..."
  131. SUBLEVEL=${{ inputs.sublevel }}
  132. if [[ "$SUBLEVEL" -le 75 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
  133. sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
  134. fi
  135. echo "✓ Android 14 6.1 fixes applied"
  136. - name: Apply Android 15 6.6 Fixes
  137. if: inputs.android_version == 'android15' && inputs.kernel_version == '6.6'
  138. shell: bash
  139. working-directory: ${{ inputs.kernel_root }}/common
  140. run: |
  141. echo "Applying Android 15 6.6 specific fixes..."
  142. SUBLEVEL=${{ inputs.sublevel }}
  143. SUSFS_VERSION=${{ env.SUSFS_VERSION }}
  144. if [[ "$SUBLEVEL" -ge 98 ]]; then
  145. cp ${{ inputs.kernel_patches }}/wild/susfs_fix_patches/v${SUSFS_VERSION}/a15-6.6/base.c.patch ./
  146. patch -p1 < base.c.patch
  147. fi
  148. if [[ "$SUBLEVEL" -le 58 ]]; then
  149. cp ${{ inputs.kernel_patches }}/wild/susfs_fix_patches/v${SUSFS_VERSION}/a15-6.6/task_mmu.c.patch ./
  150. patch -p1 < task_mmu.c.patch
  151. fi
  152. echo "✓ Android 15 6.6 fixes applied"
  153. - name: SUSFS Setup Complete
  154. shell: bash
  155. run: |
  156. echo "✓ SUSFS Setup Complete"
  157. echo " Version: 2.0.0"
  158. echo " Branch: gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
  159. echo "========================================"