Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4907

Beginners • How to add a new driver module to the Raspberry Pi kernel?

$
0
0
My attempt was largely based on the following link:
viewtopic.php?t=355870

I tried to add a new ST7789 display driver module to the Raspberry Pi kernel, but after compiling the kernel, I found that the new module did not appear.
Below is my specific operating procedure:

I have added a new file drivers/gpu/drm/tiny/st7789v.c based on this file drivers/gpu/drm/tiny/st7735r.c.

Then I added obj-$(CONFIGTINYDRMST7789V) += st7789v.o to the Makefile in drivers/gpu/drm/tiny/

Then, based on the adafruit-st7735r-overlay.dts in arch/arm/boot/dts/overlays, I added a new file called st7789v-overlay.dts in the same directory. Additionally, in the arch/arm/boot/dts/overlays/Makefile, I added st7789v.dtbo below the configuration for adafruit-st7735r.dtbo.


Then, I added

Code:

config TINYDRM_ST7789Vtristate "DRM support for Sitronix ST7789V display panels"depends on DRM && SPIselect DRM_KMS_HELPERselect DRM_GEM_DMA_HELPERselect DRM_MIPI_DBIselect BACKLIGHT_CLASS_DEVICEhelp  DRM driver for Sitronix ST7789 with the following  LCDs:  * Phoenix Display International (PDI) PDI013021B 2.0" 240x320 TFT  If M is selected the module will be called st7789v.
to the file drivers/gpu/drm/tiny/Kconfig.

Finally, I compiled the 64-bit kernel for Raspberry Pi 5 using the following instructions:

Code:

cd linuxKERNEL=kernel_2712sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2712_defconfigsudo make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbssudo mkdir mntsudo mkdir mnt/fat32sudo mkdir mnt/ext4sudo mount /dev/sdb1 mnt/fat32sudo mount /dev/sdb2 mnt/ext4sudo env PATH=$PATH make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=mnt/ext4 modules_installsudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.imgsudo cp arch/arm64/boot/Image mnt/fat32/$KERNEL.imgsudo cp arch/arm64/boot/dts/broadcom/*.dtb mnt/fat32/sudo cp arch/arm64/boot/dts/overlays/*.dtb* mnt/fat32/overlays/sudo cp arch/arm64/boot/dts/overlays/README mnt/fat32/overlays/sudo umount mnt/fat32sudo umount mnt/ext4
Inserting the SD card into Raspberry Pi 5 allows it to boot up normally. However, when using the “sudo modinfo st7789v” command, I cannot see the presence of the st7789v driver module. I believe this indicates that the st7789 driver module was not correctly compiled into the system kernel.

Is there something wrong with my operating procedure?

Statistics: Posted by jieweizero — Sat Feb 24, 2024 4:06 am



Viewing all articles
Browse latest Browse all 4907

Trending Articles