Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
To build a PCIe device driver for your Verdin iMX8M Plus board running TorizonCore, you need to follow these steps:
Prerequisites
- TorizonCore Builder Tool: Ensure you have the TorizonCore Builder tool installed. This tool simplifies the process of adding kernel modules to TorizonCore images.
Steps to Build and Install the PCIe Device Driver
1. Install TorizonCore Builder
If you haven’t already installed TorizonCore Builder, follow the installation instructions provided in the TorizonCore Builder documentation.
2. Prepare Your Kernel Module Source Code
Organize your PCIe device driver source code into a directory. For example, let’s call this directory pcie-driver
.
3. Create a Makefile
Ensure your pcie-driver
directory contains a Makefile. The Makefile should include the environment variable $(KERNEL_SRC)
or $(KDIR)
. Here is an example Makefile:
obj-m := pcie_driver.o
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
all:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
4. Build the Kernel Module
Use the TorizonCore Builder tool to build the kernel module. Run the following command in the directory containing your pcie-driver
source code:
torizoncore-builder kernel build_module --source-dir pcie-driver
5. Create a Custom TorizonCore Image
You can create a custom TorizonCore image with your built kernel module. There are two approaches: using a configuration YAML file or standalone commands.
Approach 1: Using a Configuration YAML File
Create a tcbuild.yaml
file with the following content:
input:
easy-installer:
local: torizon-core-docker-verdin-imx8mp-Tezi_5.4.193-5.7.2+build.7.tar
customization:
kernel:
modules:
- source-dir: pcie-driver
autoload: yes
Then, run the build command:
torizoncore-builder build
Approach 2: Using Standalone Commands
Please, also check if these links can help you solve your problem: