Helping building Android driver modules for STM32MP25 running OpenSTDroid
I've been trying to build compatible Android modules (.ko) for my STM32MP25F7-EV1 running OpenSTDroid Distribution. I've successfully built these modules, but I cannot enable them with the `insmod` command because they're incompatible.
insmod: ERROR: could not insert module btusb.ko: Exec format error
I ran `strings btusb.ko | grep vermagic` and it looks like the `btusb.ko` is using a slightly different kernel version than the target's kernel version (6.1.78-00024-ge4076639eb90 for module v.s. 6.1.78-00024-gf31b8a21afa8 for kernel).
vermagic=6.1.78-00024-ge4076639eb90 SMP preempt mod_unload aarch64
__UNIQUE_ID_vermagic330
__UNIQUE_ID_vermagic330I don't understand where I'm going wrongly. Here's my module build process so far
- Download OpenSTDroid Distribution (following the wiki linked here).
- Build OpenSTDroid using the wiki linked here.
- Set the following environment variables
export BUILD_TOP=$(pwd) /* AOSP root/top directory */
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
export KERNEL_src=${BUILD_TOP}/device/stm/stm32mp2-kernel/linux-stm32mp2- Ran `./device/stm/stm32mp2-kernel/source/load_kernel.sh` to load the kernel.
- I entered `$KERNEL_SRC` and ran `make menuconfig` to enable the Bluetooth USB configuration options.
- I ran `make olddefconfig`, `make prepare`, and then `make –C $KERNEL_SRC ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE –j$(nrpoc)` to build the kernel.
- Finally, I run `make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- M=drivers/bluetooth modules` to successfully build `btusb.ko`.
Am I in the wrong kernel folder? Am I building the module incorrectly? Any insight would be helpful.
Target Hardware Platform: STM32MP25F7-EV1
Target Operating System: OpenSTDroid Distribution (st-android-13.0.0-2024-07-31) [Wiki link]
Target Kernel Version: 6.1.78-00024-gf31b8a21afa8
