From dbc9d0fb6863026b16f4805709acc7e4977d7e66 Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Sun, 30 Aug 2026 03:10:39 +0300 Subject: cmake: fix kernel module installation Install each module from its real build directory, propagate staged install roots, and fail when kbuild modules_install fails. Add a rootless CTest and CI regression for successful and failed installs. Best practices followed: Use the standard CMake DESTDIR and kbuild INSTALL_MOD_PATH staging interfaces: https://cmake.org/cmake/help/latest/envvar/DESTDIR.html https://docs.kernel.org/kbuild/modules.html#install-mod-path Check child command status with execute_process RESULT_VARIABLE: https://cmake.org/cmake/help/latest/command/execute_process.html Register repeatable tests with CTest add_test: https://cmake.org/cmake/help/latest/command/add_test.html --- drivers/ipoe/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/ipoe') diff --git a/drivers/ipoe/CMakeLists.txt b/drivers/ipoe/CMakeLists.txt index d0d6902c..5bbac4f6 100644 --- a/drivers/ipoe/CMakeLists.txt +++ b/drivers/ipoe/CMakeLists.txt @@ -41,5 +41,9 @@ ADD_CUSTOM_TARGET(ipoe_drv ALL ) IF (NOT DEFINED CPACK_TYPE) - INSTALL(CODE "EXECUTE_PROCESS(COMMAND make -C ${KDIR} M=${CMAKE_CURRENT_BINARY_DIR}/drivers/ipoe modules_install)") + INSTALL(CODE " + set(KERNEL_BUILD_DIR [==[${KDIR}]==]) + set(KERNEL_MODULE_BUILD_DIR [==[${CMAKE_CURRENT_BINARY_DIR}/driver]==]) + include([==[${CMAKE_SOURCE_DIR}/cmake/install-kernel-module.cmake]==]) + ") ENDIF() -- cgit v1.2.3