{"id":6516,"date":"2025-07-22T22:56:08","date_gmt":"2025-07-23T02:56:08","guid":{"rendered":"https:\/\/droidbasement.com\/db-blog\/?p=6516"},"modified":"2025-09-25T17:28:56","modified_gmt":"2025-09-25T21:28:56","slug":"tutorial-kernelsu-next-with-susfs-integrated-in-to-a-gki-generic-kernel-image","status":"publish","type":"post","link":"https:\/\/droidbasement.com\/db-blog\/tutorial-kernelsu-next-with-susfs-integrated-in-to-a-gki-generic-kernel-image\/","title":{"rendered":"Tutorial &#8211; KernelSU-Next with SuSFS integrated in to a GKI (Generic Kernel Image)"},"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 a <a href=\"https:\/\/source.android.com\/docs\/core\/architecture\/kernel\/generic-kernel-image\">GKI<\/a> (Generic Kernel Image).  This is used to gain escalation on your mobile device.<\/p>\n\n\n\n<p>This tutorial will use Pixel 7a as an example (Pixel 6 \/ 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.2 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>Install curl (sudo apt-get -y install curl).<br><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><em>Note: As per Avo and urkiu, leaving it on, doesn&#8217;t appear to prevent you from booting and flashing (SPL is being modified).  However, antezero ran in to some odd issues which prevented proper back \/ forth updates and SweBow ran in to a no boot \/ crash situation, so it is advised to turn it off, which requires a one-time wipe.<\/em> <br><br>Grab the stock boot.img (referenced as boot-stock.img below) from the latest monthly update for your device in to the root of the workarea folder (see below) and name it boot-stock.img (<code>mv boot.img boot-stock.img<\/code>).<br><br>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).<br><br>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>&#8230;..<\/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 6 \/ 7 \/ 8).<br>You can get this information by unpacking the stock boot.img (see below) with magiskboot and taking note of the linux version string:<br><code>strings kernel | grep -i 'linux version'<\/code><\/p>\n\n\n\n<p>&#8230;..<\/p>\n\n\n\n<p>Grab manifest_<em>xxxxx<\/em>.xml from a Tagged build (click kernel under &#8216;kernel artifacts&#8217;):<br>https:\/\/source.android.com\/docs\/core\/architecture\/kernel\/gki-android14-6_1-release-builds<br>Note: Replace <em>xxxxx<\/em> with the actual number.<br><br>After you click on manifest_<em>xxxxx<\/em>.xml, right click &#8216;Download&#8217;, copy link:<br><code>curl -o manifest_<em>xxxxx<\/em>.xml \"<em>LINK<\/em>\"<\/code><br>Note: Replace <em>LINK<\/em> (inside the quotes; retain the quotes (due to special characters in the long link)) with the actual session based <em>URL \/ LINK<\/em> that was copied in to your buffer.<br><br>Clone susfs4ksu:<br>Note: 8\/15\/25: Added flag(s) for space reduction.<br>Note2: 8\/21\/25: Increase depth.<br><code>git clone --depth 3 --no-tags<\/code> <code>https:\/\/gitlab.com\/pershoot\/susfs4ksu.git -b gki-android14-6.1-dev<\/code><\/p>\n\n\n\n<p>Create the source folder for the repository and the destination directory for the build:<br><code>mkdir gki-kernel<br>mkdir android-kernel<\/code><\/p>\n\n\n\n<p>Pull down the repository (Note: Replace <em>xxxxx<\/em> with the actual number):<br>Note: 8\/15\/25: Added flag(s) for space reduction.<br>Note2: 8\/21\/25: Increase depth.<br><code>cd gki-kernel<br>repo init -u https:\/\/android.googlesource.com\/kernel\/manifest --depth=3<br>cp -p ..\/manifest_<em>xxxxx<\/em>.xml .repo\/manifests<br>repo init -m manifest_<em>xxxxx<\/em>.xml --depth=3<br>repo sync -c --no-tags<br>cd ..<\/code><br><br>Create a mirror, which you will work against:<br><code>rsync -a --del gki-kernel\/ gki-14<\/code><br><br>Copy SuSFS module and patches in:<br><code>cd gki-14<\/code><br><code>cp -p ..\/susfs4ksu\/kernel_patches\/fs\/* common\/fs<br>cp -p ..\/susfs4ksu\/kernel_patches\/include\/linux\/* common\/include\/linux<br>cp -p ..\/susfs4ksu\/kernel_patches\/50_add_susfs_in_gki-android14-6.1.patch common<br>cp -p ..\/susfs4ksu\/kernel_patches\/60_scope-minimized_manual_hooks.patch common<\/code><\/p>\n\n\n\n<p>Patch:<br>Note: 8\/15\/25: Use input and unified flag.<br><code>cd common<br>patch -p1 -ui 50_add_susfs_in_gki-android14-6.1.patch<br>patch -p1 -ui 60_scope-minimized_manual_hooks.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 protected exports (also the patches) so Wi-Fi and Bluetooth will function:<br><code>sed -i '\/^[[:space:]]*\"protected_exports_list\"[[:space:]]*:[[:space:]]*\"android\\\/abi_gki_protected_exports_aarch64\",$\/d' common\/BUILD.bazel<br>rm common\/android\/abi_gki_protected_exports_* common\/50_add_susfs_in_gki-android14-6.1.patch common\/60_scope-minimized_manual_hooks.patch<\/code><\/p>\n\n\n\n<p>Commit the changes in to your local repository:<br><code>cd common<br>git add -A<br>git commit -a -m \"Add KernelSU-Next-susfs\"<br>cd ..<\/code><\/p>\n\n\n\n<p>Build:<br><code>tools\/bazel run --config=fast --config=stamp --lto=thin \/\/common:kernel_aarch64_dist -- --dist_dir=..\/android-kernel<\/code><\/p>\n\n\n\n<p>Create a directory where you will use magiskboot to sort out SPL (Security Patch Level) using your stock image:<br>Note: If you have ~\/.bin in your PATH, then you do not have to put a preceding relative path.  The below assumes you followed the manual install of repo and put it in that same directory. <br><code>mkdir ..\/android-kernel\/kernel<br>cd ..\/android-kernel\/kernel<br>cp -p ..\/boot.img .<br>..\/..\/..\/.bin\/magiskboot unpack boot.img<br>..\/..\/..\/.bin\/magiskboot repack ..\/..\/boot-stock.img<\/code><br><\/p>\n\n\n\n<p>&#8230;..<\/p>\n\n\n\n<p><br>Test your boot image (new-boot.img is found in android-kernel\/kernel directory you are in):<br><code>adb reboot bootloader or vol down and power<br>fastboot boot new-boot.img<\/code><br><br>If all looks well:<br><code>adb reboot bootloader<br>fastboot flash boot new-boot.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\/gki-android14-6.1-dev\">pershoot\/susfs4ksu\/-\/tree\/gki-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><\/p>\n\n\n\n<p><br><\/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 a GKI (Generic Kernel Image). This is used to gain escalation on your mobile device. This tutorial will use Pixel 7a as an example (Pixel 6 \/ 7 \/ 8 \/ 9 can be used) and is geared towards using AVB [&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":[87,85,86],"class_list":["post-6516","post","type-post","status-publish","format-standard","hentry","category-android","tag-gki","tag-kernelsunext","tag-susfs"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/posts\/6516","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=6516"}],"version-history":[{"count":67,"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/posts\/6516\/revisions"}],"predecessor-version":[{"id":6723,"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/posts\/6516\/revisions\/6723"}],"wp:attachment":[{"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/media?parent=6516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/categories?post=6516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/droidbasement.com\/db-blog\/wp-json\/wp\/v2\/tags?post=6516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}