deploy: aa21385a36ce417863164a1bf4771b45387046a5

This commit is contained in:
tiann 2023-11-13 03:46:43 +00:00
parent 6c1524924f
commit 5905311bf9
332 changed files with 7929 additions and 4430 deletions

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
import{d as p,K as s,a2 as i,u,p as c,k as l,a3 as d,a4 as f,a5 as m,a6 as h,a7 as A,a8 as g,a9 as P,aa as v,ab as y,ac as C,ad as w,ae as _,af as b,ag as E}from"./chunks/framework.43781440.js";import{t as R}from"./chunks/theme.85c31bd3.js";function r(e){if(e.extends){const a=r(e.extends);return{...a,...e,async enhanceApp(t){a.enhanceApp&&await a.enhanceApp(t),e.enhanceApp&&await e.enhanceApp(t)}}}return e}const n=r(R),D=p({name:"VitePressApp",setup(){const{site:e}=u();return c(()=>{l(()=>{document.documentElement.lang=e.value.lang,document.documentElement.dir=e.value.dir})}),d(),f(),m(),n.setup&&n.setup(),()=>h(n.Layout)}});async function O(){const e=T(),a=S();a.provide(A,e);const t=g(e.route);return a.provide(P,t),a.component("Content",v),a.component("ClientOnly",y),Object.defineProperties(a.config.globalProperties,{$frontmatter:{get(){return t.frontmatter.value}},$params:{get(){return t.page.value.params}}}),n.enhanceApp&&await n.enhanceApp({app:a,router:e,siteData:C}),{app:a,router:e,data:t}}function S(){return w(D)}function T(){let e=s,a;return _(t=>{let o=b(t);return e&&(a=o),(e||a===o)&&(o=o.replace(/\.js$/,".lean.js")),s&&(e=!1),E(()=>import(o),[])},n.NotFound)}s&&O().then(({app:e,router:a,data:t})=>{a.go().then(()=>{i(a.route,t.site),e.mount("#app")})});export{O as createApp};

1
assets/app.a2c23f3d.js Normal file
View File

