Hi all,
Im working with driver for camera, I found all components like source code and recipes. The linux has not this driver by default (it is too new, new component, Linux doesn't know that it exist), I have to add it locally. Before I used URL and already existing drivers in the Linux sources. What I have to do to add new driver to yocto build project from my hard drive?
已解决! 转到解答。
Hi @btarnowski ,
There's some ways :
1. Commit your driver source code into your own linux-imx repository then update the URL and commit HASH of your linux & driver in the following recipe : <path-to-yocto-bsp>/sources/meta-imx/meta-bsp/recipes-kernel/linux/linux-imx_%.bbappend
KERNEL_src="git://git@gitlab.com:/company-name/linux-imx.git;protocol=ssh" # The repository of your company, cloned and modified from https://source.codeaurora.org/external/imx/linux-imx/
SRCBRANCH = "lf-5.10.y"
SRCREV = "a11753a89ec610768301d4070e10b8bd60fde8cd" # The commit that you added your driver
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
or,
2. Add local patches to the default NXP's source (downloaded from https://source.codeaurora.org/external/imx/linux-imx/) :
a. Add patches and .bbappend :
$ tree <path-to-yocto-bsp>/sources/meta-imx/meta-bsp/recipes-kernel/linux/
<path-to-yocto-bsp>/sources/meta-imx/meta-bsp/recipes-kernel/linux/
├── linux-imx
│ ├── 0001-dts-imx8mp-evk-Add-DTS-with-AR0234-sensor-nodes.patch
│ ├── 0002-dts-imx8mp-evk-Add-camera-SYNC-signals.patch
│ ├── 0011-defconfig-Enable-PRINTK-and-set-LOGLEVEL.patch
│ └── 0012-Enable-debugging-of-MIPI-CSI2-interface.patch
├── linux-imx_5.10.bb
├── linux-imx_%.bbappend
├── linux-imx-headers_5.10.bb
└── linux-imx-headers_%.bbappend
b. Modify <path-to-yocto-bsp>/sources/meta-imx/meta-bsp/recipes-kernel/linux/linux-imx_%.bbappend to add patches' location :
SRC_URI_append_mx8 = " \
file://0001-dts-imx8mp-evk-Add-DTS-with-AR0234-sensor-nodes.patch \
file://0002-dts-imx8mp-evk-Add-camera-SYNC-signals.patch \
file://0011-defconfig-Enable-PRINTK-and-set-LOGLEVEL.patch \
file://0012-Enable-debugging-of-MIPI-CSI2-interface.patch \
After that, you will need to re-bitbake your kernel : bitbake virtual/kernel -c cleansstate && bitbake virtual/kernel -c compile && bitbake <image-name>
Regards,
K.
Hi @btarnowski ,
There's some ways :
1. Commit your driver source code into your own linux-imx repository then update the URL and commit HASH of your linux & driver in the following recipe : <path-to-yocto-bsp>/sources/meta-imx/meta-bsp/recipes-kernel/linux/linux-imx_%.bbappend
KERNEL_src="git://git@gitlab.com:/company-name/linux-imx.git;protocol=ssh" # The repository of your company, cloned and modified from https://source.codeaurora.org/external/imx/linux-imx/
SRCBRANCH = "lf-5.10.y"
SRCREV = "a11753a89ec610768301d4070e10b8bd60fde8cd" # The commit that you added your driver
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
or,
2. Add local patches to the default NXP's source (downloaded from https://source.codeaurora.org/external/imx/linux-imx/) :
a. Add patches and .bbappend :
$ tree <path-to-yocto-bsp>/sources/meta-imx/meta-bsp/recipes-kernel/linux/
<path-to-yocto-bsp>/sources/meta-imx/meta-bsp/recipes-kernel/linux/
├── linux-imx
│ ├── 0001-dts-imx8mp-evk-Add-DTS-with-AR0234-sensor-nodes.patch
│ ├── 0002-dts-imx8mp-evk-Add-camera-SYNC-signals.patch
│ ├── 0011-defconfig-Enable-PRINTK-and-set-LOGLEVEL.patch
│ └── 0012-Enable-debugging-of-MIPI-CSI2-interface.patch
├── linux-imx_5.10.bb
├── linux-imx_%.bbappend
├── linux-imx-headers_5.10.bb
└── linux-imx-headers_%.bbappend
b. Modify <path-to-yocto-bsp>/sources/meta-imx/meta-bsp/recipes-kernel/linux/linux-imx_%.bbappend to add patches' location :
SRC_URI_append_mx8 = " \
file://0001-dts-imx8mp-evk-Add-DTS-with-AR0234-sensor-nodes.patch \
file://0002-dts-imx8mp-evk-Add-camera-SYNC-signals.patch \
file://0011-defconfig-Enable-PRINTK-and-set-LOGLEVEL.patch \
file://0012-Enable-debugging-of-MIPI-CSI2-interface.patch \
After that, you will need to re-bitbake your kernel : bitbake virtual/kernel -c cleansstate && bitbake virtual/kernel -c compile && bitbake <image-name>
Regards,
K.
Thank you for your help @khang_letruong , I appreciate it.
For me the second solution is suitable. I made some tests, I assume that I have to see the object file after kernel rebuild. Below on the picture I described 5 steps I made. (additional I modified DeviceTree).
I have other hint and I made that one hint as the first and now Im going to combine your hint with this one. What Im missing that I can not obtain the os02g10.o file after bitbake linux-imx -c compile -f ?
Hi @btarnowski
Did you add your own kernel's configuration to DELTA_KERNEL_DEFCONFIG ? Also, I wonder if DELTA_KERNEL_DEFCONFIG_append exist ?
Regards,
Khang
In my project there is only DELTA_KERNEL_DEFCONFIG_append
I added os02g10.cfg but still not see os02g10.o after build.
So now I need to study the use of DELTA_KERNEL_DEFCONFIG and why other functionalities works only with DELTA_KERNEL_DEFCONFIG_append
Hi @btarnowski ,
Are os02g10.c and the modified Makefile committed to the repository or added as patches ? Btw, you can do bitbake virtual/kernel -c menuconfig to ensure that the CONFIG_VIDEO_OS02G10 is available and selected.
Regards,
K
Looks like I need to generate patches for all added files: all header files and one source file os02g10.c
regarding menucofig tool:
1. bitbake virtual/kernel -c menuconfig - is not working as below on the picture
2. make menuconfig - works but I see 4 git repositories, I added os02g10.c and other files only to one of them - yocto/build/tmp/work/cortexa53-crypto-mx8mm-poky-linux/linux-imx-headers/5.10-r0/git
for these I did not add
yocto/build/tmp/work/imx8mmevk-poky-linux/linux-imx/5.10.72+gitAUTOINC+a68e31b63f-r0/git
yocto/build/tmp/work/imx8mmevk-poky-linux/linux-imx/5.10.72+gitAUTOINC+a68e31b63f-r0/build/source
yocto/build/tmp/work-shared/imx8mmevk/kernel-source
Im confused that there are 4 git source repositories
Hi @btarnowski
So now I need to study the use of DELTA_KERNEL_DEFCONFIG and why other functionalities works only with DELTA_KERNEL_DEFCONFIG_append
There's also DELTA_KERNEL_DEFCONFIG_mx8 in the following example : https://github.com/SolidRun/meta-solidrun-arm-imx8/blob/hardknott-imx8mp/recipes-kernel/linux/linux-...
Looks like I need to generate patches for all added files: all header files and one source file os02g10.c
Yes, you should. That is the proper way for Yocto build system.
1. bitbake virtual/kernel -c menuconfig - is not working as below on the picture
It might be due to the fact that you ran the command within Docker.
Regards,
K
I got it to build, I had to add 2 patches, there was additional dependency in the driver so after the first patch I got build error.
The second thing I need to do is adding the i2c-tools to my kernel build, it is challenge for me as well
https://git.yoctoproject.org/poky/plain/meta/recipes-devtools/i2c-tools/i2c-tools_4.3.bb
Hi,
The second thing I need to do is adding the i2c-tools to my kernel build, it is challenge for me as well
You can populate the Yocto SDK then cross-build i2c-tools on host machine and copy the binaries into the board.