Cameras for Raspberry Pi

  1. Home
  2. Docs
  3. Cameras for Raspberry Pi
  4. New: Pivariety Camera
  5. How to build Raspberry Pi Kernel Driver – Pivariety Camera

How to build Raspberry Pi Kernel Driver – Pivariety Camera

1. Do you know?

The driver is used to communicate with the hardware and provide a unified interface to the software layer. Usually, the initialization of the hardware has a standard process. You should operate to make the hardware work normally according to the standard process and these operations are cumbersome. Generally, only the hardware manufacturer understands the specific details. One of the main tasks of the driver is to ensure that the hardware works as expected according to the standard process and hardware communication.

We only provide the driver for the latest official kernel version image when the Pivariety camera is released. Please check the kernel version if the driver installation fails. You can choose to compile the kernel yourself if the kernel version used is not provided by us.

2. Kernel Driver building

There are two compilation methods.

3.1. The first way-Build from the kernel source

Please refer to the official documentation to compile the kernel.

NOTE: The instructions are divided into native builds and cross-compilation.

After obtaining the linux source code, add the arducam driver and device tree code through apply patch.

git clone
cd <path>/linux
patch -p1 -i <path>/Arducam-Pivariety-V4L2-Driver/patchs/arducam_driver.patch

3.2. The second way-Build from the kernel headers

NOTE: The following steps compile on Raspberry Pi.

3.2.1. Download the kernel source code

cd ~
sudo apt update && sudo apt install git bc bison flex libssl-dev
sudo wget -O /usr/local/bin/rpi-source && sudo chmod +x /usr/local/bin/rpi-source && /usr/local/bin/rpi-source -q --tag-update
mkdir $(uname -r)
rpi-source -d $(uname -r)

3.2.2. Compile the driver and device tree

cd ~
git clone
cd Arducam-Pivariety-V4L2-Driver/src

# compile dtbo
patch -p1 -d /lib/modules/$(uname -r)/build -i $(pwd)/../patchs/arducam_device_tree.patch
make -C /lib/modules/$(uname -r)/build  dtbs
sudo cp /lib/modules/$(uname -r)/build/arch/arm/boot/dts/overlays/arducam.dtbo /boot/overlays/arducam.dtbo

# manully add dtoverlay=arducam in /boot/config.txt

# compile arducam.ko
make && sudo make install
sudo depmod
sudo modprobe arducam

At this point, your kernel driver building is complete!

Was this article helpful to you? Yes No