With the latest r32.4.3 release, we found our previous version of DTB and kernel for imx219 sensor based Raspberry Pi cameras no longer working. After a few good days of scrambling, we finally got our tx2 kit + camera boar to function with imx219.
Our camera carrier board is designed to support both imx219 and ov5647 RPi cameras, up to 6 cameras simultaneously. Overall, we follow the approach of unregistering the plugin manager, and adding the new imx219 device to the main device tree dtsi file.
The main change in the DTS code is instead of csi-port, the dtsi now use port-index.
Another thing we bumped into is the errors cause by LC898212 after we unregistered the plugin manager. By try-and-error, we found that removing the reference to LC898212 in the Makefile is the most effective way to handle the problem. No need to remove the related dts files, just comment out the line
#dtb-$(CONFIG_ARCH_TEGRA_18x_SOC) += tegra186-quill-p3310-1000-a00-00-lc898212.dtb in Makefile.
The next task is the kernel driver for imx219. Actually it turns out we may pretty much reuse the official imx219.c with some minor touch up. The biggest challenge is to find how to compile it. Or in a simple question, where to put imx219.c and where to find the related headers.
By default, imx219.c is in tx2_32.4_3/kernel/nvidia/drivers/media/i2c.
However, that’s not where the make would see when building the kernel. If we follow the official guideline, the compilation should be performed under kernel/kernel-4.9/, not kernel/nvidia.
While doing the study, we found that the kernel and dtb can be compile using the script nvbuild.sh, which is under the extracted source top directory.
nvbuild.sh would take the imx219.c under kernel/nvidia/drivers/media/i2c
Since nvbuild.sh is not described in the official NVIDIA Jetson Linux Developer Guide, we didn’t do a thorough verification on the process. But we can say that it works.
The second method is to closely follow the steps as described in the Guide. However, you have to copy the imx219.c and related headers from various places. Make sure they are all placed in corresponding directories under kernel/kernel-4.9/include and kernel/kernel-4.9/drivers.
With the steps above, we can pretty much reuse the scripts we had before to build the kernel and dtb.
Recap the three main issues resolved:
- csi-port vs port-index
- LC898212 removal
- Placement of imx219.c and headers.
Afterward, flash the Image and dtb using a terminal command:
sudo ./flash.sh jetson-tx2-devkit mmcblk0p1
BTW, we couldn’t figure out how to use SDKM to flash the customized kernel and dtb. Until a solution is present, I’d say don’t use SDKM to flash it for that purpose.
We continued the setup on tx2 after flash., including the connetion to the network gateway. Enter “ifconfig” to get the network IP address of tx2.
Now we can use SDK Manager to install the Jetson Components.
Use the ip address, go back to the host PC and run SDK Manager STEP03 (tune off the Jetson OS, turn on the Jetson SDK COmponents).
That should give you a working TX2 with customized IMX219 kernel and device tree.