action.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. name: apply susfs patches
  2. description: apply susfs patches
  3. runs:
  4. using: composite
  5. steps:
  6. - name: clone susfs
  7. shell: bash
  8. run: |
  9. SUSFS_BRANCH="gki-$ANDROID_VER-$KERNEL_VER"
  10. git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH"
  11. git config --global user.name "github-actions[bot]"
  12. git config --global user.email "41898282+github-actions[bot]@://github.com"
  13. cd susfs4ksu
  14. git fetch https://gitlab.com/pershoot/susfs4ksu.git gki-android14-6.1-dev
  15. git log ..FETCH_HEAD --oneline -n 2 | awk '{print $1}' | tac | xargs git cherry-pick
  16. #cd susfs4ksu
  17. #if [[ "$ANDROID_VER-$KERNEL_VER" == "android12-5.10" ]]; then
  18. #COMMIT=ce2c2b2dea28c89d33f61af898cc18a93bf65ae9
  19. #elif [[ "$ANDROID_VER-$KERNEL_VER" == "android13-5.15" ]]; then
  20. # COMMIT=529919fbc9f8aee6ee70eb3a8890ef33af0a109c
  21. #elif [[ "$ANDROID_VER-$KERNEL_VER" == "android14-6.1" ]]; then
  22. #COMMIT=d1327b62e0854603cfc26e2226e0a993ec9b0656
  23. #elif [[ "$ANDROID_VER-$KERNEL_VER" == "android15-6.6" ]]; then
  24. #COMMIT=676d202ed2cc322a2f90bcb2b56bc4f6a864acb8
  25. #fi
  26. #git checkout "$COMMIT"
  27. SUSFS4KSU="$ROOT/susfs4ksu"
  28. echo "SUSFS4KSU=$SUSFS4KSU" >> $GITHUB_ENV
  29. - name: Apply to KSUN
  30. shell: bash
  31. run: |
  32. #cd "$COMMON/KernelSU-Next"
  33. #SUSFS_VERSION="v2.1.0"
  34. # Apply SUSFS to KernelSU-Next
  35. #cp "$SUSFS4KSU/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch" .
  36. #patch -p1 < 10_enable_susfs_for_ksu.patch || true
  37. #rm -rf 10_enable_susfs_for_ksu.patch
  38. #Fix rejects from adding susfs to KSUN
  39. #cp "$KERNEL_PATCHES/next/susfs_fix_patches/$SUSFS_VERSION/"*.patch .
  40. #rm -rf multi_manager.patch
  41. #for p in *.patch; do
  42. # patch -p1 < "$p"
  43. # rm -f "$p"
  44. #done
  45. - name: Copy required files
  46. shell: bash
  47. run: |
  48. # Apply SUSFS to kernel
  49. cd "$COMMON"
  50. cp "$SUSFS4KSU/kernel_patches/fs/"* ./fs/
  51. cp "$SUSFS4KSU/kernel_patches/include/linux/"* ./include/linux/
  52. cp "$SUSFS4KSU/kernel_patches/50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch" ./
  53. - name: prepare namespace and open.c for susfs patch because scamsung
  54. shell: bash
  55. run: |
  56. cd "$COMMON"
  57. #Prepare open.c for susfs patching
  58. sed -i '/#ifdef CONFIG_SECURITY_DEFEX/,/^#endif/d' fs/open.c
  59. #Prepare namespace.c for susfs patching
  60. sed -i '/copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;/,/#endif/ {
  61. /#ifdef CONFIG_KDP_NS/,/#endif/ {
  62. /#else/,/#endif/!d
  63. /#else/d
  64. /#endif/d
  65. }
  66. }' fs/namespace.c
  67. - name: apply susfs patch and fix if necessary
  68. shell: bash
  69. run: |
  70. cd "$COMMON"
  71. # Apply SUSFS core patch
  72. patch -p1 < 50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch || true
  73. rm -rf 50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch
  74. shopt -s nullglob
  75. patches=("$KERNEL_PATCHES/samsung/$BRANCH"/*.patch)
  76. if [ ${#patches[@]} -gt 0 ]; then
  77. echo "Patches found, applying..."
  78. cp "${patches[@]}" ./
  79. # Fix SUSFS rejects
  80. for p in *.patch; do
  81. patch -p1 < "$p"
  82. rm -f "$p"
  83. done
  84. shopt -u nullglob
  85. else
  86. echo "No patch file found, skipping"
  87. fi
  88. - name: fix VMA_PAD error
  89. if: ${{ env.BRANCH == 'SM-X926B-Oneui6.1' || env.BRANCH == 'SM-A546B-Oneui6.0' || env.BRANCH == 'SM-S9180-Oneui6.1' }}
  90. shell: bash
  91. run: |
  92. cd "$COMMON"
  93. # Define VMA_PAD_START fallback macro if it does not exist
  94. sed -i '/static int show_map_vma/i \
  95. #ifndef VMA_PAD_START\n#define VMA_PAD_START(vma) ((vma)->vm_start)\n#endif\n' fs/proc/task_mmu.c
  96. - name: fix __fold function error for s25 ultra oneui7
  97. if: ${{ env.BRANCH == 'SM-S938B-Oneui7' }}
  98. shell: bash
  99. run: |
  100. cd "$COMMON"
  101. sed -i '/static int show_map_vma/i \
  102. #ifdef CONFIG_KSU_SUSFS_OPEN_REDIRECT\nstatic inline void __fold_filemap_fixup_entry(struct vma_iterator *vmi, unsigned long *end)\n{\n\tstruct vm_area_struct *next = vma_next(vmi);\n\tif (next) {\n\t\t*end = next->vm_start;\n\t\tvma_prev(vmi);\n\t}\n}\n#endif\n' fs/proc/task_mmu.c
  103. - name: add ksu-susfs to config
  104. shell: bash
  105. run: |
  106. "$COMMON/scripts/config" --file "$GKI_DEFCONFIG" --enable CONFIG_KSU_SUSFS