@ -0,0 +1 @@
import{s,a0 as i,a1 as u,a2 as c,a3 as l,a4 as d,a5 as f,a6 as m,a7 as h,a8 as A,a9 as g,aa as P,d as v,u as y,j as C,y as w,ab as _,ac as b,ad as E,ae as R}from"./chunks/framework.ec8f7e8e.js";import{t as D}from"./chunks/theme.4b73f3e8.js";function p(e){if(e.extends){const a=p(e.extends);return{...a,...e,async enhanceApp(t){a.enhanceApp&&await a.enhanceApp(t),e.enhanceApp&&await e.enhanceApp(t)}}}return e}const o=p(D),j=v({name:"VitePressApp",setup(){const{site:e}=y();return C(()=>{w(()=>{document.documentElement.lang=e.value.lang,document.documentElement.dir=e.value.dir})}),_(),b(),E(),o.setup&&o.setup(),()=>R(o.Layout)}});async function O(){const e=T(),a=S();a.provide(u,e);const t=c(e.route);return a.provide(l,t),a.component("Content",d),a.component("ClientOnly",f),Object.defineProperties(a.config.globalProperties,{$frontmatter:{get(){return t.frontmatter.value}},$params:{get(){return t.page.value.params}}}),o.enhanceApp&&await o.enhanceApp({app:a,router:e,siteData:m}),{app:a,router:e,data:t}}function S(){return h(j)}function T(){let e=s,a;return A(t=>{let n=g(t),r=null;return n&&(e&&(a=n),(e||a===n)&&(n=n.replace(/\.js$/,".lean.js")),r=P(()=>import(n),[])),s&&(e=!1),r},o.NotFound)}s&&O().then(({app:e,router:a,data:t})=>{a.go().then(()=>{i(a.route,t.site),e.mount("#app")})});export{O as createApp};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{_ as e,o as s,c as o,Q as a}from"./chunks/framework.ec8f7e8e.js";const E=JSON.parse('{"title":"App Profile","description":"","frontmatter":{},"headers":[],"relativePath":"guide/app-profile.md","filePath":"guide/app-profile.md"}'),n={name:"guide/app-profile.md"},t=a("",46),l=[t];function p(r,i,c,d,u,h){return s(),o("div",null,l)}const m=e(n,[["render",p]]);export{E as __pageData,m as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
import{_ as e,o,c as s,O as t}from"./chunks/framework.43781440.js";const f=JSON.parse('{"title":"App Profile","description":"","frontmatter":{},"headers":[],"relativePath":"guide/app-profile.md","filePath":"guide/app-profile.md"}'),a={name:"guide/app-profile.md"},n=t("",46),i=[n];function r(l,p,c,d,u,h){return o(),s("div",null,i)}const y=e(a,[["render",r]]);export{f as __pageData,y as default};

View File

@ -1 +1 @@
import{_ as e,o as i,c as t,O as o}from"./chunks/framework.43781440.js";const p=JSON.parse('{"title":"Difference with Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"guide/difference-with-magisk.md","filePath":"guide/difference-with-magisk.md"}'),a={name:"guide/difference-with-magisk.md"},s=o('<h1 id="difference-with-magisk" tabindex="-1">Difference with Magisk <a class="header-anchor" href="#difference-with-magisk" aria-label="Permalink to &quot;Difference with Magisk&quot;"></a></h1><p>Although there are many similarities between KernelSU modules and Magisk modules, there are inevitably some differences due to their completely different implementation mechanisms. If you want your module to run on both Magisk and KernelSU, you must understand these differences.</p><h2 id="similarities" tabindex="-1">Similarities <a class="header-anchor" href="#similarities" aria-label="Permalink to &quot;Similarities&quot;"></a></h2><ul><li>Module file format: both use zip format to organize modules, and the format of modules is almost the same</li><li>Module installation directory: both located in <code>/data/adb/modules</code></li><li>Systemless: both support modifying /system in a systemless way through modules</li><li>post-fs-data.sh: the execution time and semantics are exactly the same</li><li>service.sh: the execution time and semantics are exactly the same</li><li>system.prop: completely the same</li><li>sepolicy.rule: completely the same</li><li>BusyBox: scripts are run in BusyBox with &quot;standalone mode&quot; enabled in both cases</li></ul><h2 id="differences" tabindex="-1">Differences <a class="header-anchor" href="#differences" aria-label="Permalink to &quot;Differences&quot;"></a></h2><p>Before understanding the differences, you need to know how to differentiate whether your module is running in KernelSU or Magisk. You can use the environment variable <code>KSU</code> to differentiate it in all places where you can run module scripts (<code>customize.sh</code>, <code>post-fs-data.sh</code>, <code>service.sh</code>). In KernelSU, this environment variable will be set to <code>true</code>.</p><p>Here are some differences:</p><ul><li>KernelSU modules cannot be installed in Recovery mode.</li><li>KernelSU modules do not have built-in support for Zygisk (but you can use Zygisk modules through <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a>.</li><li>The method for replacing or deleting files in KernelSU modules is completely different from Magisk. KernelSU does not support the <code>.replace</code> method. Instead, you need to create a same-named file with <code>mknod filename c 0 0</code> to delete the corresponding file.</li><li>The directories for BusyBox are different. The built-in BusyBox in KernelSU is located in <code>/data/adb/ksu/bin/busybox</code>, while in Magisk it is in <code>/data/adb/magisk/busybox</code>. <strong>Note that this is an internal behavior of KernelSU and may change in the future!</strong></li><li>KernelSU does not support <code>.replace</code> files; however, KernelSU supports the <code>REMOVE</code> and <code>REPLACE</code> variable to remove or replace files and folders.</li><li>KernelSU adds <code>boot-completed</code> stage to run some scripts on boot completed.</li><li>KernelSU adds <code>post-mount</code> stage to run some scripts after mounting overlayfs</li></ul>',8),r=[s];function n(l,d,c,h,m,u){return i(),t("div",null,r)}const g=e(a,[["render",n]]);export{p as __pageData,g as default};
import{_ as e,o as i,c as t,Q as o}from"./chunks/framework.ec8f7e8e.js";const p=JSON.parse('{"title":"Difference with Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"guide/difference-with-magisk.md","filePath":"guide/difference-with-magisk.md"}'),a={name:"guide/difference-with-magisk.md"},s=o('<h1 id="difference-with-magisk" tabindex="-1">Difference with Magisk <a class="header-anchor" href="#difference-with-magisk" aria-label="Permalink to &quot;Difference with Magisk&quot;"></a></h1><p>Although there are many similarities between KernelSU modules and Magisk modules, there are inevitably some differences due to their completely different implementation mechanisms. If you want your module to run on both Magisk and KernelSU, you must understand these differences.</p><h2 id="similarities" tabindex="-1">Similarities <a class="header-anchor" href="#similarities" aria-label="Permalink to &quot;Similarities&quot;"></a></h2><ul><li>Module file format: both use zip format to organize modules, and the format of modules is almost the same</li><li>Module installation directory: both located in <code>/data/adb/modules</code></li><li>Systemless: both support modifying /system in a systemless way through modules</li><li>post-fs-data.sh: the execution time and semantics are exactly the same</li><li>service.sh: the execution time and semantics are exactly the same</li><li>system.prop: completely the same</li><li>sepolicy.rule: completely the same</li><li>BusyBox: scripts are run in BusyBox with &quot;standalone mode&quot; enabled in both cases</li></ul><h2 id="differences" tabindex="-1">Differences <a class="header-anchor" href="#differences" aria-label="Permalink to &quot;Differences&quot;"></a></h2><p>Before understanding the differences, you need to know how to differentiate whether your module is running in KernelSU or Magisk. You can use the environment variable <code>KSU</code> to differentiate it in all places where you can run module scripts (<code>customize.sh</code>, <code>post-fs-data.sh</code>, <code>service.sh</code>). In KernelSU, this environment variable will be set to <code>true</code>.</p><p>Here are some differences:</p><ul><li>KernelSU modules cannot be installed in Recovery mode.</li><li>KernelSU modules do not have built-in support for Zygisk (but you can use Zygisk modules through <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a>.</li><li>The method for replacing or deleting files in KernelSU modules is completely different from Magisk. KernelSU does not support the <code>.replace</code> method. Instead, you need to create a same-named file with <code>mknod filename c 0 0</code> to delete the corresponding file.</li><li>The directories for BusyBox are different. The built-in BusyBox in KernelSU is located in <code>/data/adb/ksu/bin/busybox</code>, while in Magisk it is in <code>/data/adb/magisk/busybox</code>. <strong>Note that this is an internal behavior of KernelSU and may change in the future!</strong></li><li>KernelSU does not support <code>.replace</code> files; however, KernelSU supports the <code>REMOVE</code> and <code>REPLACE</code> variable to remove or replace files and folders.</li><li>KernelSU adds <code>boot-completed</code> stage to run some scripts on boot completed.</li><li>KernelSU adds <code>post-mount</code> stage to run some scripts after mounting overlayfs</li></ul>',8),r=[s];function n(l,d,c,h,m,u){return i(),t("div",null,r)}const g=e(a,[["render",n]]);export{p as __pageData,g as default};

View File

@ -1 +1 @@
import{_ as e,o as i,c as t,O as o}from"./chunks/framework.43781440.js";const p=JSON.parse('{"title":"Difference with Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"guide/difference-with-magisk.md","filePath":"guide/difference-with-magisk.md"}'),a={name:"guide/difference-with-magisk.md"},s=o("",8),r=[s];function n(l,d,c,h,m,u){return i(),t("div",null,r)}const g=e(a,[["render",n]]);export{p as __pageData,g as default};
import{_ as e,o as i,c as t,Q as o}from"./chunks/framework.ec8f7e8e.js";const p=JSON.parse('{"title":"Difference with Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"guide/difference-with-magisk.md","filePath":"guide/difference-with-magisk.md"}'),a={name:"guide/difference-with-magisk.md"},s=o("",8),r=[s];function n(l,d,c,h,m,u){return i(),t("div",null,r)}const g=e(a,[["render",n]]);export{p as __pageData,g as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{_ as e,o,c as a,O as t}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"FAQ","description":"","frontmatter":{},"headers":[],"relativePath":"guide/faq.md","filePath":"guide/faq.md"}'),r={name:"guide/faq.md"},n=t("",33),s=[n];function i(l,d,u,h,c,p){return o(),a("div",null,s)}const b=e(r,[["render",i]]);export{m as __pageData,b as default};
import{_ as e,o,c as a,Q as t}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"FAQ","description":"","frontmatter":{},"headers":[],"relativePath":"guide/faq.md","filePath":"guide/faq.md"}'),r={name:"guide/faq.md"},n=t("",33),s=[n];function i(l,d,u,h,c,p){return o(),a("div",null,s)}const b=e(r,[["render",i]]);export{m as __pageData,b as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as t,O as d}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"Hidden Features","description":"","frontmatter":{},"headers":[],"relativePath":"guide/hidden-features.md","filePath":"guide/hidden-features.md"}'),s={name:"guide/hidden-features.md"},r=d('<h1 id="hidden-features" tabindex="-1">Hidden Features <a class="header-anchor" href="#hidden-features" aria-label="Permalink to &quot;Hidden Features&quot;"></a></h1><h2 id="ksurc" tabindex="-1">.ksurc <a class="header-anchor" href="#ksurc" aria-label="Permalink to &quot;.ksurc&quot;"></a></h2><p>By default, <code>/system/bin/sh</code> loads <code>/system/etc/mkshrc</code>.</p><p>You can make su load customized rc file by creating a <code>/data/adb/ksu/.ksurc</code> file.</p>',4),c=[r];function o(i,n,u,_,h,l){return a(),t("div",null,c)}const p=e(s,[["render",o]]);export{m as __pageData,p as default};
import{_ as e,o as a,c as t,Q as d}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"Hidden Features","description":"","frontmatter":{},"headers":[],"relativePath":"guide/hidden-features.md","filePath":"guide/hidden-features.md"}'),s={name:"guide/hidden-features.md"},r=d('<h1 id="hidden-features" tabindex="-1">Hidden Features <a class="header-anchor" href="#hidden-features" aria-label="Permalink to &quot;Hidden Features&quot;"></a></h1><h2 id="ksurc" tabindex="-1">.ksurc <a class="header-anchor" href="#ksurc" aria-label="Permalink to &quot;.ksurc&quot;"></a></h2><p>By default, <code>/system/bin/sh</code> loads <code>/system/etc/mkshrc</code>.</p><p>You can make su load customized rc file by creating a <code>/data/adb/ksu/.ksurc</code> file.</p>',4),c=[r];function o(i,n,u,_,h,l){return a(),t("div",null,c)}const p=e(s,[["render",o]]);export{m as __pageData,p as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as t,O as d}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"Hidden Features","description":"","frontmatter":{},"headers":[],"relativePath":"guide/hidden-features.md","filePath":"guide/hidden-features.md"}'),s={name:"guide/hidden-features.md"},r=d("",4),c=[r];function o(i,n,u,_,h,l){return a(),t("div",null,c)}const p=e(s,[["render",o]]);export{m as __pageData,p as default};
import{_ as e,o as a,c as t,Q as d}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"Hidden Features","description":"","frontmatter":{},"headers":[],"relativePath":"guide/hidden-features.md","filePath":"guide/hidden-features.md"}'),s={name:"guide/hidden-features.md"},r=d("",4),c=[r];function o(i,n,u,_,h,l){return a(),t("div",null,c)}const p=e(s,[["render",o]]);export{m as __pageData,p as default};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{_ as s,o as a,c as e,Q as l}from"./chunks/framework.ec8f7e8e.js";const E=JSON.parse('{"title":"How to build KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"guide/how-to-build.md","filePath":"guide/how-to-build.md"}'),n={name:"guide/how-to-build.md"},o=l("",24),p=[o];function t(r,c,i,d,y,u){return a(),e("div",null,p)}const F=s(n,[["render",t]]);export{E as __pageData,F as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
import{_ as s,o as e,c as a,O as l}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"How to build KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"guide/how-to-build.md","filePath":"guide/how-to-build.md"}'),n={name:"guide/how-to-build.md"},o=l("",24),t=[o];function r(p,c,i,d,u,h){return e(),a("div",null,t)}const D=s(n,[["render",r]]);export{y as __pageData,D as default};

View File

@ -1,152 +0,0 @@
import{_ as s,o as n,c as a,O as e}from"./chunks/framework.43781440.js";const A=JSON.parse('{"title":"How to integrate KernelSU for non GKI kernels?","description":"","frontmatter":{},"headers":[],"relativePath":"guide/how-to-integrate-for-non-gki.md","filePath":"guide/how-to-integrate-for-non-gki.md"}'),l={name:"guide/how-to-integrate-for-non-gki.md"},p=e(`<h1 id="how-to-integrate-kernelsu-for-non-gki-kernels" tabindex="-1">How to integrate KernelSU for non GKI kernels? <a class="header-anchor" href="#how-to-integrate-kernelsu-for-non-gki-kernels" aria-label="Permalink to &quot;How to integrate KernelSU for non GKI kernels?&quot;"></a></h1><p>KernelSU can be integrated into non GKI kernels, and was backported to 4.14 and below.</p><p>Due to the fragmentization of non GKI kernels, we do not have a uniform way to build it, so we can not provide non GKI boot images. But you can build the kernel yourself with KernelSU integrated.</p><p>First, you should be able to build a bootable kernel from kernel source code. If the kernel is not open source, then it is difficult to run KernelSU for your device.</p><p>If you can build a bootable kernel, there are two ways to integrate KernelSU to the kernel source code:</p><ol><li>Automatically with <code>kprobe</code></li><li>Manually</li></ol><h2 id="integrate-with-kprobe" tabindex="-1">Integrate with kprobe <a class="header-anchor" href="#integrate-with-kprobe" aria-label="Permalink to &quot;Integrate with kprobe&quot;"></a></h2><p>KernelSU uses kprobe to do kernel hooks, if the <em>kprobe</em> runs well in your kernel, it is recommended to use this way.</p><p>First, add KernelSU to your kernel source tree:</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-</span></span></code></pre></div><p>Then, you should check if <em>kprobe</em> is enabled in your kernel config, if it is not, please add these configs to it:</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">CONFIG_KPROBES=y</span></span>
<span class="line"><span style="color:#A6ACCD;">CONFIG_HAVE_KPROBES=y</span></span>
<span class="line"><span style="color:#A6ACCD;">CONFIG_KPROBE_EVENTS=y</span></span></code></pre></div><p>And build your kernel again, KernelSU should works well.</p><p>If you find that KPROBES is still not activated, you can try enabling <code>CONFIG_MODULES</code>. (If it still doesn&#39;t take effect, use <code>make menuconfig</code> to search for other dependencies of KPROBES)</p><p>But if you encounter a boot loop when integrated KernelSU, it is maybe <em>kprobe is broken in your kernel</em>, you should fix the kprobe bug or use the second way.</p><div class="tip custom-block"><p class="custom-block-title">How to check if kprobe is broken</p><p>comment out <code>ksu_enable_sucompat()</code> and <code>ksu_enable_ksud()</code> in <code>KernelSU/kernel/ksu.c</code>, if the device boots normally, then kprobe may be broken.</p></div><h2 id="manually-modify-the-kernel-source" tabindex="-1">Manually modify the kernel source <a class="header-anchor" href="#manually-modify-the-kernel-source" aria-label="Permalink to &quot;Manually modify the kernel source&quot;"></a></h2><p>If kprobe does not work in your kernel (may be an upstream or kernel bug below 4.8), then you can try this way:</p><p>First, add KernelSU to your kernel source tree:</p><ul><li>Latest tag(stable)</li></ul><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-</span></span></code></pre></div><ul><li>main branch(dev)</li></ul><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">main</span></span></code></pre></div><ul><li>Select tag(Such as v0.5.2)</li></ul><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">v0.5.2</span></span></code></pre></div><p>Then, add KernelSU calls to the kernel source, here is a patch to refer:</p><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/fs/exec.c b/fs/exec.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index ac59664eaecf..bdd585e1d2cc 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/exec.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/exec.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -1890,11 +1890,14 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> static int __do_execve_file(int fd, struct filename *filename,</span></span>
<span class="line"><span style="color:#A6ACCD;"> return retval;</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern bool ksu_execveat_hook __read_mostly;</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> void *envp, int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> void *argv, void *envp, int *flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> static int do_execveat_common(int fd, struct filename *filename,</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct user_arg_ptr argv,</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct user_arg_ptr envp,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int flags)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> if (unlikely(ksu_execveat_hook))</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_execveat(&amp;fd, &amp;filename, &amp;argv, &amp;envp, &amp;flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> else</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_execveat_sucompat(&amp;fd, &amp;filename, &amp;argv, &amp;envp, &amp;flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> return __do_execve_file(fd, filename, argv, envp, flags, NULL);</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">diff --git a/fs/open.c b/fs/open.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 05036d819197..965b84d486b8 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -348,6 +348,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)</span></span>
<span class="line"><span style="color:#A6ACCD;"> return ksys_fallocate(fd, mode, offset, len);</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> int *flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> /*</span></span>
<span class="line"><span style="color:#A6ACCD;"> * access() needs to use the real uid/gid, not the effective uid/gid.</span></span>
<span class="line"><span style="color:#A6ACCD;"> * We do this by temporarily clearing all FS-related capabilities and</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -355,6 +357,7 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)</span></span>
<span class="line"><span style="color:#A6ACCD;"> */</span></span>
<span class="line"><span style="color:#A6ACCD;"> long do_faccessat(int dfd, const char __user *filename, int mode)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_faccessat(&amp;dfd, &amp;filename, &amp;mode, NULL);</span></span>
<span class="line"><span style="color:#A6ACCD;"> const struct cred *old_cred;</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct cred *override_cred;</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct path path;</span></span>
<span class="line"><span style="color:#A6ACCD;">diff --git a/fs/read_write.c b/fs/read_write.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 650fc7e0f3a6..55be193913b6 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/read_write.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/read_write.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -434,10 +434,14 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> EXPORT_SYMBOL(kernel_read);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern bool ksu_vfs_read_hook __read_mostly;</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> size_t *count_ptr, loff_t **pos);</span></span>
<span class="line"><span style="color:#A6ACCD;"> ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#A6ACCD;"> ssize_t ret;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> if (unlikely(ksu_vfs_read_hook))</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_vfs_read(&amp;file, &amp;buf, &amp;count, &amp;pos);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> if (!(file-&gt;f_mode &amp; FMODE_READ))</span></span>
<span class="line"><span style="color:#A6ACCD;"> return -EBADF;</span></span>
<span class="line"><span style="color:#A6ACCD;"> if (!(file-&gt;f_mode &amp; FMODE_CAN_READ))</span></span>
<span class="line"><span style="color:#A6ACCD;">diff --git a/fs/stat.c b/fs/stat.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 376543199b5a..82adcef03ecc 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -148,6 +148,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_statx_fd(unsigned int fd, struct kstat *stat,</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> EXPORT_SYMBOL(vfs_statx_fd);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> /**</span></span>
<span class="line"><span style="color:#A6ACCD;"> * vfs_statx - Get basic and extra attributes by filename</span></span>
<span class="line"><span style="color:#A6ACCD;"> * @dfd: A file descriptor representing the base dir for a relative filename</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -170,6 +172,7 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_statx(int dfd, const char __user *filename, int flags,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int error = -EINVAL;</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_stat(&amp;dfd, &amp;filename, &amp;flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> if ((flags &amp; ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |</span></span>
<span class="line"><span style="color:#A6ACCD;"> AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0)</span></span>
<span class="line"><span style="color:#A6ACCD;"> return -EINVAL;</span></span></code></pre></div><p>You should find the four functions in kernel source:</p><ol><li>do_faccessat, usually in <code>fs/open.c</code></li><li>do_execveat_common, usually in <code>fs/exec.c</code></li><li>vfs_read, usually in <code>fs/read_write.c</code></li><li>vfs_statx, usually in <code>fs/stat.c</code></li></ol><p>If your kernel does not have the <code>vfs_statx</code>, use <code>vfs_fstatat</code> instead:</p><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/fs/stat.c b/fs/stat.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 068fdbcc9e26..5348b7bb9db2 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -87,6 +87,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_fstat(unsigned int fd, struct kstat *stat)</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> EXPORT_SYMBOL(vfs_fstat);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int flag)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -94,6 +96,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int error = -EINVAL;</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int lookup_flags = 0;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_stat(&amp;dfd, &amp;filename, &amp;flag);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> if ((flag &amp; ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |</span></span>
<span class="line"><span style="color:#A6ACCD;"> AT_EMPTY_PATH)) != 0)</span></span>
<span class="line"><span style="color:#A6ACCD;"> goto out;</span></span></code></pre></div><p>For kernels eariler than 4.17, if you cannot find <code>do_faccessat</code>, just go to the definition of the <code>faccessat</code> syscall and place the call there:</p><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/fs/open.c b/fs/open.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 2ff887661237..e758d7db7663 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -355,6 +355,9 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)</span></span>
<span class="line"><span style="color:#A6ACCD;"> return error;</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> /*</span></span>
<span class="line"><span style="color:#A6ACCD;"> * access() needs to use the real uid/gid, not the effective uid/gid.</span></span>
<span class="line"><span style="color:#A6ACCD;"> * We do this by temporarily clearing all FS-related capabilities and</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -370,6 +373,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)</span></span>
<span class="line"><span style="color:#A6ACCD;"> int res;</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int lookup_flags = LOOKUP_FOLLOW;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_faccessat(&amp;dfd, &amp;filename, &amp;mode, NULL);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> if (mode &amp; ~S_IRWXO) /* where&#39;s F_OK, X_OK, W_OK, R_OK? */</span></span>
<span class="line"><span style="color:#A6ACCD;"> return -EINVAL;</span></span></code></pre></div><p>To enable KernelSU&#39;s builtin SafeMode, You should also modify <code>input_handle_event</code> in <code>drivers/input/input.c</code>:</p><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>It is strongly recommended to enable this feature, it is very helpful to prevent bootloops!</p></div><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/drivers/input/input.c b/drivers/input/input.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 45306f9ef247..815091ebfca4 100755</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/drivers/input/input.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/drivers/input/input.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -367,10 +367,13 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> static int input_get_disposition(struct input_dev *dev,</span></span>
<span class="line"><span style="color:#A6ACCD;"> return disposition;</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern bool ksu_input_hook __read_mostly;</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code, int *value);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> static void input_handle_event(struct input_dev *dev,</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int type, unsigned int code, int value)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#A6ACCD;"> int disposition = input_get_disposition(dev, type, code, &amp;value);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> if (unlikely(ksu_input_hook))</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_input_handle_event(&amp;type, &amp;code, &amp;value);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> if (disposition != INPUT_IGNORE_EVENT &amp;&amp; type != EV_SYN)</span></span>
<span class="line"><span style="color:#A6ACCD;"> add_input_randomness(type, code, value);</span></span></code></pre></div><p>Finally, build your kernel again, KernelSU should work well.</p>`,37),o=[p];function t(c,r,i,C,y,D){return n(),a("div",null,o)}const f=s(l,[["render",t]]);export{A as __pageData,f as default};

View File

@ -1 +0,0 @@
import{_ as s,o as n,c as a,O as e}from"./chunks/framework.43781440.js";const A=JSON.parse('{"title":"How to integrate KernelSU for non GKI kernels?","description":"","frontmatter":{},"headers":[],"relativePath":"guide/how-to-integrate-for-non-gki.md","filePath":"guide/how-to-integrate-for-non-gki.md"}'),l={name:"guide/how-to-integrate-for-non-gki.md"},p=e("",37),o=[p];function t(c,r,i,C,y,D){return n(),a("div",null,o)}const f=s(l,[["render",t]]);export{A as __pageData,f as default};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{_ as s,o as n,c as a,Q as e}from"./chunks/framework.ec8f7e8e.js";const u=JSON.parse('{"title":"How to integrate KernelSU for non GKI kernels?","description":"","frontmatter":{},"headers":[],"relativePath":"guide/how-to-integrate-for-non-gki.md","filePath":"guide/how-to-integrate-for-non-gki.md"}'),l={name:"guide/how-to-integrate-for-non-gki.md"},p=e("",37),t=[p];function o(c,i,r,d,E,f){return n(),a("div",null,t)}const _=s(l,[["render",o]]);export{u as __pageData,_ as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{_ as e,o,c as t,O as a}from"./chunks/framework.43781440.js";const b=JSON.parse('{"title":"Installation","description":"","frontmatter":{},"headers":[],"relativePath":"guide/installation.md","filePath":"guide/installation.md"}'),i={name:"guide/installation.md"},r=a("",63),s=[r];function l(n,d,c,h,p,u){return o(),t("div",null,s)}const g=e(i,[["render",l]]);export{b as __pageData,g as default};
import{_ as e,o,c as a,Q as t}from"./chunks/framework.ec8f7e8e.js";const b=JSON.parse('{"title":"Installation","description":"","frontmatter":{},"headers":[],"relativePath":"guide/installation.md","filePath":"guide/installation.md"}'),i={name:"guide/installation.md"},s=t("",63),l=[s];function n(r,c,d,h,p,u){return o(),a("div",null,l)}const g=e(i,[["render",n]]);export{b as __pageData,g as default};

View File

@ -1 +0,0 @@
import{_ as e,o as s,c as o,O as a}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"Module guides","description":"","frontmatter":{},"headers":[],"relativePath":"guide/module.md","filePath":"guide/module.md"}'),t={name:"guide/module.md"},n=a("",58),l=[n];function i(r,c,p,d,u,h){return s(),o("div",null,l)}const f=e(t,[["render",i]]);export{y as __pageData,f as default};

View File

@ -1,83 +1,165 @@
import{_ as e,o as s,c as o,O as a}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"Module guides","description":"","frontmatter":{},"headers":[],"relativePath":"guide/module.md","filePath":"guide/module.md"}'),t={name:"guide/module.md"},n=a(`<h1 id="module-guides" tabindex="-1">Module guides <a class="header-anchor" href="#module-guides" aria-label="Permalink to &quot;Module guides&quot;"></a></h1><p>KernelSU provides a module mechanism that achieves the effect of modifying the system directory while maintaining the integrity of the system partition. This mechanism is commonly known as &quot;systemless&quot;.</p><p>The module mechanism of KernelSU is almost the same as that of Magisk. If you are familiar with Magisk module development, developing KernelSU modules is very similar. You can skip the introduction of modules below and only need to read <a href="./difference-with-magisk.html">difference-with-magisk</a>.</p><h2 id="busybox" tabindex="-1">Busybox <a class="header-anchor" href="#busybox" aria-label="Permalink to &quot;Busybox&quot;"></a></h2><p>KernelSU ships with a feature complete BusyBox binary (including full SELinux support). The executable is located at <code>/data/adb/ksu/bin/busybox</code>. KernelSU&#39;s BusyBox supports runtime toggle-able &quot;ASH Standalone Shell Mode&quot;. What this standalone mode means is that when running in the <code>ash</code> shell of BusyBox, every single command will directly use the applet within BusyBox, regardless of what is set as <code>PATH</code>. For example, commands like <code>ls</code>, <code>rm</code>, <code>chmod</code> will <strong>NOT</strong> use what is in <code>PATH</code> (in the case of Android by default it will be <code>/system/bin/ls</code>, <code>/system/bin/rm</code>, and <code>/system/bin/chmod</code> respectively), but will instead directly call internal BusyBox applets. This makes sure that scripts always run in a predictable environment and always have the full suite of commands no matter which Android version it is running on. To force a command <em>not</em> to use BusyBox, you have to call the executable with full paths.</p><p>Every single shell script running in the context of KernelSU will be executed in BusyBox&#39;s <code>ash</code> shell with standalone mode enabled. For what is relevant to 3rd party developers, this includes all boot scripts and module installation scripts.</p><p>For those who want to use this &quot;Standalone Mode&quot; feature outside of KernelSU, there are 2 ways to enable it:</p><ol><li>Set environment variable <code>ASH_STANDALONE</code> to <code>1</code><br>Example: <code>ASH_STANDALONE=1 /data/adb/ksu/bin/busybox sh &lt;script&gt;</code></li><li>Toggle with command-line options:<br><code>/data/adb/ksu/bin/busybox sh -o standalone &lt;script&gt;</code></li></ol><p>To make sure all subsequent <code>sh</code> shell executed also runs in standalone mode, option 1 is the preferred method (and this is what KernelSU and the KernelSU manager internally use) as environment variables are inherited down to child processes.</p><div class="tip custom-block"><p class="custom-block-title">difference with Magisk</p><p>KernelSU&#39;s BusyBox is now using the binary file compiled directly from the Magisk project. <strong>Thanks to Magisk!</strong> Therefore, you don&#39;t have to worry about compatibility issues between BusyBox scripts in Magisk and KernelSU because they are exactly the same!</p></div><h2 id="kernelsu-modules" tabindex="-1">KernelSU modules <a class="header-anchor" href="#kernelsu-modules" aria-label="Permalink to &quot;KernelSU modules&quot;"></a></h2><p>A KernelSU module is a folder placed in <code>/data/adb/modules</code> with the structure below:</p><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">/data/adb/modules</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;">|</span></span>
<span class="line"><span style="color:#A6ACCD;"> $MODID &lt;--- The folder is named with the ID of the module</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Module Identity ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> module.prop &lt;--- This file stores the metadata of the module</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Main Contents ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> system &lt;--- This folder will be mounted if skip_mount does not exist</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Status Flags ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> skip_mount &lt;--- If exists, KernelSU will NOT mount your system folder</span></span>
<span class="line"><span style="color:#A6ACCD;"> disable &lt;--- If exists, the module will be disabled</span></span>
<span class="line"><span style="color:#A6ACCD;"> remove &lt;--- If exists, the module will be removed next reboot</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Optional Files ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> post-fs-data.sh &lt;--- This script will be executed in post-fs-data</span></span>
<span class="line"><span style="color:#A6ACCD;"> post-mount.sh &lt;--- This script will be executed in post-mount</span></span>
<span class="line"><span style="color:#A6ACCD;"> service.sh &lt;--- This script will be executed in late_start service</span></span>
<span class="line"><span style="color:#A6ACCD;"> boot-completed.sh &lt;--- This script will be executed on boot completed</span></span>
<span class="line"><span style="color:#A6ACCD;">| uninstall.sh &lt;--- This script will be executed when KernelSU removes your module</span></span>
<span class="line"><span style="color:#A6ACCD;"> system.prop &lt;--- Properties in this file will be loaded as system properties by resetprop</span></span>
<span class="line"><span style="color:#A6ACCD;"> sepolicy.rule &lt;--- Additional custom sepolicy rules</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Auto Generated, DO NOT MANUALLY CREATE OR MODIFY ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> vendor &lt;--- A symlink to $MODID/system/vendor</span></span>
<span class="line"><span style="color:#A6ACCD;"> product &lt;--- A symlink to $MODID/system/product</span></span>
<span class="line"><span style="color:#A6ACCD;"> system_ext &lt;--- A symlink to $MODID/system/system_ext</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Any additional files / folders are allowed ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;">|</span></span>
<span class="line"><span style="color:#A6ACCD;"> another_module</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">difference with Magisk</p><p>KernelSU does not have built-in support for Zygisk, so there is no content related to Zygisk in the module. However, you can use <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a> to support Zygisk modules. In this case, the content of the Zygisk module is identical to that supported by Magisk.</p></div><h3 id="module-prop" tabindex="-1">module.prop <a class="header-anchor" href="#module-prop" aria-label="Permalink to &quot;module.prop&quot;"></a></h3><p>module.prop is a configuration file for a module. In KernelSU, if a module does not contain this file, it will not be recognized as a module. The format of this file is as follows:</p><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">id=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">name=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">version=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">versionCode=&lt;int&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">author=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">description=&lt;string&gt;</span></span></code></pre></div><ul><li><code>id</code> has to match this regular expression: <code>^[a-zA-Z][a-zA-Z0-9._-]+$</code><br> ex: <code>a_module</code>, <code>a.module</code>, <code>module-101</code>, <code>a module</code>, <code>1_module</code>, <code>-a-module</code><br> This is the <strong>unique identifier</strong> of your module. You should not change it once published.</li><li><code>versionCode</code> has to be an <strong>integer</strong>. This is used to compare versions</li><li>Others that weren&#39;t mentioned above can be any <strong>single line</strong> string.</li><li>Make sure to use the <code>UNIX (LF)</code> line break type and not the <code>Windows (CR+LF)</code> or <code>Macintosh (CR)</code>.</li></ul><h3 id="shell-scripts" tabindex="-1">Shell scripts <a class="header-anchor" href="#shell-scripts" aria-label="Permalink to &quot;Shell scripts&quot;"></a></h3><p>Please read the <a href="#boot-scripts">Boot Scripts</a> section to understand the difference between <code>post-fs-data.sh</code> and <code>service.sh</code>. For most module developers, <code>service.sh</code> should be good enough if you just need to run a boot script, if you need to run the script after boot completed, please use <code>boot-completed.sh</code>. If you want to do something after mounting overlayfs, please use <code>post-mount.sh</code>.</p><p>In all scripts of your module, please use <code>MODDIR=\${0%/*}</code> to get your module&#39;s base directory path; do <strong>NOT</strong> hardcode your module path in scripts.</p><div class="tip custom-block"><p class="custom-block-title">difference with Magisk</p><p>You can use the environment variable KSU to determine if a script is running in KernelSU or Magisk. If running in KernelSU, this value will be set to true.</p></div><h3 id="system-directory" tabindex="-1"><code>system</code> directory <a class="header-anchor" href="#system-directory" aria-label="Permalink to &quot;\`system\` directory&quot;"></a></h3><p>The contents of this directory will be overlaid on top of the system&#39;s /system partition using overlayfs after the system is booted. This means that:</p><ol><li>Files with the same name as those in the corresponding directory in the system will be overwritten by the files in this directory.</li><li>Folders with the same name as those in the corresponding directory in the system will be merged with the folders in this directory.</li></ol><p>If you want to delete a file or folder in the original system directory, you need to create a file with the same name as the file/folder in the module directory using <code>mknod filename c 0 0</code>. This way, the overlayfs system will automatically &quot;whiteout&quot; this file as if it has been deleted (the /system partition is not actually changed).</p><p>You can also declare a variable named <code>REMOVE</code> containing a list of directories in <code>customize.sh</code> to execute removal operations, and KernelSU will automatically execute <code>mknod &lt;TARGET&gt; c 0 0</code> in the corresponding directories of the module. For example:</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">REMOVE</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span></span>
<span class="line"><span style="color:#C3E88D;">/system/app/YouTube</span></span>
<span class="line"><span style="color:#C3E88D;">/system/app/Bloatware</span></span>
<span class="line"><span style="color:#89DDFF;">&quot;</span></span></code></pre></div><p>The above list will execute <code>mknod $MODPATH/system/app/YouTuBe c 0 0</code> and <code>mknod $MODPATH/system/app/Bloatware c 0 0</code>; and <code>/system/app/YouTube</code> and <code>/system/app/Bloatware</code> will be removed after the module takes effect.</p><p>If you want to replace a directory in the system, you need to create a directory with the same path in your module directory, and then set the attribute <code>setfattr -n trusted.overlay.opaque -v y &lt;TARGET&gt;</code> for this directory. This way, the overlayfs system will automatically replace the corresponding directory in the system (without changing the /system partition).</p><p>You can declare a variable named <code>REPLACE</code> in your <code>customize.sh</code> file, which includes a list of directories to be replaced, and KernelSU will automatically perform the corresponding operations in your module directory. For example:</p><p>REPLACE=&quot; /system/app/YouTube /system/app/Bloatware &quot;</p><p>This list will automatically create the directories <code>$MODPATH/system/app/YouTube</code> and <code>$MODPATH/system/app/Bloatware</code>, and then execute <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/YouTube</code> and <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/Bloatware</code>. After the module takes effect, <code>/system/app/YouTube</code> and <code>/system/app/Bloatware</code> will be replaced with empty directories.</p><div class="tip custom-block"><p class="custom-block-title">difference with Magisk</p><p>KernelSU&#39;s systemless mechanism is implemented through the kernel&#39;s overlayfs, while Magisk currently uses magic mount (bind mount). The two implementation methods have significant differences, but the ultimate goal is the same: to modify /system files without physically modifying the /system partition.</p></div><p>If you are interested in overlayfs, it is recommended to read the Linux Kernel&#39;s <a href="https://docs.kernel.org/filesystems/overlayfs.html" target="_blank" rel="noreferrer">documentation on overlayfs</a>.</p><h3 id="system-prop" tabindex="-1">system.prop <a class="header-anchor" href="#system-prop" aria-label="Permalink to &quot;system.prop&quot;"></a></h3><p>This file follows the same format as <code>build.prop</code>. Each line comprises of <code>[key]=[value]</code>.</p><h3 id="sepolicy-rule" tabindex="-1">sepolicy.rule <a class="header-anchor" href="#sepolicy-rule" aria-label="Permalink to &quot;sepolicy.rule&quot;"></a></h3><p>If your module requires some additional sepolicy patches, please add those rules into this file. Each line in this file will be treated as a policy statement.</p><h2 id="module-installer" tabindex="-1">Module installer <a class="header-anchor" href="#module-installer" aria-label="Permalink to &quot;Module installer&quot;"></a></h2><p>A KernelSU module installer is a KernelSU module packaged in a zip file that can be flashed in the KernelSU manager APP. The simplest KernelSU module installer is just a KernelSU module packed as a zip file.</p><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">module.zip</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> customize.sh &lt;--- (Optional, more details later)</span></span>
<span class="line"><span style="color:#A6ACCD;"> This script will be sourced by update-binary</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ... /* The rest of module&#39;s files */</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span></code></pre></div><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>KernelSU module is NOT supported to be installed in custom recovery!!</p></div><h3 id="customization" tabindex="-1">Customization <a class="header-anchor" href="#customization" aria-label="Permalink to &quot;Customization&quot;"></a></h3><p>If you need to customize the module installation process, optionally you can create a script in the installer named <code>customize.sh</code>. This script will be <em>sourced</em> (not executed!) by the module installer script after all files are extracted and default permissions and secontext are applied. This is very useful if your module require additional setup based on the device ABI, or you need to set special permissions/secontext for some of your module files.</p><p>If you would like to fully control and customize the installation process, declare <code>SKIPUNZIP=1</code> in <code>customize.sh</code> to skip all default installation steps. By doing so, your <code>customize.sh</code> will be responsible to install everything by itself.</p><p>The <code>customize.sh</code> script runs in KernelSU&#39;s BusyBox <code>ash</code> shell with &quot;Standalone Mode&quot; enabled. The following variables and functions are available:</p><h4 id="variables" tabindex="-1">Variables <a class="header-anchor" href="#variables" aria-label="Permalink to &quot;Variables&quot;"></a></h4><ul><li><code>KSU</code> (bool): a variable to mark that the script is running in the KernelSU environment, and the value of this variable will always be true. You can use it to distinguish between KernelSU and Magisk.</li><li><code>KSU_VER</code> (string): the version string of current installed KernelSU (e.g. <code>v0.4.0</code>)</li><li><code>KSU_VER_CODE</code> (int): the version code of current installed KernelSU in userspace (e.g. <code>10672</code>)</li><li><code>KSU_KERNEL_VER_CODE</code> (int): the version code of current installed KernelSU in kernel space (e.g. <code>10672</code>)</li><li><code>BOOTMODE</code> (bool): always be <code>true</code> in KernelSU</li><li><code>MODPATH</code> (path): the path where your module files should be installed</li><li><code>TMPDIR</code> (path): a place where you can temporarily store files</li><li><code>ZIPFILE</code> (path): your module&#39;s installation zip</li><li><code>ARCH</code> (string): the CPU architecture of the device. Value is either <code>arm</code>, <code>arm64</code>, <code>x86</code>, or <code>x64</code></li><li><code>IS64BIT</code> (bool): <code>true</code> if <code>$ARCH</code> is either <code>arm64</code> or <code>x64</code></li><li><code>API</code> (int): the API level (Android version) of the device (e.g. <code>23</code> for Android 6.0)</li></ul><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>In KernelSU, MAGISK_VER_CODE is always 25200 and MAGISK_VER is always v25.2. Please do not use these two variables to determine whether it is running on KernelSU or not.</p></div><h4 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to &quot;Functions&quot;"></a></h4><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">ui_print &lt;msg&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;"> print &lt;msg&gt; to console</span></span>
<span class="line"><span style="color:#A6ACCD;"> Avoid using &#39;echo&#39; as it will not display in custom recovery&#39;s console</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">abort &lt;msg&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;"> print error message &lt;msg&gt; to console and terminate the installation</span></span>
<span class="line"><span style="color:#A6ACCD;"> Avoid using &#39;exit&#39; as it will skip the termination cleanup steps</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">set_perm &lt;target&gt; &lt;owner&gt; &lt;group&gt; &lt;permission&gt; [context]</span></span>
<span class="line"><span style="color:#A6ACCD;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#A6ACCD;"> this function is a shorthand for the following commands:</span></span>
<span class="line"><span style="color:#A6ACCD;"> chown owner.group target</span></span>
<span class="line"><span style="color:#A6ACCD;"> chmod permission target</span></span>
<span class="line"><span style="color:#A6ACCD;"> chcon context target</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">set_perm_recursive &lt;directory&gt; &lt;owner&gt; &lt;group&gt; &lt;dirpermission&gt; &lt;filepermission&gt; [context]</span></span>
<span class="line"><span style="color:#A6ACCD;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#A6ACCD;"> for all files in &lt;directory&gt;, it will call:</span></span>
<span class="line"><span style="color:#A6ACCD;"> set_perm file owner group filepermission context</span></span>
<span class="line"><span style="color:#A6ACCD;"> for all directories in &lt;directory&gt; (including itself), it will call:</span></span>
<span class="line"><span style="color:#A6ACCD;"> set_perm dir owner group dirpermission context</span></span></code></pre></div><h2 id="boot-scripts" tabindex="-1">Boot scripts <a class="header-anchor" href="#boot-scripts" aria-label="Permalink to &quot;Boot scripts&quot;"></a></h2><p>In KernelSU, scripts are divided into two types based on their running mode: post-fs-data mode and late_start service mode:</p><ul><li>post-fs-data mode <ul><li>This stage is BLOCKING. The boot process is paused before execution is done, or 10 seconds have passed.</li><li>Scripts run before any modules are mounted. This allows a module developer to dynamically adjust their modules before it gets mounted.</li><li>This stage happens before Zygote is started, which pretty much means everything in Android</li><li><strong>WARNING:</strong> using <code>setprop</code> will deadlock the boot process! Please use <code>resetprop -n &lt;prop_name&gt; &lt;prop_value&gt;</code> instead.</li><li><strong>Only run scripts in this mode if necessary.</strong></li></ul></li><li>late_start service mode <ul><li>This stage is NON-BLOCKING. Your script runs in parallel with the rest of the booting process.</li><li><strong>This is the recommended stage to run most scripts.</strong></li></ul></li></ul><p>In KernelSU, startup scripts are divided into two types based on their storage location: general scripts and module scripts:</p><ul><li>General Scripts <ul><li>Placed in <code>/data/adb/post-fs-data.d</code>, <code>/data/adb/service.d</code>, <code>/data/adb/post-mount.d</code> or <code>/data/adb/boot-completed.d</code></li><li>Only executed if the script is set as executable (<code>chmod +x script.sh</code>)</li><li>Scripts in <code>post-fs-data.d</code> runs in post-fs-data mode, and scripts in <code>service.d</code> runs in late_start service mode.</li><li>Modules should <strong>NOT</strong> add general scripts during installation</li></ul></li><li>Module Scripts <ul><li>Placed in the module&#39;s own folder</li><li>Only executed if the module is enabled</li><li><code>post-fs-data.sh</code> runs in post-fs-data mode, <code>service.sh</code> runs in late_start service mode, <code>boot-completed.sh</code> runs on boot completed, <code>post-mount.sh</code> runs on overlayfs mounted.</li></ul></li></ul><p>All boot scripts will run in KernelSU&#39;s BusyBox <code>ash</code> shell with &quot;Standalone Mode&quot; enabled.</p>`,58),l=[n];function i(r,c,p,d,u,h){return s(),o("div",null,l)}const f=e(t,[["render",i]]);export{y as __pageData,f as default};
import{_ as e,o as s,c as n,Q as a}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"Module guides","description":"","frontmatter":{},"headers":[],"relativePath":"guide/module.md","filePath":"guide/module.md"}'),l={name:"guide/module.md"},o=a(`<h1 id="module-guides" tabindex="-1">Module guides <a class="header-anchor" href="#module-guides" aria-label="Permalink to &quot;Module guides&quot;"></a></h1><p>KernelSU provides a module mechanism that achieves the effect of modifying the system directory while maintaining the integrity of the system partition. This mechanism is commonly known as &quot;systemless&quot;.</p><p>The module mechanism of KernelSU is almost the same as that of Magisk. If you are familiar with Magisk module development, developing KernelSU modules is very similar. You can skip the introduction of modules below and only need to read <a href="./difference-with-magisk.html">difference-with-magisk</a>.</p><h2 id="busybox" tabindex="-1">Busybox <a class="header-anchor" href="#busybox" aria-label="Permalink to &quot;Busybox&quot;"></a></h2><p>KernelSU ships with a feature complete BusyBox binary (including full SELinux support). The executable is located at <code>/data/adb/ksu/bin/busybox</code>. KernelSU&#39;s BusyBox supports runtime toggle-able &quot;ASH Standalone Shell Mode&quot;. What this standalone mode means is that when running in the <code>ash</code> shell of BusyBox, every single command will directly use the applet within BusyBox, regardless of what is set as <code>PATH</code>. For example, commands like <code>ls</code>, <code>rm</code>, <code>chmod</code> will <strong>NOT</strong> use what is in <code>PATH</code> (in the case of Android by default it will be <code>/system/bin/ls</code>, <code>/system/bin/rm</code>, and <code>/system/bin/chmod</code> respectively), but will instead directly call internal BusyBox applets. This makes sure that scripts always run in a predictable environment and always have the full suite of commands no matter which Android version it is running on. To force a command <em>not</em> to use BusyBox, you have to call the executable with full paths.</p><p>Every single shell script running in the context of KernelSU will be executed in BusyBox&#39;s <code>ash</code> shell with standalone mode enabled. For what is relevant to 3rd party developers, this includes all boot scripts and module installation scripts.</p><p>For those who want to use this &quot;Standalone Mode&quot; feature outside of KernelSU, there are 2 ways to enable it:</p><ol><li>Set environment variable <code>ASH_STANDALONE</code> to <code>1</code><br>Example: <code>ASH_STANDALONE=1 /data/adb/ksu/bin/busybox sh &lt;script&gt;</code></li><li>Toggle with command-line options:<br><code>/data/adb/ksu/bin/busybox sh -o standalone &lt;script&gt;</code></li></ol><p>To make sure all subsequent <code>sh</code> shell executed also runs in standalone mode, option 1 is the preferred method (and this is what KernelSU and the KernelSU manager internally use) as environment variables are inherited down to child processes.</p><div class="tip custom-block"><p class="custom-block-title">difference with Magisk</p><p>KernelSU&#39;s BusyBox is now using the binary file compiled directly from the Magisk project. <strong>Thanks to Magisk!</strong> Therefore, you don&#39;t have to worry about compatibility issues between BusyBox scripts in Magisk and KernelSU because they are exactly the same!</p></div><h2 id="kernelsu-modules" tabindex="-1">KernelSU modules <a class="header-anchor" href="#kernelsu-modules" aria-label="Permalink to &quot;KernelSU modules&quot;"></a></h2><p>A KernelSU module is a folder placed in <code>/data/adb/modules</code> with the structure below:</p><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">/data/adb/modules</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;">|</span></span>
<span class="line"><span style="color:#e1e4e8;"> $MODID &lt;--- The folder is named with the ID of the module</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Module Identity ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> module.prop &lt;--- This file stores the metadata of the module</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Main Contents ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> system &lt;--- This folder will be mounted if skip_mount does not exist</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Status Flags ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> skip_mount &lt;--- If exists, KernelSU will NOT mount your system folder</span></span>
<span class="line"><span style="color:#e1e4e8;"> disable &lt;--- If exists, the module will be disabled</span></span>
<span class="line"><span style="color:#e1e4e8;"> remove &lt;--- If exists, the module will be removed next reboot</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Optional Files ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> post-fs-data.sh &lt;--- This script will be executed in post-fs-data</span></span>
<span class="line"><span style="color:#e1e4e8;"> post-mount.sh &lt;--- This script will be executed in post-mount</span></span>
<span class="line"><span style="color:#e1e4e8;"> service.sh &lt;--- This script will be executed in late_start service</span></span>
<span class="line"><span style="color:#e1e4e8;"> boot-completed.sh &lt;--- This script will be executed on boot completed</span></span>
<span class="line"><span style="color:#e1e4e8;">| uninstall.sh &lt;--- This script will be executed when KernelSU removes your module</span></span>
<span class="line"><span style="color:#e1e4e8;"> system.prop &lt;--- Properties in this file will be loaded as system properties by resetprop</span></span>
<span class="line"><span style="color:#e1e4e8;"> sepolicy.rule &lt;--- Additional custom sepolicy rules</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Auto Generated, DO NOT MANUALLY CREATE OR MODIFY ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> vendor &lt;--- A symlink to $MODID/system/vendor</span></span>
<span class="line"><span style="color:#e1e4e8;"> product &lt;--- A symlink to $MODID/system/product</span></span>
<span class="line"><span style="color:#e1e4e8;"> system_ext &lt;--- A symlink to $MODID/system/system_ext</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Any additional files / folders are allowed ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;">|</span></span>
<span class="line"><span style="color:#e1e4e8;"> another_module</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">/data/adb/modules</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;">|</span></span>
<span class="line"><span style="color:#24292e;"> $MODID &lt;--- The folder is named with the ID of the module</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Module Identity ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> module.prop &lt;--- This file stores the metadata of the module</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Main Contents ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> system &lt;--- This folder will be mounted if skip_mount does not exist</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Status Flags ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> skip_mount &lt;--- If exists, KernelSU will NOT mount your system folder</span></span>
<span class="line"><span style="color:#24292e;"> disable &lt;--- If exists, the module will be disabled</span></span>
<span class="line"><span style="color:#24292e;"> remove &lt;--- If exists, the module will be removed next reboot</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Optional Files ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> post-fs-data.sh &lt;--- This script will be executed in post-fs-data</span></span>
<span class="line"><span style="color:#24292e;"> post-mount.sh &lt;--- This script will be executed in post-mount</span></span>
<span class="line"><span style="color:#24292e;"> service.sh &lt;--- This script will be executed in late_start service</span></span>
<span class="line"><span style="color:#24292e;"> boot-completed.sh &lt;--- This script will be executed on boot completed</span></span>
<span class="line"><span style="color:#24292e;">| uninstall.sh &lt;--- This script will be executed when KernelSU removes your module</span></span>
<span class="line"><span style="color:#24292e;"> system.prop &lt;--- Properties in this file will be loaded as system properties by resetprop</span></span>
<span class="line"><span style="color:#24292e;"> sepolicy.rule &lt;--- Additional custom sepolicy rules</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Auto Generated, DO NOT MANUALLY CREATE OR MODIFY ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> vendor &lt;--- A symlink to $MODID/system/vendor</span></span>
<span class="line"><span style="color:#24292e;"> product &lt;--- A symlink to $MODID/system/product</span></span>
<span class="line"><span style="color:#24292e;"> system_ext &lt;--- A symlink to $MODID/system/system_ext</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Any additional files / folders are allowed ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;">|</span></span>
<span class="line"><span style="color:#24292e;"> another_module</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">difference with Magisk</p><p>KernelSU does not have built-in support for Zygisk, so there is no content related to Zygisk in the module. However, you can use <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a> to support Zygisk modules. In this case, the content of the Zygisk module is identical to that supported by Magisk.</p></div><h3 id="module-prop" tabindex="-1">module.prop <a class="header-anchor" href="#module-prop" aria-label="Permalink to &quot;module.prop&quot;"></a></h3><p>module.prop is a configuration file for a module. In KernelSU, if a module does not contain this file, it will not be recognized as a module. The format of this file is as follows:</p><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">id=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">name=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">version=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">versionCode=&lt;int&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">author=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">description=&lt;string&gt;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">id=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">name=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">version=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">versionCode=&lt;int&gt;</span></span>
<span class="line"><span style="color:#24292e;">author=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">description=&lt;string&gt;</span></span></code></pre></div><ul><li><code>id</code> has to match this regular expression: <code>^[a-zA-Z][a-zA-Z0-9._-]+$</code><br> ex: <code>a_module</code>, <code>a.module</code>, <code>module-101</code>, <code>a module</code>, <code>1_module</code>, <code>-a-module</code><br> This is the <strong>unique identifier</strong> of your module. You should not change it once published.</li><li><code>versionCode</code> has to be an <strong>integer</strong>. This is used to compare versions</li><li>Others that weren&#39;t mentioned above can be any <strong>single line</strong> string.</li><li>Make sure to use the <code>UNIX (LF)</code> line break type and not the <code>Windows (CR+LF)</code> or <code>Macintosh (CR)</code>.</li></ul><h3 id="shell-scripts" tabindex="-1">Shell scripts <a class="header-anchor" href="#shell-scripts" aria-label="Permalink to &quot;Shell scripts&quot;"></a></h3><p>Please read the <a href="#boot-scripts">Boot Scripts</a> section to understand the difference between <code>post-fs-data.sh</code> and <code>service.sh</code>. For most module developers, <code>service.sh</code> should be good enough if you just need to run a boot script, if you need to run the script after boot completed, please use <code>boot-completed.sh</code>. If you want to do something after mounting overlayfs, please use <code>post-mount.sh</code>.</p><p>In all scripts of your module, please use <code>MODDIR=\${0%/*}</code> to get your module&#39;s base directory path; do <strong>NOT</strong> hardcode your module path in scripts.</p><div class="tip custom-block"><p class="custom-block-title">difference with Magisk</p><p>You can use the environment variable KSU to determine if a script is running in KernelSU or Magisk. If running in KernelSU, this value will be set to true.</p></div><h3 id="system-directory" tabindex="-1"><code>system</code> directory <a class="header-anchor" href="#system-directory" aria-label="Permalink to &quot;\`system\` directory&quot;"></a></h3><p>The contents of this directory will be overlaid on top of the system&#39;s /system partition using overlayfs after the system is booted. This means that:</p><ol><li>Files with the same name as those in the corresponding directory in the system will be overwritten by the files in this directory.</li><li>Folders with the same name as those in the corresponding directory in the system will be merged with the folders in this directory.</li></ol><p>If you want to delete a file or folder in the original system directory, you need to create a file with the same name as the file/folder in the module directory using <code>mknod filename c 0 0</code>. This way, the overlayfs system will automatically &quot;whiteout&quot; this file as if it has been deleted (the /system partition is not actually changed).</p><p>You can also declare a variable named <code>REMOVE</code> containing a list of directories in <code>customize.sh</code> to execute removal operations, and KernelSU will automatically execute <code>mknod &lt;TARGET&gt; c 0 0</code> in the corresponding directories of the module. For example:</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">REMOVE</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;</span></span>
<span class="line"><span style="color:#9ECBFF;">/system/app/YouTube</span></span>
<span class="line"><span style="color:#9ECBFF;">/system/app/Bloatware</span></span>
<span class="line"><span style="color:#9ECBFF;">&quot;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">REMOVE</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;</span></span>
<span class="line"><span style="color:#032F62;">/system/app/YouTube</span></span>
<span class="line"><span style="color:#032F62;">/system/app/Bloatware</span></span>
<span class="line"><span style="color:#032F62;">&quot;</span></span></code></pre></div><p>The above list will execute <code>mknod $MODPATH/system/app/YouTuBe c 0 0</code> and <code>mknod $MODPATH/system/app/Bloatware c 0 0</code>; and <code>/system/app/YouTube</code> and <code>/system/app/Bloatware</code> will be removed after the module takes effect.</p><p>If you want to replace a directory in the system, you need to create a directory with the same path in your module directory, and then set the attribute <code>setfattr -n trusted.overlay.opaque -v y &lt;TARGET&gt;</code> for this directory. This way, the overlayfs system will automatically replace the corresponding directory in the system (without changing the /system partition).</p><p>You can declare a variable named <code>REPLACE</code> in your <code>customize.sh</code> file, which includes a list of directories to be replaced, and KernelSU will automatically perform the corresponding operations in your module directory. For example:</p><p>REPLACE=&quot; /system/app/YouTube /system/app/Bloatware &quot;</p><p>This list will automatically create the directories <code>$MODPATH/system/app/YouTube</code> and <code>$MODPATH/system/app/Bloatware</code>, and then execute <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/YouTube</code> and <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/Bloatware</code>. After the module takes effect, <code>/system/app/YouTube</code> and <code>/system/app/Bloatware</code> will be replaced with empty directories.</p><div class="tip custom-block"><p class="custom-block-title">difference with Magisk</p><p>KernelSU&#39;s systemless mechanism is implemented through the kernel&#39;s overlayfs, while Magisk currently uses magic mount (bind mount). The two implementation methods have significant differences, but the ultimate goal is the same: to modify /system files without physically modifying the /system partition.</p></div><p>If you are interested in overlayfs, it is recommended to read the Linux Kernel&#39;s <a href="https://docs.kernel.org/filesystems/overlayfs.html" target="_blank" rel="noreferrer">documentation on overlayfs</a>.</p><h3 id="system-prop" tabindex="-1">system.prop <a class="header-anchor" href="#system-prop" aria-label="Permalink to &quot;system.prop&quot;"></a></h3><p>This file follows the same format as <code>build.prop</code>. Each line comprises of <code>[key]=[value]</code>.</p><h3 id="sepolicy-rule" tabindex="-1">sepolicy.rule <a class="header-anchor" href="#sepolicy-rule" aria-label="Permalink to &quot;sepolicy.rule&quot;"></a></h3><p>If your module requires some additional sepolicy patches, please add those rules into this file. Each line in this file will be treated as a policy statement.</p><h2 id="module-installer" tabindex="-1">Module installer <a class="header-anchor" href="#module-installer" aria-label="Permalink to &quot;Module installer&quot;"></a></h2><p>A KernelSU module installer is a KernelSU module packaged in a zip file that can be flashed in the KernelSU manager APP. The simplest KernelSU module installer is just a KernelSU module packed as a zip file.</p><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">module.zip</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;"> customize.sh &lt;--- (Optional, more details later)</span></span>
<span class="line"><span style="color:#e1e4e8;"> This script will be sourced by update-binary</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ... /* The rest of module&#39;s files */</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">module.zip</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;"> customize.sh &lt;--- (Optional, more details later)</span></span>
<span class="line"><span style="color:#24292e;"> This script will be sourced by update-binary</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ... /* The rest of module&#39;s files */</span></span>
<span class="line"><span style="color:#24292e;"></span></span></code></pre></div><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>KernelSU module is NOT supported to be installed in custom recovery!!</p></div><h3 id="customization" tabindex="-1">Customization <a class="header-anchor" href="#customization" aria-label="Permalink to &quot;Customization&quot;"></a></h3><p>If you need to customize the module installation process, optionally you can create a script in the installer named <code>customize.sh</code>. This script will be <em>sourced</em> (not executed!) by the module installer script after all files are extracted and default permissions and secontext are applied. This is very useful if your module require additional setup based on the device ABI, or you need to set special permissions/secontext for some of your module files.</p><p>If you would like to fully control and customize the installation process, declare <code>SKIPUNZIP=1</code> in <code>customize.sh</code> to skip all default installation steps. By doing so, your <code>customize.sh</code> will be responsible to install everything by itself.</p><p>The <code>customize.sh</code> script runs in KernelSU&#39;s BusyBox <code>ash</code> shell with &quot;Standalone Mode&quot; enabled. The following variables and functions are available:</p><h4 id="variables" tabindex="-1">Variables <a class="header-anchor" href="#variables" aria-label="Permalink to &quot;Variables&quot;"></a></h4><ul><li><code>KSU</code> (bool): a variable to mark that the script is running in the KernelSU environment, and the value of this variable will always be true. You can use it to distinguish between KernelSU and Magisk.</li><li><code>KSU_VER</code> (string): the version string of current installed KernelSU (e.g. <code>v0.4.0</code>)</li><li><code>KSU_VER_CODE</code> (int): the version code of current installed KernelSU in userspace (e.g. <code>10672</code>)</li><li><code>KSU_KERNEL_VER_CODE</code> (int): the version code of current installed KernelSU in kernel space (e.g. <code>10672</code>)</li><li><code>BOOTMODE</code> (bool): always be <code>true</code> in KernelSU</li><li><code>MODPATH</code> (path): the path where your module files should be installed</li><li><code>TMPDIR</code> (path): a place where you can temporarily store files</li><li><code>ZIPFILE</code> (path): your module&#39;s installation zip</li><li><code>ARCH</code> (string): the CPU architecture of the device. Value is either <code>arm</code>, <code>arm64</code>, <code>x86</code>, or <code>x64</code></li><li><code>IS64BIT</code> (bool): <code>true</code> if <code>$ARCH</code> is either <code>arm64</code> or <code>x64</code></li><li><code>API</code> (int): the API level (Android version) of the device (e.g. <code>23</code> for Android 6.0)</li></ul><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>In KernelSU, MAGISK_VER_CODE is always 25200 and MAGISK_VER is always v25.2. Please do not use these two variables to determine whether it is running on KernelSU or not.</p></div><h4 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to &quot;Functions&quot;"></a></h4><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">ui_print &lt;msg&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;"> print &lt;msg&gt; to console</span></span>
<span class="line"><span style="color:#e1e4e8;"> Avoid using &#39;echo&#39; as it will not display in custom recovery&#39;s console</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">abort &lt;msg&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;"> print error message &lt;msg&gt; to console and terminate the installation</span></span>
<span class="line"><span style="color:#e1e4e8;"> Avoid using &#39;exit&#39; as it will skip the termination cleanup steps</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">set_perm &lt;target&gt; &lt;owner&gt; &lt;group&gt; &lt;permission&gt; [context]</span></span>
<span class="line"><span style="color:#e1e4e8;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#e1e4e8;"> this function is a shorthand for the following commands:</span></span>
<span class="line"><span style="color:#e1e4e8;"> chown owner.group target</span></span>
<span class="line"><span style="color:#e1e4e8;"> chmod permission target</span></span>
<span class="line"><span style="color:#e1e4e8;"> chcon context target</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">set_perm_recursive &lt;directory&gt; &lt;owner&gt; &lt;group&gt; &lt;dirpermission&gt; &lt;filepermission&gt; [context]</span></span>
<span class="line"><span style="color:#e1e4e8;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#e1e4e8;"> for all files in &lt;directory&gt;, it will call:</span></span>
<span class="line"><span style="color:#e1e4e8;"> set_perm file owner group filepermission context</span></span>
<span class="line"><span style="color:#e1e4e8;"> for all directories in &lt;directory&gt; (including itself), it will call:</span></span>
<span class="line"><span style="color:#e1e4e8;"> set_perm dir owner group dirpermission context</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">ui_print &lt;msg&gt;</span></span>
<span class="line"><span style="color:#24292e;"> print &lt;msg&gt; to console</span></span>
<span class="line"><span style="color:#24292e;"> Avoid using &#39;echo&#39; as it will not display in custom recovery&#39;s console</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">abort &lt;msg&gt;</span></span>
<span class="line"><span style="color:#24292e;"> print error message &lt;msg&gt; to console and terminate the installation</span></span>
<span class="line"><span style="color:#24292e;"> Avoid using &#39;exit&#39; as it will skip the termination cleanup steps</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">set_perm &lt;target&gt; &lt;owner&gt; &lt;group&gt; &lt;permission&gt; [context]</span></span>
<span class="line"><span style="color:#24292e;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#24292e;"> this function is a shorthand for the following commands:</span></span>
<span class="line"><span style="color:#24292e;"> chown owner.group target</span></span>
<span class="line"><span style="color:#24292e;"> chmod permission target</span></span>
<span class="line"><span style="color:#24292e;"> chcon context target</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">set_perm_recursive &lt;directory&gt; &lt;owner&gt; &lt;group&gt; &lt;dirpermission&gt; &lt;filepermission&gt; [context]</span></span>
<span class="line"><span style="color:#24292e;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#24292e;"> for all files in &lt;directory&gt;, it will call:</span></span>
<span class="line"><span style="color:#24292e;"> set_perm file owner group filepermission context</span></span>
<span class="line"><span style="color:#24292e;"> for all directories in &lt;directory&gt; (including itself), it will call:</span></span>
<span class="line"><span style="color:#24292e;"> set_perm dir owner group dirpermission context</span></span></code></pre></div><h2 id="boot-scripts" tabindex="-1">Boot scripts <a class="header-anchor" href="#boot-scripts" aria-label="Permalink to &quot;Boot scripts&quot;"></a></h2><p>In KernelSU, scripts are divided into two types based on their running mode: post-fs-data mode and late_start service mode:</p><ul><li>post-fs-data mode <ul><li>This stage is BLOCKING. The boot process is paused before execution is done, or 10 seconds have passed.</li><li>Scripts run before any modules are mounted. This allows a module developer to dynamically adjust their modules before it gets mounted.</li><li>This stage happens before Zygote is started, which pretty much means everything in Android</li><li><strong>WARNING:</strong> using <code>setprop</code> will deadlock the boot process! Please use <code>resetprop -n &lt;prop_name&gt; &lt;prop_value&gt;</code> instead.</li><li><strong>Only run scripts in this mode if necessary.</strong></li></ul></li><li>late_start service mode <ul><li>This stage is NON-BLOCKING. Your script runs in parallel with the rest of the booting process.</li><li><strong>This is the recommended stage to run most scripts.</strong></li></ul></li></ul><p>In KernelSU, startup scripts are divided into two types based on their storage location: general scripts and module scripts:</p><ul><li>General Scripts <ul><li>Placed in <code>/data/adb/post-fs-data.d</code>, <code>/data/adb/service.d</code>, <code>/data/adb/post-mount.d</code> or <code>/data/adb/boot-completed.d</code></li><li>Only executed if the script is set as executable (<code>chmod +x script.sh</code>)</li><li>Scripts in <code>post-fs-data.d</code> runs in post-fs-data mode, and scripts in <code>service.d</code> runs in late_start service mode.</li><li>Modules should <strong>NOT</strong> add general scripts during installation</li></ul></li><li>Module Scripts <ul><li>Placed in the module&#39;s own folder</li><li>Only executed if the module is enabled</li><li><code>post-fs-data.sh</code> runs in post-fs-data mode, <code>service.sh</code> runs in late_start service mode, <code>boot-completed.sh</code> runs on boot completed, <code>post-mount.sh</code> runs on overlayfs mounted.</li></ul></li></ul><p>All boot scripts will run in KernelSU&#39;s BusyBox <code>ash</code> shell with &quot;Standalone Mode&quot; enabled.</p>`,58),t=[o];function i(p,c,r,d,u,h){return s(),n("div",null,t)}const g=e(l,[["render",i]]);export{m as __pageData,g as default};

