[libcamera-devel] [PATCH] meson: detect kernel version

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Jun 11 11:09:05 CEST 2020


Hi Stéphane,

On 11/06/2020 09:43, Stéphane Cerveau wrote:
> Add kernel version detection to warn user
> that only >= 5.0.0 V4L API are supported in
> libcamera.
> 
> Signed-off-by: Stéphane Cerveau <scerveau at collabora.com>
> ---
>  meson.build | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index e898782..a72fef6 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -105,6 +105,14 @@ if get_option('test')
>      subdir('test')
>  endif
>  
> +if not meson.is_cross_build()
> +  kernel_version_req = '>= 5.0.0'
> +  kernel_version = run_command('uname', '-r').stdout()

> meson.build:112: WARNING: V4L2 API version 5.4.0-33-generic
>  is too old, >= 5.8.0 is required, consider to upgrade your kernel version to use libcamera

This needs a .strip() at the end to remove the new lines:

> +  if not kernel_version.version_compare(kernel_version_req)
> +    warning('V4L2 API version @0@ is too old, @1@ is required, consider to upgrade your kernel version to use 
libcamera'.format(kernel_version, kernel_version_req))

That line is really long, can it be reduced? At the very least, the
.format() can move to a new line I believe.


Grammatically I think this should be :
 "consider upgrading your"
rather than
 "consider to upgrade"

but that's longer ;-(


"WARNING: V4L2 API version 5.4.0-33-generic"

That's not really the V4L2 API version (I mean I guess it is) but it's
the Linux-kernel version...

So I wouldn't reference the V4L2 API there ...


> +  endif
> +endif
> +
>  # Create a symlink from the build root to the source root. This is used when
>  # running libcamera from the build directory to locate resources in the source
>  # directory (such as IPA configuration files).
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list