[Xiaomi Mi 9 Questions & Answers] Separatee:
Hi everyone,

During this week, I tried compiling kernel, then got a little success when i compiled kernel source without any modules but KernelSU. So from then on, I tried compiling kernel with KernelSU, kali Nethunter and Docker. But I failed due to some errors from kernel source.

Environments I Used:

System:

Kali GNU/Linux (Proot container based on Android Termux(yes,i ran it on my local phone))

CC:

clang 17.0.2-arrch64 Download_Link

Kernel Repo:

Here

Compiler Args:

make -j{nproc --all} CC="ccache clang" USE_CCACHE=1 AR=llvm-ar NM=llvm-nm OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump STRIP=llvm-strip O=out KBUILD_OUTPUT=out 2>&1 | tee kernel.log

What I ve done:

# 1. edit .config
# 2. patched kali
git clone https://gitlab.com/kalilinux/nethunter/build-scripts/kali-nethunter-kernel.git

patch -p1 < kali-nethunter-kernel/patches/4.14/add-wifi-injection-4.14.patch

patch -p1 < kali-nethunter-kernel/patches/4.14/fix-ath9k-naming-conflict.patch

# Try to use CCACHE
apt install -y ccache
ccache clang -v

# Checked .config carefully and backed it up.

'cause I don't know what the basic compilation principle of kernel is, and I don't know anything about C, so thank you in advance, all the files can be found in the Kernel Repo just mentioned above.

Errors Found:

../drivers/hid/hid-qvr.c:699:1: error: redefinition of '__inittest'
699 | module_init(qvr_external_sensor_init);
| ^
../include/linux/module.h:130:42: note: expanded from macro 'module_init'
130 | static inline initcall_t __maybe_unused __inittest(void) \
| ^
../drivers/hid/hid-qvr.c:639:1: note: previous definition is here
639 | module_hid_driver(qvr_external_sensor_driver);
| ^
../include/linux/hid.h:852:2: note: expanded from macro 'module_hid_driver'
852 | module_driver(__hid_driver, hid_register_driver, \
| ^
../include/linux/device.h:1525:3: note: expanded from macro 'module_driver'
1525 | } \
| ^
../include/linux/module.h:130:42: note: expanded from macro '\
module_init'
130 | static inline initcall_t __maybe_unused __inittest(void) \
| ^
../drivers/hid/hid-qvr.c:699:1: error: redefinition of 'init_module'
699 | module_init(qvr_external_sensor_init);
| ^
../include/linux/module.h:132:6: note: expanded from macro 'module_init'
132 | int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
| ^
../drivers/hid/hid-qvr.c:639:1: note: previous definition is here
639 | module_hid_driver(qvr_external_sensor_driver);
| ^
../include/linux/hid.h:852:2: note: expanded from macro 'module_hid_driver'
852 | module_driver(__hid_driver, hid_register_driver, \
| ^
../include/linux/device.h:1525:3: note: expanded from macro 'module_driver'
1525 | } \
| ^
../include/linux/module.h:132:6: note: expanded from macro '\
module_init'
132 | int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
| ^
../drivers/hid/hid-qvr.c:700:1: error: redefinition of '__exittest'
700 | module_exit(qvr_external_sensor_exit);
| ^
../include/linux/module.h:136:42: note: expanded from macro 'module_exit'
136 | static inline exitcall_t __maybe_unused __exittest(void) \
| ^
../drivers/hid/hid-qvr.c:639:1: note: previous definition is here
639 | module_hid_driver(qvr_external_sensor_driver);
| ^
../include/linux/hid.h:852:2: note: expanded from macro 'module_hid_driver'
852 | module_driver(__hid_driver, hid_register_driver, \
| ^
../include/linux/device.h:1530:3: note: expanded from macro 'module_driver'
1530 | } \
| ^
../include/linux/module.h:136:42: note: expanded from macro '\
module_exit'
136 | static inline exitcall_t __maybe_unused __exittest(void) \
| ^
../drivers/hid/hid-qvr.c:700:1: error: redefinition of 'cleanup_module'
700 | module_exit(qvr_external_sensor_exit);
| ^
../include/linux/module.h:138:7: note: expanded from macro 'module_exit'
138 | void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn)));
| ^
../drivers/hid/hid-qvr.c:639:1: note: previous definition is here
639 | module_hid_driver(qvr_external_sensor_driver);
| ^
../include/linux/hid.h:852:2: note: expanded from macro 'module_hid_driver'
852 | module_driver(__hid_driver, hid_register_driver, \
| ^
../include/linux/device.h:1530:3: note: expanded from macro 'module_driver'
1530 | } \
| ^
../include/linux/module.h:138:7: note: expanded from macro '\
module_exit'
138 | void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn)));
| ^
4 errors generated.