{"id":6639,"date":"2025-08-18T21:57:11","date_gmt":"2025-08-19T01:57:11","guid":{"rendered":"https:\/\/droidbasement.com\/db-blog\/?p=6639"},"modified":"2025-09-25T17:29:35","modified_gmt":"2025-09-25T21:29:35","slug":"tutorial-kernelsu-next-with-susfs-integrated-in-to-a-kernel-with-aosp","status":"publish","type":"post","link":"https:\/\/droidbasement.com\/db-blog\/tutorial-kernelsu-next-with-susfs-integrated-in-to-a-kernel-with-aosp\/","title":{"rendered":"Tutorial &#8211; KernelSU-Next with SuSFS integrated in to a kernel with AOSP"},"content":{"rendered":"\n<p>This is a tutorial to build <a href=\"https:\/\/kernelsu-next.github.io\/webpage\/\">KernelSU-Next<\/a> (<a href=\"https:\/\/github.com\/rifsxd\">rifsxd<\/a>) with <a href=\"https:\/\/gitlab.com\/simonpunk\/susfs4ksu#introduction\">SuSFS<\/a> (<a href=\"https:\/\/gitlab.com\/simonpunk\">simonpunk<\/a>) integrated in to an <a href=\"https:\/\/source.android.com\/docs\/core\/architecture\/kernel\">AOSP<\/a>, <a href=\"https:\/\/source.android.com\/docs\/core\/architecture\/kernel\/generic-kernel-image\">GKI<\/a> (Generic Kernel Image) or <a href=\"https:\/\/source.android.com\/docs\/core\/architecture\/kernel\/generic-kernel-image\">GKI<\/a> LTS (Generic Kernel Image; (Long Term Support)) kernel using <a href=\"https:\/\/source.android.com\/\">AOSP<\/a>. This is used to gain escalation on your mobile device.<\/p>\n\n\n\n<p>This tutorial will use Pixel 7a (Lynx) as an example (Pixel 7 \/ 8 \/ 9 can be used) and is geared towards using <a href=\"https:\/\/source.android.com\/docs\/core\/architecture\/bootloader\/version-info-avb\">AVB<\/a> Android14-11. Other interfaces can be used (the tutorial shows how to get this information), but you would need to, perhaps, fix hunks and \/ or rejects against the source that is applicable to your device, when using the patches. We will build using Ubuntu 24.0.4.3 on WSL2 (this requires virtualization to be on).<\/p>\n\n\n\n<p>&#8230;..<\/p>\n\n\n\n<p>Pre-requirements:<br>You will need <a href=\"https:\/\/developer.android.com\/tools\/releases\/platform-tools\">adb \/ fastboot<\/a>.<br>Install git (sudo apt-get update &amp;&amp; sudo apt-get -y install git)<br>You will need <a href=\"https:\/\/github.com\/xiaoxindada\/magisk_bins_ndk\/releases\" data-type=\"link\" data-id=\"https:\/\/github.com\/xiaoxindada\/magisk_bins_ndk\/releases\">magiskboot<\/a> (place the binary from x86-64 (if on Windows using WSL2 Linux) in to the root of the ~\/.bin directory (see below; where you are putting the manual install of repo)). Ensure you set execute permissions on it: chmod u+x magiskboot<br><strong>Note<\/strong>: magiskboot is only needed to unpack the stock kernel to take a peek at it (strings, etc.).<br>Install curl (sudo apt-get -y install curl).<br><br><em>This was amended on 8\/29\/25.<\/em><br><strong>You will need to perform a one-time wipe to turn off boot verification so you can boot and flash things you build, to properly test before committal.  Please see below but do not remove the -w (wipe USERDATA), but add on the aforementioned flags before it,  Thereafter, you will always pass the needed flags when you flash the monthly updates (but remove the -w).<\/strong> <br><\/p>\n\n\n\n<p>Update to the latest monthly update for your device prior (remove any ramdisk modifications you may have made (Magisk), remove -w after fastboot in flash-all script and replace with &#8211;disable-verity &#8211;disable-verification):<br>https:\/\/developers.google.com\/android\/images#xxxxx<br>Replace xxxxx with the codename for your device.<\/p>\n\n\n\n<p><a href=\"https:\/\/gerrit.googlesource.com\/git-repo\">Repo<\/a> (Use manual install, its newer).<\/p>\n\n\n\n<p>Put the path to it (repo) in your PATH:<br><code>export PATH=<em>PATH_TO_REPO<\/em>:$PATH<\/code><br>Replace <em>PATH_TO_REPO<\/em> with the \/xxx\/xxx\/xxx path to repo.<br>You can make it permanent by adding it in to your shell&#8217;s .rc file (i.e. if you use BASH then at the end of ~\/.bashrc) and source it after (source ~\/.bashrc), so it can reflect in your current shell session.<\/p>\n\n\n\n<p>Create a work area for yourself and enter it:<br><code>mkdir workarea &amp;&amp; cd workarea<\/code><\/p>\n\n\n\n<p>We will use android14-6.1 (Pixel 7 \/ 8).<br><em>This was amended on 8\/29\/25.<\/em><br>You can get this information by unpacking the stock boot.img (boot-stock.img) with magiskboot and taking note of the linux version string:<br>magiskboot unpack boot-stock.img<br><code>strings kernel | grep -i 'linux version'<\/code><\/p>\n\n\n\n<p>&#8230;..<\/p>\n\n\n\n<p>Clone susfs4ksu:<br>Note: If you have done the previous tutorial(s), then: cd <code>susfs4ksu<\/code> &amp;&amp; git fetch origin <code>aosp-android14-6.1-dev<\/code> &amp;&amp; git checkout <code>aosp-android14-6.1-dev<\/code><br><code>git clone --depth 3 --no-tags<\/code> <code>https:\/\/gitlab.com\/pershoot\/susfs4ksu.git -b aosp-android14-6.1-dev<\/code><br><br><strong>Note<\/strong>: The repo&#8217;s branch in mention is set to patch against AOSP (kernel (which is GKI in the past)). For GKI and \/ or GKI-LTS, please see below (patching with susfs4ksu section).<br><em>This was amended on 8\/23\/25.<\/em><\/p>\n\n\n\n<p>Create the source folder for the repository and the destination directory for the build:<br>Note: If you&#8217;ve done the previous tutorial(s), then: rm -rf android-kernel\/*<br><code>mkdir aosp-kernel<br>mkdir android-kernel<\/code><\/p>\n\n\n\n<p>Pull down the repository:<br>Note: Use the branch designated for your device&#8217;s codename. Replace &#8216;lynx&#8217; (below) with it.<br><code>cd aosp-kernel<br>repo init -u https:\/\/android.googlesource.com\/kernel\/manifest -b android-gs-lynx-6.1-android16 --depth=3<br>repo sync -c --no-tags<br>cd ..<\/code><\/p>\n\n\n\n<p><strong>Note<\/strong>: If you want GKI &#8211;<br><em>This was amended on 8\/23\/25.<\/em><br>Note2: Use the branch designated for your device&#8217;s codename. Replace &#8216;lynx&#8217; (below) with it.<br>Note3: If you want to perform a synchronization, change back to the device codename&#8217;s branch (replace <em>CODENAME <\/em>with your device&#8217;s codename): cd aosp-kernel\/aosp &amp;&amp; git checkout <code>android-gs-<em>CODENAME<\/em>-6.1-android16<\/code> &amp;&amp; cd ..\/ &amp;&amp; repo sync -c &#8211;no-tags<br>Note4: If you want to synchronize GKI: git checkout <code>android14-6.1-2025-08<\/code> &amp;&amp; git pull &#8211;depth 3 &#8211;no-tags aosp <code>android14-6.1-2025-08<\/code><br>Note5: If you want to move to a new date, do to the below (change the date), then remove the previous from local tracking: git branch -D android14-6.1-2025-<em>MONTH<\/em><\/p>\n\n\n\n<p><br><code>cd aosp-kernel\/aosp<br>git fetch --depth 3 --no-tags aosp android14-6.1-2025-08<br>git checkout android-gs-lynx-6.1-android16<br>git checkout android14-6.1-2025-08<br>cd ..\/..\/<\/code><\/p>\n\n\n\n<p><strong>Note<\/strong>: If you want GKI-LTS &#8211;<br><em>This was amended on 8\/23\/25.<\/em><br>Note2: Use the branch designated for your device&#8217;s codename. Replace &#8216;lynx&#8217; (below) with it.<br>Note3: If you want to perform a synchronization, change back to the device codename&#8217;s branch (replace <em>CODENAME <\/em>with your device&#8217;s codename): cd aosp-kernel\/aosp &amp;&amp; git checkout <code>android-gs-<em>CODENAME<\/em>-6.1-android16<\/code> &amp;&amp; cd ..\/ &amp;&amp; repo sync -c &#8211;no-tags<br>Note4: Use the current date (2025-08 as of this writing) of development in the repository. You can also use the current development tag (i.e. append _rNUM (NUM = 1, 2, 3, etc.) to the DATE).<br>Note5: You can also use a tag instead of branch<br>Note6: If you want to synchronize GKI-LTS: git checkout <code><code>android14-6.1-lts<\/code><\/code> &amp;&amp; git pull &#8211;depth 3 &#8211;no-tags aosp <code><code>android14-6.1-lts<\/code><\/code><br><code>cd aosp-kernel\/aosp<br>git fetch --depth 3 --no-tags aosp android14-6.1-lts<br>git checkout android-gs-lynx-6.1-android16<br>git checkout android14-6.1-lts<br>cd ..\/..\/<\/code><\/p>\n\n\n\n<p>Create a mirror, which you will work against:<br><code>rsync -a --del aosp-kernel\/ aosp-14<\/code><\/p>\n\n\n\n<p>Copy SuSFS module and patches in:<br><em>This was amended on 8\/23\/25<\/em>, <em>8\/29\/25, 8\/30\/25<\/em>.<br><code>cd aosp-14<\/code><br><code>cp -p ..\/susfs4ksu\/kernel_patches\/fs\/* aosp\/fs<br>cp -p ..\/susfs4ksu\/kernel_patches\/include\/linux\/* aosp\/include\/linux<\/code><\/p>\n\n\n\n<p>If you want <strong>AOSP<\/strong>:<code><br>cp -p ..\/susfs4ksu\/kernel_patches\/50_add_susfs_in_gki-android14-6.1.patch aosp<\/code><\/p>\n\n\n\n<p>If you want <strong>GKI<\/strong>:<br><code>cp -p ..\/susfs4ksu\/kernel_patches\/50_add_susfs_in_gki-android14-6.1_GKI.patch aosp<\/code><\/p>\n\n\n\n<p>If you want <strong>GKI-LTS<\/strong>:<br><code>cp -p ..\/susfs4ksu\/kernel_patches\/50_add_susfs_in_gki-android14-6.1_GKI-LTS.patch aosp<\/code><\/p>\n\n\n\n<p><code><br>cp -p ..\/susfs4ksu\/kernel_patches\/60_scope-minimized_manual_hooks.patch aosp<\/code><br><code>cp -p ..\/susfs4ksu\/device_patches\/10_disable-prebuilt_build-aosp.patch private\/devices\/google\/common<\/code><\/p>\n\n\n\n<p>Patch:<br><em>This was amended on 8\/23\/25<\/em>, <em>8\/29\/25, 8\/30\/25<\/em>.<br><code>cd aosp<\/code><\/p>\n\n\n\n<p>If you want <strong>AOSP<\/strong>:<code><br>patch -p1 -ui 50_add_susfs_in_gki-android14-6.1.patch<\/code><\/p>\n\n\n\n<p>If you want <strong>GKI<\/strong>:<br><code>patch -p1 -ui 50_add_susfs_in_gki-android14-6.1_GKI.patch<\/code><\/p>\n\n\n\n<p>If you want <strong>GKI-LTS<\/strong>:<br><code>patch -p1 -ui 50_add_susfs_in_gki-android14-6.1_GKI-LTS.patch<\/code><\/p>\n\n\n\n<p><code><br>patch -p1 -ui 60_scope-minimized_manual_hooks.patch<br>cd ..\/private\/devices\/google\/common<br>patch -p1 -ui 10_disable-prebuilt_build-aosp.patch<br>cd ..\/..\/..\/..\/<\/code><\/p>\n\n\n\n<p>Pull down KernelSU-Next and execute setup:<br><code>curl -LSs \"https:\/\/raw.githubusercontent.com\/pershoot\/KernelSU-Next\/refs\/heads\/next-susfs\/kernel\/setup.sh\" | bash -s next-susfs<\/code><\/p>\n\n\n\n<p>Remove patches:<br><em>This was amended on 8\/23\/25, 8\/29\/25, 8\/30\/25<\/em>.<code><br>rm aosp\/50_add_susfs_in_gki-android14-6.1*.patch aosp\/60_scope-minimized_manual_hooks.patch private\/devices\/google\/common\/10_disable-prebuilt_build-aosp.patch<\/code><\/p>\n\n\n\n<p>Commit the changes in to your local repository:<br><code>cd aosp<br>git add -A<br>git commit -a -m \"Add KernelSU-Next-susfs\"<br>cd ..\/private\/devices\/google\/common<br>git add -A<br>git commit -a -m \"Disable prebuilt; build AOSP\"<br>cd ..\/..\/..\/..\/<\/code><\/p>\n\n\n\n<p>Build:<br>Note: concatenate (cat) the build_<em>CODENAME<\/em>.sh (replace <em>CODENAME <\/em>with your device&#8217;s codename) and replace &#8211;config=lynx and <code>lynx:gs201_lynx_dist<\/code> with what&#8217;s found in your designated file (below)<br><em>This was amended on 8\/29\/25<\/em>, <em>8\/30\/25<\/em>.<br><code>tools\/bazel run <\/code><code>--kernel_package=@\/\/aosp <code>--config=no_download_gki <\/code>--config=fast --config=stamp --config=lynx --lto=thin \/\/private\/devices\/google\/lynx:gs201_lynx_dist -- --dist_dir=..\/android-kernel<\/code><\/p>\n\n\n\n<p>Change in to the kernel output directory:<br><code>cd ..\/android-kernel<\/code><\/p>\n\n\n\n<p>Test your boot image (boot.img is found in android-kernel directory you are in):<br><code>adb reboot bootloader or vol down and power<br>fastboot boot boot.img<\/code><br><br>Note: Wi-Fi \/ BT will not work (it will, once you place the module(s) built with the same versioning on to the system).<\/p>\n\n\n\n<p>If all looks well (Pixel 7 \/ 8):<br><code>adb reboot bootloader<br>fastboot flash boot boot.img<br>fastboot flash dtbo dtbo.img<br>fastboot flash vendor_kernel_boot vendor_kernel_boot.img<br>fastboot reboot fastboot<br>fastboot flash vendor_dlkm vendor_dlkm.img<br>fastboot flash system_dlkm system_dlkm.img<br>fastboot reboot<\/code><\/p>\n\n\n\n<p>&#8230;..<\/p>\n\n\n\n<p>Install the latest <a href=\"https:\/\/github.com\/sidex15\/susfs4ksu-module\/releases\">susfs4ksu<\/a> module (<a href=\"https:\/\/github.com\/sidex15\">sidex15<\/a>) through the KernelSU-Next Manager.<\/p>\n\n\n\n<p>Enjoy!<\/p>\n\n\n\n<p>&#8230;..<\/p>\n\n\n\n<p>Sources:<br><a href=\"https:\/\/github.com\/pershoot\/KernelSU-Next\/tree\/next-susfs\">pershoot\/KernelSU-Next at next-susfs<\/a><br><a href=\"https:\/\/gitlab.com\/pershoot\/susfs4ksu\/-\/tree\/aosp-android14-6.1-dev\">pershoot\/susfs4ksu\/-\/tree\/aosp-android14-6.1-dev<\/a><br><a href=\"https:\/\/github.com\/KernelSU-Next\/KernelSU-Next\/\">KernelSU-Next\/KernelSU-Next: An advanced Kernel based root solution for Android<\/a><br><a href=\"https:\/\/gitlab.com\/simonpunk\/susfs4ksu\/-\/tree\/gki-android14-6.1\">simonpunk\/susfs4ksu\/-\/tree\/gki-android14-6.1<\/a><br><a href=\"https:\/\/github.com\/sidex15\/susfs4ksu-module\">sidex15\/susfs4ksu-module: An addon root hiding service for KernelSU<\/a><br><a href=\"https:\/\/github.com\/backslashxx\/KernelSU\">backslashxx\/KernelSU<\/a><br><a href=\"https:\/\/source.android.com\/docs\/setup\/build\/building-pixel-kernels\">build\/building-pixel-kernels<\/a><br><a href=\"https:\/\/chatgpt.com\/\">ChatGPT<\/a> to crawl repos \/ sanity checking \/ specific implementation assistance<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a tutorial to build KernelSU-Next (rifsxd) with SuSFS (simonpunk) integrated in to an AOSP, GKI (Generic Kernel Image) or GKI LTS (Generic Kernel Image; (Long Term Support)) kernel using AOSP. This is used to gain escalation on your mobile device. This tutorial will use Pixel 7a (Lynx) as an example (Pixel 7 \/ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[88],"class_list":["post-6639","post","type-post","status-publish","format-standard","hentry","category-android","tag-kernelsunext-susfs-aosp"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/posts\/6639","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/comments?post=6639"}],"version-history":[{"count":54,"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/posts\/6639\/revisions"}],"predecessor-version":[{"id":6724,"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/posts\/6639\/revisions\/6724"}],"wp:attachment":[{"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/media?parent=6639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/categories?post=6639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/tags?post=6639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}