action.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. name: apply susfs patches
  2. description: apply susfs patches
  3. inputs:
  4. nomount:
  5. description: 'nomount'
  6. required: true
  7. susfs_commit:
  8. description: 'pinned SUSFS commit (empty = latest tip)'
  9. required: false
  10. default: ""
  11. runs:
  12. using: composite
  13. steps:
  14. - name: clone susfs
  15. shell: bash
  16. run: |
  17. SUSFS_BRANCH="gki-$ANDROID_VER-$KERNEL_VER"
  18. git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH"
  19. if [ -n "${{ inputs.susfs_commit }}" ]; then
  20. echo "Checking out pinned SUSFS ${{ inputs.susfs_commit }}"
  21. git -C susfs4ksu fetch --depth 1 origin "${{ inputs.susfs_commit }}" || git -C susfs4ksu fetch origin "${{ inputs.susfs_commit }}"
  22. git -C susfs4ksu checkout "${{ inputs.susfs_commit }}"
  23. fi
  24. git config --global user.name "github-actions[bot]"
  25. git config --global user.email "41898282+github-actions[bot]@://github.com"
  26. cd susfs4ksu
  27. git fetch https://gitlab.com/pershoot/susfs4ksu.git gki-android14-6.1-dev || true
  28. git log ..FETCH_HEAD --oneline -n 2 | awk '{print $1}' | tac | xargs git cherry-pick 2>/dev/null || true
  29. SUSFS4KSU="$ROOT/susfs4ksu"
  30. echo "SUSFS4KSU=$SUSFS4KSU" >> $GITHUB_ENV
  31. echo "SUSFS_COMMIT=$(git -C "$ROOT/susfs4ksu" rev-parse HEAD)" >> $GITHUB_ENV
  32. - name: Apply to KSUN
  33. shell: bash
  34. run: |
  35. echo "SUSFS prepared at $SUSFS4KSU"
  36. - name: Copy required files
  37. shell: bash
  38. run: |
  39. cd "$COMMON"
  40. cp "$SUSFS4KSU/kernel_patches/fs/"* ./fs/
  41. cp "$SUSFS4KSU/kernel_patches/include/linux/"* ./include/linux/
  42. cp "$SUSFS4KSU/kernel_patches/50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch" ./
  43. - name: prepare namespace and open.c for susfs patch because scamsung
  44. shell: bash
  45. run: |
  46. cd "$COMMON"
  47. sed -i '/#ifdef CONFIG_SECURITY_DEFEX/,/^#endif/d' fs/open.c
  48. sed -i '/copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;/,/#endif/ {
  49. /#ifdef CONFIG_KDP_NS/,/#endif/ {
  50. /#else/,/#endif/!d
  51. /#else/d
  52. /#endif/d
  53. }
  54. }' fs/namespace.c
  55. - name: apply susfs patch and fix if necessary
  56. shell: bash
  57. run: |
  58. cd "$COMMON"
  59. patch -p1 < 50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch || true
  60. rm -rf 50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch
  61. shopt -s nullglob
  62. patches=("$KERNEL_PATCHES/samsung/$BRANCH"/*.patch)
  63. if [ ${#patches[@]} -gt 0 ]; then
  64. echo "Patches found, applying..."
  65. cp "${patches[@]}" ./
  66. for p in *.patch; do
  67. patch -p1 < "$p"
  68. rm -f "$p"
  69. done
  70. shopt -u nullglob
  71. else
  72. echo "No patch file found, skipping"
  73. fi
  74. if grep -q 'VMA_PAD_START(' fs/proc/task_mmu.c && ! grep -qE '#include <linux/pgsize_migration(_inline)?\.h>|define VMA_PAD_START' fs/proc/task_mmu.c; then
  75. sed -i '1a #ifndef VMA_PAD_START\n#define VMA_PAD_START(vma) ((vma)->vm_end)\n#endif' fs/proc/task_mmu.c
  76. echo "Added VMA_PAD_START fallback"
  77. fi
  78. if grep -q '__fold_filemap_fixup_entry' fs/proc/task_mmu.c && ! grep -q '#include <linux/page_size_compat.h>' fs/proc/task_mmu.c; then
  79. sed -i '/#include <linux\/pkeys.h>/a #include <linux/page_size_compat.h>' fs/proc/task_mmu.c
  80. echo "Added page_size_compat.h include"
  81. fi
  82. - name: add ksu-susfs to config
  83. shell: bash
  84. run: |
  85. "$COMMON/scripts/config" --file "$GKI_DEFCONFIG" --enable CONFIG_KSU_SUSFS
  86. - name: remove open redirect if nomount is enabled
  87. if: inputs.nomount == 'true'
  88. shell: bash
  89. run: |
  90. "$COMMON/scripts/config" --file "$GKI_DEFCONFIG" --disable CONFIG_KSU_SUSFS_OPEN_REDIRECT