| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- name: apply susfs patches
- description: apply susfs patches
- inputs:
- nomount:
- description: 'nomount'
- required: true
- susfs_commit:
- description: 'pinned SUSFS commit (empty = latest tip)'
- required: false
- default: ""
- runs:
- using: composite
- steps:
- - name: clone susfs
- shell: bash
- run: |
- SUSFS_BRANCH="gki-$ANDROID_VER-$KERNEL_VER"
- git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH"
- if [ -n "${{ inputs.susfs_commit }}" ]; then
- echo "Checking out pinned SUSFS ${{ inputs.susfs_commit }}"
- git -C susfs4ksu fetch --depth 1 origin "${{ inputs.susfs_commit }}" || git -C susfs4ksu fetch origin "${{ inputs.susfs_commit }}"
- git -C susfs4ksu checkout "${{ inputs.susfs_commit }}"
- fi
- git config --global user.name "github-actions[bot]"
- git config --global user.email "41898282+github-actions[bot]@://github.com"
-
- cd susfs4ksu
- git fetch https://gitlab.com/pershoot/susfs4ksu.git gki-android14-6.1-dev || true
- git log ..FETCH_HEAD --oneline -n 2 | awk '{print $1}' | tac | xargs git cherry-pick 2>/dev/null || true
-
- SUSFS4KSU="$ROOT/susfs4ksu"
- echo "SUSFS4KSU=$SUSFS4KSU" >> $GITHUB_ENV
- echo "SUSFS_COMMIT=$(git -C "$ROOT/susfs4ksu" rev-parse HEAD)" >> $GITHUB_ENV
-
- - name: Apply to KSUN
- shell: bash
- run: |
- echo "SUSFS prepared at $SUSFS4KSU"
-
- - name: Copy required files
- shell: bash
- run: |
- cd "$COMMON"
- cp "$SUSFS4KSU/kernel_patches/fs/"* ./fs/
- cp "$SUSFS4KSU/kernel_patches/include/linux/"* ./include/linux/
- cp "$SUSFS4KSU/kernel_patches/50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch" ./
- - name: prepare namespace and open.c for susfs patch because scamsung
- shell: bash
- run: |
- cd "$COMMON"
- sed -i '/#ifdef CONFIG_SECURITY_DEFEX/,/^#endif/d' fs/open.c
- sed -i '/copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;/,/#endif/ {
- /#ifdef CONFIG_KDP_NS/,/#endif/ {
- /#else/,/#endif/!d
- /#else/d
- /#endif/d
- }
- }' fs/namespace.c
-
- - name: apply susfs patch and fix if necessary
- shell: bash
- run: |
- cd "$COMMON"
- patch -p1 < 50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch || true
- rm -rf 50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch
- shopt -s nullglob
- patches=("$KERNEL_PATCHES/samsung/$BRANCH"/*.patch)
- if [ ${#patches[@]} -gt 0 ]; then
- echo "Patches found, applying..."
- cp "${patches[@]}" ./
- for p in *.patch; do
- patch -p1 < "$p"
- rm -f "$p"
- done
- shopt -u nullglob
- else
- echo "No patch file found, skipping"
- fi
- if grep -q 'VMA_PAD_START(' fs/proc/task_mmu.c && ! grep -qE '#include <linux/pgsize_migration(_inline)?\.h>|define VMA_PAD_START' fs/proc/task_mmu.c; then
- sed -i '1a #ifndef VMA_PAD_START\n#define VMA_PAD_START(vma) ((vma)->vm_end)\n#endif' fs/proc/task_mmu.c
- echo "Added VMA_PAD_START fallback"
- fi
- if grep -q '__fold_filemap_fixup_entry' fs/proc/task_mmu.c && ! grep -q '#include <linux/page_size_compat.h>' fs/proc/task_mmu.c; then
- sed -i '/#include <linux\/pkeys.h>/a #include <linux/page_size_compat.h>' fs/proc/task_mmu.c
- echo "Added page_size_compat.h include"
- fi
-
- - name: add ksu-susfs to config
- shell: bash
- run: |
- "$COMMON/scripts/config" --file "$GKI_DEFCONFIG" --enable CONFIG_KSU_SUSFS
- - name: remove open redirect if nomount is enabled
- if: inputs.nomount == 'true'
- shell: bash
- run: |
- "$COMMON/scripts/config" --file "$GKI_DEFCONFIG" --disable CONFIG_KSU_SUSFS_OPEN_REDIRECT
|