Dear Community,
I would like to have a question purely Yocto for the NXP BSP : Currently, I develop the ISP based driver of some custom sensors, and I can integrate them into the Yocto bitbaking system as following :
$ <path-to>/meta-<company>/recipes-kernel
├── kernel-modules
│ ├── kernel-module-isp-vvcam
│ │ ├── 0001-vvcam-isp-Force-disable-WDR3.patch
│ │ └── 0002-vvcam-v4l2-sensor-Add-support-for-TOTO.patch
│ └── kernel-module-isp-vvcam_%.bbappend
In order to get the custom sensor driver (0002-vvcam-v4l2-sensor-Add-support-for-TOTO.patch) built, I need to modify it a little bit by updating the path of the relevant resources (replace /vvcam/v4l2/sensor by /sensor
Original version:
diff --git a/vvcam/v4l2/sensor/Makefile b/vvcam/v4l2/sensor/Makefile
index d98ecda..bb8f6fa 100755
--- a/vvcam/v4l2/sensor/Makefile
+++ b/vvcam/v4l2/sensor/Makefile
@@ -1,4 +1,5 @@
+obj-m += toto/
obj-m += ov2775/
obj-m += os08a20/
obj-m += camera-proxy-driver/
diff --git a/vvcam/v4l2/sensor/toto/Makefile b/vvcam/v4l2/sensor/toto/Makefile
new file mode 100644
index 0000000..c9fe9b8
--- /dev/null
+++ b/vvcam/v4l2/sensor/toto/Makefile
@@ -0,0 +1,4 @@
+EXTRA_CFLAGS += -I$(PWD)/../common/ -O2 -Werror
+toto-objs += toto_mipi_v3.o
+obj-m += toto.o
diff --git a/vvcam/v4l2/sensor/toto/toto_mipi_v3.c b/vvcam/v4l2/sensor/toto/toto_mipi_v3.c
new file mode 100644
index 0000000..50bf080
--- /dev/null
+++ b/vvcam/v4l2/sensor/toto/toto_mipi_v3.c
Modified version :
diff --git a/sensor/Makefile b/sensor/Makefile
index d98ecda..bb8f6fa 100755
--- a/sensor/Makefile
+++ b/sensor/Makefile
@@ -1,4 +1,5 @@
+obj-m += toto/
obj-m += ov2775/
obj-m += os08a20/
obj-m += camera-proxy-driver/
diff --git a/sensor/toto/Makefile b/sensor/toto/Makefile
new file mode 100644
index 0000000..c9fe9b8
--- /dev/null
+++ b/sensor/toto/Makefile
@@ -0,0 +1,4 @@
+EXTRA_CFLAGS += -I$(PWD)/../common/ -O2 -Werror
+toto-objs += toto_mipi_v3.o
+obj-m += toto.o
diff --git a/sensor/toto/toto_mipi_v3.c b/sensor/toto/toto_mipi_v3.c
new file mode 100644
index 0000000..50bf080
--- /dev/null
+++ b/sensor/toto/toto_mipi_v3.c
...
The above modification works well. However, when it comes to the resource/file out side of /vvcam/v4l2/, such as in the first patch 0001-vvcam-isp-Force-disable-WDR3.patch, I have not known how to modify it:
diff --git a/vvcam/isp/isp_wdr3.c b/vvcam/isp/isp_wdr3.c
index 487a42e..9fbd3de 100644
--- a/vvcam/isp/isp_wdr3.c
+++ b/vvcam/isp/isp_wdr3.c
@@ -406,7 +406,8 @@ void wdr3_hw_init(struct isp_ic_dev *dev)
{
uint32_t isp_wdr3_ctrl = isp_read_reg(dev, REG_ADDR(isp_wdr3_ctrl));
- REG_SET_SLICE(isp_wdr3_ctrl, WDR3_ENABLE, 1);
+ pr_warn("[TOTO] %s: Force WDR3 disabled by default\n", __func__);
+ REG_SET_SLICE(isp_wdr3_ctrl, WDR3_ENABLE, 0);
isp_write_reg(dev, REG_ADDR(isp_wdr3_ctrl), isp_wdr3_ctrl);
}
}
@@ -419,8 +420,9 @@ int isp_enable_wdr3(struct isp_ic_dev *dev)
#else
struct isp_wdr3_context *wdr3 = &dev->wdr3;
int32_t isp_wdr3_ctrl = isp_read_reg(dev, REG_ADDR(isp_wdr3_ctrl));
- wdr3->enable = true;
- REG_SET_SLICE(isp_wdr3_ctrl, WDR3_ENABLE, 1);
+ pr_warn("[TOTO] %s: Force WDR3 disabled in all cases\n", __func__);
+ wdr3->enable = false;
+ REG_SET_SLICE(isp_wdr3_ctrl, WDR3_ENABLE, 0);
isp_write_reg(dev, REG_ADDR(isp_wdr3_ctrl), isp_wdr3_ctrl);
{
If I let it bitbaked as-is, there will be following error:
ERROR: kernel-module-isp-vvcam-4.2.2.15.0-r0 do_patch: Command Error: 'quilt --quiltrc /data/Khang/imx-yocto-bsp-hardknott-5_10_52-2_1_0/build-xwayland-imx_imx8mp/tmp/work/imx_imx8mp-poky-linux/kernel-module-isp-vvcam/4.2.2.15.0-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0 Output:
stdout: Applying patch 0001-vvcam-isp-Force-disable-WDR3.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/vvcam/isp/isp_wdr3.c b/vvcam/isp/isp_wdr3.c
|index 487a42e..9fbd3de 100644
|--- a/vvcam/isp/isp_wdr3.c
|+++ b/vvcam/isp/isp_wdr3.c
--------------------------
No file to patch. Skipping patch.
2 out of 2 hunks ignored
Patch 0001-vvcam-isp-Force-disable-WDR3.patch does not apply (enforce with -f)
stderr:
ERROR: Logfile of failure stored in: /data/Khang/imx-yocto-bsp-hardknott-5_10_52-2_1_0/build-xwayland-imx_imx8mp/tmp/work/imx_imx8mp-poky-linux/kernel-module-isp-vvcam/4.2.2.15.0-r0/temp/log.do_patch.888472
ERROR: Task (/data/Khang/imx-yocto-bsp-hardknott-5_10_52-2_1_0/sources/meta-imx/meta-bsp/recipes-kernel/kernel-modules/kernel-module-isp-vvcam_4.2.2.15.0.bb:do_patch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 518 tasks of which 514 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/data/Khang/imx-yocto-bsp-hardknott-5_10_52-2_1_0/sources/meta-imx/meta-bsp/recipes-kernel/kernel-modules/kernel-module-isp-vvcam_4.2.2.15.0.bb:do_patch
Effectively, the file being patched could not be found.
Could you help to suggest a solution, please ?
Thanks in advance and best regards,
Khang
Solved! Go to Solution.
Hi @joanxie ,
Thank you. But this would not work for modification outside of vvcam/v4l2 folder which is the case of my 0001-vvcam-isp-Force-disable-WDR3.patch.
I ended up with clone the source from my own repository and compile it directly instead of patching:
SRCBRANCH = "DEV/lf-5.10.52_2.0.0-toto"
ISP_KERNEL_src="git://git@gitlab.com:/company/isp-vvcam.git;protocol=ssh"
SRC_URI = " \
${ISP_KERNEL_SRC};branch=${SRCBRANCH} \
"
SRCREV = "<commit-HASH>"
Regards,
Khang
I don't know if I understand you correct or not, maybe you can put the patch under source folder, then change the bb file to build agan, the patch is "../sources/meta-imx/meta-bsp/recipes-kernel/kernel-modules/"
Dear @joanxie ,
Either your suggestion or my organization of custom bsp in a separate yocto layer (<imx-yocto-bsp>/sources/meta-<company>) is okay. I often put the custom source for isp-vvcam in <imx-yocto-bsp>/sources/meta-imx/meta-bsp/recipes-kernel/kernel-modules/kernel-module-isp-vvcam/ as well. But the problem could come from the following line in <imx-yocto-bsp>/sources/meta-imx/meta-bsp/recipes-kernel/kernel-modules/kernel-module-isp-vvcam_4.2.2.20.0.bb :
S = "${WORKDIR}/git/vvcam/v4l2"
In above line, it seems that the source is within <isp-vvcam>/vvcam/v4l2/, and one of the patch files (0001-vvcam-isp-Force-disable-WDR3.patch) is applied to resource outside of this folder : <isp-vvcam>/vvcam/isp/
Best Regards,
Khang
for porting new camera via ISP, you can refer to this to add patch in the bb file
Hi @joanxie ,
Thank you. But this would not work for modification outside of vvcam/v4l2 folder which is the case of my 0001-vvcam-isp-Force-disable-WDR3.patch.
I ended up with clone the source from my own repository and compile it directly instead of patching:
SRCBRANCH = "DEV/lf-5.10.52_2.0.0-toto"
ISP_KERNEL_src="git://git@gitlab.com:/company/isp-vvcam.git;protocol=ssh"
SRC_URI = " \
${ISP_KERNEL_SRC};branch=${SRCBRANCH} \
"
SRCREV = "<commit-HASH>"
Regards,
Khang