View File

@ -0,0 +1 @@
import{_ as e,o as s,c as n,Q as a}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"Module guides","description":"","frontmatter":{},"headers":[],"relativePath":"guide/module.md","filePath":"guide/module.md"}'),l={name:"guide/module.md"},o=a("",58),t=[o];function i(p,c,r,d,u,h){return s(),n("div",null,t)}const g=e(l,[["render",i]]);export{m as __pageData,g as default};

View File

@ -1 +1 @@
import{_ as e,o,c as t,O as a}from"./chunks/framework.43781440.js";const p=JSON.parse('{"title":"Rescue from bootloop","description":"","frontmatter":{},"headers":[],"relativePath":"guide/rescue-from-bootloop.md","filePath":"guide/rescue-from-bootloop.md"}'),s={name:"guide/rescue-from-bootloop.md"},i=a("",23),r=[i];function l(n,u,d,h,c,m){return o(),t("div",null,r)}const f=e(s,[["render",l]]);export{p as __pageData,f as default};
import{_ as e,o,c as t,Q as a}from"./chunks/framework.ec8f7e8e.js";const p=JSON.parse('{"title":"Rescue from bootloop","description":"","frontmatter":{},"headers":[],"relativePath":"guide/rescue-from-bootloop.md","filePath":"guide/rescue-from-bootloop.md"}'),s={name:"guide/rescue-from-bootloop.md"},i=a("",23),r=[i];function l(n,u,d,h,c,m){return o(),t("div",null,r)}const f=e(s,[["render",l]]);export{p as __pageData,f as default};

View File

@ -1 +1 @@
import{d as n}from"./chunks/repos.9a031e32.js";import{o as i,c as r,z as e,F as s,L as o,b as l,O as c,t as a}from"./chunks/framework.43781440.js";const d=c('<h1 id="unofficially-supported-devices" tabindex="-1">Unofficially Supported Devices <a class="header-anchor" href="#unofficially-supported-devices" aria-label="Permalink to &quot;Unofficially Supported Devices&quot;"></a></h1><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>In this page, there are kernels for non-GKI devices supporting KernelSU maintained by other developers.</p></div><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>This page is only for you to find the source code corresponding to your device, it does <strong>NOT</strong> mean that the source code has been reviewed by <em>KernelSU Developers</em>. You should use it at your own risk.</p></div>',3),u=e("thead",null,[e("tr",null,[e("th",null,"Maintainer"),e("th",null,"Repository"),e("th",null,"Support devices")])],-1),p=["href"],_=["href"],k=JSON.parse('{"title":"Unofficially Supported Devices","description":"","frontmatter":{},"headers":[],"relativePath":"guide/unofficially-support-devices.md","filePath":"guide/unofficially-support-devices.md"}'),f={name:"guide/unofficially-support-devices.md"},b=Object.assign(f,{setup(h){return(m,v)=>(i(),r("div",null,[d,e("table",null,[u,e("tbody",null,[(i(!0),r(s,null,o(l(n),t=>(i(),r("tr",{key:t.devices},[e("td",null,[e("a",{href:t.maintainer_link,target:"_blank",rel:"noreferrer"},a(t.maintainer),9,p)]),e("td",null,[e("a",{href:t.kernel_link,target:"_blank",rel:"noreferrer"},a(t.kernel_name),9,_)]),e("td",null,a(t.devices),1)]))),128))])])]))}});export{k as __pageData,b as default};
import{d as n}from"./chunks/repos.9a031e32.js";import{o as i,c as r,k as e,F as s,D as l,l as o,Q as c,t as a}from"./chunks/framework.ec8f7e8e.js";const d=c('<h1 id="unofficially-supported-devices" tabindex="-1">Unofficially Supported Devices <a class="header-anchor" href="#unofficially-supported-devices" aria-label="Permalink to &quot;Unofficially Supported Devices&quot;"></a></h1><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>In this page, there are kernels for non-GKI devices supporting KernelSU maintained by other developers.</p></div><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>This page is only for you to find the source code corresponding to your device, it does <strong>NOT</strong> mean that the source code has been reviewed by <em>KernelSU Developers</em>. You should use it at your own risk.</p></div>',3),u=e("thead",null,[e("tr",null,[e("th",null,"Maintainer"),e("th",null,"Repository"),e("th",null,"Support devices")])],-1),p=["href"],_=["href"],k=JSON.parse('{"title":"Unofficially Supported Devices","description":"","frontmatter":{},"headers":[],"relativePath":"guide/unofficially-support-devices.md","filePath":"guide/unofficially-support-devices.md"}'),f={name:"guide/unofficially-support-devices.md"},b=Object.assign(f,{setup(h){return(m,v)=>(i(),r("div",null,[d,e("table",null,[u,e("tbody",null,[(i(!0),r(s,null,l(o(n),t=>(i(),r("tr",{key:t.devices},[e("td",null,[e("a",{href:t.maintainer_link,target:"_blank",rel:"noreferrer"},a(t.maintainer),9,p)]),e("td",null,[e("a",{href:t.kernel_link,target:"_blank",rel:"noreferrer"},a(t.kernel_name),9,_)]),e("td",null,a(t.devices),1)]))),128))])])]))}});export{k as __pageData,b as default};

View File

@ -1 +1 @@
import{d as n}from"./chunks/repos.9a031e32.js";import{o as i,c as r,z as e,F as s,L as o,b as l,O as c,t as a}from"./chunks/framework.43781440.js";const d=c("",3),u=e("thead",null,[e("tr",null,[e("th",null,"Maintainer"),e("th",null,"Repository"),e("th",null,"Support devices")])],-1),p=["href"],_=["href"],k=JSON.parse('{"title":"Unofficially Supported Devices","description":"","frontmatter":{},"headers":[],"relativePath":"guide/unofficially-support-devices.md","filePath":"guide/unofficially-support-devices.md"}'),f={name:"guide/unofficially-support-devices.md"},b=Object.assign(f,{setup(h){return(m,v)=>(i(),r("div",null,[d,e("table",null,[u,e("tbody",null,[(i(!0),r(s,null,o(l(n),t=>(i(),r("tr",{key:t.devices},[e("td",null,[e("a",{href:t.maintainer_link,target:"_blank",rel:"noreferrer"},a(t.maintainer),9,p)]),e("td",null,[e("a",{href:t.kernel_link,target:"_blank",rel:"noreferrer"},a(t.kernel_name),9,_)]),e("td",null,a(t.devices),1)]))),128))])])]))}});export{k as __pageData,b as default};
import{d as n}from"./chunks/repos.9a031e32.js";import{o as i,c as r,k as e,F as s,D as l,l as o,Q as c,t as a}from"./chunks/framework.ec8f7e8e.js";const d=c("",3),u=e("thead",null,[e("tr",null,[e("th",null,"Maintainer"),e("th",null,"Repository"),e("th",null,"Support devices")])],-1),p=["href"],_=["href"],k=JSON.parse('{"title":"Unofficially Supported Devices","description":"","frontmatter":{},"headers":[],"relativePath":"guide/unofficially-support-devices.md","filePath":"guide/unofficially-support-devices.md"}'),f={name:"guide/unofficially-support-devices.md"},b=Object.assign(f,{setup(h){return(m,v)=>(i(),r("div",null,[d,e("table",null,[u,e("tbody",null,[(i(!0),r(s,null,l(o(n),t=>(i(),r("tr",{key:t.devices},[e("td",null,[e("a",{href:t.maintainer_link,target:"_blank",rel:"noreferrer"},a(t.maintainer),9,p)]),e("td",null,[e("a",{href:t.kernel_link,target:"_blank",rel:"noreferrer"},a(t.kernel_name),9,_)]),e("td",null,a(t.devices),1)]))),128))])])]))}});export{k as __pageData,b as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as o,O as t}from"./chunks/framework.43781440.js";const f=JSON.parse('{"title":"What is KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"guide/what-is-kernelsu.md","filePath":"guide/what-is-kernelsu.md"}'),r={name:"guide/what-is-kernelsu.md"},s=t('<h1 id="what-is-kernelsu" tabindex="-1">What is KernelSU? <a class="header-anchor" href="#what-is-kernelsu" aria-label="Permalink to &quot;What is KernelSU?&quot;"></a></h1><p>KernelSU is a root solution for Android GKI devices, it works in kernel mode and grant root permission to userspace application directly in kernel space.</p><h2 id="features" tabindex="-1">Features <a class="header-anchor" href="#features" aria-label="Permalink to &quot;Features&quot;"></a></h2><p>The main feature of KernelSU is it is <strong>Kernel-based</strong>. KernelSU works in kernel mode, so it can provide kernel interface we never had before. For example, we can add hardware breakpoint to any process in kernel mode; We can access physical memory of any process without anybody being aware of; We can intercept any syscall in kernel space; etc.</p><p>And also, KernelSU provides a module system via overlayfs, which allows you to load your custom plugin into system. It also provides a mechanism to modify files in <code>/system</code> partition.</p><h2 id="how-to-use" tabindex="-1">How to use <a class="header-anchor" href="#how-to-use" aria-label="Permalink to &quot;How to use&quot;"></a></h2><p>Please refer: <a href="./installation.html">Installation</a></p><h2 id="how-to-build" tabindex="-1">How to build <a class="header-anchor" href="#how-to-build" aria-label="Permalink to &quot;How to build&quot;"></a></h2><p><a href="./how-to-build.html">How to build</a></p><h2 id="discussion" tabindex="-1">Discussion <a class="header-anchor" href="#discussion" aria-label="Permalink to &quot;Discussion&quot;"></a></h2><ul><li>Telegram: <a href="https://t.me/KernelSU" target="_blank" rel="noreferrer">@KernelSU</a></li></ul>',11),i=[s];function n(l,d,h,c,u,p){return a(),o("div",null,i)}const _=e(r,[["render",n]]);export{f as __pageData,_ as default};
import{_ as e,o as a,c as o,Q as t}from"./chunks/framework.ec8f7e8e.js";const f=JSON.parse('{"title":"What is KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"guide/what-is-kernelsu.md","filePath":"guide/what-is-kernelsu.md"}'),r={name:"guide/what-is-kernelsu.md"},s=t('<h1 id="what-is-kernelsu" tabindex="-1">What is KernelSU? <a class="header-anchor" href="#what-is-kernelsu" aria-label="Permalink to &quot;What is KernelSU?&quot;"></a></h1><p>KernelSU is a root solution for Android GKI devices, it works in kernel mode and grant root permission to userspace application directly in kernel space.</p><h2 id="features" tabindex="-1">Features <a class="header-anchor" href="#features" aria-label="Permalink to &quot;Features&quot;"></a></h2><p>The main feature of KernelSU is it is <strong>Kernel-based</strong>. KernelSU works in kernel mode, so it can provide kernel interface we never had before. For example, we can add hardware breakpoint to any process in kernel mode; We can access physical memory of any process without anybody being aware of; We can intercept any syscall in kernel space; etc.</p><p>And also, KernelSU provides a module system via overlayfs, which allows you to load your custom plugin into system. It also provides a mechanism to modify files in <code>/system</code> partition.</p><h2 id="how-to-use" tabindex="-1">How to use <a class="header-anchor" href="#how-to-use" aria-label="Permalink to &quot;How to use&quot;"></a></h2><p>Please refer: <a href="./installation.html">Installation</a></p><h2 id="how-to-build" tabindex="-1">How to build <a class="header-anchor" href="#how-to-build" aria-label="Permalink to &quot;How to build&quot;"></a></h2><p><a href="./how-to-build.html">How to build</a></p><h2 id="discussion" tabindex="-1">Discussion <a class="header-anchor" href="#discussion" aria-label="Permalink to &quot;Discussion&quot;"></a></h2><ul><li>Telegram: <a href="https://t.me/KernelSU" target="_blank" rel="noreferrer">@KernelSU</a></li></ul>',11),i=[s];function n(l,d,h,c,u,p){return a(),o("div",null,i)}const _=e(r,[["render",n]]);export{f as __pageData,_ as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as o,O as t}from"./chunks/framework.43781440.js";const f=JSON.parse('{"title":"What is KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"guide/what-is-kernelsu.md","filePath":"guide/what-is-kernelsu.md"}'),r={name:"guide/what-is-kernelsu.md"},s=t("",11),i=[s];function n(l,d,h,c,u,p){return a(),o("div",null,i)}const _=e(r,[["render",n]]);export{f as __pageData,_ as default};
import{_ as e,o as a,c as o,Q as t}from"./chunks/framework.ec8f7e8e.js";const f=JSON.parse('{"title":"What is KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"guide/what-is-kernelsu.md","filePath":"guide/what-is-kernelsu.md"}'),r={name:"guide/what-is-kernelsu.md"},s=t("",11),i=[s];function n(l,d,h,c,u,p){return a(),o("div",null,i)}const _=e(r,[["render",n]]);export{f as __pageData,_ as default};

View File

@ -1 +1 @@
import{_ as a,o as e,c as n,O as i}from"./chunks/framework.43781440.js";const p=JSON.parse('{"title":"Perbedaan dengan Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/difference-with-magisk.md","filePath":"id_ID/guide/difference-with-magisk.md"}'),d={name:"id_ID/guide/difference-with-magisk.md"},t=i('<h1 id="perbedaan-dengan-magisk" tabindex="-1">Perbedaan dengan Magisk <a class="header-anchor" href="#perbedaan-dengan-magisk" aria-label="Permalink to &quot;Perbedaan dengan Magisk&quot;"></a></h1><p>Meskipun ada banyak kesamaan antara modul KernelSU dan modul Magisk, pasti ada beberapa perbedaan karena mekanisme implementasinya yang sangat berbeda. Jika Anda ingin modul Anda berjalan di Magisk dan KernelSU, Anda harus memahami perbedaan ini.</p><h2 id="kesamaan" tabindex="-1">Kesamaan <a class="header-anchor" href="#kesamaan" aria-label="Permalink to &quot;Kesamaan&quot;"></a></h2><ul><li>Format file modul: keduanya menggunakan format zip untuk mengatur modul, dan format modulnya hampir sama</li><li>Direktori pemasangan modul: keduanya terletak di <code>/data/adb/modules</code></li><li>Tanpa sistem: keduanya mendukung modifikasi / sistem dengan cara tanpa sistem melalui modul</li><li>post-fs-data.sh: waktu eksekusi dan semantiknya persis sama</li><li>service.sh: waktu eksekusi dan semantiknya persis sama</li><li>system.prop: sepenuhnya sama</li><li>sepolicy.rule: sama persis</li><li>BusyBox: skrip dijalankan di BusyBox dengan &quot;mode mandiri&quot; diaktifkan di kedua kasus</li></ul><h2 id="perbedaan" tabindex="-1">Perbedaan <a class="header-anchor" href="#perbedaan" aria-label="Permalink to &quot;Perbedaan&quot;"></a></h2><p>Sebelum memahami perbedaannya, Anda perlu mengetahui cara membedakan apakah modul Anda berjalan di KernelSU atau Magisk. Anda dapat menggunakan variabel lingkungan <code>KSU</code> untuk membedakannya di semua tempat di mana Anda dapat menjalankan skrip modul (<code>customize.sh</code>, <code>post-fs-data.sh</code>, <code>service.sh</code>). Di KernelSU, variabel lingkungan ini akan disetel ke <code>true</code>.</p><p>Berikut beberapa perbedaannya:</p><ul><li>Modul KernelSU tidak dapat diinstal dalam mode Pemulihan.</li><li>Modul KernelSU tidak memiliki dukungan bawaan untuk Zygisk (tetapi Anda dapat menggunakan modul Zygisk melalui <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a>.</li><li>Metode untuk mengganti atau menghapus file dalam modul KernelSU sama sekali berbeda dari Magisk. KernelSU tidak mendukung metode <code>.replace</code>. Sebagai gantinya, Anda perlu membuat file dengan nama yang sama dengan <code>mknod filename c 0 0</code> untuk menghapus file terkait.</li><li>Direktori untuk BusyBox berbeda. BusyBox bawaan di KernelSU terletak di <code>/data/adb/ksu/bin/busybox</code>, sedangkan di Magisk terletak di <code>/data/adb/magisk/busybox</code>. <strong>Perhatikan bahwa ini adalah perilaku internal KernelSU dan dapat berubah di masa mendatang!</strong></li><li>KernelSU tidak mendukung file <code>.replace</code>; namun, KernelSU mendukung variabel <code>REMOVE</code> dan <code>REPLACE</code> untuk menghapus atau mengganti file dan folder.</li></ul>',8),s=[t];function r(l,m,u,o,k,g){return e(),n("div",null,s)}const b=a(d,[["render",r]]);export{p as __pageData,b as default};
import{_ as a,o as e,c as n,Q as i}from"./chunks/framework.ec8f7e8e.js";const p=JSON.parse('{"title":"Perbedaan dengan Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/difference-with-magisk.md","filePath":"id_ID/guide/difference-with-magisk.md"}'),d={name:"id_ID/guide/difference-with-magisk.md"},t=i('<h1 id="perbedaan-dengan-magisk" tabindex="-1">Perbedaan dengan Magisk <a class="header-anchor" href="#perbedaan-dengan-magisk" aria-label="Permalink to &quot;Perbedaan dengan Magisk&quot;"></a></h1><p>Meskipun ada banyak kesamaan antara modul KernelSU dan modul Magisk, pasti ada beberapa perbedaan karena mekanisme implementasinya yang sangat berbeda. Jika Anda ingin modul Anda berjalan di Magisk dan KernelSU, Anda harus memahami perbedaan ini.</p><h2 id="kesamaan" tabindex="-1">Kesamaan <a class="header-anchor" href="#kesamaan" aria-label="Permalink to &quot;Kesamaan&quot;"></a></h2><ul><li>Format file modul: keduanya menggunakan format zip untuk mengatur modul, dan format modulnya hampir sama</li><li>Direktori pemasangan modul: keduanya terletak di <code>/data/adb/modules</code></li><li>Tanpa sistem: keduanya mendukung modifikasi / sistem dengan cara tanpa sistem melalui modul</li><li>post-fs-data.sh: waktu eksekusi dan semantiknya persis sama</li><li>service.sh: waktu eksekusi dan semantiknya persis sama</li><li>system.prop: sepenuhnya sama</li><li>sepolicy.rule: sama persis</li><li>BusyBox: skrip dijalankan di BusyBox dengan &quot;mode mandiri&quot; diaktifkan di kedua kasus</li></ul><h2 id="perbedaan" tabindex="-1">Perbedaan <a class="header-anchor" href="#perbedaan" aria-label="Permalink to &quot;Perbedaan&quot;"></a></h2><p>Sebelum memahami perbedaannya, Anda perlu mengetahui cara membedakan apakah modul Anda berjalan di KernelSU atau Magisk. Anda dapat menggunakan variabel lingkungan <code>KSU</code> untuk membedakannya di semua tempat di mana Anda dapat menjalankan skrip modul (<code>customize.sh</code>, <code>post-fs-data.sh</code>, <code>service.sh</code>). Di KernelSU, variabel lingkungan ini akan disetel ke <code>true</code>.</p><p>Berikut beberapa perbedaannya:</p><ul><li>Modul KernelSU tidak dapat diinstal dalam mode Pemulihan.</li><li>Modul KernelSU tidak memiliki dukungan bawaan untuk Zygisk (tetapi Anda dapat menggunakan modul Zygisk melalui <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a>.</li><li>Metode untuk mengganti atau menghapus file dalam modul KernelSU sama sekali berbeda dari Magisk. KernelSU tidak mendukung metode <code>.replace</code>. Sebagai gantinya, Anda perlu membuat file dengan nama yang sama dengan <code>mknod filename c 0 0</code> untuk menghapus file terkait.</li><li>Direktori untuk BusyBox berbeda. BusyBox bawaan di KernelSU terletak di <code>/data/adb/ksu/bin/busybox</code>, sedangkan di Magisk terletak di <code>/data/adb/magisk/busybox</code>. <strong>Perhatikan bahwa ini adalah perilaku internal KernelSU dan dapat berubah di masa mendatang!</strong></li><li>KernelSU tidak mendukung file <code>.replace</code>; namun, KernelSU mendukung variabel <code>REMOVE</code> dan <code>REPLACE</code> untuk menghapus atau mengganti file dan folder.</li></ul>',8),s=[t];function r(l,m,u,o,k,g){return e(),n("div",null,s)}const b=a(d,[["render",r]]);export{p as __pageData,b as default};

View File

