action.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. susfs_commit:
  17. description: 'Commit map (branch:commit,branch:commit...)'
  18. required: false
  19. runs:
  20. using: composite
  21. steps:
  22. - name: Setup SUSFS Branch
  23. shell: bash
  24. run: |
  25. SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
  26. SUSFS_REPO="https://gitlab.com/simonpunk/susfs4ksu.git"
  27. echo "Preparing SUSFS for branch: $SUSFS_BRANCH"
  28. # Parse commit map to find the commit for this branch
  29. COMMIT_MAP="${{ inputs.susfs_commit }}"
  30. TARGET_COMMIT=""
  31. if [ -n "$COMMIT_MAP" ]; then
  32. # Split by comma
  33. IFS=',' read -ra ENTRIES <<< "$COMMIT_MAP"
  34. for entry in "${ENTRIES[@]}"; do
  35. # Split by colon
  36. IFS=':' read -r branch commit <<< "$entry"
  37. if [ "$branch" == "$SUSFS_BRANCH" ]; then
  38. TARGET_COMMIT="$commit"
  39. break
  40. fi
  41. done
  42. fi
  43. if [ -n "$TARGET_COMMIT" ]; then
  44. echo "Found specific commit for $SUSFS_BRANCH: $TARGET_COMMIT"
  45. git clone "$SUSFS_REPO" -b "$SUSFS_BRANCH" susfs4ksu
  46. cd susfs4ksu
  47. git checkout "$TARGET_COMMIT"
  48. cd ..
  49. else
  50. echo "No specific commit found for $SUSFS_BRANCH, cloning latest..."
  51. git clone "$SUSFS_REPO" -b "$SUSFS_BRANCH" --depth=1 susfs4ksu
  52. fi
  53. SUSFS_VERSION="v2.1.0"
  54. echo "SUSFS_VERSION=$SUSFS_VERSION" >> $GITHUB_ENV
  55. echo "SUSFS_BRANCH=$SUSFS_BRANCH" >> $GITHUB_ENV
  56. echo "SUSFS_COMMIT=$TARGET_COMMIT" >> $GITHUB_ENV
  57. - name: Enable KernelSU SUSFS Config
  58. shell: bash
  59. working-directory: ${{ github.workspace }}/kernel
  60. run: |
  61. cat >> "${{ github.workspace }}/wild_gki.fragment" << 'EOF'
  62. # KernelSU SUSFS Configuration
  63. CONFIG_KSU_SUSFS=y
  64. CONFIG_KSU_SUSFS_SUS_PATH=y
  65. CONFIG_KSU_SUSFS_SUS_MOUNT=y
  66. CONFIG_KSU_SUSFS_SUS_KSTAT=y
  67. CONFIG_KSU_SUSFS_SPOOF_UNAME=y
  68. CONFIG_KSU_SUSFS_ENABLE_LOG=y
  69. CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y
  70. CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y
  71. CONFIG_KSU_SUSFS_OPEN_REDIRECT=y
  72. CONFIG_KSU_SUSFS_SUS_MAP=y
  73. EOF
  74. - name: Apply Kernel SUSFS Patches
  75. shell: bash
  76. working-directory: ${{ github.workspace }}/kernel/common
  77. run: |
  78. # Apply base SUSFS patches
  79. cp "${{ github.workspace }}/susfs4ksu/kernel_patches/fs/"* "${{ github.workspace }}/kernel/common/fs/"
  80. cp "${{ github.workspace }}/susfs4ksu/kernel_patches/include/linux/"* "${{ github.workspace }}/kernel/common/include/linux/"
  81. cp ${{ github.workspace }}/susfs4ksu/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch ./
  82. FIX_NAMESPACE=0
  83. if grep -q '^#include <trace/hooks/blk.h>$' fs/namespace.c; then
  84. sed -i '/^#include <trace\/hooks\/blk.h>$/d' fs/namespace.c
  85. FIX_NAMESPACE=1
  86. fi
  87. patch -p1 -F3 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
  88. if [ "$FIX_NAMESPACE" = "1" ]; then
  89. sed -i '/^#include "internal.h"$/a #include <trace/hooks/blk.h>' fs/namespace.c
  90. fi
  91. - name: Apply KSU SUSFS Patches
  92. shell: bash
  93. working-directory: ${{ github.workspace }}/kernel/KernelSU-Next
  94. run: |
  95. cp ${{ github.workspace }}/kernel_patches/wild/ksun-0daf55582-susfs-v2.1.0-e259e7d6.patch ./
  96. patch -p1 < ksun-0daf55582-susfs-v2.1.0-e259e7d6.patch