docs: Add devpts description for non gki

This commit is contained in:
weishu
2024-05-09 11:47:34 +08:00
parent a943528d82
commit 109442f8c4
3 changed files with 101 additions and 32 deletions

View File

@@ -264,6 +264,8 @@ index 2ff887661237..e758d7db7663 100644
return -EINVAL;
```
### Safe Mode
To enable KernelSU's builtin SafeMode, You should also modify `input_handle_event` in `drivers/input/input.c`:
:::tip
@@ -297,6 +299,38 @@ index 45306f9ef247..815091ebfca4 100755
add_input_randomness(type, code, value);
```
:::info Entering safe mode accidiently?
If you use manual integration and do not disable `CONFIG_KPROBES`, then the user may trigger safe mode by pressing the volume down button after booting! Therefore if using manual integration you need to disable `CONFIG_KPROBES`!
:::
### Failed to execute `pm` in terminal?
You should modify `fs/devpts/inode.c`, reference:
```diff
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 32f6f1c68..d69d8eca2 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -602,6 +602,8 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
return dentry;
}
+extern int ksu_handle_devpts(struct inode*);
+
/**
* devpts_get_priv -- get private data for a slave
* @pts_inode: inode of the slave
@@ -610,6 +612,7 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
*/
void *devpts_get_priv(struct dentry *dentry)
{
+ ksu_handle_devpts(dentry->d_inode);
if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC)
return NULL;
return dentry->d_fsdata;
```
### How to backport path_umount
You can get module umount feature working on pre-GKI kernels by manually backporting `path_umount` from 5.9. You can use this patch as reference:
@@ -347,7 +381,3 @@ You can get module umount feature working on pre-GKI kernels by manually backpor
```
Finally, build your kernel again, KernelSU should work well.
:::info Entering safe mode accidiently?
If you use manual integration and do not disable `CONFIG_KPROBES`, then the user may trigger safe mode by pressing the volume down button after booting! Therefore if using manual integration you need to disable `CONFIG_KPROBES`!
:::

View File

@@ -258,12 +258,18 @@ index 2ff887661237..e758d7db7663 100644
return -EINVAL;
```
### 安全模式
要使用 KernelSU 内置的安全模式,你还需要修改 `drivers/input/input.c` 中的 `input_handle_event` 方法:
:::tip
强烈建议开启此功能,对用户救砖会非常有帮助!
:::
:::info 莫名其妙进入安全模式?
如果你采用手动集成的方式,并且没有禁用`CONFIG_KPROBES`,那么用户在开机之后按音量下,也可能触发安全模式!因此如果使用手动集成,你需要关闭 `CONFIG_KPROBES`
:::
```diff
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 45306f9ef247..815091ebfca4 100755
@@ -291,7 +297,35 @@ index 45306f9ef247..815091ebfca4 100755
add_input_randomness(type, code, value);
```
### 如何backport(向旧版本移植) path_umount {#how-to-backport-path-umount}
### pm 命令执行失败?
你需要同时修改 `fs/devpts/inode.c`,补丁如下:
```diff
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 32f6f1c68..d69d8eca2 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -602,6 +602,8 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
return dentry;
}
+extern int ksu_handle_devpts(struct inode*);
+
/**
* devpts_get_priv -- get private data for a slave
* @pts_inode: inode of the slave
@@ -610,6 +612,7 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
*/
void *devpts_get_priv(struct dentry *dentry)
{
+ ksu_handle_devpts(dentry->d_inode);
if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC)
return NULL;
return dentry->d_fsdata;
```
### path_umount {#how-to-backport-path-umount}
你可以通过从K5.9向旧版本移植`path_umount`在GKI之前的内核上获得卸载模块的功能。你可以通过以下补丁作为参考:
@@ -341,7 +375,3 @@ index 45306f9ef247..815091ebfca4 100755
```
改完之后重新编译内核即可。
:::info 莫名其妙进入安全模式?
如果你采用手动集成的方式,并且没有禁用`CONFIG_KPROBES`,那么用户在开机之后按音量下,也可能触发安全模式!因此如果使用手动集成,你需要关闭 `CONFIG_KPROBES`
:::