action.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: Add zeromount
  2. description: add zeromount to kernel
  3. runs:
  4. using: composite
  5. steps:
  6. - name: clone zeromount
  7. shell: bash
  8. run: |
  9. git clone https://github.com/jimsterino98/Super-Builders.git
  10. ZEROMOUNT="$ROOT/Super-Builders"
  11. echo "ZEROMOUNT=$ZEROMOUNT" >> $GITHUB_ENV
  12. - name: apply zeromount patches
  13. shell: bash
  14. run: |
  15. echo "adding zeromount..."
  16. cd "$COMMON"
  17. cp "$ZEROMOUNT/$ANDROID_VER-$KERNEL_VER/WildKSU/patches/60_zeromount-$ANDROID_VER-$KERNEL_VER.patch" .
  18. #patch -p1 < 51_enhanced_susfs_gki-$ANDROID_VER-$KERNEL_VER.patch || true
  19. patch -p1 < 60_zeromount-$ANDROID_VER-$KERNEL_VER.patch || true
  20. rm -rf 60_zeromount-$ANDROID_VER-$KERNEL_VER.patch
  21. if [ -f fs/proc/task_mmu.c.rej ]; then
  22. echo "Fixing task_mmu.c..."
  23. sed -i '/pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;/a\
  24. #ifdef CONFIG_ZEROMOUNT\
  25. \tzeromount_spoof_mmap_metadata(inode, \&dev, \&ino);\
  26. #endif' fs/proc/task_mmu.c
  27. fi
  28. if [ -f fs/stat.c.rej ]; then
  29. echo "fixing stat.c."
  30. if ! grep -q 'zeromount_stat_hook(dfd, filename, stat, request_mask, flags)' fs/stat.c; then
  31. perl -0pi -e 's@(static int vfs_statx\(.*?\)\s*\{.*?orig_flow:\n#endif\n)@$1\n#ifdef CONFIG_ZEROMOUNT\n\tif (filename) {\n\t\tint zm_ret = zeromount_stat_hook(dfd, filename, stat, request_mask, flags);\n\t\tif (zm_ret != -ENOENT)\n\t\t\treturn zm_ret;\n\t}\n#endif\n\n@s' fs/stat.c
  32. fi
  33. fi
  34. if [ -f fs/Kconfig.rej ]; then
  35. echo "Applying Kconfig zeromount fix..."
  36. if ! grep -q '^config ZEROMOUNT$' fs/Kconfig; then
  37. perl -0pi -e 's@(config IO_WQ\n\tbool\n)@\1\nconfig ZEROMOUNT\n\tbool "ZeroMount Path Redirection Subsystem"\n\tdefault y\n\thelp\n\t ZeroMount allows path redirection and virtual file injection\n\t without mounting filesystems. Useful for systemless modifications.\n\n@' fs/Kconfig
  38. fi
  39. fi
  40. #patch -p1 < 70_ksu_safety-wksu-$KERNEL_VER.patch || true
  41. - name: apply zeromount patches
  42. shell: bash
  43. run: |
  44. "$COMMON/scripts/config" --file "$GKI_DEFCONFIG" --enable CONFIG_ZEROMOUNT