Digilent / Petalinux-Zybo-Z7-20

52 stars 17 forks source link

/dev/media0 missing on Ubuntu running on ZYBO-Z7-20 #2

Open lp6m opened 6 years ago

lp6m commented 6 years ago

Hi, I want to get image from Pcam 5C from Ubuntu running on ZYBO-Z7-20. First, I cloned this repository, and tested pre-built image. I could get camera image by command-line.

Next, To use ubuntu, I changed the configuration and built petalinux project. $ petalinux-config Linux Components Selection -> u-boot -> u-boot-plnx Linux Components Selection -> linux-kernel -> linux-xlnx Image Packaging Configuration -> Root filesystem type -> SD card And I modified project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi as described in README.md.

After change the configuration, I created kernel image file. $petalinux-build -c kernel $petalinux-build -c u-boot $petalinux-build -c fsbl $petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system_wrapper.bit --u-boot --force

I downloaded ubuntu rootfs armhf-rootfs-ubuntu-xenial.tar from here, and copy them to the second partition of SD card.

Ubuntu was successfully booted, and I tested command to get image. But I couldn't get image from pcam. media-ctl -d /dev/media0 -V '"ov5640 2-003c":0 [fmt:UYVY/'"$width"x"$height"'@1/'"$rate"' field:none]' media-ctl -d /dev/media0 -V '"43c60000.mipi_csi2_rx_subsystem":0 [fmt:UYVY/'"$width"x"$height"' field:none]' When I run this command, the following error is occurred. failed to enumerate /dev/media0 (-2)

When I run v4l2-ctl -d /dev/video0 --info command, it seemed that I got camera information correctly. But /dev/media0 is missing. /dev/video0 is appeared.

Why /dev/media0 is missing? Got any ideas on how to fix this?

lp6m commented 6 years ago

Update I found the reason why /dev/media0 was missing. The petalinux project of this repository uses linux kernel which is made by digilent. (https://github.com/Digilent/linux-digilent)

So, I should not have change Linux Components Selection setting. With the default setting, I could find /dev/media0 on Ubuntu running on ZYBO-Z7-20.

But, I still could not get image from PCam. As I said in the previous post, I use kernel and image which is built on petalinux(image.ub and BOOT.BIN), but rootfs uses downloaded one.( armhf-rootfs-ubuntu-xenial.tar)

I checked the loaded module by ls /sys/module command, and found that the xilinx_csi2rxss module is not loaded. When I use rootfs which is built on petalinux, xilinx_csi2rxss is successfully loaded. And I removed the module by modprobe -r command, I could not get image from PCam. So, I think the xilinx_csi2rxss module needs to get image from PCam.

I checked the kernel settings on petalinux-config and found the driver module of Xilinx IP is set to built-in module. So, ubuntu should automatically load driver module after boot. But no error message was found in dmesg log.

I tried change these driver module from built-in(*) to module(m)' on petalinux-config. I rebuilt kernel image and rootfs, and extract modularrized driver file (*.ko) from rootfs.tar.gz that I built.( driver is at /lib/module/4.9.0-xilinx-v2017.4/) And copyed them to my ubuntu rootfs. Ubuntu seems to try to load these driver, but failed. I found error message bydmesg` command.

The error is the following.

videobuf2_core: exports duplicate symbol vb2_buffer_in_use (owned by kernel)

I don't understand the meaning of this error so much. I found videobuf2_core module (or driver?) is set to built-in on KConfig (And I could not change this setting by petalinux-config).

How to fix this problem? Thanks in advance.

lp6m commented 6 years ago

I finally fix this problem. Please see here for details.