action.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. name: apply susfs patches
  2. description: apply susfs patches
  3. inputs:
  4. android_version:
  5. description: 'Android version (android14)'
  6. required: true
  7. kernel_version:
  8. description: 'Kernel version (6.1)'
  9. required: true
  10. branch:
  11. description: 'device kernel'
  12. required: true
  13. nomount:
  14. description: 'nomount'
  15. required: true
  16. runs:
  17. using: composite
  18. steps:
  19. - name: Apply to KSUN
  20. shell: bash
  21. run: |
  22. #cd "$COMMON/KernelSU-Next"
  23. #SUSFS_VERSION="v2.1.0"
  24. # Apply SUSFS to KernelSU-Next
  25. #cp "$SUSFS4KSU/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch" .
  26. #patch -p1 < 10_enable_susfs_for_ksu.patch || true
  27. #rm -rf 10_enable_susfs_for_ksu.patch
  28. #Fix rejects from adding susfs to KSUN
  29. #cp "$KERNEL_PATCHES/next/susfs_fix_patches/$SUSFS_VERSION/"*.patch .
  30. #rm -rf multi_manager.patch
  31. #for p in *.patch; do
  32. # patch -p1 < "$p"
  33. # rm -f "$p"
  34. #done
  35. - name: Copy required files
  36. shell: bash
  37. run: |
  38. # Apply SUSFS to kernel
  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-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch" ./
  43. - name: prepare namespace and open.c for susfs patch because scamsung
  44. shell: bash
  45. run: |
  46. cd "$COMMON"
  47. #Prepare open.c for susfs patching
  48. sed -i '/#ifdef CONFIG_SECURITY_DEFEX/,/^#endif/d' fs/open.c
  49. #Prepare namespace.c for susfs patching
  50. sed -i '/copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;/,/#endif/ {
  51. /#ifdef CONFIG_KDP_NS/,/#endif/ {
  52. /#else/,/#endif/!d
  53. /#else/d
  54. /#endif/d
  55. }
  56. }' fs/namespace.c
  57. - name: apply susfs patch and fix if necessary
  58. shell: bash
  59. run: |
  60. cd "$COMMON"
  61. # Apply SUSFS core patch
  62. patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
  63. rm -rf 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch
  64. shopt -s nullglob
  65. patches=("$KERNEL_PATCHES/samsung/${{ inputs.branch }}"/*.patch)
  66. if [ ${#patches[@]} -gt 0 ]; then
  67. echo "Patches found, applying..."
  68. cp "${patches[@]}" ./
  69. # Fix SUSFS rejects
  70. for p in *.patch; do
  71. patch -p1 < "$p"
  72. rm -f "$p"
  73. done
  74. shopt -u nullglob
  75. else
  76. echo "No patch file found, skipping"
  77. fi
  78. - name: add ksu-susfs to config
  79. shell: bash
  80. run: |
  81. cat >> "$GKI_DEFCONFIG" << 'EOF'
  82. # SUSFS Configuration
  83. CONFIG_KSU_SUSFS=y
  84. EOF
  85. - name: if using nomount, disable sus_mount
  86. if: inputs.nomount == 'true'
  87. shell: bash
  88. run: |
  89. cat >> "$GKI_DEFCONFIG" << 'EOF'
  90. CONFIG_KSU_SUSFS_SUS_MOUNT=n
  91. EOF