name: Add zeromount description: add zeromount to kernel inputs: android_version: description: 'Android version (android14)' required: true kernel_version: description: 'kernel version (6.1)' required: true runs: using: composite steps: - name: apply zeromount patches shell: bash run: | echo "adding zeromount..." cd "$COMMON" cp "$ZEROMOUNT/${{ inputs.android_version }}-${{ inputs.kernel_version }}/WildKSU/patches/60_zeromount-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch" . #patch -p1 < 51_enhanced_susfs_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true patch -p1 < 60_zeromount-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true rm -rf 60_zeromount-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch if [ -f fs/proc/task_mmu.c.rej ]; then echo "Fixing task_mmu.c..." sed -i '/pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;/a\ #ifdef CONFIG_ZEROMOUNT\ \tzeromount_spoof_mmap_metadata(inode, \&dev, \&ino);\ #endif' fs/proc/task_mmu.c fi if [ -f fs/stat.c.rej ]; then echo "fixing stat.c." if ! grep -q 'zeromount_stat_hook(dfd, filename, stat, request_mask, flags)' fs/stat.c; then 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 fi fi if [ -f fs/Kconfig.rej ]; then echo "Applying Kconfig zeromount fix..." if ! grep -q '^config ZEROMOUNT$' fs/Kconfig; then 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 fi fi #patch -p1 < 70_ksu_safety-wksu-${{ inputs.kernel_version }}.patch || true cd "$GITHUB_WORKSPACE" cat >> "$GKI_DEFCONFIG" << 'EOF' # Zeromount Configuration CONFIG_ZEROMOUNT=y EOF