action.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. runs:
  14. using: composite
  15. steps:
  16. - name: Apply to KSUN
  17. shell: bash
  18. run: |
  19. cd "$COMMON/KernelSU-Next"
  20. SUSFS_VERSION="v2.1.0"
  21. # Apply SUSFS to KernelSU-Next
  22. cp "$SUSFS4KSU/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch" .
  23. patch -p1 < 10_enable_susfs_for_ksu.patch || true
  24. rm -rf 10_enable_susfs_for_ksu.patch
  25. #Fix rejects from adding susfs to KSUN
  26. cp "$KERNEL_PATCHES/next/susfs_fix_patches/$SUSFS_VERSION/"*.patch .
  27. rm -rf multi_manager.patch
  28. for p in *.patch; do
  29. patch -p1 < "$p"
  30. rm -f "$p"
  31. done
  32. - name: Apply to Kernel
  33. shell: bash
  34. run: |
  35. # Apply SUSFS to kernel
  36. cd "$COMMON"
  37. cp "$SUSFS4KSU/kernel_patches/fs/"* ./fs/
  38. cp "$SUSFS4KSU/kernel_patches/include/linux/"* ./include/linux/
  39. cp "$SUSFS4KSU/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch" ./
  40. #Prepare open.c for susfs patching
  41. sed -i '/#ifdef CONFIG_SECURITY_DEFEX/,/^#endif/d' fs/open.c
  42. #Prepare namespace.c for susfs patching
  43. sed -i '/copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;/,/#endif/ {
  44. /#ifdef CONFIG_KDP_NS/,/#endif/ {
  45. /#else/,/#endif/!d
  46. /#else/d
  47. /#endif/d
  48. }
  49. }' fs/namespace.c
  50. # Apply SUSFS core patch
  51. patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
  52. rm -rf 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch
  53. shopt -s nullglob
  54. patches=("$KERNEL_PATCHES/samsung/${{ inputs.branch }}"/*.patch)
  55. if [ ${#patches[@]} -gt 0 ]; then
  56. echo "Patches found, applying..."
  57. cp "${patches[@]}" ./
  58. # Fix SUSFS rejects
  59. for p in *.patch; do
  60. patch -p1 < "$p"
  61. rm -f "$p"
  62. done
  63. shopt -u nullglob
  64. else
  65. echo "No patch file found, skipping"
  66. fi
  67. cd "$GITHUB_WORKSPACE"
  68. cat >> "$GKI_DEFCONFIG" << 'EOF'
  69. # SUSFS Configuration
  70. CONFIG_KSU_SUSFS=y
  71. EOF