This is an old revision of the document!
No lecture available :(
Let's build a Linux kernel module and load in onto our board!
First, you need to have the Linux source code for the same version of the kernel you're running your board on.
You can check the version by running uname -a
on the imx8 device (we will use v6.4
in our example).
Check your linux source code using git status
to see if you're running the same one:
# git status HEAD detached at v6.4
If you need to recompile the kernel, check out the desired tag.
Next (optional), it's going to be useful to have ssh installed inside the rootfs.
Use buildroot's menuconfig
to install PACKAGE_OPENSSH
(all of them).
In either case (kernel / buildroot recompilation), you will need to regenerate the linux.itb image with your new binaries.
Read some of this and create your external module's makefile.
ARCH=arm64
to the kbuild make invocation!
If you don't do so, the kernel's .config
will be reset and you'll probably need to recompile the kernel if you do anything more on the kernel tree.
TODO
Google for some inspiration on Linux kernel sample character device modules.
Next: build it!
Upload it onto your board and test it using insmod
!
TODO
Download & read the i.MX8M's Reference Manual, chapter 16.2.
Ahem not all of it, check the memory map / register definition for UTXD
and UTS
.
Next, we will enhance our character device to print the using IMX UART peripheral using a simple MMIO interface. Useful resources for mapping, reading & writing IO memory: https://www.kernel.org/doc/html/latest/driver-api/device-io.html
TODO