• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

How to compile a kernel module for stock OnePlus 6T kernel?

Search This thread

urbanmuzak

New member
Sep 1, 2007
2
0
Hi guys,

I am trying to compile an xt_HL.ko module which will allow me to use target TTL in iptables to fix the TTL when using the phone as a hotspot. I would like to do so for a stock kernel.

I am doing this under linux mint 19.

I have gotten as far as
1) Getting the sources for the Oneplus 6T kernel from git.
2) I got the android NDK installed (sudo apt install google-android-ndk-installer)
3) export ARCH=arm64
4) export CROSS_COMPILE=/usr/lib/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-
5) in the kernel source
6) make ARCH=arm64 CROSS_COMPILE=/usr/lib/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android- sdm845-perf_defconfig
7) make menuconfig >> here I add the TTL Target as a module, save the .config
8) make -j8
9) make modules
10) everything builds successfully with no errors in the modules area
11) I transfer the resulting xt_HL.ko into the phone onto /sdcard/xt_HL.ko
12) adb shell
13) su
14) insmod /sdcard/xt_HL.ko

and after all this I get an error:
Code:
OnePlus6T:/sdcard # insmod xt_HL.ko -f                                                                                                                    
insmod: failed to load xt_HL.ko: Required key not available

As i understand I am using the wrong toolchain? Or am I missing something else?

when I look at /proc/version I get:

Code:
OnePlus6T:/sdcard # cat /proc/version                                                                                                                     
Linux version 4.9.106-perf+ ([email protected]) (gcc version 4.9.x 20150123 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Nov 27 03:37:42 CST 2018

Please help me with this. I don't really want to go as far as a completely custom kernel yet.
 

Nsane457

Senior Member
Mar 14, 2008
116
102
The kernel in the phone was built with EFI_SECURE_BOOT_SIG_ENFORCE=y. This prevents loading unsigned, 3rd-party modules. You would probably need a custom kernel.