[LEDE-DEV] [PATCH ubox] cmake: Check for getrandom system call
Etienne Champetier
champetier.etienne at gmail.com
Sat Feb 4 20:55:43 PST 2017
Ack
Thanks Florian
2017-02-04 18:41 GMT-08:00 Florian Fainelli <f.fainelli at gmail.com>:
> In case we are building against a kernel that is too old and does not
> support SYS_getrandom, error out with a message indicating so.
>
> Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
> ---
> CMakeLists.txt | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 6cf0c934aac6..9033493c7a3b 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -16,10 +16,17 @@ IF(DEBUG)
> ADD_DEFINITIONS(-DDEBUG -g3)
> ENDIF()
>
> -ADD_EXECUTABLE(getrandom getrandom.c)
> -INSTALL(TARGETS getrandom
> - RUNTIME DESTINATION bin
> -)
> +INCLUDE (CheckSymbolExists)
> +CHECK_SYMBOL_EXISTS(SYS_getrandom sycall.h getrandom)
> +
> +IF(getrandom)
> + ADD_EXECUTABLE(getrandom getrandom.c)
> + INSTALL(TARGETS getrandom
> + RUNTIME DESTINATION bin
> + )
> +ELSE()
> + message( FATAL_ERROR "Kernel too old, missing SYS_getrandom system call")
> +ENDIF()
>
> ADD_EXECUTABLE(kmodloader kmodloader.c)
> TARGET_LINK_LIBRARIES(kmodloader ubox)
> --
> 2.9.3
>
>
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
More information about the Lede-dev
mailing list