@ -1 +1 @@
import{_ as a,o as e,c as n,O as i}from"./chunks/framework.43781440.js";const p=JSON.parse('{"title":"Perbedaan dengan Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/difference-with-magisk.md","filePath":"id_ID/guide/difference-with-magisk.md"}'),d={name:"id_ID/guide/difference-with-magisk.md"},t=i("",8),s=[t];function r(l,m,u,o,k,g){return e(),n("div",null,s)}const b=a(d,[["render",r]]);export{p as __pageData,b as default};
import{_ as a,o as e,c as n,Q as i}from"./chunks/framework.ec8f7e8e.js";const p=JSON.parse('{"title":"Perbedaan dengan Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/difference-with-magisk.md","filePath":"id_ID/guide/difference-with-magisk.md"}'),d={name:"id_ID/guide/difference-with-magisk.md"},t=i("",8),s=[t];function r(l,m,u,o,k,g){return e(),n("div",null,s)}const b=a(d,[["render",r]]);export{p as __pageData,b as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{_ as a,o as e,c as n,O as k}from"./chunks/framework.43781440.js";const p=JSON.parse('{"title":"FAQ","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/faq.md","filePath":"id_ID/guide/faq.md"}'),r={name:"id_ID/guide/faq.md"},i=k("",24),u=[i];function d(t,l,m,o,s,h){return e(),n("div",null,u)}const b=a(r,[["render",d]]);export{p as __pageData,b as default};
import{_ as a,o as e,c as n,Q as k}from"./chunks/framework.ec8f7e8e.js";const p=JSON.parse('{"title":"FAQ","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/faq.md","filePath":"id_ID/guide/faq.md"}'),r={name:"id_ID/guide/faq.md"},i=k("",24),u=[i];function d(t,l,m,o,s,h){return e(),n("div",null,u)}const b=a(r,[["render",d]]);export{p as __pageData,b as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
import{_ as a,o as s,c as n,O as e}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"Bagaimana caranya untuk build KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/how-to-build.md","filePath":"id_ID/guide/how-to-build.md"}'),l={name:"id_ID/guide/how-to-build.md"},o=e("",24),t=[o];function r(p,i,c,d,u,C){return s(),n("div",null,t)}const k=a(l,[["render",r]]);export{y as __pageData,k as default};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{_ as s,o as a,c as n,Q as l}from"./chunks/framework.ec8f7e8e.js";const E=JSON.parse('{"title":"Bagaimana caranya untuk build KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/how-to-build.md","filePath":"id_ID/guide/how-to-build.md"}'),e={name:"id_ID/guide/how-to-build.md"},o=l("",24),p=[o];function t(r,c,i,d,u,y){return a(),n("div",null,p)}const k=s(e,[["render",t]]);export{E as __pageData,k as default};

View File

@ -1,152 +0,0 @@
import{_ as s,o as a,c as n,O as e}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"Bagaimana Caranya untuk mengintegrasikan KernelSU ke kernel non GKI?","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/how-to-integrate-for-non-gki.md","filePath":"id_ID/guide/how-to-integrate-for-non-gki.md"}'),l={name:"id_ID/guide/how-to-integrate-for-non-gki.md"},p=e(`<h1 id="bagaimana-caranya-untuk-mengintegrasikan-kernelsu-ke-kernel-non-gki" tabindex="-1">Bagaimana Caranya untuk mengintegrasikan KernelSU ke kernel non GKI? <a class="header-anchor" href="#bagaimana-caranya-untuk-mengintegrasikan-kernelsu-ke-kernel-non-gki" aria-label="Permalink to &quot;Bagaimana Caranya untuk mengintegrasikan KernelSU ke kernel non GKI?&quot;"></a></h1><p>KernelSU dapat diintegrasikan ke kernel non GKI, dan saat ini sudah di-backport ke 4.14, dan juga dapat dijalankan pada kernel di bawah 4.14.</p><p>Karena fragmentasi kernel non GKI, kami tidak memiliki cara yang seragam untuk membangunnya, sehingga kami tidak dapat menyediakan gambar boot non GKI. Tetapi Anda dapat membangun kernel sendiri dengan KernelSU yang terintegrasi.</p><p>Pertama, Anda harus dapat membangun kernel yang dapat di-boot dari kode sumber kernel, jika kernel tersebut tidak open source, maka akan sulit untuk menjalankan KernelSU untuk perangkat Anda.</p><p>Jika Anda dapat membuat kernel yang dapat di-booting, ada dua cara untuk mengintegrasikan KernelSU ke kode sumber kernel:</p><ol><li>Secara otomatis dengan <code>kprobe</code></li><li>Secara manual</li></ol><h2 id="integrasikan-dengan-kprobe" tabindex="-1">Integrasikan dengan kprobe <a class="header-anchor" href="#integrasikan-dengan-kprobe" aria-label="Permalink to &quot;Integrasikan dengan kprobe&quot;"></a></h2><p>KernelSU menggunakan kprobe untuk melakukan hook kernel, jika <em>kprobe</em> berjalan dengan baik pada kernel Anda, maka disarankan untuk menggunakan cara ini.</p><p>Pertama, tambahkan KernelSU ke dalam berkas kernel source tree:</p><ul><li>Latest tag(stable)</li></ul><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-</span></span></code></pre></div><ul><li>main branch(dev)</li></ul><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">main</span></span></code></pre></div><ul><li>Select tag(Such as v0.5.2)</li></ul><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">v0.5.2</span></span></code></pre></div><p>Kemudian, Anda harus memeriksa apakah <em>kprobe</em> diaktifkan dalam konfigurasi kernel Anda, jika tidak, tambahkan konfigurasi ini ke dalamnya:</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">CONFIG_KPROBES=y</span></span>
<span class="line"><span style="color:#A6ACCD;">CONFIG_HAVE_KPROBES=y</span></span>
<span class="line"><span style="color:#A6ACCD;">CONFIG_KPROBE_EVENTS=y</span></span></code></pre></div><p>Dan build kernel Anda lagi, KernelSU seharusnya bekerja dengan baik.</p><p>Jika Anda menemukan bahwa KPROBES masih belum diaktifkan, Anda dapat mencoba mengaktifkan <code>CONFIG_MODULES</code>. (Jika masih belum berlaku, gunakan <code>make menuconfig</code> untuk mencari ketergantungan KPROBES yang lain)</p><p>etapi jika Anda mengalami boot loop saat mengintegrasikan KernelSU, itu mungkin <em>kprobe rusak di kernel Anda</em>, Anda harus memperbaiki bug kprobe atau menggunakan cara kedua.</p><h2 id="memodifikasi-sumber-kernel-secara-manual" tabindex="-1">Memodifikasi sumber kernel secara manual <a class="header-anchor" href="#memodifikasi-sumber-kernel-secara-manual" aria-label="Permalink to &quot;Memodifikasi sumber kernel secara manual&quot;"></a></h2><p>Jika kprobe tidak dapat bekerja pada kernel Anda (mungkin karena bug di upstream atau kernel di bawah 4.8), maka Anda dapat mencoba cara ini:</p><p>Pertama, tambahkan KernelSU ke dalam direktori kernel source tree:</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-</span></span></code></pre></div><p>Kemudian, tambahkan panggilan KernelSU ke source kernel, berikut ini adalah patch yang dapat dirujuk:</p><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/fs/exec.c b/fs/exec.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index ac59664eaecf..bdd585e1d2cc 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/exec.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/exec.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -1890,11 +1890,14 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> static int __do_execve_file(int fd, struct filename *filename,</span></span>
<span class="line"><span style="color:#A6ACCD;"> return retval;</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern bool ksu_execveat_hook __read_mostly;</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> void *envp, int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> void *argv, void *envp, int *flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> static int do_execveat_common(int fd, struct filename *filename,</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct user_arg_ptr argv,</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct user_arg_ptr envp,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int flags)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> if (unlikely(ksu_execveat_hook))</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_execveat(&amp;fd, &amp;filename, &amp;argv, &amp;envp, &amp;flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> else</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_execveat_sucompat(&amp;fd, &amp;filename, &amp;argv, &amp;envp, &amp;flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> return __do_execve_file(fd, filename, argv, envp, flags, NULL);</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">diff --git a/fs/open.c b/fs/open.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 05036d819197..965b84d486b8 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -348,6 +348,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)</span></span>
<span class="line"><span style="color:#A6ACCD;"> return ksys_fallocate(fd, mode, offset, len);</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> int *flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> /*</span></span>
<span class="line"><span style="color:#A6ACCD;"> * access() needs to use the real uid/gid, not the effective uid/gid.</span></span>
<span class="line"><span style="color:#A6ACCD;"> * We do this by temporarily clearing all FS-related capabilities and</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -355,6 +357,7 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)</span></span>
<span class="line"><span style="color:#A6ACCD;"> */</span></span>
<span class="line"><span style="color:#A6ACCD;"> long do_faccessat(int dfd, const char __user *filename, int mode)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_faccessat(&amp;dfd, &amp;filename, &amp;mode, NULL);</span></span>
<span class="line"><span style="color:#A6ACCD;"> const struct cred *old_cred;</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct cred *override_cred;</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct path path;</span></span>
<span class="line"><span style="color:#A6ACCD;">diff --git a/fs/read_write.c b/fs/read_write.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 650fc7e0f3a6..55be193913b6 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/read_write.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/read_write.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -434,10 +434,14 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> EXPORT_SYMBOL(kernel_read);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern bool ksu_vfs_read_hook __read_mostly;</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> size_t *count_ptr, loff_t **pos);</span></span>
<span class="line"><span style="color:#A6ACCD;"> ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#A6ACCD;"> ssize_t ret;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> if (unlikely(ksu_vfs_read_hook))</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_vfs_read(&amp;file, &amp;buf, &amp;count, &amp;pos);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> if (!(file-&gt;f_mode &amp; FMODE_READ))</span></span>
<span class="line"><span style="color:#A6ACCD;"> return -EBADF;</span></span>
<span class="line"><span style="color:#A6ACCD;"> if (!(file-&gt;f_mode &amp; FMODE_CAN_READ))</span></span>
<span class="line"><span style="color:#A6ACCD;">diff --git a/fs/stat.c b/fs/stat.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 376543199b5a..82adcef03ecc 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -148,6 +148,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_statx_fd(unsigned int fd, struct kstat *stat,</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> EXPORT_SYMBOL(vfs_statx_fd);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> /**</span></span>
<span class="line"><span style="color:#A6ACCD;"> * vfs_statx - Get basic and extra attributes by filename</span></span>
<span class="line"><span style="color:#A6ACCD;"> * @dfd: A file descriptor representing the base dir for a relative filename</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -170,6 +172,7 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_statx(int dfd, const char __user *filename, int flags,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int error = -EINVAL;</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_stat(&amp;dfd, &amp;filename, &amp;flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> if ((flags &amp; ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |</span></span>
<span class="line"><span style="color:#A6ACCD;"> AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0)</span></span>
<span class="line"><span style="color:#A6ACCD;"> return -EINVAL;</span></span></code></pre></div><p>Anda harus menemukan empat fungsi dalam kernel source:</p><ol><li>do_faccessat, usually in <code>fs/open.c</code></li><li>do_execveat_common, usually in <code>fs/exec.c</code></li><li>vfs_read, usually in <code>fs/read_write.c</code></li><li>vfs_statx, usually in <code>fs/stat.c</code></li></ol><p>Jika kernel anda tidak memiliki <code>vfs_statx</code>, maka gunakan <code>vfs_fstatat</code> alih-alih:</p><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/fs/stat.c b/fs/stat.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 068fdbcc9e26..5348b7bb9db2 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -87,6 +87,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_fstat(unsigned int fd, struct kstat *stat)</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> EXPORT_SYMBOL(vfs_fstat);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int flag)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -94,6 +96,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int error = -EINVAL;</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int lookup_flags = 0;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_stat(&amp;dfd, &amp;filename, &amp;flag);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> if ((flag &amp; ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |</span></span>
<span class="line"><span style="color:#A6ACCD;"> AT_EMPTY_PATH)) != 0)</span></span>
<span class="line"><span style="color:#A6ACCD;"> goto out;</span></span></code></pre></div><p>Untuk kernel lebih awal dari 4.17, jika anda menemukan <code>do_faccessat</code>, hanya pergi ke definisi yang sama <code>faccessat</code> syscall dan tempatkan pemanggil di sini:</p><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/fs/open.c b/fs/open.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 2ff887661237..e758d7db7663 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -355,6 +355,9 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)</span></span>
<span class="line"><span style="color:#A6ACCD;"> return error;</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> /*</span></span>
<span class="line"><span style="color:#A6ACCD;"> * access() needs to use the real uid/gid, not the effective uid/gid.</span></span>
<span class="line"><span style="color:#A6ACCD;"> * We do this by temporarily clearing all FS-related capabilities and</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -370,6 +373,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)</span></span>
<span class="line"><span style="color:#A6ACCD;"> int res;</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int lookup_flags = LOOKUP_FOLLOW;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_faccessat(&amp;dfd, &amp;filename, &amp;mode, NULL);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> if (mode &amp; ~S_IRWXO) /* where&#39;s F_OK, X_OK, W_OK, R_OK? */</span></span>
<span class="line"><span style="color:#A6ACCD;"> return -EINVAL;</span></span></code></pre></div><p>To enable KernelSU&#39;s builtin SafeMode, You should also modify <code>input_handle_event</code> in <code>drivers/input/input.c</code>:</p><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>Fitur ini sangat direkomendasikan, serta sangat membantu untuk memulihkan pada saat bootloop!</p></div><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/drivers/input/input.c b/drivers/input/input.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 45306f9ef247..815091ebfca4 100755</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/drivers/input/input.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/drivers/input/input.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -367,10 +367,13 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> static int input_get_disposition(struct input_dev *dev,</span></span>
<span class="line"><span style="color:#A6ACCD;"> return disposition;</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern bool ksu_input_hook __read_mostly;</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code, int *value);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> static void input_handle_event(struct input_dev *dev,</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int type, unsigned int code, int value)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#A6ACCD;"> int disposition = input_get_disposition(dev, type, code, &amp;value);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> if (unlikely(ksu_input_hook))</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_input_handle_event(&amp;type, &amp;code, &amp;value);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> if (disposition != INPUT_IGNORE_EVENT &amp;&amp; type != EV_SYN)</span></span>
<span class="line"><span style="color:#A6ACCD;"> add_input_randomness(type, code, value);</span></span></code></pre></div><p>Terakhir, edit <code>KernelSU/kernel/ksu.c</code> dan beri komentar pada <code>enable_sucompat()</code> lalu build kernel Anda lagi, KernelSU akan bekerja dengan baik.</p>`,36),t=[p];function o(c,i,r,d,C,D){return a(),n("div",null,t)}const u=s(l,[["render",o]]);export{y as __pageData,u as default};

View File

@ -1 +0,0 @@
import{_ as s,o as a,c as n,O as e}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"Bagaimana Caranya untuk mengintegrasikan KernelSU ke kernel non GKI?","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/how-to-integrate-for-non-gki.md","filePath":"id_ID/guide/how-to-integrate-for-non-gki.md"}'),l={name:"id_ID/guide/how-to-integrate-for-non-gki.md"},p=e("",36),t=[p];function o(c,i,r,d,C,D){return a(),n("div",null,t)}const u=s(l,[["render",o]]);export{y as __pageData,u as default};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{_ as s,o as n,c as a,Q as e}from"./chunks/framework.ec8f7e8e.js";const u=JSON.parse('{"title":"Bagaimana Caranya untuk mengintegrasikan KernelSU ke kernel non GKI?","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/how-to-integrate-for-non-gki.md","filePath":"id_ID/guide/how-to-integrate-for-non-gki.md"}'),l={name:"id_ID/guide/how-to-integrate-for-non-gki.md"},p=e("",36),t=[p];function o(c,i,r,d,E,y){return n(),a("div",null,t)}const _=s(l,[["render",o]]);export{u as __pageData,_ as default};

View File

@ -1 +1 @@
import{_ as a,o as e,c as n,O as t}from"./chunks/framework.43781440.js";const g=JSON.parse('{"title":"Instalasi","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/installation.md","filePath":"id_ID/guide/installation.md"}'),o={name:"id_ID/guide/installation.md"},s=t('<h1 id="instalasi" tabindex="-1">Instalasi <a class="header-anchor" href="#instalasi" aria-label="Permalink to &quot;Instalasi&quot;"></a></h1><h2 id="periksa-apakah-perangkat-anda-didukung" tabindex="-1">Periksa apakah perangkat Anda didukung <a class="header-anchor" href="#periksa-apakah-perangkat-anda-didukung" aria-label="Permalink to &quot;Periksa apakah perangkat Anda didukung&quot;"></a></h2><p>Unduh aplikasi manajer KernelSU dari <a href="https://github.com/tiann/KernelSU/releases" target="_blank" rel="noreferrer">github releases</a> atau <a href="https://github.com/tiann/KernelSU/actions/workflows/build-manager.yml" target="_blank" rel="noreferrer">github actions</a>, lalu instal aplikasi ke perangkat dan buka aplikasi:</p><ul><li>Jika aplikasi menunjukkan <code>Unsupported</code>, itu berarti <strong>Anda harus mengkompilasi kernel sendiri</strong>, KernelSU tidak akan dan tidak pernah menyediakan boot image untuk Anda flash.</li><li>Jika aplikasi menunjukkan <code>Not installed</code>, maka perangkat Anda secara resmi didukung oleh KernelSU.</li></ul><h2 id="temukan-boot-img-yang-tepat" tabindex="-1">Temukan boot.img yang tepat <a class="header-anchor" href="#temukan-boot-img-yang-tepat" aria-label="Permalink to &quot;Temukan boot.img yang tepat&quot;"></a></h2><p>KernelSU menyediakan boot.img umum untuk perangkat GKI, Anda harus mem-flash boot.img ke partisi boot perangkat Anda.</p><p>Anda dapat mengunduh boot.img dari [github actions for kernel] (<a href="https://github.com/tiann/KernelSU/actions/workflows/build-kernel.yml" target="_blank" rel="noreferrer">https://github.com/tiann/KernelSU/actions/workflows/build-kernel.yml</a>), perlu diketahui bahwa Anda harus menggunakan versi boot.img yang tepat. Sebagai contoh, jika perangkat Anda menunjukkan bahwa kernelnya adalah <code>5.10.101</code>, maka Anda harus mengunduh <code>5.10.101-xxxx.boot.xxx</code>.</p><p>Dan juga, silakan periksa format boot.img Anda, Anda harus menggunakan format yang tepat, seperti <code>lz4</code>、<code>gz</code>.</p><h2 id="flash-boot-img-ke-perangkat" tabindex="-1">Flash boot.img ke perangkat <a class="header-anchor" href="#flash-boot-img-ke-perangkat" aria-label="Permalink to &quot;Flash boot.img ke perangkat&quot;"></a></h2><p>Hubungkan perangkat Anda dengan <code>adb</code> lalu jalankan <code>adb reboot bootloader</code> untuk masuk ke mode fastboot, lalu gunakan perintah ini untuk mem-flash KernelSU:</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">fastboot</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">flash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">boot</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">boot.img</span></span></code></pre></div><h2 id="reboot" tabindex="-1">Reboot <a class="header-anchor" href="#reboot" aria-label="Permalink to &quot;Reboot&quot;"></a></h2><p>Ketika di-flash, Anda harus menyalakan ulang perangkat Anda:</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">fastboot</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">reboot</span></span></code></pre></div>',14),i=[s];function l(r,d,p,k,u,h){return e(),n("div",null,i)}const m=a(o,[["render",l]]);export{g as __pageData,m as default};
import{_ as a,o as e,c as n,Q as t}from"./chunks/framework.ec8f7e8e.js";const g=JSON.parse('{"title":"Instalasi","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/installation.md","filePath":"id_ID/guide/installation.md"}'),o={name:"id_ID/guide/installation.md"},s=t('<h1 id="instalasi" tabindex="-1">Instalasi <a class="header-anchor" href="#instalasi" aria-label="Permalink to &quot;Instalasi&quot;"></a></h1><h2 id="periksa-apakah-perangkat-anda-didukung" tabindex="-1">Periksa apakah perangkat Anda didukung <a class="header-anchor" href="#periksa-apakah-perangkat-anda-didukung" aria-label="Permalink to &quot;Periksa apakah perangkat Anda didukung&quot;"></a></h2><p>Unduh aplikasi manajer KernelSU dari <a href="https://github.com/tiann/KernelSU/releases" target="_blank" rel="noreferrer">github releases</a> atau <a href="https://github.com/tiann/KernelSU/actions/workflows/build-manager.yml" target="_blank" rel="noreferrer">github actions</a>, lalu instal aplikasi ke perangkat dan buka aplikasi:</p><ul><li>Jika aplikasi menunjukkan <code>Unsupported</code>, itu berarti <strong>Anda harus mengkompilasi kernel sendiri</strong>, KernelSU tidak akan dan tidak pernah menyediakan boot image untuk Anda flash.</li><li>Jika aplikasi menunjukkan <code>Not installed</code>, maka perangkat Anda secara resmi didukung oleh KernelSU.</li></ul><h2 id="temukan-boot-img-yang-tepat" tabindex="-1">Temukan boot.img yang tepat <a class="header-anchor" href="#temukan-boot-img-yang-tepat" aria-label="Permalink to &quot;Temukan boot.img yang tepat&quot;"></a></h2><p>KernelSU menyediakan boot.img umum untuk perangkat GKI, Anda harus mem-flash boot.img ke partisi boot perangkat Anda.</p><p>Anda dapat mengunduh boot.img dari [github actions for kernel] (<a href="https://github.com/tiann/KernelSU/actions/workflows/build-kernel.yml" target="_blank" rel="noreferrer">https://github.com/tiann/KernelSU/actions/workflows/build-kernel.yml</a>), perlu diketahui bahwa Anda harus menggunakan versi boot.img yang tepat. Sebagai contoh, jika perangkat Anda menunjukkan bahwa kernelnya adalah <code>5.10.101</code>, maka Anda harus mengunduh <code>5.10.101-xxxx.boot.xxx</code>.</p><p>Dan juga, silakan periksa format boot.img Anda, Anda harus menggunakan format yang tepat, seperti <code>lz4</code>、<code>gz</code>.</p><h2 id="flash-boot-img-ke-perangkat" tabindex="-1">Flash boot.img ke perangkat <a class="header-anchor" href="#flash-boot-img-ke-perangkat" aria-label="Permalink to &quot;Flash boot.img ke perangkat&quot;"></a></h2><p>Hubungkan perangkat Anda dengan <code>adb</code> lalu jalankan <code>adb reboot bootloader</code> untuk masuk ke mode fastboot, lalu gunakan perintah ini untuk mem-flash KernelSU:</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#B392F0;">fastboot</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">flash</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">boot</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">boot.img</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#6F42C1;">fastboot</span><span style="color:#24292E;"> </span><span style="color:#032F62;">flash</span><span style="color:#24292E;"> </span><span style="color:#032F62;">boot</span><span style="color:#24292E;"> </span><span style="color:#032F62;">boot.img</span></span></code></pre></div><h2 id="reboot" tabindex="-1">Reboot <a class="header-anchor" href="#reboot" aria-label="Permalink to &quot;Reboot&quot;"></a></h2><p>Ketika di-flash, Anda harus menyalakan ulang perangkat Anda:</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#B392F0;">fastboot</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">reboot</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#6F42C1;">fastboot</span><span style="color:#24292E;"> </span><span style="color:#032F62;">reboot</span></span></code></pre></div>',14),l=[s];function i(r,p,d,c,k,u){return e(),n("div",null,l)}const b=a(o,[["render",i]]);export{g as __pageData,b as default};

View File

@ -0,0 +1 @@
import{_ as a,o as e,c as n,Q as t}from"./chunks/framework.ec8f7e8e.js";const g=JSON.parse('{"title":"Instalasi","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/installation.md","filePath":"id_ID/guide/installation.md"}'),o={name:"id_ID/guide/installation.md"},s=t("",14),l=[s];function i(r,p,d,c,k,u){return e(),n("div",null,l)}const b=a(o,[["render",i]]);export{g as __pageData,b as default};

View File

@ -1 +0,0 @@
import{_ as a,o as e,c as n,O as t}from"./chunks/framework.43781440.js";const g=JSON.parse('{"title":"Instalasi","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/installation.md","filePath":"id_ID/guide/installation.md"}'),o={name:"id_ID/guide/installation.md"},s=t("",14),i=[s];function l(r,d,p,k,u,h){return e(),n("div",null,i)}const m=a(o,[["render",l]]);export{g as __pageData,m as default};

View File

@ -1,81 +1,161 @@
import{_ as a,o as e,c as n,O as s}from"./chunks/framework.43781440.js";const g=JSON.parse('{"title":"Panduan module","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/module.md","filePath":"id_ID/guide/module.md"}'),i={name:"id_ID/guide/module.md"},l=s(`<h1 id="panduan-module" tabindex="-1">Panduan module <a class="header-anchor" href="#panduan-module" aria-label="Permalink to &quot;Panduan module&quot;"></a></h1><p>KernelSU menyediakan mekanisme modul yang mencapai efek memodifikasi direktori sistem dengan tetap menjaga integritas partisi sistem. Mekanisme ini umumnya dikenal sebagai &quot;tanpa sistem&quot;.</p><p>Mekanisme modul KernelSU hampir sama dengan Magisk. Jika Anda terbiasa dengan pengembangan modul Magisk, mengembangkan modul KernelSU sangat mirip. Anda dapat melewati pengenalan modul di bawah ini dan hanya perlu membaca <a href="./difference-with-magisk.html">difference-with-magisk</a>.</p><h2 id="busybox" tabindex="-1">Busybox <a class="header-anchor" href="#busybox" aria-label="Permalink to &quot;Busybox&quot;"></a></h2><p>KernelSU dikirimkan dengan fitur biner BusyBox yang lengkap (termasuk dukungan penuh SELinux). Eksekusi terletak di <code>/data/adb/ksu/bin/busybox</code>. BusyBox KernelSU mendukung &quot;Mode Shell Standalone Shell&quot; yang dapat dialihkan waktu proses. Apa yang dimaksud dengan mode mandiri ini adalah bahwa ketika dijalankan di shell <code>ash</code> dari BusyBox, setiap perintah akan langsung menggunakan applet di dalam BusyBox, terlepas dari apa yang ditetapkan sebagai <code>PATH</code>. Misalnya, perintah seperti <code>ls</code>, <code>rm</code>, <code>chmod</code> <strong>TIDAK</strong> akan menggunakan apa yang ada di <code>PATH</code> (dalam kasus Android secara default akan menjadi <code>/system/bin/ls</code>, <code> /system/bin/rm</code>, dan <code>/system/bin/chmod</code> masing-masing), tetapi akan langsung memanggil applet BusyBox internal. Ini memastikan bahwa skrip selalu berjalan di lingkungan yang dapat diprediksi dan selalu memiliki rangkaian perintah lengkap, apa pun versi Android yang menjalankannya. Untuk memaksa perintah <em>not</em> menggunakan BusyBox, Anda harus memanggil yang dapat dieksekusi dengan path lengkap.</p><p>Setiap skrip shell tunggal yang berjalan dalam konteks KernelSU akan dieksekusi di shell <code>ash</code> BusyBox dengan mode mandiri diaktifkan. Untuk apa yang relevan dengan pengembang pihak ke-3, ini termasuk semua skrip boot dan skrip instalasi modul.</p><p>Bagi yang ingin menggunakan fitur “Standalone Mode” ini di luar KernelSU, ada 2 cara untuk mengaktifkannya:</p><ol><li>Tetapkan variabel lingkungan <code>ASH_STANDALONE</code> ke <code>1</code><br>Contoh: <code>ASH_STANDALONE=1 /data/adb/ksu/bin/busybox sh &lt;script&gt;</code></li><li>Beralih dengan opsi baris perintah:<br><code>/data/adb/ksu/bin/busybox sh -o mandiri &lt;script&gt;</code></li></ol><p>Untuk memastikan semua shell <code>sh</code> selanjutnya dijalankan juga dalam mode mandiri, opsi 1 adalah metode yang lebih disukai (dan inilah yang digunakan secara internal oleh KernelSU dan manajer KernelSU) karena variabel lingkungan diwariskan ke proses anak.</p><p>::: perbedaan tip dengan Magisk</p><p>BusyBox KernelSU sekarang menggunakan file biner yang dikompilasi langsung dari proyek Magisk. <strong>Berkat Magisk!</strong> Oleh karena itu, Anda tidak perlu khawatir tentang masalah kompatibilitas antara skrip BusyBox di Magisk dan KernelSU karena keduanya persis sama! :::</p><h2 id="kernelsu-module" tabindex="-1">KernelSU module <a class="header-anchor" href="#kernelsu-module" aria-label="Permalink to &quot;KernelSU module&quot;"></a></h2><p>Modul KernelSU adalah folder yang ditempatkan di <code>/data/adb/modules</code> dengan struktur di bawah ini:</p><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">/data/adb/modules</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;">|</span></span>
<span class="line"><span style="color:#A6ACCD;"> $MODID &lt;--- The folder is named with the ID of the module</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Module Identity ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> module.prop &lt;--- This file stores the metadata of the module</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Main Contents ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> system &lt;--- This folder will be mounted if skip_mount does not exist</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Status Flags ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> skip_mount &lt;--- If exists, KernelSU will NOT mount your system folder</span></span>
<span class="line"><span style="color:#A6ACCD;"> disable &lt;--- If exists, the module will be disabled</span></span>
<span class="line"><span style="color:#A6ACCD;"> remove &lt;--- If exists, the module will be removed next reboot</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Optional Files ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> post-fs-data.sh &lt;--- This script will be executed in post-fs-data</span></span>
<span class="line"><span style="color:#A6ACCD;"> service.sh &lt;--- This script will be executed in late_start service</span></span>
<span class="line"><span style="color:#A6ACCD;">| uninstall.sh &lt;--- This script will be executed when KernelSU removes your module</span></span>
<span class="line"><span style="color:#A6ACCD;"> system.prop &lt;--- Properties in this file will be loaded as system properties by resetprop</span></span>
<span class="line"><span style="color:#A6ACCD;"> sepolicy.rule &lt;--- Additional custom sepolicy rules</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Auto Generated, DO NOT MANUALLY CREATE OR MODIFY ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> vendor &lt;--- A symlink to $MODID/system/vendor</span></span>
<span class="line"><span style="color:#A6ACCD;"> product &lt;--- A symlink to $MODID/system/product</span></span>
<span class="line"><span style="color:#A6ACCD;"> system_ext &lt;--- A symlink to $MODID/system/system_ext</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** Any additional files / folders are allowed ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;">|</span></span>
<span class="line"><span style="color:#A6ACCD;"> another_module</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span></code></pre></div><p>::: perbedaan tip dengan Magisk KernelSU tidak memiliki dukungan bawaan untuk Zygisk, jadi tidak ada konten terkait Zygisk dalam modul. Namun, Anda dapat menggunakan <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a> untuk mendukung modul Zygisk. Dalam hal ini, konten modul Zygisk identik dengan yang didukung oleh Magisk. :::</p><h3 id="module-prop" tabindex="-1">module.prop <a class="header-anchor" href="#module-prop" aria-label="Permalink to &quot;module.prop&quot;"></a></h3><p>module.prop adalah file konfigurasi untuk sebuah modul. Di KernelSU, jika modul tidak berisi file ini, maka tidak akan dikenali sebagai modul. Format file ini adalah sebagai berikut:</p><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">id=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">name=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">version=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">versioncode=&lt;int&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">author=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">description=&lt;string&gt;</span></span></code></pre></div><ul><li><code>id</code> harus cocok dengan ekspresi reguler ini: <code>^[a-zA-Z][a-zA-Z0-9._-]+$</code><br> contoh: <code>a_module</code>, <code>a.module</code>, <code>module-101</code>, <code>a module</code>, <code>1_module</code>, <code>-a-module</code><br> Ini adalah <strong>pengidentifikasi unik</strong> modul Anda. Anda tidak boleh mengubahnya setelah dipublikasikan.</li><li><code>versionCode</code> harus berupa <strong>integer</strong>. Ini digunakan untuk membandingkan versi</li><li>Lainnya yang tidak disebutkan di atas dapat berupa string <strong>satu baris</strong>.</li><li>Pastikan untuk menggunakan tipe jeda baris <code>UNIX (LF)</code> dan bukan <code>Windows (CR+LF)</code> atau <code>Macintosh (CR)</code>.</li></ul><h3 id="shell-skrip" tabindex="-1">Shell skrip <a class="header-anchor" href="#shell-skrip" aria-label="Permalink to &quot;Shell skrip&quot;"></a></h3><p>Harap baca bagian <a href="#boot-scripts">Boot Scripts</a> untuk memahami perbedaan antara <code>post-fs-data.sh</code> dan <code>service.sh</code>. Untuk sebagian besar pengembang modul, <code>service.sh</code> sudah cukup baik jika Anda hanya perlu menjalankan skrip boot.</p><p>Di semua skrip modul Anda, harap gunakan <code>MODDIR=\${0%/*}</code> untuk mendapatkan jalur direktori dasar modul Anda; lakukan <strong>TIDAK</strong> hardcode jalur modul Anda dalam skrip.</p><p>::: perbedaan tip dengan Magisk Anda dapat menggunakan variabel lingkungan KSU untuk menentukan apakah skrip berjalan di KernelSU atau Magisk. Jika berjalan di KernelSU, nilai ini akan disetel ke true. :::</p><h3 id="system-directory" tabindex="-1"><code>system</code> directory <a class="header-anchor" href="#system-directory" aria-label="Permalink to &quot;\`system\` directory&quot;"></a></h3><p>Isi direktori ini akan dihamparkan di atas partisi sistem /sistem menggunakan overlayfs setelah sistem di-boot. Ini berarti bahwa:</p><ol><li>File dengan nama yang sama dengan yang ada di direktori terkait di sistem akan ditimpa oleh file di direktori ini.</li><li>Folder dengan nama yang sama dengan yang ada di direktori terkait di sistem akan digabungkan dengan folder di direktori ini.</li></ol><p>Jika Anda ingin menghapus file atau folder di direktori sistem asli, Anda perlu membuat file dengan nama yang sama dengan file/folder di direktori modul menggunakan <code>mknod filename c 0 0</code>. Dengan cara ini, sistem overlayfs akan secara otomatis &quot;memutihkan&quot; file ini seolah-olah telah dihapus (partisi / sistem sebenarnya tidak diubah).</p><p>Anda juga dapat mendeklarasikan variabel bernama <code>REMOVE</code> yang berisi daftar direktori di <code>customize.sh</code> untuk menjalankan operasi penghapusan, dan KernelSU akan secara otomatis mengeksekusi <code>mknod &lt;TARGET&gt; c 0 0</code> di direktori modul yang sesuai. Misalnya:</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">HAPUS</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">=</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span></span>
<span class="line"><span style="color:#C3E88D;">/sistem/aplikasi/YouTube</span></span>
<span class="line"><span style="color:#C3E88D;">/system/app/Bloatware</span></span>
<span class="line"><span style="color:#89DDFF;">&quot;</span></span></code></pre></div><p>Daftar di atas akan mengeksekusi <code>mknod $MODPATH/system/app/YouTuBe c 0 0</code> dan <code>mknod $MODPATH/system/app/Bloatware c 0 0</code>; dan <code>/system/app/YouTube</code> dan <code>/system/app/Bloatware</code> akan dihapus setelah modul berlaku.</p><p>Jika Anda ingin mengganti direktori di sistem, Anda perlu membuat direktori dengan jalur yang sama di direktori modul Anda, lalu atur atribut <code>setfattr -n trusted.overlay.opaque -v y &lt;TARGET&gt;</code> untuk direktori ini. Dengan cara ini, sistem overlayfs akan secara otomatis mengganti direktori terkait di sistem (tanpa mengubah partisi /sistem).</p><p>Anda dapat mendeklarasikan variabel bernama <code>REPLACE</code> di file <code>customize.sh</code> Anda, yang menyertakan daftar direktori yang akan diganti, dan KernelSU akan secara otomatis melakukan operasi yang sesuai di direktori modul Anda. Misalnya:</p><p>REPLACE=&quot; /system/app/YouTube /system/app/Bloatware &quot;</p><p>Daftar ini akan secara otomatis membuat direktori <code>$MODPATH/system/app/YouTube</code> dan <code>$MODPATH/system/app/Bloatware</code>, lalu jalankan <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/ YouTube</code> dan <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/Bloatware</code>. Setelah modul berlaku, <code>/system/app/YouTube</code> dan <code>/system/app/Bloatware</code> akan diganti dengan direktori kosong.</p><p>::: perbedaan tip dengan Magisk</p><p>Mekanisme tanpa sistem KernelSU diimplementasikan melalui overlay kernel, sementara Magisk saat ini menggunakan magic mount (bind mount). Kedua metode implementasi tersebut memiliki perbedaan yang signifikan, tetapi tujuan utamanya sama: untuk memodifikasi file / sistem tanpa memodifikasi partisi / sistem secara fisik. :::</p><p>Jika Anda tertarik dengan overlayfs, disarankan untuk membaca <a href="https://docs.kernel.org/filesystems/overlayfs.html" target="_blank" rel="noreferrer">dokumentasi overlayfs</a> Kernel Linux.</p><h3 id="system-prop" tabindex="-1">system.prop <a class="header-anchor" href="#system-prop" aria-label="Permalink to &quot;system.prop&quot;"></a></h3><p>File ini mengikuti format yang sama dengan <code>build.prop</code>. Setiap baris terdiri dari <code>[kunci]=[nilai]</code>.</p><h3 id="sepolicy-rule" tabindex="-1">sepolicy.rule <a class="header-anchor" href="#sepolicy-rule" aria-label="Permalink to &quot;sepolicy.rule&quot;"></a></h3><p>Jika modul Anda memerlukan beberapa tambalan sepolicy tambahan, harap tambahkan aturan tersebut ke dalam file ini. Setiap baris dalam file ini akan diperlakukan sebagai pernyataan kebijakan.</p><h2 id="pemasangan-module" tabindex="-1">Pemasangan module <a class="header-anchor" href="#pemasangan-module" aria-label="Permalink to &quot;Pemasangan module&quot;"></a></h2><p>Penginstal modul KernelSU adalah modul KernelSU yang dikemas dalam file zip yang dapat di-flash di aplikasi pengelola KernelSU. Pemasang modul KernelSU yang paling sederhana hanyalah modul KernelSU yang dikemas sebagai file zip.</p><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">module.zip</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> customize.sh &lt;--- (Optional, more details later)</span></span>
<span class="line"><span style="color:#A6ACCD;"> This script will be sourced by update-binary</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ... /* The rest of module&#39;s files */</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span></code></pre></div><p>:::peringatan Modul KernelSU TIDAK didukung untuk diinstal dalam pemulihan kustom!! :::</p><h3 id="kostumisasi" tabindex="-1">Kostumisasi <a class="header-anchor" href="#kostumisasi" aria-label="Permalink to &quot;Kostumisasi&quot;"></a></h3><p>Jika Anda perlu menyesuaikan proses penginstalan modul, secara opsional Anda dapat membuat skrip di penginstal bernama <code>customize.sh</code>. Skrip ini akan <em>sourced</em> (tidak dijalankan!) oleh skrip penginstal modul setelah semua file diekstrak dan izin default serta konteks sekon diterapkan. Ini sangat berguna jika modul Anda memerlukan penyiapan tambahan berdasarkan ABI perangkat, atau Anda perlu menyetel izin khusus/konteks kedua untuk beberapa file modul Anda.</p><p>Jika Anda ingin sepenuhnya mengontrol dan menyesuaikan proses penginstalan, nyatakan <code>SKIPUNZIP=1</code> di <code>customize.sh</code> untuk melewati semua langkah penginstalan default. Dengan melakukannya, <code>customize.sh</code> Anda akan bertanggung jawab untuk menginstal semuanya dengan sendirinya.</p><p>Skrip <code>customize.sh</code> berjalan di shell BusyBox <code>ash</code> KernelSU dengan &quot;Mode Mandiri&quot; diaktifkan. Variabel dan fungsi berikut tersedia:</p><h4 id="variable" tabindex="-1">Variable <a class="header-anchor" href="#variable" aria-label="Permalink to &quot;Variable&quot;"></a></h4><ul><li><code>KSU</code> (bool): variabel untuk menandai bahwa skrip berjalan di lingkungan KernelSU, dan nilai variabel ini akan selalu benar. Anda dapat menggunakannya untuk membedakan antara KernelSU dan Magisk.</li><li><code>KSU_VER</code> (string): string versi dari KernelSU yang diinstal saat ini (mis. <code>v0.4.0</code>)</li><li><code>KSU_VER_CODE</code> (int): kode versi KernelSU yang terpasang saat ini di ruang pengguna (mis. <code>10672</code>)</li><li><code>KSU_KERNEL_VER_CODE</code> (int): kode versi KernelSU yang terpasang saat ini di ruang kernel (mis. <code>10672</code>)</li><li><code>BOOTMODE</code> (bool): selalu <code>true</code> di KernelSU</li><li><code>MODPATH</code> (jalur): jalur tempat file modul Anda harus diinstal</li><li><code>TMPDIR</code> (jalur): tempat di mana Anda dapat menyimpan file untuk sementara</li><li><code>ZIPFILE</code> (jalur): zip instalasi modul Anda</li><li><code>ARCH</code> (string): arsitektur CPU perangkat. Nilainya adalah <code>arm</code>, <code>arm64</code>, <code>x86</code>, atau <code>x64</code></li><li><code>IS64BIT</code> (bool): <code>true</code> jika <code>$ARCH</code> adalah <code>arm64</code> atau <code>x64</code></li><li><code>API</code> (int): level API (versi Android) perangkat (mis. <code>23</code> untuk Android 6.0)</li></ul><p>::: peringatan Di KernelSU, MAGISK_VER_CODE selalu 25200 dan MAGISK_VER selalu v25.2. Tolong jangan gunakan kedua variabel ini untuk menentukan apakah itu berjalan di KernelSU atau tidak. :::</p><h4 id="fungsi" tabindex="-1">Fungsi <a class="header-anchor" href="#fungsi" aria-label="Permalink to &quot;Fungsi&quot;"></a></h4><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">ui_print &lt;msg&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;"> print &lt;msg&gt; to console</span></span>
<span class="line"><span style="color:#A6ACCD;"> Avoid using &#39;echo&#39; as it will not display in custom recovery&#39;s console</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">abort &lt;msg&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;"> print error message &lt;msg&gt; to console and terminate the installation</span></span>
<span class="line"><span style="color:#A6ACCD;"> Avoid using &#39;exit&#39; as it will skip the termination cleanup steps</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">set_perm &lt;target&gt; &lt;owner&gt; &lt;group&gt; &lt;permission&gt; [context]</span></span>
<span class="line"><span style="color:#A6ACCD;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#A6ACCD;"> this function is a shorthand for the following commands:</span></span>
<span class="line"><span style="color:#A6ACCD;"> chown owner.group target</span></span>
<span class="line"><span style="color:#A6ACCD;"> chmod permission target</span></span>
<span class="line"><span style="color:#A6ACCD;"> chcon context target</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">set_perm_recursive &lt;directory&gt; &lt;owner&gt; &lt;group&gt; &lt;dirpermission&gt; &lt;filepermission&gt; [context]</span></span>
<span class="line"><span style="color:#A6ACCD;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#A6ACCD;"> for all files in &lt;directory&gt;, it will call:</span></span>
<span class="line"><span style="color:#A6ACCD;"> set_perm file owner group filepermission context</span></span>
<span class="line"><span style="color:#A6ACCD;"> for all directories in &lt;directory&gt; (including itself), it will call:</span></span>
<span class="line"><span style="color:#A6ACCD;"> set_perm dir owner group dirpermission context</span></span></code></pre></div><h2 id="boot-scripts" tabindex="-1">Boot scripts <a class="header-anchor" href="#boot-scripts" aria-label="Permalink to &quot;Boot scripts&quot;"></a></h2><p>Di KernelSU, skrip dibagi menjadi dua jenis berdasarkan mode operasinya: mode post-fs-data dan mode layanan late_start:</p><ul><li>mode pasca-fs-data <ul><li>Tahap ini adalah BLOKIR. Proses boot dijeda sebelum eksekusi selesai, atau 10 detik telah berlalu.</li><li>Skrip dijalankan sebelum modul apa pun dipasang. Ini memungkinkan pengembang modul untuk menyesuaikan modul mereka secara dinamis sebelum dipasang.</li><li>Tahap ini terjadi sebelum Zygote dimulai, yang berarti segalanya di Android</li><li><strong>PERINGATAN:</strong> menggunakan <code>setprop</code> akan menghentikan proses booting! Silakan gunakan <code>resetprop -n &lt;prop_name&gt; &lt;prop_value&gt;</code> sebagai gantinya.</li><li><strong>Hanya jalankan skrip dalam mode ini jika perlu.</strong></li></ul></li><li>mode layanan late_start <ul><li>Tahap ini NON-BLOCKING. Skrip Anda berjalan paralel dengan proses booting lainnya.</li><li><strong>Ini adalah tahap yang disarankan untuk menjalankan sebagian besar skrip.</strong></li></ul></li></ul><p>Di KernelSU, skrip startup dibagi menjadi dua jenis berdasarkan lokasi penyimpanannya: skrip umum dan skrip modul:</p><ul><li>Skrip Umum <ul><li>Ditempatkan di <code>/data/adb/post-fs-data.d</code> atau <code>/data/adb/service.d</code></li><li>Hanya dieksekusi jika skrip disetel sebagai dapat dieksekusi (<code>chmod +x script.sh</code>)</li><li>Skrip di <code>post-fs-data.d</code> berjalan dalam mode post-fs-data, dan skrip di <code>service.d</code> berjalan di mode layanan late_start.</li><li>Modul seharusnya <strong>TIDAK</strong> menambahkan skrip umum selama instalasi</li></ul></li><li>Skrip Modul <ul><li>Ditempatkan di folder modul itu sendiri</li><li>Hanya dijalankan jika modul diaktifkan</li><li><code>post-fs-data.sh</code> berjalan dalam mode post-fs-data, dan <code>service.sh</code> berjalan dalam mode layanan late_start.</li></ul></li></ul><p>Semua skrip boot akan berjalan di shell BusyBox <code>ash</code> KernelSU dengan &quot;Mode Mandiri&quot; diaktifkan.</p>`,60),o=[l];function t(d,p,r,c,u,m){return e(),n("div",null,o)}const y=a(i,[["render",t]]);export{g as __pageData,y as default};
import{_ as a,o as e,c as s,Q as n}from"./chunks/framework.ec8f7e8e.js";const g=JSON.parse('{"title":"Panduan module","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/module.md","filePath":"id_ID/guide/module.md"}'),l={name:"id_ID/guide/module.md"},i=n(`<h1 id="panduan-module" tabindex="-1">Panduan module <a class="header-anchor" href="#panduan-module" aria-label="Permalink to &quot;Panduan module&quot;"></a></h1><p>KernelSU menyediakan mekanisme modul yang mencapai efek memodifikasi direktori sistem dengan tetap menjaga integritas partisi sistem. Mekanisme ini umumnya dikenal sebagai &quot;tanpa sistem&quot;.</p><p>Mekanisme modul KernelSU hampir sama dengan Magisk. Jika Anda terbiasa dengan pengembangan modul Magisk, mengembangkan modul KernelSU sangat mirip. Anda dapat melewati pengenalan modul di bawah ini dan hanya perlu membaca <a href="./difference-with-magisk.html">difference-with-magisk</a>.</p><h2 id="busybox" tabindex="-1">Busybox <a class="header-anchor" href="#busybox" aria-label="Permalink to &quot;Busybox&quot;"></a></h2><p>KernelSU dikirimkan dengan fitur biner BusyBox yang lengkap (termasuk dukungan penuh SELinux). Eksekusi terletak di <code>/data/adb/ksu/bin/busybox</code>. BusyBox KernelSU mendukung &quot;Mode Shell Standalone Shell&quot; yang dapat dialihkan waktu proses. Apa yang dimaksud dengan mode mandiri ini adalah bahwa ketika dijalankan di shell <code>ash</code> dari BusyBox, setiap perintah akan langsung menggunakan applet di dalam BusyBox, terlepas dari apa yang ditetapkan sebagai <code>PATH</code>. Misalnya, perintah seperti <code>ls</code>, <code>rm</code>, <code>chmod</code> <strong>TIDAK</strong> akan menggunakan apa yang ada di <code>PATH</code> (dalam kasus Android secara default akan menjadi <code>/system/bin/ls</code>, <code> /system/bin/rm</code>, dan <code>/system/bin/chmod</code> masing-masing), tetapi akan langsung memanggil applet BusyBox internal. Ini memastikan bahwa skrip selalu berjalan di lingkungan yang dapat diprediksi dan selalu memiliki rangkaian perintah lengkap, apa pun versi Android yang menjalankannya. Untuk memaksa perintah <em>not</em> menggunakan BusyBox, Anda harus memanggil yang dapat dieksekusi dengan path lengkap.</p><p>Setiap skrip shell tunggal yang berjalan dalam konteks KernelSU akan dieksekusi di shell <code>ash</code> BusyBox dengan mode mandiri diaktifkan. Untuk apa yang relevan dengan pengembang pihak ke-3, ini termasuk semua skrip boot dan skrip instalasi modul.</p><p>Bagi yang ingin menggunakan fitur “Standalone Mode” ini di luar KernelSU, ada 2 cara untuk mengaktifkannya:</p><ol><li>Tetapkan variabel lingkungan <code>ASH_STANDALONE</code> ke <code>1</code><br>Contoh: <code>ASH_STANDALONE=1 /data/adb/ksu/bin/busybox sh &lt;script&gt;</code></li><li>Beralih dengan opsi baris perintah:<br><code>/data/adb/ksu/bin/busybox sh -o mandiri &lt;script&gt;</code></li></ol><p>Untuk memastikan semua shell <code>sh</code> selanjutnya dijalankan juga dalam mode mandiri, opsi 1 adalah metode yang lebih disukai (dan inilah yang digunakan secara internal oleh KernelSU dan manajer KernelSU) karena variabel lingkungan diwariskan ke proses anak.</p><p>::: perbedaan tip dengan Magisk</p><p>BusyBox KernelSU sekarang menggunakan file biner yang dikompilasi langsung dari proyek Magisk. <strong>Berkat Magisk!</strong> Oleh karena itu, Anda tidak perlu khawatir tentang masalah kompatibilitas antara skrip BusyBox di Magisk dan KernelSU karena keduanya persis sama! :::</p><h2 id="kernelsu-module" tabindex="-1">KernelSU module <a class="header-anchor" href="#kernelsu-module" aria-label="Permalink to &quot;KernelSU module&quot;"></a></h2><p>Modul KernelSU adalah folder yang ditempatkan di <code>/data/adb/modules</code> dengan struktur di bawah ini:</p><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">/data/adb/modules</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;">|</span></span>
<span class="line"><span style="color:#e1e4e8;"> $MODID &lt;--- The folder is named with the ID of the module</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Module Identity ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> module.prop &lt;--- This file stores the metadata of the module</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Main Contents ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> system &lt;--- This folder will be mounted if skip_mount does not exist</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Status Flags ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> skip_mount &lt;--- If exists, KernelSU will NOT mount your system folder</span></span>
<span class="line"><span style="color:#e1e4e8;"> disable &lt;--- If exists, the module will be disabled</span></span>
<span class="line"><span style="color:#e1e4e8;"> remove &lt;--- If exists, the module will be removed next reboot</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Optional Files ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> post-fs-data.sh &lt;--- This script will be executed in post-fs-data</span></span>
<span class="line"><span style="color:#e1e4e8;"> service.sh &lt;--- This script will be executed in late_start service</span></span>
<span class="line"><span style="color:#e1e4e8;">| uninstall.sh &lt;--- This script will be executed when KernelSU removes your module</span></span>
<span class="line"><span style="color:#e1e4e8;"> system.prop &lt;--- Properties in this file will be loaded as system properties by resetprop</span></span>
<span class="line"><span style="color:#e1e4e8;"> sepolicy.rule &lt;--- Additional custom sepolicy rules</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Auto Generated, DO NOT MANUALLY CREATE OR MODIFY ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> vendor &lt;--- A symlink to $MODID/system/vendor</span></span>
<span class="line"><span style="color:#e1e4e8;"> product &lt;--- A symlink to $MODID/system/product</span></span>
<span class="line"><span style="color:#e1e4e8;"> system_ext &lt;--- A symlink to $MODID/system/system_ext</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** Any additional files / folders are allowed ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;">|</span></span>
<span class="line"><span style="color:#e1e4e8;"> another_module</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">/data/adb/modules</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;">|</span></span>
<span class="line"><span style="color:#24292e;"> $MODID &lt;--- The folder is named with the ID of the module</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Module Identity ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> module.prop &lt;--- This file stores the metadata of the module</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Main Contents ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> system &lt;--- This folder will be mounted if skip_mount does not exist</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Status Flags ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> skip_mount &lt;--- If exists, KernelSU will NOT mount your system folder</span></span>
<span class="line"><span style="color:#24292e;"> disable &lt;--- If exists, the module will be disabled</span></span>
<span class="line"><span style="color:#24292e;"> remove &lt;--- If exists, the module will be removed next reboot</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Optional Files ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> post-fs-data.sh &lt;--- This script will be executed in post-fs-data</span></span>
<span class="line"><span style="color:#24292e;"> service.sh &lt;--- This script will be executed in late_start service</span></span>
<span class="line"><span style="color:#24292e;">| uninstall.sh &lt;--- This script will be executed when KernelSU removes your module</span></span>
<span class="line"><span style="color:#24292e;"> system.prop &lt;--- Properties in this file will be loaded as system properties by resetprop</span></span>
<span class="line"><span style="color:#24292e;"> sepolicy.rule &lt;--- Additional custom sepolicy rules</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Auto Generated, DO NOT MANUALLY CREATE OR MODIFY ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> vendor &lt;--- A symlink to $MODID/system/vendor</span></span>
<span class="line"><span style="color:#24292e;"> product &lt;--- A symlink to $MODID/system/product</span></span>
<span class="line"><span style="color:#24292e;"> system_ext &lt;--- A symlink to $MODID/system/system_ext</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** Any additional files / folders are allowed ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;">|</span></span>
<span class="line"><span style="color:#24292e;"> another_module</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span></code></pre></div><p>::: perbedaan tip dengan Magisk KernelSU tidak memiliki dukungan bawaan untuk Zygisk, jadi tidak ada konten terkait Zygisk dalam modul. Namun, Anda dapat menggunakan <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a> untuk mendukung modul Zygisk. Dalam hal ini, konten modul Zygisk identik dengan yang didukung oleh Magisk. :::</p><h3 id="module-prop" tabindex="-1">module.prop <a class="header-anchor" href="#module-prop" aria-label="Permalink to &quot;module.prop&quot;"></a></h3><p>module.prop adalah file konfigurasi untuk sebuah modul. Di KernelSU, jika modul tidak berisi file ini, maka tidak akan dikenali sebagai modul. Format file ini adalah sebagai berikut:</p><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">id=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">name=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">version=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">versioncode=&lt;int&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">author=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">description=&lt;string&gt;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">id=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">name=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">version=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">versioncode=&lt;int&gt;</span></span>
<span class="line"><span style="color:#24292e;">author=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">description=&lt;string&gt;</span></span></code></pre></div><ul><li><code>id</code> harus cocok dengan ekspresi reguler ini: <code>^[a-zA-Z][a-zA-Z0-9._-]+$</code><br> contoh: <code>a_module</code>, <code>a.module</code>, <code>module-101</code>, <code>a module</code>, <code>1_module</code>, <code>-a-module</code><br> Ini adalah <strong>pengidentifikasi unik</strong> modul Anda. Anda tidak boleh mengubahnya setelah dipublikasikan.</li><li><code>versionCode</code> harus berupa <strong>integer</strong>. Ini digunakan untuk membandingkan versi</li><li>Lainnya yang tidak disebutkan di atas dapat berupa string <strong>satu baris</strong>.</li><li>Pastikan untuk menggunakan tipe jeda baris <code>UNIX (LF)</code> dan bukan <code>Windows (CR+LF)</code> atau <code>Macintosh (CR)</code>.</li></ul><h3 id="shell-skrip" tabindex="-1">Shell skrip <a class="header-anchor" href="#shell-skrip" aria-label="Permalink to &quot;Shell skrip&quot;"></a></h3><p>Harap baca bagian <a href="#boot-scripts">Boot Scripts</a> untuk memahami perbedaan antara <code>post-fs-data.sh</code> dan <code>service.sh</code>. Untuk sebagian besar pengembang modul, <code>service.sh</code> sudah cukup baik jika Anda hanya perlu menjalankan skrip boot.</p><p>Di semua skrip modul Anda, harap gunakan <code>MODDIR=\${0%/*}</code> untuk mendapatkan jalur direktori dasar modul Anda; lakukan <strong>TIDAK</strong> hardcode jalur modul Anda dalam skrip.</p><p>::: perbedaan tip dengan Magisk Anda dapat menggunakan variabel lingkungan KSU untuk menentukan apakah skrip berjalan di KernelSU atau Magisk. Jika berjalan di KernelSU, nilai ini akan disetel ke true. :::</p><h3 id="system-directory" tabindex="-1"><code>system</code> directory <a class="header-anchor" href="#system-directory" aria-label="Permalink to &quot;\`system\` directory&quot;"></a></h3><p>Isi direktori ini akan dihamparkan di atas partisi sistem /sistem menggunakan overlayfs setelah sistem di-boot. Ini berarti bahwa:</p><ol><li>File dengan nama yang sama dengan yang ada di direktori terkait di sistem akan ditimpa oleh file di direktori ini.</li><li>Folder dengan nama yang sama dengan yang ada di direktori terkait di sistem akan digabungkan dengan folder di direktori ini.</li></ol><p>Jika Anda ingin menghapus file atau folder di direktori sistem asli, Anda perlu membuat file dengan nama yang sama dengan file/folder di direktori modul menggunakan <code>mknod filename c 0 0</code>. Dengan cara ini, sistem overlayfs akan secara otomatis &quot;memutihkan&quot; file ini seolah-olah telah dihapus (partisi / sistem sebenarnya tidak diubah).</p><p>Anda juga dapat mendeklarasikan variabel bernama <code>REMOVE</code> yang berisi daftar direktori di <code>customize.sh</code> untuk menjalankan operasi penghapusan, dan KernelSU akan secara otomatis mengeksekusi <code>mknod &lt;TARGET&gt; c 0 0</code> di direktori modul yang sesuai. Misalnya:</p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#B392F0;">HAPUS</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;</span></span>
<span class="line"><span style="color:#9ECBFF;">/sistem/aplikasi/YouTube</span></span>
<span class="line"><span style="color:#9ECBFF;">/system/app/Bloatware</span></span>
<span class="line"><span style="color:#9ECBFF;">&quot;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#6F42C1;">HAPUS</span><span style="color:#24292E;"> </span><span style="color:#032F62;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;</span></span>
<span class="line"><span style="color:#032F62;">/sistem/aplikasi/YouTube</span></span>
<span class="line"><span style="color:#032F62;">/system/app/Bloatware</span></span>
<span class="line"><span style="color:#032F62;">&quot;</span></span></code></pre></div><p>Daftar di atas akan mengeksekusi <code>mknod $MODPATH/system/app/YouTuBe c 0 0</code> dan <code>mknod $MODPATH/system/app/Bloatware c 0 0</code>; dan <code>/system/app/YouTube</code> dan <code>/system/app/Bloatware</code> akan dihapus setelah modul berlaku.</p><p>Jika Anda ingin mengganti direktori di sistem, Anda perlu membuat direktori dengan jalur yang sama di direktori modul Anda, lalu atur atribut <code>setfattr -n trusted.overlay.opaque -v y &lt;TARGET&gt;</code> untuk direktori ini. Dengan cara ini, sistem overlayfs akan secara otomatis mengganti direktori terkait di sistem (tanpa mengubah partisi /sistem).</p><p>Anda dapat mendeklarasikan variabel bernama <code>REPLACE</code> di file <code>customize.sh</code> Anda, yang menyertakan daftar direktori yang akan diganti, dan KernelSU akan secara otomatis melakukan operasi yang sesuai di direktori modul Anda. Misalnya:</p><p>REPLACE=&quot; /system/app/YouTube /system/app/Bloatware &quot;</p><p>Daftar ini akan secara otomatis membuat direktori <code>$MODPATH/system/app/YouTube</code> dan <code>$MODPATH/system/app/Bloatware</code>, lalu jalankan <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/ YouTube</code> dan <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/Bloatware</code>. Setelah modul berlaku, <code>/system/app/YouTube</code> dan <code>/system/app/Bloatware</code> akan diganti dengan direktori kosong.</p><p>::: perbedaan tip dengan Magisk</p><p>Mekanisme tanpa sistem KernelSU diimplementasikan melalui overlay kernel, sementara Magisk saat ini menggunakan magic mount (bind mount). Kedua metode implementasi tersebut memiliki perbedaan yang signifikan, tetapi tujuan utamanya sama: untuk memodifikasi file / sistem tanpa memodifikasi partisi / sistem secara fisik. :::</p><p>Jika Anda tertarik dengan overlayfs, disarankan untuk membaca <a href="https://docs.kernel.org/filesystems/overlayfs.html" target="_blank" rel="noreferrer">dokumentasi overlayfs</a> Kernel Linux.</p><h3 id="system-prop" tabindex="-1">system.prop <a class="header-anchor" href="#system-prop" aria-label="Permalink to &quot;system.prop&quot;"></a></h3><p>File ini mengikuti format yang sama dengan <code>build.prop</code>. Setiap baris terdiri dari <code>[kunci]=[nilai]</code>.</p><h3 id="sepolicy-rule" tabindex="-1">sepolicy.rule <a class="header-anchor" href="#sepolicy-rule" aria-label="Permalink to &quot;sepolicy.rule&quot;"></a></h3><p>Jika modul Anda memerlukan beberapa tambalan sepolicy tambahan, harap tambahkan aturan tersebut ke dalam file ini. Setiap baris dalam file ini akan diperlakukan sebagai pernyataan kebijakan.</p><h2 id="pemasangan-module" tabindex="-1">Pemasangan module <a class="header-anchor" href="#pemasangan-module" aria-label="Permalink to &quot;Pemasangan module&quot;"></a></h2><p>Penginstal modul KernelSU adalah modul KernelSU yang dikemas dalam file zip yang dapat di-flash di aplikasi pengelola KernelSU. Pemasang modul KernelSU yang paling sederhana hanyalah modul KernelSU yang dikemas sebagai file zip.</p><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">module.zip</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;"> customize.sh &lt;--- (Optional, more details later)</span></span>
<span class="line"><span style="color:#e1e4e8;"> This script will be sourced by update-binary</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ... /* The rest of module&#39;s files */</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">module.zip</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;"> customize.sh &lt;--- (Optional, more details later)</span></span>
<span class="line"><span style="color:#24292e;"> This script will be sourced by update-binary</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ... /* The rest of module&#39;s files */</span></span>
<span class="line"><span style="color:#24292e;"></span></span></code></pre></div><p>:::peringatan Modul KernelSU TIDAK didukung untuk diinstal dalam pemulihan kustom!! :::</p><h3 id="kostumisasi" tabindex="-1">Kostumisasi <a class="header-anchor" href="#kostumisasi" aria-label="Permalink to &quot;Kostumisasi&quot;"></a></h3><p>Jika Anda perlu menyesuaikan proses penginstalan modul, secara opsional Anda dapat membuat skrip di penginstal bernama <code>customize.sh</code>. Skrip ini akan <em>sourced</em> (tidak dijalankan!) oleh skrip penginstal modul setelah semua file diekstrak dan izin default serta konteks sekon diterapkan. Ini sangat berguna jika modul Anda memerlukan penyiapan tambahan berdasarkan ABI perangkat, atau Anda perlu menyetel izin khusus/konteks kedua untuk beberapa file modul Anda.</p><p>Jika Anda ingin sepenuhnya mengontrol dan menyesuaikan proses penginstalan, nyatakan <code>SKIPUNZIP=1</code> di <code>customize.sh</code> untuk melewati semua langkah penginstalan default. Dengan melakukannya, <code>customize.sh</code> Anda akan bertanggung jawab untuk menginstal semuanya dengan sendirinya.</p><p>Skrip <code>customize.sh</code> berjalan di shell BusyBox <code>ash</code> KernelSU dengan &quot;Mode Mandiri&quot; diaktifkan. Variabel dan fungsi berikut tersedia:</p><h4 id="variable" tabindex="-1">Variable <a class="header-anchor" href="#variable" aria-label="Permalink to &quot;Variable&quot;"></a></h4><ul><li><code>KSU</code> (bool): variabel untuk menandai bahwa skrip berjalan di lingkungan KernelSU, dan nilai variabel ini akan selalu benar. Anda dapat menggunakannya untuk membedakan antara KernelSU dan Magisk.</li><li><code>KSU_VER</code> (string): string versi dari KernelSU yang diinstal saat ini (mis. <code>v0.4.0</code>)</li><li><code>KSU_VER_CODE</code> (int): kode versi KernelSU yang terpasang saat ini di ruang pengguna (mis. <code>10672</code>)</li><li><code>KSU_KERNEL_VER_CODE</code> (int): kode versi KernelSU yang terpasang saat ini di ruang kernel (mis. <code>10672</code>)</li><li><code>BOOTMODE</code> (bool): selalu <code>true</code> di KernelSU</li><li><code>MODPATH</code> (jalur): jalur tempat file modul Anda harus diinstal</li><li><code>TMPDIR</code> (jalur): tempat di mana Anda dapat menyimpan file untuk sementara</li><li><code>ZIPFILE</code> (jalur): zip instalasi modul Anda</li><li><code>ARCH</code> (string): arsitektur CPU perangkat. Nilainya adalah <code>arm</code>, <code>arm64</code>, <code>x86</code>, atau <code>x64</code></li><li><code>IS64BIT</code> (bool): <code>true</code> jika <code>$ARCH</code> adalah <code>arm64</code> atau <code>x64</code></li><li><code>API</code> (int): level API (versi Android) perangkat (mis. <code>23</code> untuk Android 6.0)</li></ul><p>::: peringatan Di KernelSU, MAGISK_VER_CODE selalu 25200 dan MAGISK_VER selalu v25.2. Tolong jangan gunakan kedua variabel ini untuk menentukan apakah itu berjalan di KernelSU atau tidak. :::</p><h4 id="fungsi" tabindex="-1">Fungsi <a class="header-anchor" href="#fungsi" aria-label="Permalink to &quot;Fungsi&quot;"></a></h4><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">ui_print &lt;msg&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;"> print &lt;msg&gt; to console</span></span>
<span class="line"><span style="color:#e1e4e8;"> Avoid using &#39;echo&#39; as it will not display in custom recovery&#39;s console</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">abort &lt;msg&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;"> print error message &lt;msg&gt; to console and terminate the installation</span></span>
<span class="line"><span style="color:#e1e4e8;"> Avoid using &#39;exit&#39; as it will skip the termination cleanup steps</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">set_perm &lt;target&gt; &lt;owner&gt; &lt;group&gt; &lt;permission&gt; [context]</span></span>
<span class="line"><span style="color:#e1e4e8;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#e1e4e8;"> this function is a shorthand for the following commands:</span></span>
<span class="line"><span style="color:#e1e4e8;"> chown owner.group target</span></span>
<span class="line"><span style="color:#e1e4e8;"> chmod permission target</span></span>
<span class="line"><span style="color:#e1e4e8;"> chcon context target</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">set_perm_recursive &lt;directory&gt; &lt;owner&gt; &lt;group&gt; &lt;dirpermission&gt; &lt;filepermission&gt; [context]</span></span>
<span class="line"><span style="color:#e1e4e8;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#e1e4e8;"> for all files in &lt;directory&gt;, it will call:</span></span>
<span class="line"><span style="color:#e1e4e8;"> set_perm file owner group filepermission context</span></span>
<span class="line"><span style="color:#e1e4e8;"> for all directories in &lt;directory&gt; (including itself), it will call:</span></span>
<span class="line"><span style="color:#e1e4e8;"> set_perm dir owner group dirpermission context</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">ui_print &lt;msg&gt;</span></span>
<span class="line"><span style="color:#24292e;"> print &lt;msg&gt; to console</span></span>
<span class="line"><span style="color:#24292e;"> Avoid using &#39;echo&#39; as it will not display in custom recovery&#39;s console</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">abort &lt;msg&gt;</span></span>
<span class="line"><span style="color:#24292e;"> print error message &lt;msg&gt; to console and terminate the installation</span></span>
<span class="line"><span style="color:#24292e;"> Avoid using &#39;exit&#39; as it will skip the termination cleanup steps</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">set_perm &lt;target&gt; &lt;owner&gt; &lt;group&gt; &lt;permission&gt; [context]</span></span>
<span class="line"><span style="color:#24292e;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#24292e;"> this function is a shorthand for the following commands:</span></span>
<span class="line"><span style="color:#24292e;"> chown owner.group target</span></span>
<span class="line"><span style="color:#24292e;"> chmod permission target</span></span>
<span class="line"><span style="color:#24292e;"> chcon context target</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">set_perm_recursive &lt;directory&gt; &lt;owner&gt; &lt;group&gt; &lt;dirpermission&gt; &lt;filepermission&gt; [context]</span></span>
<span class="line"><span style="color:#24292e;"> if [context] is not set, the default is &quot;u:object_r:system_file:s0&quot;</span></span>
<span class="line"><span style="color:#24292e;"> for all files in &lt;directory&gt;, it will call:</span></span>
<span class="line"><span style="color:#24292e;"> set_perm file owner group filepermission context</span></span>
<span class="line"><span style="color:#24292e;"> for all directories in &lt;directory&gt; (including itself), it will call:</span></span>
<span class="line"><span style="color:#24292e;"> set_perm dir owner group dirpermission context</span></span></code></pre></div><h2 id="boot-scripts" tabindex="-1">Boot scripts <a class="header-anchor" href="#boot-scripts" aria-label="Permalink to &quot;Boot scripts&quot;"></a></h2><p>Di KernelSU, skrip dibagi menjadi dua jenis berdasarkan mode operasinya: mode post-fs-data dan mode layanan late_start:</p><ul><li>mode pasca-fs-data <ul><li>Tahap ini adalah BLOKIR. Proses boot dijeda sebelum eksekusi selesai, atau 10 detik telah berlalu.</li><li>Skrip dijalankan sebelum modul apa pun dipasang. Ini memungkinkan pengembang modul untuk menyesuaikan modul mereka secara dinamis sebelum dipasang.</li><li>Tahap ini terjadi sebelum Zygote dimulai, yang berarti segalanya di Android</li><li><strong>PERINGATAN:</strong> menggunakan <code>setprop</code> akan menghentikan proses booting! Silakan gunakan <code>resetprop -n &lt;prop_name&gt; &lt;prop_value&gt;</code> sebagai gantinya.</li><li><strong>Hanya jalankan skrip dalam mode ini jika perlu.</strong></li></ul></li><li>mode layanan late_start <ul><li>Tahap ini NON-BLOCKING. Skrip Anda berjalan paralel dengan proses booting lainnya.</li><li><strong>Ini adalah tahap yang disarankan untuk menjalankan sebagian besar skrip.</strong></li></ul></li></ul><p>Di KernelSU, skrip startup dibagi menjadi dua jenis berdasarkan lokasi penyimpanannya: skrip umum dan skrip modul:</p><ul><li>Skrip Umum <ul><li>Ditempatkan di <code>/data/adb/post-fs-data.d</code> atau <code>/data/adb/service.d</code></li><li>Hanya dieksekusi jika skrip disetel sebagai dapat dieksekusi (<code>chmod +x script.sh</code>)</li><li>Skrip di <code>post-fs-data.d</code> berjalan dalam mode post-fs-data, dan skrip di <code>service.d</code> berjalan di mode layanan late_start.</li><li>Modul seharusnya <strong>TIDAK</strong> menambahkan skrip umum selama instalasi</li></ul></li><li>Skrip Modul <ul><li>Ditempatkan di folder modul itu sendiri</li><li>Hanya dijalankan jika modul diaktifkan</li><li><code>post-fs-data.sh</code> berjalan dalam mode post-fs-data, dan <code>service.sh</code> berjalan dalam mode layanan late_start.</li></ul></li></ul><p>Semua skrip boot akan berjalan di shell BusyBox <code>ash</code> KernelSU dengan &quot;Mode Mandiri&quot; diaktifkan.</p>`,60),o=[i];function t(p,r,d,c,u,m){return e(),s("div",null,o)}const y=a(l,[["render",t]]);export{g as __pageData,y as default};

View File

@ -0,0 +1 @@
import{_ as a,o as e,c as s,Q as n}from"./chunks/framework.ec8f7e8e.js";const g=JSON.parse('{"title":"Panduan module","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/module.md","filePath":"id_ID/guide/module.md"}'),l={name:"id_ID/guide/module.md"},i=n("",60),o=[i];function t(p,r,d,c,u,m){return e(),s("div",null,o)}const y=a(l,[["render",t]]);export{g as __pageData,y as default};

View File

@ -1 +0,0 @@
import{_ as a,o as e,c as n,O as s}from"./chunks/framework.43781440.js";const g=JSON.parse('{"title":"Panduan module","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/module.md","filePath":"id_ID/guide/module.md"}'),i={name:"id_ID/guide/module.md"},l=s("",60),o=[l];function t(d,p,r,c,u,m){return e(),n("div",null,o)}const y=a(i,[["render",t]]);export{g as __pageData,y as default};

View File

@ -1 +1 @@
import{_ as a,o as e,c as n,O as i}from"./chunks/framework.43781440.js";const g=JSON.parse('{"title":"Recovery dari bootloop","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/rescue-from-bootloop.md","filePath":"id_ID/guide/rescue-from-bootloop.md"}'),t={name:"id_ID/guide/rescue-from-bootloop.md"},m=i("",23),o=[m];function r(d,l,u,s,k,b){return e(),n("div",null,o)}const h=a(t,[["render",r]]);export{g as __pageData,h as default};
import{_ as a,o as e,c as n,Q as i}from"./chunks/framework.ec8f7e8e.js";const g=JSON.parse('{"title":"Recovery dari bootloop","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/rescue-from-bootloop.md","filePath":"id_ID/guide/rescue-from-bootloop.md"}'),t={name:"id_ID/guide/rescue-from-bootloop.md"},m=i("",23),o=[m];function r(d,l,u,s,k,b){return e(),n("div",null,o)}const h=a(t,[["render",r]]);export{g as __pageData,h as default};

View File

@ -1 +1 @@
import{d as r}from"./chunks/repos.9a031e32.js";import{o as n,c as t,z as e,F as l,L as d,b as s,O as u,t as i}from"./chunks/framework.43781440.js";const o=u('<h1 id="perangkat-yang-didukung-tidak-resmi" tabindex="-1">Perangkat Yang Didukung Tidak Resmi <a class="header-anchor" href="#perangkat-yang-didukung-tidak-resmi" aria-label="Permalink to &quot;Perangkat Yang Didukung Tidak Resmi&quot;"></a></h1><p>:::peringatan</p><p>di halaman ini, terdapat kernel untuk perangkat non-GKI yang mendukung KernelSU yang dikelola oleh pengembang lain.</p><p>:::</p><p>:::peringatan</p><p>Halaman ini hanya untuk Anda yang ingin menemukan kode sumber yang sesuai dengan perangkat Anda, itu <strong>BUKAN</strong> berarti kode sumber telah ditinjau oleh <em>KernelSU Developers</em>. Anda harus menggunakannya dengan risiko Anda sendiri.</p><p>:::</p>',7),g=e("thead",null,[e("tr",null,[e("th",null,"Pengelola"),e("th",null,"Repository"),e("th",null,"Perangkat yang didukung")])],-1),_=["href"],k=["href"],b=JSON.parse('{"title":"Perangkat Yang Didukung Tidak Resmi","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/unofficially-support-devices.md","filePath":"id_ID/guide/unofficially-support-devices.md"}'),p={name:"id_ID/guide/unofficially-support-devices.md"},D=Object.assign(p,{setup(m){return(c,h)=>(n(),t("div",null,[o,e("table",null,[g,e("tbody",null,[(n(!0),t(l,null,d(s(r),a=>(n(),t("tr",{key:a.devices},[e("td",null,[e("a",{href:a.maintainer_link,target:"_blank",rel:"noreferrer"},i(a.maintainer),9,_)]),e("td",null,[e("a",{href:a.kernel_link,target:"_blank",rel:"noreferrer"},i(a.kernel_name),9,k)]),e("td",null,i(a.devices),1)]))),128))])])]))}});export{b as __pageData,D as default};
import{d as r}from"./chunks/repos.9a031e32.js";import{o as n,c as t,k as e,F as l,D as d,l as s,Q as u,t as i}from"./chunks/framework.ec8f7e8e.js";const o=u('<h1 id="perangkat-yang-didukung-tidak-resmi" tabindex="-1">Perangkat Yang Didukung Tidak Resmi <a class="header-anchor" href="#perangkat-yang-didukung-tidak-resmi" aria-label="Permalink to &quot;Perangkat Yang Didukung Tidak Resmi&quot;"></a></h1><p>:::peringatan</p><p>di halaman ini, terdapat kernel untuk perangkat non-GKI yang mendukung KernelSU yang dikelola oleh pengembang lain.</p><p>:::</p><p>:::peringatan</p><p>Halaman ini hanya untuk Anda yang ingin menemukan kode sumber yang sesuai dengan perangkat Anda, itu <strong>BUKAN</strong> berarti kode sumber telah ditinjau oleh <em>KernelSU Developers</em>. Anda harus menggunakannya dengan risiko Anda sendiri.</p><p>:::</p>',7),g=e("thead",null,[e("tr",null,[e("th",null,"Pengelola"),e("th",null,"Repository"),e("th",null,"Perangkat yang didukung")])],-1),k=["href"],_=["href"],b=JSON.parse('{"title":"Perangkat Yang Didukung Tidak Resmi","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/unofficially-support-devices.md","filePath":"id_ID/guide/unofficially-support-devices.md"}'),p={name:"id_ID/guide/unofficially-support-devices.md"},D=Object.assign(p,{setup(m){return(c,h)=>(n(),t("div",null,[o,e("table",null,[g,e("tbody",null,[(n(!0),t(l,null,d(s(r),a=>(n(),t("tr",{key:a.devices},[e("td",null,[e("a",{href:a.maintainer_link,target:"_blank",rel:"noreferrer"},i(a.maintainer),9,k)]),e("td",null,[e("a",{href:a.kernel_link,target:"_blank",rel:"noreferrer"},i(a.kernel_name),9,_)]),e("td",null,i(a.devices),1)]))),128))])])]))}});export{b as __pageData,D as default};

View File

@ -1 +1 @@
import{d as r}from"./chunks/repos.9a031e32.js";import{o as n,c as t,z as e,F as l,L as d,b as s,O as u,t as i}from"./chunks/framework.43781440.js";const o=u("",7),g=e("thead",null,[e("tr",null,[e("th",null,"Pengelola"),e("th",null,"Repository"),e("th",null,"Perangkat yang didukung")])],-1),_=["href"],k=["href"],b=JSON.parse('{"title":"Perangkat Yang Didukung Tidak Resmi","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/unofficially-support-devices.md","filePath":"id_ID/guide/unofficially-support-devices.md"}'),p={name:"id_ID/guide/unofficially-support-devices.md"},D=Object.assign(p,{setup(m){return(c,h)=>(n(),t("div",null,[o,e("table",null,[g,e("tbody",null,[(n(!0),t(l,null,d(s(r),a=>(n(),t("tr",{key:a.devices},[e("td",null,[e("a",{href:a.maintainer_link,target:"_blank",rel:"noreferrer"},i(a.maintainer),9,_)]),e("td",null,[e("a",{href:a.kernel_link,target:"_blank",rel:"noreferrer"},i(a.kernel_name),9,k)]),e("td",null,i(a.devices),1)]))),128))])])]))}});export{b as __pageData,D as default};
import{d as r}from"./chunks/repos.9a031e32.js";import{o as n,c as t,k as e,F as l,D as d,l as s,Q as u,t as i}from"./chunks/framework.ec8f7e8e.js";const o=u("",7),g=e("thead",null,[e("tr",null,[e("th",null,"Pengelola"),e("th",null,"Repository"),e("th",null,"Perangkat yang didukung")])],-1),k=["href"],_=["href"],b=JSON.parse('{"title":"Perangkat Yang Didukung Tidak Resmi","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/unofficially-support-devices.md","filePath":"id_ID/guide/unofficially-support-devices.md"}'),p={name:"id_ID/guide/unofficially-support-devices.md"},D=Object.assign(p,{setup(m){return(c,h)=>(n(),t("div",null,[o,e("table",null,[g,e("tbody",null,[(n(!0),t(l,null,d(s(r),a=>(n(),t("tr",{key:a.devices},[e("td",null,[e("a",{href:a.maintainer_link,target:"_blank",rel:"noreferrer"},i(a.maintainer),9,k)]),e("td",null,[e("a",{href:a.kernel_link,target:"_blank",rel:"noreferrer"},i(a.kernel_name),9,_)]),e("td",null,i(a.devices),1)]))),128))])])]))}});export{b as __pageData,D as default};

View File

@ -1 +1 @@
import{_ as a,o as e,c as n,O as i}from"./chunks/framework.43781440.js";const c=JSON.parse('{"title":"Apa itu KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/what-is-kernelsu.md","filePath":"id_ID/guide/what-is-kernelsu.md"}'),r={name:"id_ID/guide/what-is-kernelsu.md"},t=i('<h1 id="apa-itu-kernelsu" tabindex="-1">Apa itu KernelSU? <a class="header-anchor" href="#apa-itu-kernelsu" aria-label="Permalink to &quot;Apa itu KernelSU?&quot;"></a></h1><p>KernelSU adalah solusi root untuk perangkat GKI Android, ia bekerja dalam mode kernel dan memberikan izin root ke aplikasi userspace secara langsung di ruang kernel.</p><h2 id="fitur" tabindex="-1">Fitur <a class="header-anchor" href="#fitur" aria-label="Permalink to &quot;Fitur&quot;"></a></h2><p>Fitur utama dari KernelSU adalah <strong>berbasis kernel</strong>. KernelSU bekerja dalam mode kernel, sehingga dapat menyediakan antarmuka kernel yang belum pernah kita miliki sebelumnya. Sebagai contoh, kita dapat menambahkan breakpoint perangkat keras ke proses apa pun dalam mode kernel; Kita dapat mengakses memori fisik dari proses apa pun tanpa diketahui oleh siapa pun; Kita dapat mencegat syscall apa pun di ruang kernel; dll.</p><p>Dan juga, KernelSU menyediakan sistem modul melalui overlayfs, yang memungkinkan Anda untuk memuat plugin kustom Anda ke dalam sistem. KernelSU juga menyediakan mekanisme untuk memodifikasi berkas-berkas pada partisi <code>/system</code>.</p><h2 id="bagaimana-cara-menggunakannya" tabindex="-1">Bagaimana cara menggunakannya <a class="header-anchor" href="#bagaimana-cara-menggunakannya" aria-label="Permalink to &quot;Bagaimana cara menggunakannya&quot;"></a></h2><p>Silakan merujuk ke: <a href="./installation.html">Installation</a></p><h2 id="bagaimana-cara-men-buildnya" tabindex="-1">Bagaimana cara men-buildnya <a class="header-anchor" href="#bagaimana-cara-men-buildnya" aria-label="Permalink to &quot;Bagaimana cara men-buildnya&quot;"></a></h2><p><a href="./how-to-build.html">How to build</a></p><h2 id="diskusi" tabindex="-1">Diskusi <a class="header-anchor" href="#diskusi" aria-label="Permalink to &quot;Diskusi&quot;"></a></h2><ul><li>Telegram: <a href="https://t.me/KernelSU" target="_blank" rel="noreferrer">@KernelSU</a></li></ul>',11),l=[t];function s(u,d,o,m,k,p){return e(),n("div",null,l)}const g=a(r,[["render",s]]);export{c as __pageData,g as default};
import{_ as a,o as e,c as n,Q as i}from"./chunks/framework.ec8f7e8e.js";const c=JSON.parse('{"title":"Apa itu KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/what-is-kernelsu.md","filePath":"id_ID/guide/what-is-kernelsu.md"}'),r={name:"id_ID/guide/what-is-kernelsu.md"},t=i('<h1 id="apa-itu-kernelsu" tabindex="-1">Apa itu KernelSU? <a class="header-anchor" href="#apa-itu-kernelsu" aria-label="Permalink to &quot;Apa itu KernelSU?&quot;"></a></h1><p>KernelSU adalah solusi root untuk perangkat GKI Android, ia bekerja dalam mode kernel dan memberikan izin root ke aplikasi userspace secara langsung di ruang kernel.</p><h2 id="fitur" tabindex="-1">Fitur <a class="header-anchor" href="#fitur" aria-label="Permalink to &quot;Fitur&quot;"></a></h2><p>Fitur utama dari KernelSU adalah <strong>berbasis kernel</strong>. KernelSU bekerja dalam mode kernel, sehingga dapat menyediakan antarmuka kernel yang belum pernah kita miliki sebelumnya. Sebagai contoh, kita dapat menambahkan breakpoint perangkat keras ke proses apa pun dalam mode kernel; Kita dapat mengakses memori fisik dari proses apa pun tanpa diketahui oleh siapa pun; Kita dapat mencegat syscall apa pun di ruang kernel; dll.</p><p>Dan juga, KernelSU menyediakan sistem modul melalui overlayfs, yang memungkinkan Anda untuk memuat plugin kustom Anda ke dalam sistem. KernelSU juga menyediakan mekanisme untuk memodifikasi berkas-berkas pada partisi <code>/system</code>.</p><h2 id="bagaimana-cara-menggunakannya" tabindex="-1">Bagaimana cara menggunakannya <a class="header-anchor" href="#bagaimana-cara-menggunakannya" aria-label="Permalink to &quot;Bagaimana cara menggunakannya&quot;"></a></h2><p>Silakan merujuk ke: <a href="./installation.html">Installation</a></p><h2 id="bagaimana-cara-men-buildnya" tabindex="-1">Bagaimana cara men-buildnya <a class="header-anchor" href="#bagaimana-cara-men-buildnya" aria-label="Permalink to &quot;Bagaimana cara men-buildnya&quot;"></a></h2><p><a href="./how-to-build.html">How to build</a></p><h2 id="diskusi" tabindex="-1">Diskusi <a class="header-anchor" href="#diskusi" aria-label="Permalink to &quot;Diskusi&quot;"></a></h2><ul><li>Telegram: <a href="https://t.me/KernelSU" target="_blank" rel="noreferrer">@KernelSU</a></li></ul>',11),l=[t];function s(u,d,o,m,k,p){return e(),n("div",null,l)}const g=a(r,[["render",s]]);export{c as __pageData,g as default};

View File

@ -1 +1 @@
import{_ as a,o as e,c as n,O as i}from"./chunks/framework.43781440.js";const c=JSON.parse('{"title":"Apa itu KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/what-is-kernelsu.md","filePath":"id_ID/guide/what-is-kernelsu.md"}'),r={name:"id_ID/guide/what-is-kernelsu.md"},t=i("",11),l=[t];function s(u,d,o,m,k,p){return e(),n("div",null,l)}const g=a(r,[["render",s]]);export{c as __pageData,g as default};
import{_ as a,o as e,c as n,Q as i}from"./chunks/framework.ec8f7e8e.js";const c=JSON.parse('{"title":"Apa itu KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"id_ID/guide/what-is-kernelsu.md","filePath":"id_ID/guide/what-is-kernelsu.md"}'),r={name:"id_ID/guide/what-is-kernelsu.md"},t=i("",11),l=[t];function s(u,d,o,m,k,p){return e(),n("div",null,l)}const g=a(r,[["render",s]]);export{c as __pageData,g as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as t}from"./chunks/framework.43781440.js";const k=JSON.parse('{"title":"Sebuah solusi root kernel-based untuk Android","description":"","frontmatter":{"layout":"home","title":"Sebuah solusi root kernel-based untuk Android","hero":{"name":"KernelSU","text":"Sebuah solusi root kernel-based untuk Android","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"Permulaan","link":"/id_ID/guide/what-is-kernelsu"},{"theme":"alt","text":"Lihat di GitHub","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"Kernel-based","details":"KernelSU bekerja dalam mode Linux kernel, dan mempunyai kelebihan diatas aplikasi userspace."},{"title":"Kontrol akses daftar putih","details":"Hanya aplikasi yang diberikan izin root yang bisa mengakses `su`, aplikasi lain tidak bisa mengakses su."},{"title":"Dukungan modul","details":"KernelSU mendukung modifikasi /system tanpa-sistem dalam overlayfs, bahkan bisa membuat system dapat ditulis."},{"title":"Sumber terbuka","details":"KernelSU adalah projek sumber terbuka dibawah lisensi GPL-3."}]},"headers":[],"relativePath":"id_ID/index.md","filePath":"id_ID/index.md"}'),i={name:"id_ID/index.md"};function n(s,r,l,d,o,u){return a(),t("div")}const b=e(i,[["render",n]]);export{k as __pageData,b as default};
import{_ as e,o as a,c as t}from"./chunks/framework.ec8f7e8e.js";const k=JSON.parse('{"title":"Sebuah solusi root kernel-based untuk Android","description":"","frontmatter":{"layout":"home","title":"Sebuah solusi root kernel-based untuk Android","hero":{"name":"KernelSU","text":"Sebuah solusi root kernel-based untuk Android","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"Permulaan","link":"/id_ID/guide/what-is-kernelsu"},{"theme":"alt","text":"Lihat di GitHub","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"Kernel-based","details":"KernelSU bekerja dalam mode Linux kernel, dan mempunyai kelebihan diatas aplikasi userspace."},{"title":"Kontrol akses daftar putih","details":"Hanya aplikasi yang diberikan izin root yang bisa mengakses `su`, aplikasi lain tidak bisa mengakses su."},{"title":"Dukungan modul","details":"KernelSU mendukung modifikasi /system tanpa-sistem dalam overlayfs, bahkan bisa membuat system dapat ditulis."},{"title":"Sumber terbuka","details":"KernelSU adalah projek sumber terbuka dibawah lisensi GPL-3."}]},"headers":[],"relativePath":"id_ID/index.md","filePath":"id_ID/index.md"}'),i={name:"id_ID/index.md"};function n(s,r,l,d,o,u){return a(),t("div")}const b=e(i,[["render",n]]);export{k as __pageData,b as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as t}from"./chunks/framework.43781440.js";const k=JSON.parse('{"title":"Sebuah solusi root kernel-based untuk Android","description":"","frontmatter":{"layout":"home","title":"Sebuah solusi root kernel-based untuk Android","hero":{"name":"KernelSU","text":"Sebuah solusi root kernel-based untuk Android","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"Permulaan","link":"/id_ID/guide/what-is-kernelsu"},{"theme":"alt","text":"Lihat di GitHub","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"Kernel-based","details":"KernelSU bekerja dalam mode Linux kernel, dan mempunyai kelebihan diatas aplikasi userspace."},{"title":"Kontrol akses daftar putih","details":"Hanya aplikasi yang diberikan izin root yang bisa mengakses `su`, aplikasi lain tidak bisa mengakses su."},{"title":"Dukungan modul","details":"KernelSU mendukung modifikasi /system tanpa-sistem dalam overlayfs, bahkan bisa membuat system dapat ditulis."},{"title":"Sumber terbuka","details":"KernelSU adalah projek sumber terbuka dibawah lisensi GPL-3."}]},"headers":[],"relativePath":"id_ID/index.md","filePath":"id_ID/index.md"}'),i={name:"id_ID/index.md"};function n(s,r,l,d,o,u){return a(),t("div")}const b=e(i,[["render",n]]);export{k as __pageData,b as default};
import{_ as e,o as a,c as t}from"./chunks/framework.ec8f7e8e.js";const k=JSON.parse('{"title":"Sebuah solusi root kernel-based untuk Android","description":"","frontmatter":{"layout":"home","title":"Sebuah solusi root kernel-based untuk Android","hero":{"name":"KernelSU","text":"Sebuah solusi root kernel-based untuk Android","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"Permulaan","link":"/id_ID/guide/what-is-kernelsu"},{"theme":"alt","text":"Lihat di GitHub","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"Kernel-based","details":"KernelSU bekerja dalam mode Linux kernel, dan mempunyai kelebihan diatas aplikasi userspace."},{"title":"Kontrol akses daftar putih","details":"Hanya aplikasi yang diberikan izin root yang bisa mengakses `su`, aplikasi lain tidak bisa mengakses su."},{"title":"Dukungan modul","details":"KernelSU mendukung modifikasi /system tanpa-sistem dalam overlayfs, bahkan bisa membuat system dapat ditulis."},{"title":"Sumber terbuka","details":"KernelSU adalah projek sumber terbuka dibawah lisensi GPL-3."}]},"headers":[],"relativePath":"id_ID/index.md","filePath":"id_ID/index.md"}'),i={name:"id_ID/index.md"};function n(s,r,l,d,o,u){return a(),t("div")}const b=e(i,[["render",n]]);export{k as __pageData,b as default};

View File

@ -1 +1 @@
import{_ as e,o as t,c as o}from"./chunks/framework.43781440.js";const p=JSON.parse('{"title":"A kernel-based root solution for Android","description":"","frontmatter":{"layout":"home","title":"A kernel-based root solution for Android","hero":{"name":"KernelSU","text":"A kernel-based root solution for Android","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"Get Started","link":"/guide/what-is-kernelsu"},{"theme":"alt","text":"View on GitHub","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"Kernel-based","details":"As the name suggests, KernelSU works under the Linux kernel giving it more control over userspace applications."},{"title":"Root Access Control","details":"Only permitted apps may access or see `su`, all other apps are not aware of this."},{"title":"Customizable Root Privileges","details":"KernelSU allows customization of `su`\'s uid, gid, groups, capabilities, and SELinux rules, locking up root privileges."},{"title":"Modules","details":"Modules may modify /system systemlessly using overlayfs enabling great power."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),s={name:"index.md"};function i(r,a,n,l,d,u){return t(),o("div")}const m=e(s,[["render",i]]);export{p as __pageData,m as default};
import{_ as e,o as t,c as o}from"./chunks/framework.ec8f7e8e.js";const p=JSON.parse('{"title":"A kernel-based root solution for Android","description":"","frontmatter":{"layout":"home","title":"A kernel-based root solution for Android","hero":{"name":"KernelSU","text":"A kernel-based root solution for Android","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"Get Started","link":"/guide/what-is-kernelsu"},{"theme":"alt","text":"View on GitHub","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"Kernel-based","details":"As the name suggests, KernelSU works under the Linux kernel giving it more control over userspace applications."},{"title":"Root Access Control","details":"Only permitted apps may access or see `su`, all other apps are not aware of this."},{"title":"Customizable Root Privileges","details":"KernelSU allows customization of `su`\'s uid, gid, groups, capabilities, and SELinux rules, locking up root privileges."},{"title":"Modules","details":"Modules may modify /system systemlessly using overlayfs enabling great power."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),s={name:"index.md"};function i(r,a,n,l,d,u){return t(),o("div")}const m=e(s,[["render",i]]);export{p as __pageData,m as default};

View File

@ -1 +1 @@
import{_ as e,o as t,c as o}from"./chunks/framework.43781440.js";const p=JSON.parse('{"title":"A kernel-based root solution for Android","description":"","frontmatter":{"layout":"home","title":"A kernel-based root solution for Android","hero":{"name":"KernelSU","text":"A kernel-based root solution for Android","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"Get Started","link":"/guide/what-is-kernelsu"},{"theme":"alt","text":"View on GitHub","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"Kernel-based","details":"As the name suggests, KernelSU works under the Linux kernel giving it more control over userspace applications."},{"title":"Root Access Control","details":"Only permitted apps may access or see `su`, all other apps are not aware of this."},{"title":"Customizable Root Privileges","details":"KernelSU allows customization of `su`\'s uid, gid, groups, capabilities, and SELinux rules, locking up root privileges."},{"title":"Modules","details":"Modules may modify /system systemlessly using overlayfs enabling great power."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),s={name:"index.md"};function i(r,a,n,l,d,u){return t(),o("div")}const m=e(s,[["render",i]]);export{p as __pageData,m as default};
import{_ as e,o as t,c as o}from"./chunks/framework.ec8f7e8e.js";const p=JSON.parse('{"title":"A kernel-based root solution for Android","description":"","frontmatter":{"layout":"home","title":"A kernel-based root solution for Android","hero":{"name":"KernelSU","text":"A kernel-based root solution for Android","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"Get Started","link":"/guide/what-is-kernelsu"},{"theme":"alt","text":"View on GitHub","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"Kernel-based","details":"As the name suggests, KernelSU works under the Linux kernel giving it more control over userspace applications."},{"title":"Root Access Control","details":"Only permitted apps may access or see `su`, all other apps are not aware of this."},{"title":"Customizable Root Privileges","details":"KernelSU allows customization of `su`\'s uid, gid, groups, capabilities, and SELinux rules, locking up root privileges."},{"title":"Modules","details":"Modules may modify /system systemlessly using overlayfs enabling great power."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),s={name:"index.md"};function i(r,a,n,l,d,u){return t(),o("div")}const m=e(s,[["render",i]]);export{p as __pageData,m as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as i,O as o}from"./chunks/framework.43781440.js";const k=JSON.parse('{"title":"Magisk との違い","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/difference-with-magisk.md","filePath":"ja_JP/guide/difference-with-magisk.md"}'),s={name:"ja_JP/guide/difference-with-magisk.md"},l=o('<h1 id="magisk-との違い" tabindex="-1">Magisk との違い <a class="header-anchor" href="#magisk-との違い" aria-label="Permalink to &quot;Magisk との違い&quot;"></a></h1><p>KernelSU モジュールと Magisk モジュールには多くの共通点がありますが、実装の仕組みが全く異なるため、必然的にいくつかの相違点が存在します。Magisk と KernelSU の両方でモジュールを動作させたい場合、これらの違いを理解する必要があります。</p><h2 id="似ているところ" tabindex="-1">似ているところ <a class="header-anchor" href="#似ているところ" aria-label="Permalink to &quot;似ているところ&quot;"></a></h2><ul><li>モジュールファイルの形式どちらもzip形式でモジュールを整理しており、モジュールの形式はほぼ同じです。</li><li>モジュールのインストールディレクトリ:どちらも <code>/data/adb/modules</code> に配置されます。</li><li>システムレス:どちらもモジュールによるシステムレスな方法で /system を変更できます。</li><li>post-fs-data.sh: 実行時間と意味は全く同じです。</li><li>service.sh: 実行時間と意味は全く同じです。</li><li>system.prop全く同じです。</li><li>sepolicy.rule全く同じです。</li><li>BusyBoxスクリプトは BusyBox で実行され、どちらの場合も「スタンドアロンモード」が有効です。</li></ul><h2 id="違うところ" tabindex="-1">違うところ <a class="header-anchor" href="#違うところ" aria-label="Permalink to &quot;違うところ&quot;"></a></h2><p>違いを理解する前に、モジュールが KernelSU で動作しているか Magisk で動作しているかを区別する方法を知っておく必要があります。環境変数 <code>KSU</code> を使うとモジュールスクリプトを実行できるすべての場所 (<code>customize.sh</code>, <code>post-fs-data.sh</code>, <code>service.sh</code>) で区別できます。KernelSU では、この環境変数に <code>true</code> が設定されます。</p><p>以下は違いです:</p><ul><li>KernelSU モジュールは、リカバリーモードではインストールできません。</li><li>KernelSU モジュールには Zygisk のサポートが組み込まれていません(ただし<a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a>を使うと Zygisk モジュールを使用できます)。</li><li>KernelSU モジュールにおけるファイルの置換や削除の方法は、Magisk とは全く異なります。KernelSU は <code>.replace</code> メソッドをサポートしていません。その代わり、<code>mknod filename c 0 0</code> で同名のファイルを作成し、対応するファイルを削除する必要があります。</li><li>BusyBox 用のディレクトリが違います。KernelSU の組み込み BusyBox は <code>/data/adb/ksu/bin/busybox</code> に、Magisk では <code>/data/adb/magisk/busybox</code> に配置されます。<strong>これは KernelSU の内部動作であり、将来的に変更される可能性があることに注意してください!</strong></li><li>KernelSU は <code>.replace</code> ファイルをサポートしていません。しかし、KernelSU はファイルやフォルダを削除したり置き換えたりするための <code>REMOVE</code> と <code>REPLACE</code> 変数をサポートしています。</li></ul>',8),t=[l];function r(d,c,n,h,_,u){return a(),i("div",null,t)}const p=e(s,[["render",r]]);export{k as __pageData,p as default};
import{_ as e,o as a,c as i,Q as o}from"./chunks/framework.ec8f7e8e.js";const k=JSON.parse('{"title":"Magisk との違い","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/difference-with-magisk.md","filePath":"ja_JP/guide/difference-with-magisk.md"}'),s={name:"ja_JP/guide/difference-with-magisk.md"},l=o('<h1 id="magisk-との違い" tabindex="-1">Magisk との違い <a class="header-anchor" href="#magisk-との違い" aria-label="Permalink to &quot;Magisk との違い&quot;"></a></h1><p>KernelSU モジュールと Magisk モジュールには多くの共通点がありますが、実装の仕組みが全く異なるため、必然的にいくつかの相違点が存在します。Magisk と KernelSU の両方でモジュールを動作させたい場合、これらの違いを理解する必要があります。</p><h2 id="似ているところ" tabindex="-1">似ているところ <a class="header-anchor" href="#似ているところ" aria-label="Permalink to &quot;似ているところ&quot;"></a></h2><ul><li>モジュールファイルの形式どちらもzip形式でモジュールを整理しており、モジュールの形式はほぼ同じです。</li><li>モジュールのインストールディレクトリ:どちらも <code>/data/adb/modules</code> に配置されます。</li><li>システムレス:どちらもモジュールによるシステムレスな方法で /system を変更できます。</li><li>post-fs-data.sh: 実行時間と意味は全く同じです。</li><li>service.sh: 実行時間と意味は全く同じです。</li><li>system.prop全く同じです。</li><li>sepolicy.rule全く同じです。</li><li>BusyBoxスクリプトは BusyBox で実行され、どちらの場合も「スタンドアロンモード」が有効です。</li></ul><h2 id="違うところ" tabindex="-1">違うところ <a class="header-anchor" href="#違うところ" aria-label="Permalink to &quot;違うところ&quot;"></a></h2><p>違いを理解する前に、モジュールが KernelSU で動作しているか Magisk で動作しているかを区別する方法を知っておく必要があります。環境変数 <code>KSU</code> を使うとモジュールスクリプトを実行できるすべての場所 (<code>customize.sh</code>, <code>post-fs-data.sh</code>, <code>service.sh</code>) で区別できます。KernelSU では、この環境変数に <code>true</code> が設定されます。</p><p>以下は違いです:</p><ul><li>KernelSU モジュールは、リカバリーモードではインストールできません。</li><li>KernelSU モジュールには Zygisk のサポートが組み込まれていません(ただし<a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a>を使うと Zygisk モジュールを使用できます)。</li><li>KernelSU モジュールにおけるファイルの置換や削除の方法は、Magisk とは全く異なります。KernelSU は <code>.replace</code> メソッドをサポートしていません。その代わり、<code>mknod filename c 0 0</code> で同名のファイルを作成し、対応するファイルを削除する必要があります。</li><li>BusyBox 用のディレクトリが違います。KernelSU の組み込み BusyBox は <code>/data/adb/ksu/bin/busybox</code> に、Magisk では <code>/data/adb/magisk/busybox</code> に配置されます。<strong>これは KernelSU の内部動作であり、将来的に変更される可能性があることに注意してください!</strong></li><li>KernelSU は <code>.replace</code> ファイルをサポートしていません。しかし、KernelSU はファイルやフォルダを削除したり置き換えたりするための <code>REMOVE</code> と <code>REPLACE</code> 変数をサポートしています。</li></ul>',8),t=[l];function r(d,c,n,h,_,u){return a(),i("div",null,t)}const p=e(s,[["render",r]]);export{k as __pageData,p as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as i,O as o}from"./chunks/framework.43781440.js";const k=JSON.parse('{"title":"Magisk との違い","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/difference-with-magisk.md","filePath":"ja_JP/guide/difference-with-magisk.md"}'),s={name:"ja_JP/guide/difference-with-magisk.md"},l=o("",8),t=[l];function r(d,c,n,h,_,u){return a(),i("div",null,t)}const p=e(s,[["render",r]]);export{k as __pageData,p as default};
import{_ as e,o as a,c as i,Q as o}from"./chunks/framework.ec8f7e8e.js";const k=JSON.parse('{"title":"Magisk との違い","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/difference-with-magisk.md","filePath":"ja_JP/guide/difference-with-magisk.md"}'),s={name:"ja_JP/guide/difference-with-magisk.md"},l=o("",8),t=[l];function r(d,c,n,h,_,u){return a(),i("div",null,t)}const p=e(s,[["render",r]]);export{k as __pageData,p as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{_ as e,o as a,c as r,O as n}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"よくある質問","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/faq.md","filePath":"ja_JP/guide/faq.md"}'),l={name:"ja_JP/guide/faq.md"},i=n("",33),o=[i];function t(s,d,h,u,k,c){return a(),r("div",null,o)}const g=e(l,[["render",t]]);export{m as __pageData,g as default};
import{_ as e,o as a,c as r,Q as n}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"よくある質問","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/faq.md","filePath":"ja_JP/guide/faq.md"}'),l={name:"ja_JP/guide/faq.md"},i=n("",33),o=[i];function t(s,d,h,u,k,c){return a(),r("div",null,o)}const g=e(l,[["render",t]]);export{m as __pageData,g as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as t,O as s}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"隠し機能","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/hidden-features.md","filePath":"ja_JP/guide/hidden-features.md"}'),r={name:"ja_JP/guide/hidden-features.md"},d=s('<h1 id="隠し機能" tabindex="-1">隠し機能 <a class="header-anchor" href="#隠し機能" aria-label="Permalink to &quot;隠し機能&quot;"></a></h1><h2 id="ksurc" tabindex="-1">.ksurc <a class="header-anchor" href="#ksurc" aria-label="Permalink to &quot;.ksurc&quot;"></a></h2><p>デフォルトでは <code>/system/bin/sh</code> は <code>/system/etc/mkshrc</code> を読み込みます。</p><p><code>/data/adb/ksu/.ksurc</code> ファイルを作成することで、カスタマイズした rc ファイルを su に読み込ませられます。</p>',4),c=[d];function o(_,i,n,u,h,l){return a(),t("div",null,c)}const f=e(r,[["render",o]]);export{m as __pageData,f as default};
import{_ as e,o as a,c as t,Q as s}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"隠し機能","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/hidden-features.md","filePath":"ja_JP/guide/hidden-features.md"}'),r={name:"ja_JP/guide/hidden-features.md"},d=s('<h1 id="隠し機能" tabindex="-1">隠し機能 <a class="header-anchor" href="#隠し機能" aria-label="Permalink to &quot;隠し機能&quot;"></a></h1><h2 id="ksurc" tabindex="-1">.ksurc <a class="header-anchor" href="#ksurc" aria-label="Permalink to &quot;.ksurc&quot;"></a></h2><p>デフォルトでは <code>/system/bin/sh</code> は <code>/system/etc/mkshrc</code> を読み込みます。</p><p><code>/data/adb/ksu/.ksurc</code> ファイルを作成することで、カスタマイズした rc ファイルを su に読み込ませられます。</p>',4),c=[d];function o(_,i,n,u,h,l){return a(),t("div",null,c)}const f=e(r,[["render",o]]);export{m as __pageData,f as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as t,O as s}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"隠し機能","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/hidden-features.md","filePath":"ja_JP/guide/hidden-features.md"}'),r={name:"ja_JP/guide/hidden-features.md"},d=s("",4),c=[d];function o(_,i,n,u,h,l){return a(),t("div",null,c)}const f=e(r,[["render",o]]);export{m as __pageData,f as default};
import{_ as e,o as a,c as t,Q as s}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"隠し機能","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/hidden-features.md","filePath":"ja_JP/guide/hidden-features.md"}'),r={name:"ja_JP/guide/hidden-features.md"},d=s("",4),c=[d];function o(_,i,n,u,h,l){return a(),t("div",null,c)}const f=e(r,[["render",o]]);export{m as __pageData,f as default};

View File

@ -1 +1 @@
import{_ as e,o,c as a,O as l}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"インストール","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/installation.md","filePath":"ja_JP/guide/installation.md"}'),t={name:"ja_JP/guide/installation.md"},i=l("",63),r=[i];function n(s,d,c,p,h,b){return o(),a("div",null,r)}const k=e(t,[["render",n]]);export{m as __pageData,k as default};
import{_ as e,o,c as a,Q as l}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"インストール","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/installation.md","filePath":"ja_JP/guide/installation.md"}'),t={name:"ja_JP/guide/installation.md"},i=l("",63),r=[i];function s(n,d,c,p,h,b){return o(),a("div",null,r)}const k=e(t,[["render",s]]);export{m as __pageData,k as default};

View File

@ -1 +0,0 @@
import{_ as s,o as e,c as a,O as n}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"モジュールのガイド","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/module.md","filePath":"ja_JP/guide/module.md"}'),l={name:"ja_JP/guide/module.md"},o=n("",58),p=[o];function t(c,i,r,d,A,C){return e(),a("div",null,p)}const m=s(l,[["render",t]]);export{y as __pageData,m as default};

View File

@ -1,81 +1,161 @@
import{_ as s,o as e,c as a,O as n}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"モジュールのガイド","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/module.md","filePath":"ja_JP/guide/module.md"}'),l={name:"ja_JP/guide/module.md"},o=n(`<h1 id="モジュールのガイド" tabindex="-1">モジュールのガイド <a class="header-anchor" href="#モジュールのガイド" aria-label="Permalink to &quot;モジュールのガイド&quot;"></a></h1><p>KernelSU はシステムパーティションの整合性を維持しながら、システムディレクトリを変更する効果を実現するモジュール機構を提供します。この機構は一般に「システムレス」と呼ばれています。</p><p>KernelSU のモジュール機構は、Magisk とほぼ同じです。Magisk のモジュール開発に慣れている方であれば、KernelSU のモジュール開発も簡単でしょう。その場合は以下のモジュールの紹介は読み飛ばして、<a href="./difference-with-magisk.html">Magisk との違い</a>の内容だけ読めばOKです。</p><h2 id="busybox" tabindex="-1">Busybox <a class="header-anchor" href="#busybox" aria-label="Permalink to &quot;Busybox&quot;"></a></h2><p>KernelSU には、機能的に完全な Busybox バイナリ (SELinux の完全サポートを含む) が同梱されています。実行ファイルは <code>/data/adb/ksu/bin/busybox</code> に配置されています。KernelSU の Busybox はランタイムに切り替え可能な「ASH スタンドアローンシェルモード」をサポートしています。このスタンドアロンモードとは、Busybox の <code>ash</code> シェルで実行する場合 <code>PATH</code> として設定されているものに関係なく、すべてのコマンドが Busybox 内のアプレットを直接使用するというものです。たとえば、<code>ls</code>、<code>rm</code>、<code>chmod</code> などのコマンドは、<code>PATH</code> にあるものAndroid の場合、デフォルトではそれぞれ <code>/system/bin/ls</code>, <code>/system/bin/rm</code>, <code>/system/bin/chmod</code>)ではなく、直接 Busybox 内部のアプレットを呼び出すことになります。これにより、スクリプトは常に予測可能な環境で実行され、どの Android バージョンで実行されていても常にコマンドを利用できます。Busybox を使用しないコマンドを強制的に実行するには、フルパスで実行ファイルを呼び出す必要があります。</p><p>KernelSU のコンテキストで実行されるすべてのシェルスクリプトは、Busybox の <code>ash</code> シェルでスタンドアロンモードが有効な状態で実行されます。サードパーティの開発者に関係するものとしては、すべてのブートスクリプトとモジュールのインストールスクリプトが含まれます。</p><p>この「スタンドアロンモード」機能を KernelSU 以外で使用したい場合、2つの方法で有効にできます</p><ol><li>環境変数 <code>ASH_STANDALONE</code> を <code>1</code> にする<br>例: <code>ASH_STANDALONE=1 /data/adb/ksu/bin/busybox sh &lt;script&gt;</code></li><li>コマンドラインのオプションで変更する:<br><code>/data/adb/ksu/bin/busybox sh -o standalone &lt;script&gt;</code></li></ol><p>環境変数が子プロセスに継承されるため、その後に実行されるすべての <code>sh</code> シェルもスタンドアロンモードで実行されるようにするにはオプション 1 が望ましい方法ですKernelSU と KernelSU Managerが内部的に使用しているのもこちらです。</p><div class="tip custom-block"><p class="custom-block-title">Magisk との違い</p><p>KernelSU の Busybox は、Magisk プロジェクトから直接コンパイルされたバイナリファイルを使用するようになりました。Magisk と KernelSU の Busybox スクリプトはまったく同じものなので、互換性の問題を心配する必要はありません!</p></div><h2 id="kernelsu-モジュール" tabindex="-1">KernelSU モジュール <a class="header-anchor" href="#kernelsu-モジュール" aria-label="Permalink to &quot;KernelSU モジュール&quot;"></a></h2><p>KernelSU モジュールは、<code>/data/adb/modules</code> に配置された以下の構造を持つフォルダーです:</p><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">/data/adb/modules</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;">|</span></span>
<span class="line"><span style="color:#A6ACCD;"> $MODID &lt;--- フォルダの名前はモジュールの ID で付けます</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** モジュールの ID ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> module.prop &lt;--- このファイルにモジュールのメタデータを保存します</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** メインコンテンツ ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> system &lt;--- skip_mount が存在しない場合このフォルダがマウントされます</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** ステータスフラグ ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> skip_mount &lt;--- 存在する場合KernelSU はシステムフォルダをマウントしません</span></span>
<span class="line"><span style="color:#A6ACCD;"> disable &lt;--- 存在する場合モジュールは無効化されます</span></span>
<span class="line"><span style="color:#A6ACCD;"> remove &lt;--- 存在する場合次の再起動時にモジュールが削除されます</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** 任意のファイル ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> post-fs-data.sh &lt;--- このスクリプトは post-fs-data で実行されます</span></span>
<span class="line"><span style="color:#A6ACCD;"> service.sh &lt;--- このスクリプトは late_start サービスで実行されます</span></span>
<span class="line"><span style="color:#A6ACCD;">| uninstall.sh &lt;--- このスクリプトは KernelSU がモジュールを削除するときに実行されます</span></span>
<span class="line"><span style="color:#A6ACCD;"> system.prop &lt;--- このファイルのプロパティは resetprop によってシステムプロパティとして読み込まれます</span></span>
<span class="line"><span style="color:#A6ACCD;"> sepolicy.rule &lt;--- カスタム SEPolicy ルールを追加します</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** 自動生成されるため手動で作成または変更しないでください ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> vendor &lt;--- $MODID/system/vendor へのシンボリックリンク</span></span>
<span class="line"><span style="color:#A6ACCD;"> product &lt;--- $MODID/system/product へのシンボリックリンク</span></span>
<span class="line"><span style="color:#A6ACCD;"> system_ext &lt;--- $MODID/system/system_ext へのシンボリックリンク</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> *** その他のファイル/フォルダの追加も可能です ***</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;">|</span></span>
<span class="line"><span style="color:#A6ACCD;"> another_module</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span>
<span class="line"><span style="color:#A6ACCD;"> .</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">Magisk </p><p>KernelSU Zygisk Zygisk <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a> Zygisk 使 Zygisk Magisk </p></div><h3 id="module-prop" tabindex="-1">module.prop <a class="header-anchor" href="#module-prop" aria-label="Permalink to &quot;module.prop&quot;"></a></h3><p>module.prop KernelSU </p><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">id=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">name=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">version=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">versionCode=&lt;int&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">author=&lt;string&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">description=&lt;string&gt;</span></span></code></pre></div><ul><li><code>id</code> : <code>^[a-zA-Z][a-zA-Z0-9._-]+$</code><br> : <code>a_module</code>, <code>a.module</code>, <code>module-101</code>, <code>a module</code>, <code>1_module</code>, <code>-a-module</code><br> <strong> ID</strong> </li><li><code>versionCode</code> <strong>integer</strong> 使</li><li><strong></strong> 使</li><li> <code>UNIX (LF)</code> 使<code>Windows (CR+LF)</code> <code>Macintosh (CR)</code> 使</li></ul><h3 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h3><p><code>post-fs-data.sh</code> <code>service.sh</code> <a href="#boot-scripts"></a> <code>service.sh</code> </p><p><code>MODDIR=\${0%/*}</code>使</p><div class="tip custom-block"><p class="custom-block-title">Magisk </p><p> <code>KSU</code> 使 KernelSU Magisk KernelSU <code>true</code> </p></div><h3 id="system-" tabindex="-1"><code>system</code> <a class="header-anchor" href="#system-" aria-label="Permalink to &quot;\`system\` &quot;"></a></h3><p> OverlayFS 使 /system </p><ol><li></li><li></li></ol><p><code>mknod filename c 0 0</code> 使/OverlayFS /system </p><p><code>customize.sh</code> <code>REMOVE</code> KernelSU <code>mknod &lt;TARGET&gt; c 0 0</code> </p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">REMOVE</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span></span>
<span class="line"><span style="color:#C3E88D;">/system/app/YouTube</span></span>
<span class="line"><span style="color:#C3E88D;">/system/app/Bloatware</span></span>
<span class="line"><span style="color:#89DDFF;">&quot;</span></span></code></pre></div><p><code>mknod $MODPATH/system/app/YouTuBe c 0 0</code><code>mknod $MODPATH/system/app/Bloatware c 0 0</code><code>/system/app/YouTube</code><code>/system/app/Bloatware</code></p><p> <code>setfattr -n trusted.overlay.opaque -v y &lt;TARGET&gt;</code> OverlayFS /system </p><p><code>customize.sh</code> <code>REPLACE</code> KernelSU </p><p>REPLACE=&quot; /system/app/YouTube /system/app/Bloatware &quot;</p><p> <code>$MODPATH/system/app/YouTube</code> <code>$MODPATH/system/app/Bloatware</code> <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/YouTube</code> <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/Bloatware</code> <code>/system/app/YouTube</code> <code>/system/app/Bloatware</code> </p><div class="tip custom-block"><p class="custom-block-title">Magisk </p><p>KernelSU OverlayFS Magisk bind mount使2/system /system </p></div><p>OverlayFS Linux <a href="https://docs.kernel.org/filesystems/overlayfs.html" target="_blank" rel="noreferrer">OverlayFS </a> </p><h3 id="system-prop" tabindex="-1">system.prop <a class="header-anchor" href="#system-prop" aria-label="Permalink to &quot;system.prop&quot;"></a></h3><p> <code>build.prop</code> <code>[key]=[value]</code> </p><h3 id="sepolicy-rule" tabindex="-1">sepolicy.rule <a class="header-anchor" href="#sepolicy-rule" aria-label="Permalink to &quot;sepolicy.rule&quot;"></a></h3><p> SEPolicy </p><h2 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h2><p>KernelSU KernelSU Manager ZIP KernelSU KernelSU KernelSU ZIP </p><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">module.zip</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> customize.sh &lt;--- (任意詳細は後述)</span></span>
<span class="line"><span style="color:#A6ACCD;"> このスクリプトは update-binary から読み込まれます</span></span>
<span class="line"><span style="color:#A6ACCD;"> ...</span></span>
<span class="line"><span style="color:#A6ACCD;"> ... /* 残りのモジュールのファイル */</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span></code></pre></div><div class="warning custom-block"><p class="custom-block-title"></p><p>KernelSU </p></div><h3 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h3><p><code>customize.sh</code> secontext () ABI /便</p><p><code>customize.sh</code> <code>SKIPUNZIP=1</code> <code>customize.sh</code> </p><p><code>customize.sh</code>KernelSU Busybox <code>ash</code> </p><h4 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h4><ul><li><code>KSU</code> (bool): KernelSU true KernelSU Magisk 使</li><li><code>KSU_VER</code> (string): KernelSU (: <code>v0.4.0</code>)</li><li><code>KSU_VER_CODE</code> (int): KernelSU (: <code>10672</code>)</li><li><code>KSU_KERNEL_VER_CODE</code> (int): KernelSU <code>10672</code></li><li><code>BOOTMODE</code> (bool): KernelSU <code>true</code></li><li><code>MODPATH</code> (path): </li><li><code>TMPDIR</code> (path): </li><li><code>ZIPFILE</code> (path): ZIP</li><li><code>ARCH</code> (string): CPU <code>arm</code><code>arm64</code><code>x86</code><code>x64</code> </li><li><code>IS64BIT</code> (bool): <code>ARCH</code> <code>arm64</code> <code>x64</code> <code>true</code></li><li><code>API</code> (int): API Android Android 6.0 <code>23</code></li></ul><div class="warning custom-block"><p class="custom-block-title"></p><p>KernelSU MAGISK_VER_CODE 25200MAGISK_VER v25.22 KernelSU </p></div><h4 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h4><div class="language-txt"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">ui_print &lt;msg&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;"> コンソールに &lt;msg&gt; を表示します</span></span>
<span class="line"><span style="color:#A6ACCD;"> カスタムリカバリーのコンソールでは表示されないためechoの使用は避けてください</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">abort &lt;msg&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;"> エラーメッセージ&lt;msg&gt;をコンソールに出力しインストールを終了させます</span></span>
<span class="line"><span style="color:#A6ACCD;"> 終了時のクリーンアップがスキップされてしまうためexitの使用は避けてください</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">set_perm &lt;target&gt; &lt;owner&gt; &lt;group&gt; &lt;permission&gt; [context]</span></span>
<span class="line"><span style="color:#A6ACCD;"> [context] が設定されていない場合デフォルトは &quot;u:object_r:system_file:s0&quot; です</span></span>
<span class="line"><span style="color:#A6ACCD;"> この機能は次のコマンドの略記です</span></span>
<span class="line"><span style="color:#A6ACCD;"> chown owner.group target</span></span>
<span class="line"><span style="color:#A6ACCD;"> chmod permission target</span></span>
<span class="line"><span style="color:#A6ACCD;"> chcon context target</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">set_perm_recursive &lt;directory&gt; &lt;owner&gt; &lt;group&gt; &lt;dirpermission&gt; &lt;filepermission&gt; [context]</span></span>
<span class="line"><span style="color:#A6ACCD;"> [context] が設定されていない場合デフォルトは &quot;u:object_r:system_file:s0&quot; です</span></span>
<span class="line"><span style="color:#A6ACCD;"> &lt;directory&gt; 内のすべてのファイルに対しては以下が実行されます:</span></span>
<span class="line"><span style="color:#A6ACCD;"> set_perm file owner group filepermission context</span></span>
<span class="line"><span style="color:#A6ACCD;"> &lt;directory&gt; 内のすべてのディレクトリ自身を含むに対しては以下が実行されます:</span></span>
<span class="line"><span style="color:#A6ACCD;"> set_perm dir owner group dirpermission context</span></span></code></pre></div><h2 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h2><p>KernelSU post-fs-data late_start 2</p><ul><li>post-fs-data <ul><li>10</li><li>調</li><li> Zygote Android </li><li><strong>:</strong> <code>setprop</code> 使! <code>resetprop -n &lt;prop_name&gt; &lt;prop_value&gt;</code> 使</li><li><strong></strong></li></ul></li><li>late_start <ul><li></li><li><strong></strong></li></ul></li></ul><p>KernelSU 2</p><ul><li> <ul><li><code>/data/adb/post-fs-data.d</code> <code>/data/adb/service.d</code> </li><li> (<code>chmod +x script.sh</code>)</li><li><code>post-fs-data.d</code> post-fs-data <code>service.d</code> late_start </li><li></li></ul></li><li> <ul><li></li><li></li><li><code>post-fs-data.sh</code> post-fs-data <code>service.sh</code> late_start </li></ul></li></ul><p>KernelSU Busybox <code>ash</code> </p>`,58),p=[o];function t(c,i,r,d,A,C){return e(),a("div",null,p)}const m=s(l,[["render",t]]);export{y as __pageData,m as default};
import{_ as s,o as e,c as n,Q as a}from"./chunks/framework.ec8f7e8e.js";const g=JSON.parse('{"title":"モジュールのガイド","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/module.md","filePath":"ja_JP/guide/module.md"}'),l={name:"ja_JP/guide/module.md"},p=a(`<h1 id="モジュールのガイド" tabindex="-1">モジュールのガイド <a class="header-anchor" href="#モジュールのガイド" aria-label="Permalink to &quot;モジュールのガイド&quot;"></a></h1><p>KernelSU はシステムパーティションの整合性を維持しながら、システムディレクトリを変更する効果を実現するモジュール機構を提供します。この機構は一般に「システムレス」と呼ばれています。</p><p>KernelSU のモジュール機構は、Magisk とほぼ同じです。Magisk のモジュール開発に慣れている方であれば、KernelSU のモジュール開発も簡単でしょう。その場合は以下のモジュールの紹介は読み飛ばして、<a href="./difference-with-magisk.html">Magisk との違い</a>の内容だけ読めばOKです。</p><h2 id="busybox" tabindex="-1">Busybox <a class="header-anchor" href="#busybox" aria-label="Permalink to &quot;Busybox&quot;"></a></h2><p>KernelSU には、機能的に完全な Busybox バイナリ (SELinux の完全サポートを含む) が同梱されています。実行ファイルは <code>/data/adb/ksu/bin/busybox</code> に配置されています。KernelSU の Busybox はランタイムに切り替え可能な「ASH スタンドアローンシェルモード」をサポートしています。このスタンドアロンモードとは、Busybox の <code>ash</code> シェルで実行する場合 <code>PATH</code> として設定されているものに関係なく、すべてのコマンドが Busybox 内のアプレットを直接使用するというものです。たとえば、<code>ls</code>、<code>rm</code>、<code>chmod</code> などのコマンドは、<code>PATH</code> にあるものAndroid の場合、デフォルトではそれぞれ <code>/system/bin/ls</code>, <code>/system/bin/rm</code>, <code>/system/bin/chmod</code>)ではなく、直接 Busybox 内部のアプレットを呼び出すことになります。これにより、スクリプトは常に予測可能な環境で実行され、どの Android バージョンで実行されていても常にコマンドを利用できます。Busybox を使用しないコマンドを強制的に実行するには、フルパスで実行ファイルを呼び出す必要があります。</p><p>KernelSU のコンテキストで実行されるすべてのシェルスクリプトは、Busybox の <code>ash</code> シェルでスタンドアロンモードが有効な状態で実行されます。サードパーティの開発者に関係するものとしては、すべてのブートスクリプトとモジュールのインストールスクリプトが含まれます。</p><p>この「スタンドアロンモード」機能を KernelSU 以外で使用したい場合、2つの方法で有効にできます</p><ol><li>環境変数 <code>ASH_STANDALONE</code> を <code>1</code> にする<br>例: <code>ASH_STANDALONE=1 /data/adb/ksu/bin/busybox sh &lt;script&gt;</code></li><li>コマンドラインのオプションで変更する:<br><code>/data/adb/ksu/bin/busybox sh -o standalone &lt;script&gt;</code></li></ol><p>環境変数が子プロセスに継承されるため、その後に実行されるすべての <code>sh</code> シェルもスタンドアロンモードで実行されるようにするにはオプション 1 が望ましい方法ですKernelSU と KernelSU Managerが内部的に使用しているのもこちらです。</p><div class="tip custom-block"><p class="custom-block-title">Magisk との違い</p><p>KernelSU の Busybox は、Magisk プロジェクトから直接コンパイルされたバイナリファイルを使用するようになりました。Magisk と KernelSU の Busybox スクリプトはまったく同じものなので、互換性の問題を心配する必要はありません!</p></div><h2 id="kernelsu-モジュール" tabindex="-1">KernelSU モジュール <a class="header-anchor" href="#kernelsu-モジュール" aria-label="Permalink to &quot;KernelSU モジュール&quot;"></a></h2><p>KernelSU モジュールは、<code>/data/adb/modules</code> に配置された以下の構造を持つフォルダーです:</p><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">/data/adb/modules</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;">|</span></span>
<span class="line"><span style="color:#e1e4e8;"> $MODID &lt;--- フォルダの名前はモジュールの ID で付けます</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** モジュールの ID ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> module.prop &lt;--- このファイルにモジュールのメタデータを保存します</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** メインコンテンツ ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> system &lt;--- skip_mount が存在しない場合このフォルダがマウントされます</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** ステータスフラグ ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> skip_mount &lt;--- 存在する場合KernelSU はシステムフォルダをマウントしません</span></span>
<span class="line"><span style="color:#e1e4e8;"> disable &lt;--- 存在する場合モジュールは無効化されます</span></span>
<span class="line"><span style="color:#e1e4e8;"> remove &lt;--- 存在する場合次の再起動時にモジュールが削除されます</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** 任意のファイル ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> post-fs-data.sh &lt;--- このスクリプトは post-fs-data で実行されます</span></span>
<span class="line"><span style="color:#e1e4e8;"> service.sh &lt;--- このスクリプトは late_start サービスで実行されます</span></span>
<span class="line"><span style="color:#e1e4e8;">| uninstall.sh &lt;--- このスクリプトは KernelSU がモジュールを削除するときに実行されます</span></span>
<span class="line"><span style="color:#e1e4e8;"> system.prop &lt;--- このファイルのプロパティは resetprop によってシステムプロパティとして読み込まれます</span></span>
<span class="line"><span style="color:#e1e4e8;"> sepolicy.rule &lt;--- カスタム SEPolicy ルールを追加します</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** 自動生成されるため手動で作成または変更しないでください ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> vendor &lt;--- $MODID/system/vendor へのシンボリックリンク</span></span>
<span class="line"><span style="color:#e1e4e8;"> product &lt;--- $MODID/system/product へのシンボリックリンク</span></span>
<span class="line"><span style="color:#e1e4e8;"> system_ext &lt;--- $MODID/system/system_ext へのシンボリックリンク</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> *** その他のファイル/フォルダの追加も可能です ***</span></span>
<span class="line"><span style="color:#e1e4e8;"> </span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;">|</span></span>
<span class="line"><span style="color:#e1e4e8;"> another_module</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span>
<span class="line"><span style="color:#e1e4e8;"> .</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">/data/adb/modules</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;">|</span></span>
<span class="line"><span style="color:#24292e;"> $MODID &lt;--- フォルダの名前はモジュールの ID で付けます</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** モジュールの ID ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> module.prop &lt;--- このファイルにモジュールのメタデータを保存します</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** メインコンテンツ ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> system &lt;--- skip_mount が存在しない場合このフォルダがマウントされます</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** ステータスフラグ ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> skip_mount &lt;--- 存在する場合KernelSU はシステムフォルダをマウントしません</span></span>
<span class="line"><span style="color:#24292e;"> disable &lt;--- 存在する場合モジュールは無効化されます</span></span>
<span class="line"><span style="color:#24292e;"> remove &lt;--- 存在する場合次の再起動時にモジュールが削除されます</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** 任意のファイル ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> post-fs-data.sh &lt;--- このスクリプトは post-fs-data で実行されます</span></span>
<span class="line"><span style="color:#24292e;"> service.sh &lt;--- このスクリプトは late_start サービスで実行されます</span></span>
<span class="line"><span style="color:#24292e;">| uninstall.sh &lt;--- このスクリプトは KernelSU がモジュールを削除するときに実行されます</span></span>
<span class="line"><span style="color:#24292e;"> system.prop &lt;--- このファイルのプロパティは resetprop によってシステムプロパティとして読み込まれます</span></span>
<span class="line"><span style="color:#24292e;"> sepolicy.rule &lt;--- カスタム SEPolicy ルールを追加します</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** 自動生成されるため手動で作成または変更しないでください ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> vendor &lt;--- $MODID/system/vendor へのシンボリックリンク</span></span>
<span class="line"><span style="color:#24292e;"> product &lt;--- $MODID/system/product へのシンボリックリンク</span></span>
<span class="line"><span style="color:#24292e;"> system_ext &lt;--- $MODID/system/system_ext へのシンボリックリンク</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> *** その他のファイル/フォルダの追加も可能です ***</span></span>
<span class="line"><span style="color:#24292e;"> </span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;">|</span></span>
<span class="line"><span style="color:#24292e;"> another_module</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span>
<span class="line"><span style="color:#24292e;"> .</span></span></code></pre></div><div class="tip custom-block"><p class="custom-block-title">Magisk </p><p>KernelSU Zygisk Zygisk <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a> Zygisk 使 Zygisk Magisk </p></div><h3 id="module-prop" tabindex="-1">module.prop <a class="header-anchor" href="#module-prop" aria-label="Permalink to &quot;module.prop&quot;"></a></h3><p>module.prop KernelSU </p><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">id=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">name=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">version=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">versionCode=&lt;int&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">author=&lt;string&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;">description=&lt;string&gt;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">id=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">name=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">version=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">versionCode=&lt;int&gt;</span></span>
<span class="line"><span style="color:#24292e;">author=&lt;string&gt;</span></span>
<span class="line"><span style="color:#24292e;">description=&lt;string&gt;</span></span></code></pre></div><ul><li><code>id</code> : <code>^[a-zA-Z][a-zA-Z0-9._-]+$</code><br> : <code>a_module</code>, <code>a.module</code>, <code>module-101</code>, <code>a module</code>, <code>1_module</code>, <code>-a-module</code><br> <strong> ID</strong> </li><li><code>versionCode</code> <strong>integer</strong> 使</li><li><strong></strong> 使</li><li> <code>UNIX (LF)</code> 使<code>Windows (CR+LF)</code> <code>Macintosh (CR)</code> 使</li></ul><h3 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h3><p><code>post-fs-data.sh</code> <code>service.sh</code> <a href="#boot-scripts"></a> <code>service.sh</code> </p><p><code>MODDIR=\${0%/*}</code>使</p><div class="tip custom-block"><p class="custom-block-title">Magisk </p><p> <code>KSU</code> 使 KernelSU Magisk KernelSU <code>true</code> </p></div><h3 id="system-" tabindex="-1"><code>system</code> <a class="header-anchor" href="#system-" aria-label="Permalink to &quot;\`system\` &quot;"></a></h3><p> OverlayFS 使 /system </p><ol><li></li><li></li></ol><p><code>mknod filename c 0 0</code> 使/OverlayFS /system </p><p><code>customize.sh</code> <code>REMOVE</code> KernelSU <code>mknod &lt;TARGET&gt; c 0 0</code> </p><div class="language-sh vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">REMOVE</span><span style="color:#F97583;">=</span><span style="color:#9ECBFF;">&quot;</span></span>
<span class="line"><span style="color:#9ECBFF;">/system/app/YouTube</span></span>
<span class="line"><span style="color:#9ECBFF;">/system/app/Bloatware</span></span>
<span class="line"><span style="color:#9ECBFF;">&quot;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">REMOVE</span><span style="color:#D73A49;">=</span><span style="color:#032F62;">&quot;</span></span>
<span class="line"><span style="color:#032F62;">/system/app/YouTube</span></span>
<span class="line"><span style="color:#032F62;">/system/app/Bloatware</span></span>
<span class="line"><span style="color:#032F62;">&quot;</span></span></code></pre></div><p><code>mknod $MODPATH/system/app/YouTuBe c 0 0</code><code>mknod $MODPATH/system/app/Bloatware c 0 0</code><code>/system/app/YouTube</code><code>/system/app/Bloatware</code></p><p> <code>setfattr -n trusted.overlay.opaque -v y &lt;TARGET&gt;</code> OverlayFS /system </p><p><code>customize.sh</code> <code>REPLACE</code> KernelSU </p><p>REPLACE=&quot; /system/app/YouTube /system/app/Bloatware &quot;</p><p> <code>$MODPATH/system/app/YouTube</code> <code>$MODPATH/system/app/Bloatware</code> <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/YouTube</code> <code>setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/Bloatware</code> <code>/system/app/YouTube</code> <code>/system/app/Bloatware</code> </p><div class="tip custom-block"><p class="custom-block-title">Magisk </p><p>KernelSU OverlayFS Magisk bind mount使2/system /system </p></div><p>OverlayFS Linux <a href="https://docs.kernel.org/filesystems/overlayfs.html" target="_blank" rel="noreferrer">OverlayFS </a> </p><h3 id="system-prop" tabindex="-1">system.prop <a class="header-anchor" href="#system-prop" aria-label="Permalink to &quot;system.prop&quot;"></a></h3><p> <code>build.prop</code> <code>[key]=[value]</code> </p><h3 id="sepolicy-rule" tabindex="-1">sepolicy.rule <a class="header-anchor" href="#sepolicy-rule" aria-label="Permalink to &quot;sepolicy.rule&quot;"></a></h3><p> SEPolicy </p><h2 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h2><p>KernelSU KernelSU Manager ZIP KernelSU KernelSU KernelSU ZIP </p><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">module.zip</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;"> customize.sh &lt;--- (任意詳細は後述)</span></span>
<span class="line"><span style="color:#e1e4e8;"> このスクリプトは update-binary から読み込まれます</span></span>
<span class="line"><span style="color:#e1e4e8;"> ...</span></span>
<span class="line"><span style="color:#e1e4e8;"> ... /* 残りのモジュールのファイル */</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">module.zip</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;"> customize.sh &lt;--- (任意詳細は後述)</span></span>
<span class="line"><span style="color:#24292e;"> このスクリプトは update-binary から読み込まれます</span></span>
<span class="line"><span style="color:#24292e;"> ...</span></span>
<span class="line"><span style="color:#24292e;"> ... /* 残りのモジュールのファイル */</span></span>
<span class="line"><span style="color:#24292e;"></span></span></code></pre></div><div class="warning custom-block"><p class="custom-block-title"></p><p>KernelSU </p></div><h3 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h3><p><code>customize.sh</code> secontext () ABI /便</p><p><code>customize.sh</code> <code>SKIPUNZIP=1</code> <code>customize.sh</code> </p><p><code>customize.sh</code>KernelSU Busybox <code>ash</code> </p><h4 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h4><ul><li><code>KSU</code> (bool): KernelSU true KernelSU Magisk 使</li><li><code>KSU_VER</code> (string): KernelSU (: <code>v0.4.0</code>)</li><li><code>KSU_VER_CODE</code> (int): KernelSU (: <code>10672</code>)</li><li><code>KSU_KERNEL_VER_CODE</code> (int): KernelSU <code>10672</code></li><li><code>BOOTMODE</code> (bool): KernelSU <code>true</code></li><li><code>MODPATH</code> (path): </li><li><code>TMPDIR</code> (path): </li><li><code>ZIPFILE</code> (path): ZIP</li><li><code>ARCH</code> (string): CPU <code>arm</code><code>arm64</code><code>x86</code><code>x64</code> </li><li><code>IS64BIT</code> (bool): <code>ARCH</code> <code>arm64</code> <code>x64</code> <code>true</code></li><li><code>API</code> (int): API Android Android 6.0 <code>23</code></li></ul><div class="warning custom-block"><p class="custom-block-title"></p><p>KernelSU MAGISK_VER_CODE 25200MAGISK_VER v25.22 KernelSU </p></div><h4 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h4><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">ui_print &lt;msg&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;"> コンソールに &lt;msg&gt; を表示します</span></span>
<span class="line"><span style="color:#e1e4e8;"> カスタムリカバリーのコンソールでは表示されないためechoの使用は避けてください</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">abort &lt;msg&gt;</span></span>
<span class="line"><span style="color:#e1e4e8;"> エラーメッセージ&lt;msg&gt;をコンソールに出力しインストールを終了させます</span></span>
<span class="line"><span style="color:#e1e4e8;"> 終了時のクリーンアップがスキップされてしまうためexitの使用は避けてください</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">set_perm &lt;target&gt; &lt;owner&gt; &lt;group&gt; &lt;permission&gt; [context]</span></span>
<span class="line"><span style="color:#e1e4e8;"> [context] が設定されていない場合デフォルトは &quot;u:object_r:system_file:s0&quot; です</span></span>
<span class="line"><span style="color:#e1e4e8;"> この機能は次のコマンドの略記です</span></span>
<span class="line"><span style="color:#e1e4e8;"> chown owner.group target</span></span>
<span class="line"><span style="color:#e1e4e8;"> chmod permission target</span></span>
<span class="line"><span style="color:#e1e4e8;"> chcon context target</span></span>
<span class="line"><span style="color:#e1e4e8;"></span></span>
<span class="line"><span style="color:#e1e4e8;">set_perm_recursive &lt;directory&gt; &lt;owner&gt; &lt;group&gt; &lt;dirpermission&gt; &lt;filepermission&gt; [context]</span></span>
<span class="line"><span style="color:#e1e4e8;"> [context] が設定されていない場合デフォルトは &quot;u:object_r:system_file:s0&quot; です</span></span>
<span class="line"><span style="color:#e1e4e8;"> &lt;directory&gt; 内のすべてのファイルに対しては以下が実行されます:</span></span>
<span class="line"><span style="color:#e1e4e8;"> set_perm file owner group filepermission context</span></span>
<span class="line"><span style="color:#e1e4e8;"> &lt;directory&gt; 内のすべてのディレクトリ自身を含むに対しては以下が実行されます:</span></span>
<span class="line"><span style="color:#e1e4e8;"> set_perm dir owner group dirpermission context</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">ui_print &lt;msg&gt;</span></span>
<span class="line"><span style="color:#24292e;"> コンソールに &lt;msg&gt; を表示します</span></span>
<span class="line"><span style="color:#24292e;"> カスタムリカバリーのコンソールでは表示されないためechoの使用は避けてください</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">abort &lt;msg&gt;</span></span>
<span class="line"><span style="color:#24292e;"> エラーメッセージ&lt;msg&gt;をコンソールに出力しインストールを終了させます</span></span>
<span class="line"><span style="color:#24292e;"> 終了時のクリーンアップがスキップされてしまうためexitの使用は避けてください</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">set_perm &lt;target&gt; &lt;owner&gt; &lt;group&gt; &lt;permission&gt; [context]</span></span>
<span class="line"><span style="color:#24292e;"> [context] が設定されていない場合デフォルトは &quot;u:object_r:system_file:s0&quot; です</span></span>
<span class="line"><span style="color:#24292e;"> この機能は次のコマンドの略記です</span></span>
<span class="line"><span style="color:#24292e;"> chown owner.group target</span></span>
<span class="line"><span style="color:#24292e;"> chmod permission target</span></span>
<span class="line"><span style="color:#24292e;"> chcon context target</span></span>
<span class="line"><span style="color:#24292e;"></span></span>
<span class="line"><span style="color:#24292e;">set_perm_recursive &lt;directory&gt; &lt;owner&gt; &lt;group&gt; &lt;dirpermission&gt; &lt;filepermission&gt; [context]</span></span>
<span class="line"><span style="color:#24292e;"> [context] が設定されていない場合デフォルトは &quot;u:object_r:system_file:s0&quot; です</span></span>
<span class="line"><span style="color:#24292e;"> &lt;directory&gt; 内のすべてのファイルに対しては以下が実行されます:</span></span>
<span class="line"><span style="color:#24292e;"> set_perm file owner group filepermission context</span></span>
<span class="line"><span style="color:#24292e;"> &lt;directory&gt; 内のすべてのディレクトリ自身を含むに対しては以下が実行されます:</span></span>
<span class="line"><span style="color:#24292e;"> set_perm dir owner group dirpermission context</span></span></code></pre></div><h2 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h2><p>KernelSU post-fs-data late_start 2</p><ul><li>post-fs-data <ul><li>10</li><li>調</li><li> Zygote Android </li><li><strong>:</strong> <code>setprop</code> 使! <code>resetprop -n &lt;prop_name&gt; &lt;prop_value&gt;</code> 使</li><li><strong></strong></li></ul></li><li>late_start <ul><li></li><li><strong></strong></li></ul></li></ul><p>KernelSU 2</p><ul><li> <ul><li><code>/data/adb/post-fs-data.d</code> <code>/data/adb/service.d</code> </li><li> (<code>chmod +x script.sh</code>)</li><li><code>post-fs-data.d</code> post-fs-data <code>service.d</code> late_start </li><li></li></ul></li><li> <ul><li></li><li></li><li><code>post-fs-data.sh</code> post-fs-data <code>service.sh</code> late_start </li></ul></li></ul><p>KernelSU Busybox <code>ash</code> </p>`,58),o=[p];function t(c,r,i,d,y,u){return e(),n("div",null,o)}const h=s(l,[["render",t]]);export{g as __pageData,h as default};

View File

@ -0,0 +1 @@
import{_ as s,o as e,c as n,Q as a}from"./chunks/framework.ec8f7e8e.js";const g=JSON.parse('{"title":"モジュールのガイド","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/module.md","filePath":"ja_JP/guide/module.md"}'),l={name:"ja_JP/guide/module.md"},p=a("",58),o=[p];function t(c,r,i,d,y,u){return e(),n("div",null,o)}const h=s(l,[["render",t]]);export{g as __pageData,h as default};

View File

@ -1 +1 @@
import{_ as o,o as e,c as a,O as t}from"./chunks/framework.43781440.js";const u=JSON.parse('{"title":"ブートループからの復旧","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/rescue-from-bootloop.md","filePath":"ja_JP/guide/rescue-from-bootloop.md"}'),r={name:"ja_JP/guide/rescue-from-bootloop.md"},l=t("",23),i=[l];function n(s,d,c,h,p,b){return e(),a("div",null,i)}const m=o(r,[["render",n]]);export{u as __pageData,m as default};
import{_ as o,o as e,c as a,Q as t}from"./chunks/framework.ec8f7e8e.js";const u=JSON.parse('{"title":"ブートループからの復旧","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/rescue-from-bootloop.md","filePath":"ja_JP/guide/rescue-from-bootloop.md"}'),r={name:"ja_JP/guide/rescue-from-bootloop.md"},l=t("",23),i=[l];function n(s,d,c,h,p,b){return e(),a("div",null,i)}const m=o(r,[["render",n]]);export{u as __pageData,m as default};

View File

@ -1 +1 @@
import{d as r}from"./chunks/repos.9a031e32.js";import{o as a,c as l,z as e,F as s,L as i,b as c,O as o,t as n}from"./chunks/framework.43781440.js";const _=o('<h1 id="非公式の対応デバイス" tabindex="-1">非公式の対応デバイス <a class="header-anchor" href="#非公式の対応デバイス" aria-label="Permalink to &quot;非公式の対応デバイス&quot;"></a></h1><div class="warning custom-block"><p class="custom-block-title">警告</p><p>このページでは他の開発者が管理している、KernelSU をサポートする GKI 以外のデバイス用のカーネルを紹介しています。</p></div><div class="warning custom-block"><p class="custom-block-title">警告</p><p>このページはあなたのデバイスに対応するソースコードを見つけるためのものであり、そのソースコードが <em>KernelSU 開発者</em> によってレビューされたことを意味するものではありません。ご自身の責任においてご利用ください。</p></div>',3),d=e("thead",null,[e("tr",null,[e("th",null,"メンテナー"),e("th",null,"リポジトリ"),e("th",null,"対応デバイス")])],-1),u=["href"],m=["href"],v=JSON.parse('{"title":"非公式の対応デバイス","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/unofficially-support-devices.md","filePath":"ja_JP/guide/unofficially-support-devices.md"}'),f={name:"ja_JP/guide/unofficially-support-devices.md"},P=Object.assign(f,{setup(h){return(p,k)=>(a(),l("div",null,[_,e("table",null,[d,e("tbody",null,[(a(!0),l(s,null,i(c(r),t=>(a(),l("tr",{key:t.devices},[e("td",null,[e("a",{href:t.maintainer_link,target:"_blank",rel:"noreferrer"},n(t.maintainer),9,u)]),e("td",null,[e("a",{href:t.kernel_link,target:"_blank",rel:"noreferrer"},n(t.kernel_name),9,m)]),e("td",null,n(t.devices),1)]))),128))])])]))}});export{v as __pageData,P as default};
import{d as r}from"./chunks/repos.9a031e32.js";import{o as a,c as l,k as e,F as s,D as i,l as c,Q as o,t as n}from"./chunks/framework.ec8f7e8e.js";const _=o('<h1 id="非公式の対応デバイス" tabindex="-1">非公式の対応デバイス <a class="header-anchor" href="#非公式の対応デバイス" aria-label="Permalink to &quot;非公式の対応デバイス&quot;"></a></h1><div class="warning custom-block"><p class="custom-block-title">警告</p><p>このページでは他の開発者が管理している、KernelSU をサポートする GKI 以外のデバイス用のカーネルを紹介しています。</p></div><div class="warning custom-block"><p class="custom-block-title">警告</p><p>このページはあなたのデバイスに対応するソースコードを見つけるためのものであり、そのソースコードが <em>KernelSU 開発者</em> によってレビューされたことを意味するものではありません。ご自身の責任においてご利用ください。</p></div>',3),d=e("thead",null,[e("tr",null,[e("th",null,"メンテナー"),e("th",null,"リポジトリ"),e("th",null,"対応デバイス")])],-1),u=["href"],m=["href"],v=JSON.parse('{"title":"非公式の対応デバイス","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/unofficially-support-devices.md","filePath":"ja_JP/guide/unofficially-support-devices.md"}'),f={name:"ja_JP/guide/unofficially-support-devices.md"},P=Object.assign(f,{setup(h){return(p,k)=>(a(),l("div",null,[_,e("table",null,[d,e("tbody",null,[(a(!0),l(s,null,i(c(r),t=>(a(),l("tr",{key:t.devices},[e("td",null,[e("a",{href:t.maintainer_link,target:"_blank",rel:"noreferrer"},n(t.maintainer),9,u)]),e("td",null,[e("a",{href:t.kernel_link,target:"_blank",rel:"noreferrer"},n(t.kernel_name),9,m)]),e("td",null,n(t.devices),1)]))),128))])])]))}});export{v as __pageData,P as default};

View File

@ -1 +1 @@
import{d as r}from"./chunks/repos.9a031e32.js";import{o as a,c as l,z as e,F as s,L as i,b as c,O as o,t as n}from"./chunks/framework.43781440.js";const _=o("",3),d=e("thead",null,[e("tr",null,[e("th",null,"メンテナー"),e("th",null,"リポジトリ"),e("th",null,"対応デバイス")])],-1),u=["href"],m=["href"],v=JSON.parse('{"title":"非公式の対応デバイス","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/unofficially-support-devices.md","filePath":"ja_JP/guide/unofficially-support-devices.md"}'),f={name:"ja_JP/guide/unofficially-support-devices.md"},P=Object.assign(f,{setup(h){return(p,k)=>(a(),l("div",null,[_,e("table",null,[d,e("tbody",null,[(a(!0),l(s,null,i(c(r),t=>(a(),l("tr",{key:t.devices},[e("td",null,[e("a",{href:t.maintainer_link,target:"_blank",rel:"noreferrer"},n(t.maintainer),9,u)]),e("td",null,[e("a",{href:t.kernel_link,target:"_blank",rel:"noreferrer"},n(t.kernel_name),9,m)]),e("td",null,n(t.devices),1)]))),128))])])]))}});export{v as __pageData,P as default};
import{d as r}from"./chunks/repos.9a031e32.js";import{o as a,c as l,k as e,F as s,D as i,l as c,Q as o,t as n}from"./chunks/framework.ec8f7e8e.js";const _=o("",3),d=e("thead",null,[e("tr",null,[e("th",null,"メンテナー"),e("th",null,"リポジトリ"),e("th",null,"対応デバイス")])],-1),u=["href"],m=["href"],v=JSON.parse('{"title":"非公式の対応デバイス","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/unofficially-support-devices.md","filePath":"ja_JP/guide/unofficially-support-devices.md"}'),f={name:"ja_JP/guide/unofficially-support-devices.md"},P=Object.assign(f,{setup(h){return(p,k)=>(a(),l("div",null,[_,e("table",null,[d,e("tbody",null,[(a(!0),l(s,null,i(c(r),t=>(a(),l("tr",{key:t.devices},[e("td",null,[e("a",{href:t.maintainer_link,target:"_blank",rel:"noreferrer"},n(t.maintainer),9,u)]),e("td",null,[e("a",{href:t.kernel_link,target:"_blank",rel:"noreferrer"},n(t.kernel_name),9,m)]),e("td",null,n(t.devices),1)]))),128))])])]))}});export{v as __pageData,P as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as r,O as t}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"KernelSU とは?","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/what-is-kernelsu.md","filePath":"ja_JP/guide/what-is-kernelsu.md"}'),l={name:"ja_JP/guide/what-is-kernelsu.md"},n=t('<h1 id="kernelsu-とは" tabindex="-1">KernelSU とは? <a class="header-anchor" href="#kernelsu-とは" aria-label="Permalink to &quot;KernelSU とは?&quot;"></a></h1><p>KernelSU は Android GKI デバイスのための root ソリューションです。カーネルモードで動作し、カーネル空間で直接ユーザー空間アプリに root 権限を付与します。</p><h2 id="機能" tabindex="-1">機能 <a class="header-anchor" href="#機能" aria-label="Permalink to &quot;機能&quot;"></a></h2><p>KernelSU の最大の特徴は、<strong>カーネルベース</strong>であることです。KernelSU はカーネルモードで動作するため、今までにないカーネルインターフェイスを提供できます。例えば、カーネルモードで任意のプロセスにハードウェアブレークポイントを追加できる、誰にも気づかれずに任意のプロセスの物理メモリにアクセスできる、カーネル空間で任意のシステムコールを傍受できる、などです。</p><p>また、KernelSU は OverlayFS によるモジュールシステムを提供しており、カスタムプラグインをシステムに読み込めます。<code>/system</code> パーティションを変更する仕組みも提供しています。</p><h2 id="使用方法" tabindex="-1">使用方法 <a class="header-anchor" href="#使用方法" aria-label="Permalink to &quot;使用方法&quot;"></a></h2><p>こちらをご覧ください: <a href="./installation.html">インストール方法</a></p><h2 id="ビルド方法" tabindex="-1">ビルド方法 <a class="header-anchor" href="#ビルド方法" aria-label="Permalink to &quot;ビルド方法&quot;"></a></h2><p><a href="./../../guide/how-to-build.html">ビルドするには</a></p><h2 id="ディスカッション" tabindex="-1">ディスカッション <a class="header-anchor" href="#ディスカッション" aria-label="Permalink to &quot;ディスカッション&quot;"></a></h2><ul><li>Telegram: <a href="https://t.me/KernelSU" target="_blank" rel="noreferrer">@KernelSU</a></li></ul>',11),o=[n];function s(i,h,d,c,_,u){return a(),r("div",null,o)}const f=e(l,[["render",s]]);export{m as __pageData,f as default};
import{_ as e,o as a,c as r,Q as t}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"KernelSU とは?","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/what-is-kernelsu.md","filePath":"ja_JP/guide/what-is-kernelsu.md"}'),l={name:"ja_JP/guide/what-is-kernelsu.md"},n=t('<h1 id="kernelsu-とは" tabindex="-1">KernelSU とは? <a class="header-anchor" href="#kernelsu-とは" aria-label="Permalink to &quot;KernelSU とは?&quot;"></a></h1><p>KernelSU は Android GKI デバイスのための root ソリューションです。カーネルモードで動作し、カーネル空間で直接ユーザー空間アプリに root 権限を付与します。</p><h2 id="機能" tabindex="-1">機能 <a class="header-anchor" href="#機能" aria-label="Permalink to &quot;機能&quot;"></a></h2><p>KernelSU の最大の特徴は、<strong>カーネルベース</strong>であることです。KernelSU はカーネルモードで動作するため、今までにないカーネルインターフェイスを提供できます。例えば、カーネルモードで任意のプロセスにハードウェアブレークポイントを追加できる、誰にも気づかれずに任意のプロセスの物理メモリにアクセスできる、カーネル空間で任意のシステムコールを傍受できる、などです。</p><p>また、KernelSU は OverlayFS によるモジュールシステムを提供しており、カスタムプラグインをシステムに読み込めます。<code>/system</code> パーティションを変更する仕組みも提供しています。</p><h2 id="使用方法" tabindex="-1">使用方法 <a class="header-anchor" href="#使用方法" aria-label="Permalink to &quot;使用方法&quot;"></a></h2><p>こちらをご覧ください: <a href="./installation.html">インストール方法</a></p><h2 id="ビルド方法" tabindex="-1">ビルド方法 <a class="header-anchor" href="#ビルド方法" aria-label="Permalink to &quot;ビルド方法&quot;"></a></h2><p><a href="./../../guide/how-to-build.html">ビルドするには</a></p><h2 id="ディスカッション" tabindex="-1">ディスカッション <a class="header-anchor" href="#ディスカッション" aria-label="Permalink to &quot;ディスカッション&quot;"></a></h2><ul><li>Telegram: <a href="https://t.me/KernelSU" target="_blank" rel="noreferrer">@KernelSU</a></li></ul>',11),o=[n];function s(i,h,d,c,_,u){return a(),r("div",null,o)}const f=e(l,[["render",s]]);export{m as __pageData,f as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as r,O as t}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"KernelSU とは?","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/what-is-kernelsu.md","filePath":"ja_JP/guide/what-is-kernelsu.md"}'),l={name:"ja_JP/guide/what-is-kernelsu.md"},n=t("",11),o=[n];function s(i,h,d,c,_,u){return a(),r("div",null,o)}const f=e(l,[["render",s]]);export{m as __pageData,f as default};
import{_ as e,o as a,c as r,Q as t}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"KernelSU とは?","description":"","frontmatter":{},"headers":[],"relativePath":"ja_JP/guide/what-is-kernelsu.md","filePath":"ja_JP/guide/what-is-kernelsu.md"}'),l={name:"ja_JP/guide/what-is-kernelsu.md"},n=t("",11),o=[n];function s(i,h,d,c,_,u){return a(),r("div",null,o)}const f=e(l,[["render",s]]);export{m as __pageData,f as default};

View File

@ -1 +1 @@
import{_ as e,o as t,c as a}from"./chunks/framework.43781440.js";const _=JSON.parse('{"title":"Android 向けのカーネルベース root ソリューション","description":"","frontmatter":{"layout":"home","title":"Android 向けのカーネルベース root ソリューション","hero":{"name":"KernelSU","text":"Android 向けのカーネルベース root ソリューション","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"はじめる","link":"/ja_JP/guide/what-is-kernelsu"},{"theme":"alt","text":"GitHub で表示","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"カーネルベース","details":"KernelSU は Linux カーネルモードで動作し、ユーザー空間よりも高度な制御が可能です。"},{"title":"ホワイトリストの権限管理","details":"root 権限を許可したアプリのみが su にアクセスでき、他のアプリは su を見つけられません。"},{"title":"モジュール対応","details":"KernelSU は OverlayFS により実際のシステムを改変せずに /system を変更できます。書き込み可能にすることさえできます。"},{"title":"オープンソース","details":"KernelSU は GPL-3 でライセンスされたオープンソースプロジェクトです。"}]},"headers":[],"relativePath":"ja_JP/index.md","filePath":"ja_JP/index.md"}'),n={name:"ja_JP/index.md"};function i(r,o,l,s,d,c){return t(),a("div")}const p=e(n,[["render",i]]);export{_ as __pageData,p as default};
import{_ as e,o as t,c as a}from"./chunks/framework.ec8f7e8e.js";const _=JSON.parse('{"title":"Android 向けのカーネルベース root ソリューション","description":"","frontmatter":{"layout":"home","title":"Android 向けのカーネルベース root ソリューション","hero":{"name":"KernelSU","text":"Android 向けのカーネルベース root ソリューション","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"はじめる","link":"/ja_JP/guide/what-is-kernelsu"},{"theme":"alt","text":"GitHub で表示","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"カーネルベース","details":"KernelSU は Linux カーネルモードで動作し、ユーザー空間よりも高度な制御が可能です。"},{"title":"ホワイトリストの権限管理","details":"root 権限を許可したアプリのみが su にアクセスでき、他のアプリは su を見つけられません。"},{"title":"モジュール対応","details":"KernelSU は OverlayFS により実際のシステムを改変せずに /system を変更できます。書き込み可能にすることさえできます。"},{"title":"オープンソース","details":"KernelSU は GPL-3 でライセンスされたオープンソースプロジェクトです。"}]},"headers":[],"relativePath":"ja_JP/index.md","filePath":"ja_JP/index.md"}'),n={name:"ja_JP/index.md"};function i(r,o,l,s,d,c){return t(),a("div")}const p=e(n,[["render",i]]);export{_ as __pageData,p as default};

View File

@ -1 +1 @@
import{_ as e,o as t,c as a}from"./chunks/framework.43781440.js";const _=JSON.parse('{"title":"Android 向けのカーネルベース root ソリューション","description":"","frontmatter":{"layout":"home","title":"Android 向けのカーネルベース root ソリューション","hero":{"name":"KernelSU","text":"Android 向けのカーネルベース root ソリューション","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"はじめる","link":"/ja_JP/guide/what-is-kernelsu"},{"theme":"alt","text":"GitHub で表示","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"カーネルベース","details":"KernelSU は Linux カーネルモードで動作し、ユーザー空間よりも高度な制御が可能です。"},{"title":"ホワイトリストの権限管理","details":"root 権限を許可したアプリのみが su にアクセスでき、他のアプリは su を見つけられません。"},{"title":"モジュール対応","details":"KernelSU は OverlayFS により実際のシステムを改変せずに /system を変更できます。書き込み可能にすることさえできます。"},{"title":"オープンソース","details":"KernelSU は GPL-3 でライセンスされたオープンソースプロジェクトです。"}]},"headers":[],"relativePath":"ja_JP/index.md","filePath":"ja_JP/index.md"}'),n={name:"ja_JP/index.md"};function i(r,o,l,s,d,c){return t(),a("div")}const p=e(n,[["render",i]]);export{_ as __pageData,p as default};
import{_ as e,o as t,c as a}from"./chunks/framework.ec8f7e8e.js";const _=JSON.parse('{"title":"Android 向けのカーネルベース root ソリューション","description":"","frontmatter":{"layout":"home","title":"Android 向けのカーネルベース root ソリューション","hero":{"name":"KernelSU","text":"Android 向けのカーネルベース root ソリューション","tagline":"","image":{"src":"/logo.png","alt":"KernelSU"},"actions":[{"theme":"brand","text":"はじめる","link":"/ja_JP/guide/what-is-kernelsu"},{"theme":"alt","text":"GitHub で表示","link":"https://github.com/tiann/KernelSU"}]},"features":[{"title":"カーネルベース","details":"KernelSU は Linux カーネルモードで動作し、ユーザー空間よりも高度な制御が可能です。"},{"title":"ホワイトリストの権限管理","details":"root 権限を許可したアプリのみが su にアクセスでき、他のアプリは su を見つけられません。"},{"title":"モジュール対応","details":"KernelSU は OverlayFS により実際のシステムを改変せずに /system を変更できます。書き込み可能にすることさえできます。"},{"title":"オープンソース","details":"KernelSU は GPL-3 でライセンスされたオープンソースプロジェクトです。"}]},"headers":[],"relativePath":"ja_JP/index.md","filePath":"ja_JP/index.md"}'),n={name:"ja_JP/index.md"};function i(r,o,l,s,d,c){return t(),a("div")}const p=e(n,[["render",i]]);export{_ as __pageData,p as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
import{_ as o,o as e,c as s,O as a}from"./chunks/framework.43781440.js";const g=JSON.parse('{"title":"Perfil do Aplicativo","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/app-profile.md","filePath":"pt_BR/guide/app-profile.md"}'),r={name:"pt_BR/guide/app-profile.md"},p=a("",46),n=[p];function i(d,t,c,l,u,m){return e(),s("div",null,n)}const F=o(r,[["render",i]]);export{g as __pageData,F as default};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{_ as o,o as e,c as s,Q as a}from"./chunks/framework.ec8f7e8e.js";const y=JSON.parse('{"title":"Perfil do Aplicativo","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/app-profile.md","filePath":"pt_BR/guide/app-profile.md"}'),p={name:"pt_BR/guide/app-profile.md"},r=a("",46),n=[r];function l(t,c,i,d,u,m){return e(),s("div",null,n)}const g=o(p,[["render",l]]);export{y as __pageData,g as default};

View File

@ -1 +1 @@
import{_ as e,o,c as a,O as s}from"./chunks/framework.43781440.js";const h=JSON.parse('{"title":"Diferença com Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/difference-with-magisk.md","filePath":"pt_BR/guide/difference-with-magisk.md"}'),i={name:"pt_BR/guide/difference-with-magisk.md"},t=s('<h1 id="diferenca-com-magisk" tabindex="-1">Diferença com Magisk <a class="header-anchor" href="#diferenca-com-magisk" aria-label="Permalink to &quot;Diferença com Magisk&quot;"></a></h1><p>Embora existam muitas semelhanças entre os módulos KernelSU e os módulos Magisk, existem inevitavelmente algumas diferenças devido aos seus mecanismos de implementação completamente diferentes. Se você deseja que seu módulo seja executado no Magisk e no KernelSU, você deve entender essas diferenças.</p><h2 id="semelhancas" tabindex="-1">Semelhanças <a class="header-anchor" href="#semelhancas" aria-label="Permalink to &quot;Semelhanças&quot;"></a></h2><ul><li>Formato de arquivo do módulo: ambos usam o formato zip para organizar os módulos, e o formato dos módulos é quase o mesmo.</li><li>Diretório de instalação do módulo: ambos localizados em <code>/data/adb/modules</code>.</li><li>Sem sistema: ambos suportam a modificação de <code>/system</code> de maneira sem sistema por meio de módulos.</li><li>post-fs-data.sh: o tempo de execução e a semântica são exatamente os mesmos.</li><li>service.sh: o tempo de execução e a semântica são exatamente os mesmos.</li><li>system.prop: completamente o mesmo.</li><li>sepolicy.rule: completamente o mesmo.</li><li>BusyBox: os scripts são executados no BusyBox com o &quot;Modo Autônomo&quot; ativado em ambos os casos.</li></ul><h2 id="diferencas" tabindex="-1">Diferenças <a class="header-anchor" href="#diferencas" aria-label="Permalink to &quot;Diferenças&quot;"></a></h2><p>Antes de entender as diferenças, você precisa saber diferenciar se o seu módulo está rodando no KernelSU ou Magisk. Você pode usar a variável de ambiente <code>KSU</code> para diferenciá-la em todos os locais onde você pode executar os scripts do módulo (<code>customize.sh</code>, <code>post-fs-data.sh</code>, <code>service.sh</code>). No KernelSU, esta variável de ambiente será definida como <code>true</code>.</p><p>Aqui estão algumas diferenças:</p><ul><li>Os módulos KernelSU não podem ser instalados no modo Recovery.</li><li>Os módulos KernelSU não têm suporte integrado para Zygisk (mas você pode usar módulos Zygisk através do <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a>.</li><li>O método para substituir ou excluir arquivos nos módulos KernelSU é completamente diferente do Magisk. O KernelSU não suporta o método <code>.replace</code>. Em vez disso, você precisa criar um arquivo com o mesmo nome <code>mknod filename c 0 0</code> para excluir o arquivo correspondente.</li><li>Os diretórios do BusyBox são diferentes. O BusyBox integrado no KernelSU está localizado em <code>/data/adb/ksu/bin/busybox</code>, enquanto no Magisk está em <code>/data/adb/magisk/busybox</code>. <strong>Observe que este é um comportamento interno do KernelSU e pode mudar no futuro!</strong></li><li>O KernelSU não suporta arquivos <code>.replace</code>, entretanto, o KernelSU suporta as variáveis <code>REMOVE</code> e <code>REPLACE</code> para remover ou substituir arquivos e pastas.</li><li>O KernelSU adiciona o estágio <code>boot-completed</code> para executar alguns scripts na inicialização concluída.</li><li>O KernelSU adiciona o estágio <code>post-mount</code> para executar alguns scripts após montar overlayfs.</li></ul>',8),r=[t];function d(n,m,c,l,u,p){return o(),a("div",null,r)}const g=e(i,[["render",d]]);export{h as __pageData,g as default};
import{_ as e,o,c as a,Q as s}from"./chunks/framework.ec8f7e8e.js";const h=JSON.parse('{"title":"Diferença com Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/difference-with-magisk.md","filePath":"pt_BR/guide/difference-with-magisk.md"}'),i={name:"pt_BR/guide/difference-with-magisk.md"},t=s('<h1 id="diferenca-com-magisk" tabindex="-1">Diferença com Magisk <a class="header-anchor" href="#diferenca-com-magisk" aria-label="Permalink to &quot;Diferença com Magisk&quot;"></a></h1><p>Embora existam muitas semelhanças entre os módulos KernelSU e os módulos Magisk, existem inevitavelmente algumas diferenças devido aos seus mecanismos de implementação completamente diferentes. Se você deseja que seu módulo seja executado no Magisk e no KernelSU, você deve entender essas diferenças.</p><h2 id="semelhancas" tabindex="-1">Semelhanças <a class="header-anchor" href="#semelhancas" aria-label="Permalink to &quot;Semelhanças&quot;"></a></h2><ul><li>Formato de arquivo do módulo: ambos usam o formato zip para organizar os módulos, e o formato dos módulos é quase o mesmo.</li><li>Diretório de instalação do módulo: ambos localizados em <code>/data/adb/modules</code>.</li><li>Sem sistema: ambos suportam a modificação de <code>/system</code> de maneira sem sistema por meio de módulos.</li><li>post-fs-data.sh: o tempo de execução e a semântica são exatamente os mesmos.</li><li>service.sh: o tempo de execução e a semântica são exatamente os mesmos.</li><li>system.prop: completamente o mesmo.</li><li>sepolicy.rule: completamente o mesmo.</li><li>BusyBox: os scripts são executados no BusyBox com o &quot;Modo Autônomo&quot; ativado em ambos os casos.</li></ul><h2 id="diferencas" tabindex="-1">Diferenças <a class="header-anchor" href="#diferencas" aria-label="Permalink to &quot;Diferenças&quot;"></a></h2><p>Antes de entender as diferenças, você precisa saber diferenciar se o seu módulo está rodando no KernelSU ou Magisk. Você pode usar a variável de ambiente <code>KSU</code> para diferenciá-la em todos os locais onde você pode executar os scripts do módulo (<code>customize.sh</code>, <code>post-fs-data.sh</code>, <code>service.sh</code>). No KernelSU, esta variável de ambiente será definida como <code>true</code>.</p><p>Aqui estão algumas diferenças:</p><ul><li>Os módulos KernelSU não podem ser instalados no modo Recovery.</li><li>Os módulos KernelSU não têm suporte integrado para Zygisk (mas você pode usar módulos Zygisk através do <a href="https://github.com/Dr-TSNG/ZygiskNext" target="_blank" rel="noreferrer">ZygiskNext</a>.</li><li>O método para substituir ou excluir arquivos nos módulos KernelSU é completamente diferente do Magisk. O KernelSU não suporta o método <code>.replace</code>. Em vez disso, você precisa criar um arquivo com o mesmo nome <code>mknod filename c 0 0</code> para excluir o arquivo correspondente.</li><li>Os diretórios do BusyBox são diferentes. O BusyBox integrado no KernelSU está localizado em <code>/data/adb/ksu/bin/busybox</code>, enquanto no Magisk está em <code>/data/adb/magisk/busybox</code>. <strong>Observe que este é um comportamento interno do KernelSU e pode mudar no futuro!</strong></li><li>O KernelSU não suporta arquivos <code>.replace</code>, entretanto, o KernelSU suporta as variáveis <code>REMOVE</code> e <code>REPLACE</code> para remover ou substituir arquivos e pastas.</li><li>O KernelSU adiciona o estágio <code>boot-completed</code> para executar alguns scripts na inicialização concluída.</li><li>O KernelSU adiciona o estágio <code>post-mount</code> para executar alguns scripts após montar overlayfs.</li></ul>',8),r=[t];function d(n,m,c,l,u,p){return o(),a("div",null,r)}const g=e(i,[["render",d]]);export{h as __pageData,g as default};

View File

@ -1 +1 @@
import{_ as e,o,c as a,O as s}from"./chunks/framework.43781440.js";const h=JSON.parse('{"title":"Diferença com Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/difference-with-magisk.md","filePath":"pt_BR/guide/difference-with-magisk.md"}'),i={name:"pt_BR/guide/difference-with-magisk.md"},t=s("",8),r=[t];function d(n,m,c,l,u,p){return o(),a("div",null,r)}const g=e(i,[["render",d]]);export{h as __pageData,g as default};
import{_ as e,o,c as a,Q as s}from"./chunks/framework.ec8f7e8e.js";const h=JSON.parse('{"title":"Diferença com Magisk","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/difference-with-magisk.md","filePath":"pt_BR/guide/difference-with-magisk.md"}'),i={name:"pt_BR/guide/difference-with-magisk.md"},t=s("",8),r=[t];function d(n,m,c,l,u,p){return o(),a("div",null,r)}const g=e(i,[["render",d]]);export{h as __pageData,g as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{_ as e,o,c as a,O as r}from"./chunks/framework.43781440.js";const k=JSON.parse('{"title":"FAQ","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/faq.md","filePath":"pt_BR/guide/faq.md"}'),s={name:"pt_BR/guide/faq.md"},i=r("",33),n=[i];function t(l,d,u,p,m,c){return o(),a("div",null,n)}const g=e(s,[["render",t]]);export{k as __pageData,g as default};
import{_ as e,o,c as a,Q as r}from"./chunks/framework.ec8f7e8e.js";const k=JSON.parse('{"title":"FAQ","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/faq.md","filePath":"pt_BR/guide/faq.md"}'),s={name:"pt_BR/guide/faq.md"},i=r("",33),n=[i];function t(l,d,u,p,m,c){return o(),a("div",null,n)}const g=e(s,[["render",t]]);export{k as __pageData,g as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as o,O as r}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"Recursos ocultos","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/hidden-features.md","filePath":"pt_BR/guide/hidden-features.md"}'),s={name:"pt_BR/guide/hidden-features.md"},t=r('<h1 id="recursos-ocultos" tabindex="-1">Recursos ocultos <a class="header-anchor" href="#recursos-ocultos" aria-label="Permalink to &quot;Recursos ocultos&quot;"></a></h1><h2 id="ksurc" tabindex="-1">.ksurc <a class="header-anchor" href="#ksurc" aria-label="Permalink to &quot;.ksurc&quot;"></a></h2><p>Por padrão, <code>/system/bin/sh</code> carrega <code>/system/etc/mkshrc</code>.</p><p>Você pode fazer su carregar um arquivo rc personalizado criando um arquivo <code>/data/adb/ksu/.ksurc</code>.</p>',4),c=[t];function d(u,i,n,_,l,h){return a(),o("div",null,c)}const f=e(s,[["render",d]]);export{m as __pageData,f as default};
import{_ as e,o as a,c as o,Q as r}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"Recursos ocultos","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/hidden-features.md","filePath":"pt_BR/guide/hidden-features.md"}'),s={name:"pt_BR/guide/hidden-features.md"},t=r('<h1 id="recursos-ocultos" tabindex="-1">Recursos ocultos <a class="header-anchor" href="#recursos-ocultos" aria-label="Permalink to &quot;Recursos ocultos&quot;"></a></h1><h2 id="ksurc" tabindex="-1">.ksurc <a class="header-anchor" href="#ksurc" aria-label="Permalink to &quot;.ksurc&quot;"></a></h2><p>Por padrão, <code>/system/bin/sh</code> carrega <code>/system/etc/mkshrc</code>.</p><p>Você pode fazer su carregar um arquivo rc personalizado criando um arquivo <code>/data/adb/ksu/.ksurc</code>.</p>',4),c=[t];function d(u,i,n,_,l,h){return a(),o("div",null,c)}const f=e(s,[["render",d]]);export{m as __pageData,f as default};

View File

@ -1 +1 @@
import{_ as e,o as a,c as o,O as r}from"./chunks/framework.43781440.js";const m=JSON.parse('{"title":"Recursos ocultos","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/hidden-features.md","filePath":"pt_BR/guide/hidden-features.md"}'),s={name:"pt_BR/guide/hidden-features.md"},t=r("",4),c=[t];function d(u,i,n,_,l,h){return a(),o("div",null,c)}const f=e(s,[["render",d]]);export{m as __pageData,f as default};
import{_ as e,o as a,c as o,Q as r}from"./chunks/framework.ec8f7e8e.js";const m=JSON.parse('{"title":"Recursos ocultos","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/hidden-features.md","filePath":"pt_BR/guide/hidden-features.md"}'),s={name:"pt_BR/guide/hidden-features.md"},t=r("",4),c=[t];function d(u,i,n,_,l,h){return a(),o("div",null,c)}const f=e(s,[["render",d]]);export{m as __pageData,f as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
import{_ as s,o,c as e,O as a}from"./chunks/framework.43781440.js";const h=JSON.parse('{"title":"Como construir o KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/how-to-build.md","filePath":"pt_BR/guide/how-to-build.md"}'),n={name:"pt_BR/guide/how-to-build.md"},l=a("",24),r=[l];function t(p,c,i,d,u,C){return o(),e("div",null,r)}const y=s(n,[["render",t]]);export{h as __pageData,y as default};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{_ as s,o,c as a,Q as n}from"./chunks/framework.ec8f7e8e.js";const h=JSON.parse('{"title":"Como construir o KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/how-to-build.md","filePath":"pt_BR/guide/how-to-build.md"}'),e={name:"pt_BR/guide/how-to-build.md"},l=n("",24),p=[l];function r(t,c,i,d,u,y){return o(),a("div",null,p)}const m=s(e,[["render",r]]);export{h as __pageData,m as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{_ as s,o as n,c as a,O as e}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"Como integrar o KernelSU para kernels não GKI?","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/how-to-integrate-for-non-gki.md","filePath":"pt_BR/guide/how-to-integrate-for-non-gki.md"}'),l={name:"pt_BR/guide/how-to-integrate-for-non-gki.md"},p=e("",37),o=[p];function t(c,r,i,d,C,D){return n(),a("div",null,o)}const f=s(l,[["render",t]]);export{y as __pageData,f as default};
import{_ as s,o as n,c as a,Q as e}from"./chunks/framework.ec8f7e8e.js";const _=JSON.parse('{"title":"Como integrar o KernelSU para kernels não GKI?","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/how-to-integrate-for-non-gki.md","filePath":"pt_BR/guide/how-to-integrate-for-non-gki.md"}'),l={name:"pt_BR/guide/how-to-integrate-for-non-gki.md"},p=e("",37),t=[p];function o(c,i,r,d,E,f){return n(),a("div",null,t)}const u=s(l,[["render",o]]);export{_ as __pageData,u as default};

View File

@ -1,152 +0,0 @@
import{_ as s,o as n,c as a,O as e}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"Como integrar o KernelSU para kernels não GKI?","description":"","frontmatter":{},"headers":[],"relativePath":"pt_BR/guide/how-to-integrate-for-non-gki.md","filePath":"pt_BR/guide/how-to-integrate-for-non-gki.md"}'),l={name:"pt_BR/guide/how-to-integrate-for-non-gki.md"},p=e(`<h1 id="como-integrar-o-kernelsu-para-kernels-nao-gki" tabindex="-1">Como integrar o KernelSU para kernels não GKI? <a class="header-anchor" href="#como-integrar-o-kernelsu-para-kernels-nao-gki" aria-label="Permalink to &quot;Como integrar o KernelSU para kernels não GKI?&quot;"></a></h1><p>O KernelSU pode ser integrado em kernels não GKI e foi portado para 4.14 e versões anteriores.</p><p>Devido à fragmentação de kernels não GKI, não temos uma maneira uniforme de construí-lo, portanto não podemos fornecer imagens boot não GKI. Mas você mesmo pode construir o kernel com o KernelSU integrado.</p><p>Primeiro, você deve ser capaz de construir um kernel inicializável a partir do código-fonte do kernel. Se o kernel não for de código aberto, será difícil executar o KernelSU no seu dispositivo.</p><p>Se você puder construir um kernel inicializável, existem duas maneiras de integrar o KernelSU ao código-fonte do kernel:</p><ol><li>Automaticamente com <code>kprobe</code></li><li>Manualmente</li></ol><h2 id="integrar-com-kprobe" tabindex="-1">Integrar com kprobe <a class="header-anchor" href="#integrar-com-kprobe" aria-label="Permalink to &quot;Integrar com kprobe&quot;"></a></h2><p>O KernelSU usa kprobe para fazer ganchos de kernel, se o kprobe funcionar bem em seu kernel, é recomendado usar desta forma.</p><p>Primeiro, adicione o KernelSU à árvore de origem do kernel:</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-</span></span></code></pre></div><p>Então, você deve verificar se o kprobe está ativado na configuração do seu kernel, se não estiver, adicione estas configurações a ele:</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">CONFIG_KPROBES=y</span></span>
<span class="line"><span style="color:#A6ACCD;">CONFIG_HAVE_KPROBES=y</span></span>
<span class="line"><span style="color:#A6ACCD;">CONFIG_KPROBE_EVENTS=y</span></span></code></pre></div><p>E construa seu kernel novamente, KernelSU deve funcionar bem.</p><p>Se você descobrir que o KPROBES ainda não está ativado, você pode tentar ativar <code>CONFIG_MODULES</code>. (Se ainda assim não surtir efeito, use <code>make menuconfig</code> para procurar outras dependências do KPROBES)</p><p>Mas se você entrar em um bootloop quando o KernelSU for integrado, talvez o <strong>kprobe esteja quebrado em seu kernel</strong>, você deve corrigir o bug do kprobe ou usar o segundo caminho.</p><div class="tip custom-block"><p class="custom-block-title">COMO VERIFICAR SE O KPROBE ESTÁ QUEBRADO?</p><p>Comente <code>ksu_enable_sucompat()</code> e <code>ksu_enable_ksud()</code> em <code>KernelSU/kernel/ksu.c</code>, se o dispositivo inicializar normalmente, então o kprobe pode estar quebrado.</p></div><h2 id="modifique-manualmente-a-fonte-do-kernel" tabindex="-1">Modifique manualmente a fonte do kernel <a class="header-anchor" href="#modifique-manualmente-a-fonte-do-kernel" aria-label="Permalink to &quot;Modifique manualmente a fonte do kernel&quot;"></a></h2><p>Se o kprobe não funcionar no seu kernel (pode ser um bug do upstream ou do kernel abaixo de 4.8), então você pode tentar desta forma:</p><p>Primeiro, adicione o KernelSU à árvore de origem do kernel:</p><ul><li>Tag mais recente (estável)</li></ul><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-</span></span></code></pre></div><ul><li>branch principal (dev)</li></ul><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">main</span></span></code></pre></div><ul><li>Selecione a tag (Como v0.5.2)</li></ul><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-LSs</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">bash</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">v0.5.2</span></span></code></pre></div><p>Em seguida, adicione chamadas KernelSU à fonte do kernel. Aqui está um patch para referência:</p><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/fs/exec.c b/fs/exec.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index ac59664eaecf..bdd585e1d2cc 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/exec.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/exec.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -1890,11 +1890,14 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> static int __do_execve_file(int fd, struct filename *filename,</span></span>
<span class="line"><span style="color:#A6ACCD;"> return retval;</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern bool ksu_execveat_hook __read_mostly;</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> void *envp, int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> void *argv, void *envp, int *flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> static int do_execveat_common(int fd, struct filename *filename,</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct user_arg_ptr argv,</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct user_arg_ptr envp,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int flags)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> if (unlikely(ksu_execveat_hook))</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_execveat(&amp;fd, &amp;filename, &amp;argv, &amp;envp, &amp;flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> else</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_execveat_sucompat(&amp;fd, &amp;filename, &amp;argv, &amp;envp, &amp;flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> return __do_execve_file(fd, filename, argv, envp, flags, NULL);</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">diff --git a/fs/open.c b/fs/open.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 05036d819197..965b84d486b8 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -348,6 +348,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)</span></span>
<span class="line"><span style="color:#A6ACCD;"> return ksys_fallocate(fd, mode, offset, len);</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> int *flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> /*</span></span>
<span class="line"><span style="color:#A6ACCD;"> * access() needs to use the real uid/gid, not the effective uid/gid.</span></span>
<span class="line"><span style="color:#A6ACCD;"> * We do this by temporarily clearing all FS-related capabilities and</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -355,6 +357,7 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)</span></span>
<span class="line"><span style="color:#A6ACCD;"> */</span></span>
<span class="line"><span style="color:#A6ACCD;"> long do_faccessat(int dfd, const char __user *filename, int mode)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_faccessat(&amp;dfd, &amp;filename, &amp;mode, NULL);</span></span>
<span class="line"><span style="color:#A6ACCD;"> const struct cred *old_cred;</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct cred *override_cred;</span></span>
<span class="line"><span style="color:#A6ACCD;"> struct path path;</span></span>
<span class="line"><span style="color:#A6ACCD;">diff --git a/fs/read_write.c b/fs/read_write.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 650fc7e0f3a6..55be193913b6 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/read_write.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/read_write.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -434,10 +434,14 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> EXPORT_SYMBOL(kernel_read);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern bool ksu_vfs_read_hook __read_mostly;</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> size_t *count_ptr, loff_t **pos);</span></span>
<span class="line"><span style="color:#A6ACCD;"> ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#A6ACCD;"> ssize_t ret;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> if (unlikely(ksu_vfs_read_hook))</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_vfs_read(&amp;file, &amp;buf, &amp;count, &amp;pos);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> if (!(file-&gt;f_mode &amp; FMODE_READ))</span></span>
<span class="line"><span style="color:#A6ACCD;"> return -EBADF;</span></span>
<span class="line"><span style="color:#A6ACCD;"> if (!(file-&gt;f_mode &amp; FMODE_CAN_READ))</span></span>
<span class="line"><span style="color:#A6ACCD;">diff --git a/fs/stat.c b/fs/stat.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 376543199b5a..82adcef03ecc 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -148,6 +148,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_statx_fd(unsigned int fd, struct kstat *stat,</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> EXPORT_SYMBOL(vfs_statx_fd);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> /**</span></span>
<span class="line"><span style="color:#A6ACCD;"> * vfs_statx - Get basic and extra attributes by filename</span></span>
<span class="line"><span style="color:#A6ACCD;"> * @dfd: A file descriptor representing the base dir for a relative filename</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -170,6 +172,7 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_statx(int dfd, const char __user *filename, int flags,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int error = -EINVAL;</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_stat(&amp;dfd, &amp;filename, &amp;flags);</span></span>
<span class="line"><span style="color:#A6ACCD;"> if ((flags &amp; ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |</span></span>
<span class="line"><span style="color:#A6ACCD;"> AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0)</span></span>
<span class="line"><span style="color:#A6ACCD;"> return -EINVAL;</span></span></code></pre></div><p>Você deve encontrar as quatro funções no código-fonte do kernel:</p><ol><li>do_faccessat, geralmente em <code>fs/open.c</code></li><li>do_execveat_common, geralmente em <code>fs/exec.c</code></li><li>vfs_read, geralmente em <code>fs/read_write.c</code></li><li>vfs_statx, geralmente em <code>fs/stat.c</code></li></ol><p>Se o seu kernel não tiver <code>vfs_statx</code>, use <code>vfs_fstatat</code>:</p><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/fs/stat.c b/fs/stat.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 068fdbcc9e26..5348b7bb9db2 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/stat.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -87,6 +87,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_fstat(unsigned int fd, struct kstat *stat)</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> EXPORT_SYMBOL(vfs_fstat);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int flag)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -94,6 +96,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,</span></span>
<span class="line"><span style="color:#A6ACCD;"> int error = -EINVAL;</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int lookup_flags = 0;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_stat(&amp;dfd, &amp;filename, &amp;flag);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> if ((flag &amp; ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |</span></span>
<span class="line"><span style="color:#A6ACCD;"> AT_EMPTY_PATH)) != 0)</span></span>
<span class="line"><span style="color:#A6ACCD;"> goto out;</span></span></code></pre></div><p>Para kernels anteriores ao 4.17, se você não conseguir encontrar <code>do_faccessat</code>, basta ir até a definição do syscall <code>faccessat</code> e fazer a chamada lá:</p><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/fs/open.c b/fs/open.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 2ff887661237..e758d7db7663 100644</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/fs/open.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -355,6 +355,9 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)</span></span>
<span class="line"><span style="color:#A6ACCD;"> return error;</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> int *flags);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> /*</span></span>
<span class="line"><span style="color:#A6ACCD;"> * access() needs to use the real uid/gid, not the effective uid/gid.</span></span>
<span class="line"><span style="color:#A6ACCD;"> * We do this by temporarily clearing all FS-related capabilities and</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -370,6 +373,8 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)</span></span>
<span class="line"><span style="color:#A6ACCD;"> int res;</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int lookup_flags = LOOKUP_FOLLOW;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_faccessat(&amp;dfd, &amp;filename, &amp;mode, NULL);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> if (mode &amp; ~S_IRWXO) /* where&#39;s F_OK, X_OK, W_OK, R_OK? */</span></span>
<span class="line"><span style="color:#A6ACCD;"> return -EINVAL;</span></span></code></pre></div><p>Para ativar o Modo de Segurança integrado do KernelSU, você também deve modificar <code>input_handle_event</code> em <code>drivers/input/input.c</code>:</p><div class="tip custom-block"><p class="custom-block-title">DICA</p><p>É altamente recomendável ativar este recurso, é muito útil para evitar bootloops!</p></div><div class="language-diff"><button title="Copy Code" class="copy"></button><span class="lang">diff</span><pre class="shiki material-theme-palenight has-diff"><code><span class="line"><span style="color:#A6ACCD;">diff --git a/drivers/input/input.c b/drivers/input/input.c</span></span>
<span class="line"><span style="color:#A6ACCD;">index 45306f9ef247..815091ebfca4 100755</span></span>
<span class="line"><span style="color:#89DDFF;">---</span><span style="color:#A6ACCD;"> a/drivers/input/input.c</span></span>
<span class="line"><span style="color:#89DDFF;">+++</span><span style="color:#A6ACCD;"> b/drivers/input/input.c</span></span>
<span class="line"><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> -367,10 +367,13 </span><span style="color:#89DDFF;">@@</span><span style="color:#A6ACCD;"> static int input_get_disposition(struct input_dev *dev,</span></span>
<span class="line"><span style="color:#A6ACCD;"> return disposition;</span></span>
<span class="line"><span style="color:#A6ACCD;"> }</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern bool ksu_input_hook __read_mostly;</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;">extern int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code, int *value);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#A6ACCD;"> static void input_handle_event(struct input_dev *dev,</span></span>
<span class="line"><span style="color:#A6ACCD;"> unsigned int type, unsigned int code, int value)</span></span>
<span class="line"><span style="color:#A6ACCD;"> {</span></span>
<span class="line"><span style="color:#A6ACCD;"> int disposition = input_get_disposition(dev, type, code, &amp;value);</span></span>
<span class="line"><span style="color:#89DDFF;">+</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> if (unlikely(ksu_input_hook))</span></span>
<span class="line"><span style="color:#89DDFF;">+</span><span style="color:#C3E88D;"> ksu_handle_input_handle_event(&amp;type, &amp;code, &amp;value);</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> if (disposition != INPUT_IGNORE_EVENT &amp;&amp; type != EV_SYN)</span></span>
<span class="line"><span style="color:#A6ACCD;"> add_input_randomness(type, code, value);</span></span></code></pre></div><p>Finalmente, construa seu kernel novamente, e então, o KernelSU deve funcionar bem.</p>`,37),o=[p];function t(c,r,i,d,C,D){return n(),a("div",null,o)}const f=s(l,[["render",t]]);export{y as __pageData,f as default};

Some files were not shown because too many files have changed in this diff Show More