Installing an in-tree driver for a DSI display panel

Hi! I’d like to use a JDI LT070ME05000 IPS display panel in my project with a RaspberryPi CM4 module. This is a 4-lane DSI panel, which I managed to get running on a RaspberryPi OS, by recompiling the 5.10 kernel and enabling a module for it.

I have seen the GitHub - balena-os/kernel-module-build: Example project for building an OOT kernel module in balena repository, but my attempts to build a module from sources at linux/panel-jdi-lt070me05000.c at rpi-5.10.y · raspberrypi/linux · GitHub failed with an error:

gcc: error: unrecognized command line option '-mstack-protector-guard=sysreg'; did you mean '-fstack-protector-strong'?

gcc: error: unrecognized command line option '-mstack-protector-guard-reg=sp_el0'; did you mean '-fstack-protector-all'?

gcc: error: unrecognized command line option '-mstack-protector-guard-offset=1336'; did you mean '-fstack-protector-strong'?

make[1]: *** [scripts/Makefile.build:266: /usr/src/app/output/panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod/panel-jdi-lt070me05000.o] Error 1

make: *** [Makefile:1732: /usr/src/app/output/panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod] Error 2

I also tried using RaspberryPi 4 device type when provisioning my device, thinking the module would be already included in the kernel, as it was newer than the one in RaspberryPi CM4IO, but my device wasn’t appearing in the devices list when it was powered on.

I am really new to the kernel stuff, so I apologize if I was mistaken in something. Thanks!

I’m having the exact same issue here, looks like it’s very broken right now.

Hello @lowder

Welcome to the balena Forums.

Please could you tell us the exact steps that you followed when trying to build the driver so that we can attempt to reproduce the issue here.

Thanks.

I cloned balena-os/kernel-module-build repo and replaced the module in the example_module folder with the module that I got from raspberrypi/linux. I also modified the Makefile according to filenames:

KERNEL_TREE_PATH?=/lib/modules/$(shell uname -r)/build
EXTRA_CFLAGS="-DDEBUG"

obj-m+=panel-jdi-lt070me05000.o

all: panel-jdi-lt070me05000.ko

panel-jdi-lt070me05000.ko: panel-jdi-lt070me05000.c
	make -C $(KERNEL_TREE_PATH) M=$(PWD) modules

clean:
	make -C $(KERNEL_TREE_PATH) M=$(PWD) clean

.PHONY: all clean

In Dockerfile, I set the latest version of balenaOS and added

RUN chmod +x build.sh
RUN chmod +x workarounds.sh
RUN chmod +x run.sh

because I was getting Permission denied errors.

I got the error that I posted above when building the release with balena push.

Hey @lowder, can you try again with the gcc-10 branch of the kernel-module-build project?

Also make sure to use the correct device raspberrypicm4-ioboard when building the module as the latest OS for raspberrypi4-64 is on a newer kernel and will not be compatible.

There’s a similar question here in case some of your module build issues have already been answered:

Thanks, @klutchell ! Using your advice, I got further when compiling the module. But I still have some errors, which probably mean, that the module is not compatible with the current kernel version.

/usr/src/app/output/panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod/panel-jdi-lt070me05000.c:385:15: error: initialization of 'int (*)(struct drm_panel *)' from incompatible pointer type 'int (*)(struct drm_panel *, struct drm_connector *)' [-Werror=incompatible-pointer-types]
  385 |  .get_modes = jdi_panel_get_modes,
      |               ^~~~~~~~~~~~~~~~~~~
/usr/src/app/output/panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod/panel-jdi-lt070me05000.c:385:15: note: (near initialization for 'jdi_panel_funcs.get_modes')

/usr/src/app/output/panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod/panel-jdi-lt070me05000.c: In function 'jdi_panel_add':

/usr/src/app/output/panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod/panel-jdi-lt070me05000.c:440:2: error: too many arguments to function 'drm_panel_init'
  440 |  drm_panel_init(&jdi->base, &jdi->dsi->dev, &jdi_panel_funcs,
      |  ^~~~~~~~~~~~~~

In file included from /usr/src/app/output/panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod/panel-jdi-lt070me05000.c:26:
./include/drm/drm_panel.h:150:6: note: declared here
  150 | void drm_panel_init(struct drm_panel *panel);
      |      ^~~~~~~~~~~~~~

cc1: some warnings being treated as errors

make[1]: *** [scripts/Makefile.build:266: /usr/src/app/output/panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod/panel-jdi-lt070me05000.o] Error 1

make: *** [Makefile:1732: /usr/src/app/output/panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod] Error 2

Well, I guess I should wait for the new kernel release.

Have you tried with the rpi-5.4.y branch of this module to be compatible with your balenaOS kernel?

Obviously when we release a new version of the raspberrypicm4-ioboard with kernel 5.10 you’ll want to point to a newer version of the module if your device is running the latest OS.

Yay, thanks! It actually builds properly now. The only thing that’s left for me is to wait until my CM4 arrives and I can test it. I’ll post my results here if anyone is interested.

I have my board to test now. I loaded a new release onto it, but I had no success with the display. The module doesn’t load and throws an error.

OS Version is 2.71.3+rev5
Loading module from panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod
insmod: ERROR: could not insert module panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod/panel-jdi-lt070me05000.ko: Unknown symbol in module
Loading module from panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod_from_src
insmod: ERROR: could not insert module panel-jdi-lt070me05000_raspberrypicm4-ioboard_2.71.3+rev5.prod_from_src/panel-jdi-lt070me05000.ko: Unknown symbol in module

Hey @lowder, that error usually means that the module was compiled against a different kernel version than the one on your device. Make sure you are specifying the correct balenaOS version and device-type when building the module!