Hello,
I have been working on porting a generic MIPI CSI-2 camera for use with the i.MX8M Plus. Thanks in large part to these previous posts by jgsandom and kunal_003, I have made some significant progress recently. I downloaded and built isp-imx-4.2.2.11.0 package, and I have now modified the requisite source code to generate my own .drv and .xml files specific to our desired sensor using ./build-all-isp.sh.
I am attempting to deploy and test my updated drivers, but I find am not quite as well-versed in Linux and Yocto Project development, so some of the discussion in those previous posts I mentioned is now going over my head.
I see that the ISP is setup by three commands: start_isp.sh, run.sh, and isp_media_server. I can also see that these will require some modification, but I am having some difficulty in figuring out exactly what those changes should be for start_isp.sh and isp_media_server.
For start_isp.sh, I will need to point to the correct .dtb file, but I am not clear on how to find/create the correct device tree.
For isp_media_server, I cannot directly edit the file to see precisely what should be changed.
Any advice on my next steps here would be much appreciated! I will post updates if I make any significant progress independently as well.
Thank you,
Cody Robson
已解决! 转到解答。
Hi @Cbrobson ,
Below is some of my experience :
For start_isp.sh, I will need to point to the correct .dtb file, but I am not clear on how to find/create the correct device tree.
This script detects number of camera sensor nodes in the used .dtb (or compiled .dts, selected by fdt_file variable in u-Boot) and will launch single sensor mode or dual sensors mode based on that number :
NR_DEVICE_TREE_BASLER=$(grep basler-camera-vvcam /sys/firmware/devicetree/base/soc@0/*/i2c@*/*/compatible -l | wc -l 2> /dev/null)
By default, it looks for 'basler-camera-vvcam' node name but you can adapt for the custom sensor node name in the .dts in your kernel. It is an automatically way to start the ISP stuff within a service such as systemd.
From Yocto source (isp-imx_4.2.2.11.0.bb), it seems that the start_isp.sh script is copied and installed as-is from the downloaded isp-imx binary (https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/isp-imx-4.2.2.11.0.bin for example) :
$ vi <yocto-bsp>/sources/meta-imx/meta-bsp/recipes-bsp/isp-imx/isp-imx_4.2.2.11.0.bb
...
do_install() {
install -d ${D}/${libdir}
install -d ${D}/${includedir}
install -d ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/build/generated/release/bin/*_test ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/build/generated/release/bin/*2775* ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/build/generated/release/bin/isp_media_server ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/build/generated/release/bin/vvext ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/${PN}-${PV}/dewarp/dewarp_config/ ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/build/generated/release/lib/*.so* ${D}/${libdir}
cp -r ${WORKDIR}/build/generated/release/include/* ${D}/${includedir}
cp ${WORKDIR}/${PN}-${PV}/imx/run.sh ${D}/opt/imx8-isp/bin
cp ${WORKDIR}/${PN}-${PV}/imx/start_isp.sh ${D}/opt/imx8-isp/bin
chmod +x ${D}/opt/imx8-isp/bin/run.sh
chmod +x ${D}/opt/imx8-isp/bin/start_isp.sh
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/${PN}-${PV}/imx/imx8-isp.service ${D}${systemd_system_unitdir}
fi
}
...
Then you might need to modify or to append to the above isp-imx_4.2.2.11.0.bb to apply some patch of your sensor node's name rather than 'basler-camera-vvcam' in order to avoid modifying it in your running system.
Also, you can remove the start_isp.sh script from your system and launch the script ./run.sh manually :
./run.sh -c <your-sensor> -lm
For isp_media_server, I cannot directly edit the file to see precisely what should be changed.
According to my opinion, you do not need to modify this isp_media_server, rather you need to modify your sensor driver in <isp-imx>/units/isi/drv/<your-sensor>/* that will be used to generate <your-sensor>.drv which then in turn will be loaded and used by the isp_media_server.
Br,
Hi @Cbrobson ,
Below is some of my experience :
For start_isp.sh, I will need to point to the correct .dtb file, but I am not clear on how to find/create the correct device tree.
This script detects number of camera sensor nodes in the used .dtb (or compiled .dts, selected by fdt_file variable in u-Boot) and will launch single sensor mode or dual sensors mode based on that number :
NR_DEVICE_TREE_BASLER=$(grep basler-camera-vvcam /sys/firmware/devicetree/base/soc@0/*/i2c@*/*/compatible -l | wc -l 2> /dev/null)
By default, it looks for 'basler-camera-vvcam' node name but you can adapt for the custom sensor node name in the .dts in your kernel. It is an automatically way to start the ISP stuff within a service such as systemd.
From Yocto source (isp-imx_4.2.2.11.0.bb), it seems that the start_isp.sh script is copied and installed as-is from the downloaded isp-imx binary (https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/isp-imx-4.2.2.11.0.bin for example) :
$ vi <yocto-bsp>/sources/meta-imx/meta-bsp/recipes-bsp/isp-imx/isp-imx_4.2.2.11.0.bb
...
do_install() {
install -d ${D}/${libdir}
install -d ${D}/${includedir}
install -d ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/build/generated/release/bin/*_test ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/build/generated/release/bin/*2775* ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/build/generated/release/bin/isp_media_server ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/build/generated/release/bin/vvext ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/${PN}-${PV}/dewarp/dewarp_config/ ${D}/opt/imx8-isp/bin
cp -r ${WORKDIR}/build/generated/release/lib/*.so* ${D}/${libdir}
cp -r ${WORKDIR}/build/generated/release/include/* ${D}/${includedir}
cp ${WORKDIR}/${PN}-${PV}/imx/run.sh ${D}/opt/imx8-isp/bin
cp ${WORKDIR}/${PN}-${PV}/imx/start_isp.sh ${D}/opt/imx8-isp/bin
chmod +x ${D}/opt/imx8-isp/bin/run.sh
chmod +x ${D}/opt/imx8-isp/bin/start_isp.sh
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/${PN}-${PV}/imx/imx8-isp.service ${D}${systemd_system_unitdir}
fi
}
...
Then you might need to modify or to append to the above isp-imx_4.2.2.11.0.bb to apply some patch of your sensor node's name rather than 'basler-camera-vvcam' in order to avoid modifying it in your running system.
Also, you can remove the start_isp.sh script from your system and launch the script ./run.sh manually :
./run.sh -c <your-sensor> -lm
For isp_media_server, I cannot directly edit the file to see precisely what should be changed.
According to my opinion, you do not need to modify this isp_media_server, rather you need to modify your sensor driver in <isp-imx>/units/isi/drv/<your-sensor>/* that will be used to generate <your-sensor>.drv which then in turn will be loaded and used by the isp_media_server.
Br,
Posting updates as promised: I found that the editable versions of the .dtb files are .dts format (at least, I am fairly confident this is the case), and are located at imx-yocto-bsp/<your_build_dir>/tmp/work-shared/imx8mpevk/kernel-source/arch/arm64/boot/dts/freescale/. I modified one of the files for a supported camera that makes use of the ISP, compiled again using bitbake, and I am now flashing the new image onto my SD card.
Once I boot back in, I will still need to edit at least isp_start.sh to point to my new .dtb file, and I am still unsure if some modification will be required to the as-yet unviewable isp_media_server.