Brainy Pi

Available to select audience (currently beta)

Building externel kernel modules on Brainy pi
Brainy Pi is a powerful single-board computer that is perfect for developing software projects. If you’re working on a project that requires additional functionality beyond what’s provided by the kernel, you may need to build external kernel modules. In this blog post, we’ll guide you through the process of Building External Kernel Modules on Brainy Pi. We’ll cover the tools and commands you need to use, as well as some best practices for ensuring that your modules are compatible with the kernel.

Step 1: Install Kernel Headers

Before you can start building external kernel modules on BrainyPi, you need to install the kernel headers. Kernel headers contain the essential files that are needed to compile external kernel modules.
To install the kernel headers, run the following commands in your terminal:
sudo apt update 
sudo apt install -y linux-headers-$(uname -r) 
The first command updates your package lists, while the second command installs the kernel headers for the current kernel version.

Step 2: Compile External Kernel Modules

Once you install the kernel headers, you can start compiling external kernel modules. The process for compiling external kernel modules is straightforward.
As an example, let’s compile the Bluetooth UART driver.
To compile the driver, run make command
cd /path/to/driver
make  
Note: Assuming that you have downloaded the driver source code to brainypi.
You should see something like this in the terminal.

Screenshot_20230327_155039

The make command will generate a .ko file which is the compiled driver.

Step 3: Loading the Kernel module

You can load Compiled kernel module using insmod command
sudo insmod /path/to/driver/hci_uart.ko
You can check if the driver is loaded by running the lsmod command

Screenshot_20230329_164051

Endnotes

Hence, we have learnt Building External Kernel Modules on Brainy Pi. Stay tuned for more such interested blogs !!
0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*