KernelSU Compiling Errors with LineageOS 22.2 on OnePlus Nord N200 (dre)
in Post with 0 comment

I am encountering compilation errors when integrating the latest stable KernelSU into my LineageOS 22.2 kernel build for the OnePlus Nord N200 5G (code name: dre). The errors specifically originate from the compilation of KernelSU's SELinux-related source files (drivers/kernelsu/selinux/*.c).

Here is a breakdown of my setup and the encountered issues:

**Environment:**

* **KernelSU Version Tried:** Latest stable tag (via official setup.sh script, as of May 20, 2025)
* **Kernel Version:** 5.4.289
* **Device:** OnePlus Nord N200 5G (codename: dre)
* **Android ROM:** LineageOS 22.2 (based on Android 15)
* **Host OS for Build:** Ubuntu 20.04 LTS (x86-64)

**Integration Method:**

I integrated KernelSU into the LineageOS kernel source tree (kernel/oneplus/sm4350) using the logic adapted from the official setup.sh script: cloning KernelSU into the kernel tree, checking out the latest stable tag, symlinking KernelSU/kernel to drivers/kernelsu, and modifying drivers/Makefile and drivers/Kconfig. The following Kconfig options were enabled in the device's defconfig:

* CONFIG_KSU=y
* CONFIG_KPROBES=y
* CONFIG_HAVE_KPROBES=y
* CONFIG_OVERLAY_FS=y
* CONFIG_MODULES=y
* CONFIG_MODULE_SIG=n

**Problem Description:**

The kernel fails to compile when KernelSU is integrated, specifically during the compilation of KernelSU's SELinux-related source files.

The errors are primarily related to redefinitions of variables and missing struct members, leading to compilation failures.

**Key Compilation Errors:**

- Redefinition of 'current_sid'
- Missing members in 'struct filename_trans_datum'...

[Include more detailed error messages here]

**Question:**

Is the latest stable tag of KernelSU expected to be compatible with Linux kernel 5.4.289, especially its SELinux implementation as found in the LineageOS kernel for the OnePlus Nord N200 5G?

Does anyone know of any workarounds, specific KernelSU versions or tags, or patches recommended for kernel 5.4.x to resolve these SELinux compilation issues?

The article has been posted for too long and comments have been automatically closed.