The prerequisites to cross-compile a kernel module are quite clear:
- We need the kernel source tree for the target system installed as part of the workspace on our host system, typically an x86_64 desktop (for our example, using the Raspberry Pi as a target, please refer to the official Raspberry Pi documentation here: https://www.raspberrypi.org/documentation/linux/kernel/building.md).
- We now need a cross toolchain. Typically, the host system is an x86_64 and here, as the target is an ARM-32, we will need an x86_64-to-ARM32 cross toolchain. Again, as is clearly mentioned in Chapter 3, Building the 5.x Linux Kernel from Source - Part 2, Kernel Build for the Raspberry Pi, you must download and install the Raspberry Pi-specific x86_64-to-ARM toolchain as part of the host system workspace (refer to Chapter 3, Building the 5.x Linux Kernel from Source - Part 2, to learn how to install the toolchain).
Okay...