1. Home
  2. Docs
  3. Arducam OBISP MIPI Camera Module
  4. 3. Use on Raspberry Pi
  5. 3.8 Source code cross compilation

3.8 Source code cross compilation

The aim of this document is to tell user how to recompile Arducam OBISP camera driver. In order to increase the compilation speed, we recommend using cross-compilation to compile. The following is the detailed compilation steps.

Build cross-compilation environment on Ubuntu 64-bitoperating system)

  • Download the compile tool
git clone git://github.com/raspberrypi/tools.git RpiTools
  • Add the cross toolchain path to the environment variable
sudo gedit ~/.bashrc
  • Paste the path below to the last line
export PATH=~/RpiTools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin:$PATH
1 1

Save and exit the file, and then execute the following command to immediately update the environment variables contained in the current console.

source .bashrc

Compile steps

  • Get kernel source code
git clone git://github.com/raspberrypi/linux.git RpiLinux
  • Check the kernel version
make kernelversion
2 1
  • Switch to other version if the current version is not you need
git checkout xxxx
  • Add arducam.c and arducam.h to the current path
3
  • Modify the the Makefile and Kconfig files
4
5
  • Add arducam.dts to the kernel source code
6
  • Modify the Makefile
7
  • Prepare compile for different platform
  • For Pi Zero/ Pi Zero w/ Pi1
cd RpiLinux
KERNEL=kernel
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  bcmrpi_defconfig
  • For Pi 2, Pi 3, Pi 3+, or Compute Module 3
cd RpiLinux
KERNEL=kernel7
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 
 bcm2709_defconfig
  • For Pi4B
cd RpiLinux
KERNEL=kernel7l
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig
  • Choose Arducam driver through menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
8
9
10
11
  • Start compile
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -jxx
12
13

Different computer performance, different compilation time.

When the compile finished, if normal, we can get the arducam.ko and arducam.dtbo files with current kernel version.

14
15

Then copy the two files to Arducam_OBISP_MIPI_Camera_Module\Release\bin\ path

16

Was this article helpful to you? Yes No