From bb4089d4a0d14ff88c5ce637806f10686c2188de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85strand?= Date: Mon, 5 Oct 2020 11:00:23 +0200 Subject: Build module with cmake Change-Id: I294f6ad22881254a8b0fef45b875fe0e12c91e7a --- mailbox/CMakeLists.txt | 24 ++++++++++++++++++++---- mailbox/Kbuild | 4 +++- mailbox/Kconfig | 12 +++++++++--- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/mailbox/CMakeLists.txt b/mailbox/CMakeLists.txt index b0da45c..ac91374 100644 --- a/mailbox/CMakeLists.txt +++ b/mailbox/CMakeLists.txt @@ -32,12 +32,28 @@ endif() # Depend on all h and c files file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c" "*.h") +file(GLOB_RECURSE OBJ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c") +list(TRANSFORM OBJ REPLACE "^(.*)[.]c" "\\1.o") +list(TRANSFORM OBJ PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/) + # Build the kernel module add_custom_target(mailbox-module ALL - COMMAND ${CMAKE_MAKE_PROGRAM} -C ${KDIR} - M=${CMAKE_CURRENT_SOURCE_DIR} CONFIG_ARM_MHU=m + COMMAND ${CMAKE_MAKE_PROGRAM} -C ${KDIR} + M=${CMAKE_CURRENT_SOURCE_DIR} CONFIG_ARM_MHU_V2=m CONFIG_ARM_MHU=m CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 modules - BYPRODUCTS arm_mhu.ko + BYPRODUCTS + ${CMAKE_CURRENT_SOURCE_DIR}/arm_mhu.ko + ${CMAKE_CURRENT_SOURCE_DIR}/arm_mhu.o + ${CMAKE_CURRENT_SOURCE_DIR}/arm_mhu.mod.o + ${CMAKE_CURRENT_SOURCE_DIR}/arm_mhu.mod.c + ${CMAKE_CURRENT_SOURCE_DIR}/arm_mhu_v2.ko + ${CMAKE_CURRENT_SOURCE_DIR}/arm_mhu_v2.o + ${CMAKE_CURRENT_SOURCE_DIR}/arm_mhu_v2.mod.o + ${CMAKE_CURRENT_SOURCE_DIR}/arm_mhu_v2.mod.c + ${CMAKE_CURRENT_SOURCE_DIR}/modules.order + ${CMAKE_CURRENT_SOURCE_DIR}/Module.symvers + ${OBJ} DEPENDS ${SOURCES} Kbuild Kconfig - COMMENT "Building arm_mhu.ko" + COMMENT "Building arm_mhu.ko arm_mhu_v2.ko" VERBATIM) + diff --git a/mailbox/Kbuild b/mailbox/Kbuild index 5aacdcb..7476fcb 100644 --- a/mailbox/Kbuild +++ b/mailbox/Kbuild @@ -18,4 +18,6 @@ # SPDX-License-Identifier: GPL-2.0-only # -obj-$(CONFIG_ARM_MHU) = arm_mhu.o +obj-$(CONFIG_ARM_MHU) += arm_mhu.o + +obj-$(CONFIG_ARM_MHU_V2) += arm_mhu_v2.o diff --git a/mailbox/Kconfig b/mailbox/Kconfig index 9cfce3e..e7a9cba 100644 --- a/mailbox/Kconfig +++ b/mailbox/Kconfig @@ -1,5 +1,5 @@ # -# (C) COPYRIGHT 2020 ARM Limited. All rights reserved. +# (C) COPYRIGHT 2020 Arm Limited. All rights reserved. # # This program is free software and is provided to you under the terms of the # GNU General Public License version 2 as published by the Free Software @@ -19,11 +19,17 @@ # config ARM_MHU - tristate "ARM MHU Mailbox" + tristate "Arm MHU Mailbox" depends on ARM_AMBA help - Say Y here if you want to build the ARM MHU controller driver. + Say Y here if you want to build the Arm MHU controller driver. The controller has support for two versions of the controller. One with 3 mailbox channels, the last of which can be used in Secure mode only and one with a single channel. +config ARM_MHU_V2 + tristate "Arm MHUv2 Mailbox" + depends on ARM_AMBA + help + Say Y here if you want to build the Arm MHUv2 controller driver, + which provides unidirectional mailboxes between processing elements. -- cgit v1.2.1