[libcamera-devel] [PATCH v5] meson: detect kernel version
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Jun 12 10:50:20 CEST 2020
Hi Stéphane,
Thank you for the patch.
On Thu, Jun 11, 2020 at 12:26:14PM +0200, 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 | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/meson.build b/meson.build
> index e898782..69d2d63 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -105,6 +105,15 @@ if get_option('test')
> subdir('test')
> endif
>
> +if not meson.is_cross_build()
> + kernel_version_req = '>= 5.0.0'
We use 4 spaces indentation in meson.build files.
> + kernel_version = run_command('uname', '-r').stdout()
You should add .strip() here to remove the trailing newline output by
uname. version_compare() will cope, but printing kernel_version (see
below) would output an extra newline in the middle.
> + if not kernel_version.version_compare(kernel_version_req)
> + warning('Consider upgrading your kernel, as only @0@ is supported by libcamera at runtime'
> + .format(kernel_version_req))
Even when not cross-building, it may be possible to build libcamera on a
different machine than the target machine. How about wording the message
as follows ?
warning('The current running kernel version @0@ is too old to run libcamera.'
.format(kernel_version))
warning('If you intend to use libcamera on this maching, please upgrade to kernel @0 at .'
.format(kernel_version_req))
Splitting the warning in two lines doesn't just make it more readable in
the meson.build file, but also on the output of meson.
> + 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,
Laurent Pinchart
More information about the libcamera-devel
mailing list