CI20-SGX kernel module

The graphics driver for the CI20 is an out-of-tree kernel module. Kernel modules must be recompiled if the base kernel is modified. Modules are only allowed to be loaded when they have been compiled using the exact source tree and kernel configuration as that of the running kernel.

As the default Xorg driver also uses the GPU for running the X window system, it would seem that Debian GUI fails to load when you recompile the kernel from sources. The only thing that needs doing, is to recompile the kernel module for the GPU and then copy that module onto the filesystem.

It's also possible to disable the GPU, if you don't need it for any specific task. You will still be able to use the Debian GUI (with a tweak to your xorg.conf), but hardware 3D acceleration and OpenGL will be disabled. Instructions for disabling the GPU are available here

It is important that your kernel module and user module version match, else the SGX driver will fail to load. The following table details this:

Compiling the module
The kernel part of the GPU driver must be built to generate a kernel module which is then loaded and interacts with the SGX hardware and the userland portions of the driver. The sources for the module are available for the 3.18 version of the GPU driver.

Download and extract the latest kernel module. Change into the extracted directory and run the following (ensuring that CROSS_COMPILE is correctly set):

CROSS_COMPILE=$CROSS_COMPILE ARCH=mips KERNELDIR=/home/user/ci20/linux_kernel_repo_dir make -C eurasiacon/build/linux2/jz4780_linux

Change the KERNELDIR variable to your kernel source tree. And the CROSS_COMPILE variable to your toolchain path.

This will generate the pvrsrvkm.ko module file. This needs to be placed in the following path on the Ci20 root filesystem

cp eurasicon/binary2_jz4780_linux_release/target/pvrsrvkm.ko /lib/modules/`uname -r`/extra/

Disabling the GPU module
You can set Xorg to default to using the fbdev driver instead of the GPU. If you do so, the Debian GUI will still run.

The only thing you need to do is apply the following xorg.conf in /etc/X11/xorg.conf

Using fbdev
Section "Device" Identifier     "Device0" Driver         "fbdev" EndSection Section "Monitor" Identifier     "Monitor" EndSection Section "Screen" Identifier     "Screen0" Monitor        "Monitor" Device         "Device0" DefaultFbBpp   32 EndSection
 * 1) X.Org X server configuration file for CI20

Using DRM modesetting
Install the modesetting driver. sudo apt-get install xserver-xorg-video-modesetting

Then use the following xorg.conf

Section "Device" Identifier     "Device0" Driver         "modesetting" EndSection Section "Monitor" Identifier     "Monitor" EndSection Section "Screen" Identifier     "Screen0" Monitor        "Monitor" Device         "Device0" DefaultFbBpp   32 EndSection
 * 1) X.Org X server configuration file for CI20

Hack for advanced users
If you know what you're doing, it is possible to bypass the kernel module version checking. However, changes to kernel options can easily tweak something minor that cause bad things to happen.

To do this, modify the kernel version string in the .config file to exactly match the one the original pvr module was built with. You can check that by checking your old /lib/modules/3.18.3-ci20-x directory numbers or uname -r.