[Buildroot] generating a kernel with camera support (video 4 linux)

Peter Seiderer ps.report at gmx.net
Fri Mar 31 19:59:35 UTC 2023


Hello Gerd,

On Fri, 31 Mar 2023 09:37:00 +0000, Gerd Kautzmann <G.Kautzmann at PRIMES.de> wrote:

> Hello Peter,
> 
> many thanks for your reply, now I have got an image loading the camera drivers after 'modprobe -v imx219'
> 
> imx219                 20480  0
> v4l2_fwnode       24576  1 imx219
> videodev              253952  2 imx219,v4l2_fwnode
> mc                         45056  2 imx219,videodev
> 
> /dev/video0 is still missing and 'v4l2-ctl' like all the other tools from v4l-utils.

Please try with the given defconfig and do a full clean rebuild (see
https://buildroot.org/downloads/manual/manual.html#full-rebuild for reasoning)...

Which buildroot version?

> 
> The settings concerning the libcamera pipeline might be the main reason:
> 
> 'BR2_PACKAGE_LIBCAMERA_PIPELINE_RASPBERRYPI=y'

No, libcamera has nothing to do with the kernel driver/modules and /dev/video
handling...

> 
> Or:
> 
> target packages -> libraries -> multimedia [*] libcamera
> 					`->	[*] libcamera v4l compatibility layer
> 						[*] raspberry pipeline
> 						[_] uvcvideo pipeline
> 
> Currently I'm getting an error during the make process:
> 
> --------------------------------
> >>> libcamera-apps 1.1.1 Configuring  
> 
> ...
> 
> CMake Warning at /usr/share/cmake-3.18/Modules/FindBoost.cmake:1187 (message):
>   New Boost version may have incorrect or missing dependencies and imported
>   targets
> Call Stack (most recent call first):
>   /usr/share/cmake-3.18/Modules/FindBoost.cmake:1311 (_Boost_COMPONENT_DEPENDENCIES)
>   /usr/share/cmake-3.18/Modules/FindBoost.cmake:1919 (_Boost_MISSING_DEPENDENCIES)
>   core/CMakeLists.txt:5 (find_package)
> 
> 
> CMake Error at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
>   Could NOT find Boost (missing: program_options) (found version "1.80.0")
> Call Stack (most recent call first):
>   /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
>   /usr/share/cmake-3.18/Modules/FindBoost.cmake:2177 (find_package_handle_standard_args)
>   core/CMakeLists.txt:5 (find_package)
> 
> 
> -- Configuring incomplete, errors occurred!
> See also "/home/gerd/buildroot/output/build/libcamera-apps-1.1.1/CMakeFiles/CMakeOutput.log".
> make: *** [package/pkg-generic.mk:283: /home/gerd/buildroot/output/build/libcamera-apps-1.1.1/.stamp_configured] Error 1
> --------------------------------

See above, try with the given defconfig and do a full clean rebuild...

> 
> But I will try myself with a new configuration first, before spamming the mailing list.
> 

No, keep the mailing list in CC (others may be interested in the problem/solution/etc.)...

Regards,
Peter


> 
> Greetings Gerd 
> 
> -----Ursprüngliche Nachricht-----
> Von: Peter Seiderer <ps.report at gmx.net> 
> Gesendet: Donnerstag, 30. März 2023 19:21
> An: Gerd Kautzmann <G.Kautzmann at PRIMES.de>
> Cc: buildroot at buildroot.org
> Betreff: Re: [Buildroot] generating a kernel with camera support (video 4 linux)
> 
> Hello Gerd,
> 
> On Thu, 30 Mar 2023 15:47:14 +0000, Gerd Kautzmann <G.Kautzmann at PRIMES.de> wrote:
> 
> > Thank you Peter for your fast reply
> >  
> > > Add 'dtparam=i2c=on' and 'dtoverlay=imx219' to the config.txt file 
> > > on the first partition, reboot and (dependent on your configuration) 
> > > load the module via 'modprobe imx219' (or re-build your buildroot image with '/dev management' set to Dynamic mdev or eudev which will enable the udev autoload magic of the kernel modules)...  
> >
> > I tried:
> >
> > dtparam=i2c=on
> > dtoverlay=imx219
> >
> > and typed:  
> > >modprobe -v imx219  
> > (no confirmation or error message)
> >  
> > > modprobe -l | grep imx219  
> > kernel/drivers/media/i2c/imx219.ko
> > (with or without modprobe -v imx219)
> >
> > I tried some variations I found online:
> > dtparam=i2c=on
> > dtoverlay=imx219,media-controller=0
> > camera_auto_detect=1
> >
> > No success
> >
> > I built a new image with
> >
> > system configuration -> /dev management -> [*] Dynamic using devtmpfs 
> > + mdev
> >
> > didn't help either.
> >
> > I tested the camera and some of your settings with a standard raspberry image, at least I know this camera could be detected from the raspberry with v4l2-ctl and I got /dev/video0 .
> >
> > So there seems to be a very basic error in the configuration I made, here ist he configuration I used:
> >
> > -------------------
> >
> > make clean
> > make raspberrypi4_defconfig
> > make menuconfig
> >
> > Target 			-> [*] ARM (little endian)
> > Target Architecture	-> [*] cortex-A72		// attention RaspPi 4 specific!
> > Target ABI 		-> [*] EABIhf			// hard float
> > Floating Point Strat-> [*] NEON/VFPvi4			// attention RaspPi 4 specific!
> > ARM instruction set	-> [*] ARM			// Thumb2 may be more compact but not compatible
> >
> > Toolchain type		-> [*] buildroot toolchain 	// default Buildroot toolchain
> > c library		-> [*] glibc			// uClibc is more compact, glibc is larger but maybe more compatibel
> > Kernel headers		-> Same as kernel being built	// should be tested for compatibility later
> > Custom kernel headers	-> (5.10.x)			// default
> > Enable C++ support	-> [*]
> >
> > Filesystem images	-> [*] ext2/3/4 root filesystem
> > 					`-> [*] ext4		// default
> >
> > Filesystem images	-> [*] tar the root filesystem
> > 					`-> [*] no compression
> >
> > Networking Applications	->	[*] dropbear	// for ssh client & server
> > System config. root pw	->	(PiManiaZX81)		// needed for root login via ssh
> >
> >
> > target packages -> hardware handling -> firmware -> [*] rpi-firmware
> > 							`-> [*] rpi 4 (extended)
> >
> > target packages -> hardware handling -> [*] rpi-userland
> >
> >
> > target packages -> libraries -> graphics [*] opencv4
> > 					`-> [*] v4l support
> > 					      [*] imgcodecs
> > 					      [*] imgproc
> >
> >
> > target packages -> libraries -> hardware handling [*] libgpiod target 
> > packages -> libraries -> hardware handling [*] lib4l
> > 						`-> [*] v4l-utils
> > target packages -> libraries -> multimedia [*] libcamera
> > 						`-> [*] libcamera v4l compatibility layer
> >
> > -------------------
> > system configuration -> /dev management -> [*] Dynamic using devtmpfs 
> > + mdev
> > -------------------
> >
> > The drivers for the camera imx219 are also included with this setting but maybe there is something missing or interfering with v4l ....
> >
> > Any ideas?  
> 
> Just tested with the following defconfig (buildrooot-git-master):
> 
> BR2_arm=y
> BR2_cortex_a72=y
> BR2_ARM_FPU_NEON_VFPV4=y
> BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
> BR2_TOOLCHAIN_BUILDROOT_CXX=y
> BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
> BR2_TARGET_GENERIC_ROOT_PASSWD="000000"
> BR2_SYSTEM_DHCP="eth0"
> BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi4/post-build.sh"
> BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4/post-image.sh"
> BR2_LINUX_KERNEL=y
> BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
> BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,0b54dbda3cca2beb51e236a25738784e90853b64)/linux-0b54dbda3cca2beb51e236a25738784e90853b64.tar.gz"
> BR2_LINUX_KERNEL_DEFCONFIG="bcm2711"
> BR2_LINUX_KERNEL_DTS_SUPPORT=y
> BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2711-rpi-4-b"
> BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> BR2_PACKAGE_RPI_FIRMWARE=y
> BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y
> BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X=y
> BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypi4/config_4.txt"
> BR2_PACKAGE_RPI_USERLAND=y
> BR2_PACKAGE_OPENCV4=y
> BR2_PACKAGE_OPENCV4_LIB_IMGCODECS=y
> BR2_PACKAGE_OPENCV4_WITH_V4L=y
> BR2_PACKAGE_LIBGPIOD=y
> BR2_PACKAGE_LIBV4L=y
> BR2_PACKAGE_LIBV4L_UTILS=y
> BR2_PACKAGE_LIBCAMERA=y
> BR2_PACKAGE_LIBCAMERA_V4L2=y
> BR2_PACKAGE_LIBCAMERA_PIPELINE_RASPBERRYPI=y
> BR2_PACKAGE_DROPBEAR=y
> BR2_TARGET_ROOTFS_EXT2=y
> BR2_TARGET_ROOTFS_EXT2_4=y
> BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
> # BR2_TARGET_ROOTFS_TAR is not set
> BR2_PACKAGE_HOST_DOSFSTOOLS=y
> BR2_PACKAGE_HOST_GENIMAGE=y
> BR2_PACKAGE_HOST_MTOOLS=y
> 
> 
> And on the RPi:
> 
> 	$ mount /dev/mmcblk0p1 /mnt/
> 	$ cat /mnt/config.txt
> # Please note that this is only a sample, we recommend you to change it to fit # your needs.
> # You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE.
> # See http://buildroot.org/manual.html#rootfs-custom
> # and http://elinux.org/RPiconfig for a description of config.txt syntax
> 
> start_file=start4.elf
> fixup_file=fixup4.dat
> 
> kernel=zImage
> 
> # To use an external initramfs file
> #initramfs rootfs.cpio.gz
> 
> # Disable overscan assuming the display supports displaying the full resolution # If the text shown on the screen disappears off the edge, comment this out
> disable_overscan=1
> 
> # How much memory in MB to assign to the GPU on Pi models having # 256, 512 or 1024 MB total memory
> gpu_mem_256=100
> gpu_mem_512=100
> gpu_mem_1024=100
> 
> # fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console dtoverlay=miniuart-bt
> 
> # enable autoprobing of Bluetooth driver without need of hciattach/btattach dtoverlay=krnbt=on
> 
> dtoverlay=imx219
> 
> 
> 	$ lsmod | grep imx219
> imx219                 20480  1
> v4l2_fwnode            24576  2 imx219,bcm2835_unicam
> videodev              253952  9 bcm2835_isp,bcm2835_codec,v4l2_mem2mem,bcm2835_v4l2,imx219,bcm2835_unicam,v4l2_fwnode,videobuf2_v4l2,videobuf2_common
> mc                     45056  8 bcm2835_isp,bcm2835_codec,v4l2_mem2mem,imx219,bcm2835_unicam,videobuf2_v4l2,videobuf2_common,videodev
> 
> 
> 	$ v4l2-ctl --all
> Driver Info:
> 	Driver name      : unicam
> 	Card type        : unicam
> 	Bus info         : platform:fe801000.csi
> 	Driver version   : 5.10.92
> 	Capabilities     : 0xa5a00001
> 		Video Capture
> 		Metadata Capture
> 		Read/Write
> 		Streaming
> 		Extended Pix Format
> 		Device Capabilities
> 	Device Caps      : 0x25200001
> 		Video Capture
> 		Read/Write
> 		Streaming
> 		Extended Pix Format
> Media Driver Info:
> 	Driver name      : unicam
> 	Model            : unicam
> 	Serial           :
> 	Bus info         : platform:fe801000.csi
> 	Media version    : 5.10.92
> 	Hardware revision: 0x00000000 (0)
> 	Driver version   : 5.10.92
> Interface Info:
> 	ID               : 0x03000006
> 	Type             : V4L Video
> Entity Info:
> 	ID               : 0x00000004 (4)
> 	Name             : unicam-image
> 	Function         : V4L2 I/O
> 	Flags            : default
> 	Pad 0x01000005   : 0: Sink
> 	  Link 0x02000008: from remote pad 0x1000002 of entity 'imx219 10-0010' (Camera Sensor): Data, Enabled, Immutable
> Priority: 2
> Video input : 0 (unicam-image: ok)
> Format Video Capture:
> 	Width/Height      : 640/480
> 	Pixel Format      : 'YUYV' (YUYV 4:2:2)
> 	Field             : None
> 	Bytes per Line    : 1280
> 	Size Image        : 614400
> 	Colorspace        : sRGB
> 	Transfer Function : sRGB
> 	YCbCr/HSV Encoding: ITU-R 601
> 	Quantization      : Limited Range
> 	Flags             :
> 
> 
> Camera detected...
> 
> Regards,
> Peter
> 
> 
> > _______________________________________________
> > buildroot mailing list
> > buildroot at buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot  
> 




More information about the buildroot mailing list