action.yml 2.5 KB

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