SOLVED Install camera to rpi4
-
I have tried:
crosscompile kinux image veye327 driver for Ubuntu Desktop 21.04 Rpi4
on rpi4
uname -r
5.11.0-1008-raspi
uname -a
Linux number 5.11.0-1008-raspi #8-Ubuntu SMP PREEMPT Thu May 6 17:46:38 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
on host
sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev crossbuild-essential-arm64 mkdir rpi_ubuntu_source cd rpi_ubuntu_source git clone --depth=1 git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux-raspi/+git/hirsute git clone https://github.com/veyeimaging/raspberrypi_v4l2.git cp raspberrypi_v4l2/driver_source/cam_drv_src/rpi-5.x_all/veye327.c hirsute/drivers/media/i2c
edit hirsute/drivers/media/i2c/Kconfig
find section imx219 and after it add:
config VIDEO_VEYE327 tristate "VEYE VEYE327 sensor support" depends on I2C && VIDEO_V4L2 select MEDIA_CONTROLLER select VIDEO_V4L2_SUBDEV_API select V4L2_FWNODE help This is a Video4Linux2 sensor driver for the VEYE IMX327 camera. To compile this driver as a module, choose M here: the module will be called veye327.
edit hirsute/drivers/media/i2c/Makefile
find line imx219 and after it add:
obj-$(CONFIG_VIDEO_VEYE327) += veye327.o cp raspberrypi_v4l2/driver_source/dts/rpi-5.10.y/veye327-overlay.dts hirsute/arch/arm64/boot/dts/overlays
edit hirsute/arch/arm64/boot/dts/overlays/Makefile
find line imx219 and after it add:
veye327.dtbo \
build
cd hirsute KERNEL=kernel8 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
got to Device Drivers --> Multimedia Support --> Media ancillary drivers --> Camera sensor devices
select veye327 and save
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs -j4
copy image and dtb
on rpi4 replace vmlinuz-* with compiled hirsute/arch/arm64/boot/Image
on rpi4 copy to /boot/firmware/overlays dtb file hirsute/arch/arm64/boot/dst/overlays/veye327.dtbo
Before was imx219 connected and it works on Ubuntu Desktop 21.04 rpi4 as /dev/video0
Was replaced imx219 to veye327E.
After reboot rpi4 loaded but /dev/video0 gone.
Can you help me to understand what files i need to copy?
May be config, system.map, initrd or other dtb files? -
This post is deleted! -
Here is rpi boot contents:
number@number:/boot$ ls config-5.11.0-1008-raspi dtb-5.11.0-1008-raspi grub System.map-5.11.0-1008-raspi config.txt dtbs initrd.img vmlinuz-5.11.0-1008-raspi dtb firmware initrd.img-5.11.0-1008-raspi
-
I tried installing veye327 to rpiOs.
I have 5.10.36 firmware. veye drivers don't have this version.
I tried build from source, but failed.
Copied built zImage and veye327.dtbo to rpi and got load kernel modules failed on startup.Updated: i did modules_install and veye327 works on rpiOs now.
Can you help build kernel for Ubuntu Desktop Rpi?
-
I did it.
crosscompile kinux image veye327 driver for Ubuntu Desktop 21.04 Rpi4
on rpi4
uname -r 5.11.0-1008-raspi uname -a Linux number 5.11.0-1008-raspi #8-Ubuntu SMP PREEMPT Thu May 6 17:46:38 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
on host
sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev crossbuild-essential-arm64 mkdir rpi_ubuntu_source cd rpi_ubuntu_source git clone --depth=1 git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux-raspi/+git/hirsute linux git clone https://github.com/veyeimaging/raspberrypi_v4l2.git cp raspberrypi_v4l2/driver_source/cam_drv_src/rpi-5.x_all/veye327.c linux/drivers/media/i2c
edit linux/drivers/media/i2c/Kconfig
find section imx219 and after it add:
config VIDEO_VEYE327 tristate "VEYE VEYE327 sensor support" depends on I2C && VIDEO_V4L2 select MEDIA_CONTROLLER select VIDEO_V4L2_SUBDEV_API select V4L2_FWNODE help This is a Video4Linux2 sensor driver for the VEYE IMX327 camera. To compile this driver as a module, choose M here: the module will be called veye327.
edit linux/drivers/media/i2c/Makefile
find line imx219 and after it add:
obj-$(CONFIG_VIDEO_VEYE327) += veye327.o cp raspberrypi_v4l2/driver_source/dts/rpi-5.10.y/veye327-overlay.dts linux/arch/arm64/boot/dts/overlays
edit linux/arch/arm64/boot/dts/overlays/Makefile
find line imx219 and after it add:
veye327.dtbo \
build kernel
cd linux KERNEL=kernel8 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
go to Device Drivers --> Multimedia Support --> Media ancillary drivers --> Camera sensor devices
select veye327 and save
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs -j4
mount sd to host
mkdir mnt mkdir mnt/fat32 mkdir mnt/ext4 sudo mount /dev/sdd1 mnt/fat32 sudo mount /dev/sdd2 mnt/ext4
copy modules
sudo env PATH=$PATH make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=mnt/ext4 modules_install
copy kernel and dtb
sudo cp mnt/fat32/vmlinuz mnt/fat32/vmlinuz.old sudo cp arch/arm64/boot/Image mnt/fat32/vmlinuz sudo cp arch/arm64/boot/dts/broadcom/*.dtb mnt/fat32/ sudo cp arch/arm64/boot/dts/overlays/*.dtb* mnt/fat32/overlays/ sudo cp arch/arm64/boot/dts/overlays/README mnt/fat32/overlays/ sudo umount mnt/fat32 sudo umount mnt/ext4
on rpi4
edit /boot/firmware/config.txt
add lines
gpu_mem=400 dtparam=i2c_vc=on cma=128M dtoverlay=veye327.dtbo start_x=1 sudo reboot dmesg | grep veye
veye327 probed
preview
gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! videoconvert ! autovideosink sync=false text-overlay=false -v
success
-
Add to /etc/modules
i2c-dev
i2c bus 10,11 for sensor control
-
@viktor
Great! Thank you for trying and sharing. -
-
@viktor
Thanks very much.
I wonder how did you set camera parameters, I found that the cs_mipi_i2c.sh not working. -
@fire Veye327 i2c fully works.
-
@viktor
Can you use the original pi commands (e.g. raspistill raspivid), instead of using gst-launch? -
@fire Yes, raspivid and raspistill works too on Ubuntu.