how to create a cutomized camera on yocto

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to create a cutomized camera on yocto

how to create a cutomized camera on yocto

This document introduce the steps how to create a new camera dtb file and ko file on the  the bsp version is 4.14.98, the test board is imx8mm LPDDR4 evk board

 

1)build the bsp

 

$ mkdir ~/bin (this step may not be needed if the bin folder already exists)

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

export PATH=~/bin:$PATH

 

$ mkdir imx-yocto-bsp

$ cd imx-yocto-bsp

$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-sumo -m

imx-4.14.98-2.0.0_ga.xml

$ repo sync

 

DISTRO=fsl-imx-xwayland MACHINE=imx8mmevk source fsl-setup-release.sh -b build-xwayland

bitbake fsl-image-qt5-validation-imx

 

2) add new camera dts flie

Add new camera dts file in the “imx-yoct-bsp/tmp/work-shared/imx8mmevk/kernel-source/arch/arm64/boot/dts/freescale”

Two points

a)    The new camera dts file, can refer to the node “ov5640_mipi”under I2C3 and “&mipi_csi_1”, change the ov5640 to your own camerahttps://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/fsl-imx8mm-e...

  1. Don’t forget add “#include "fsl-imx8mm-evk.dts" in your own dts file

 

3) add your own dts file in the “Makefile” under “imx-yoct-bsp/tmp/work-shared/imx8mmevk/kernel-source/arch/arm64/boot/dts/freescale”, after “dtb-$(CONFIG_ARCH_FSL_IMX8MM) += fsl-imx8mm-evk.dtb”

 

4) add the camera driver under “imx-yoct-bsp/tmp/work-shared/imx8mmevk/kernel-source/drivers/media/platform/imx8”

Then add camera module under “imx-yoct-bsp/tmp/work-shared/imx8mmevk/kernel-source/drivers/media/platform/imx8/Kconfig”

 

5) enable the camera module in the kernel

if the camera format is raw10 and raw12, don’t forget to enable the fsl,two-8bit-sensor-mode in the device tree

 

After modified all of source code you need, enable the camera module in the menuconfig by command “bitbake -c menuconfig linux-imx”

joanxie_0-1621858670861.png

 

joanxie_2-1621858769503.pngjoanxie_3-1621858817613.pngjoanxie_4-1621858848608.png

 

6) create a customized dtb file in the yocto

then use the command “bitbake -c compile -f linux-imx” and “bitbake linux-imx, the ko file and new dtb file are supposed to be found under “/build-xwayland/tmp/work/imx8mmevk-poky-linux/linux-imx/4.14.98-r0/build/drivers/media/platform/imx8” and “/build-xwayland/tmp/work/imx8mmevk-poky-linux/linux-imx/4.14.98-r0/build/arch/arm64/boot/dts/freescale” but one couldn’t find new dtb file, if you use the kernel in standalone environment, one can use “make dtbs” to build the new dtb file, but in yocto environment, try to use “bitbake -c devshell linux-imx” before “bitbake linux-imx”, this command is for opening a new shell where with necessary system values already defined for linux-imx, then change the folder and build as below

joanxie_5-1621858889182.png

 

After building, you can find new dtb file under “/build-xwayland/tmp/work/imx8mmevk-poky-linux/linux-imx/4.14.98-r0/build/arch/arm64/boot/dts/freescale”

Then “bitbake linux-imx”

100% helpful (1/1)
Version history
Last update:
‎05-24-2021 05:25 AM
Updated by: