aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLior Dekel <Lior.dekel@arm.com>2021-12-02 10:58:12 +0200
committerKristofer Jonsson <kristofer.jonsson@arm.com>2021-12-16 11:44:27 +0000
commitc3f4a8323984c279e143e634e7645eac86558b12 (patch)
treec757d0463840854e2e30287176ddc6c796e51502
parentafb399f7b39029280a36d4f727320e8842344dac (diff)
downloadethos-u-linux-driver-stack-c3f4a8323984c279e143e634e7645eac86558b12.tar.gz
Corstone700 Kernel modules build fix.
JIRA: MLBEDSW-5531 Change-Id: Ib4b6b6b0ee3995bb01029d561c4cf7eed981a303
-rw-r--r--CMakeLists.txt11
-rw-r--r--cmake/toolchain/aarch64-linux-gnu.cmake5
-rw-r--r--kernel/CMakeLists.txt2
-rw-r--r--mailbox/CMakeLists.txt3
-rw-r--r--remoteproc/CMakeLists.txt3
5 files changed, 18 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4711a19..e447afb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,15 @@ option(BUILD_KERNEL "Build the kernel driver" ON)
option(BUILD_MAILBOX "Build the MHU mailbox kernel module" ON)
option(BUILD_REMOTEPROC "Build the remoteproc kernel module" ON)
+# Set variables
+if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+ set(ARCH "arm64")
+else()
+ set(ARCH "arm")
+endif()
+
+string(REGEX REPLACE "(.*)gcc$" "\\1" CROSS_COMPILE "${CMAKE_C_COMPILER}")
+
# Add rpath to library directory
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
@@ -42,7 +51,7 @@ if (BUILD_MAILBOX)
endif()
if (BUILD_REMOTEPROC)
-add_subdirectory(remoteproc)
+ add_subdirectory(remoteproc)
endif()
# Build flatbuffers
diff --git a/cmake/toolchain/aarch64-linux-gnu.cmake b/cmake/toolchain/aarch64-linux-gnu.cmake
index 83a1b27..6bbefb9 100644
--- a/cmake/toolchain/aarch64-linux-gnu.cmake
+++ b/cmake/toolchain/aarch64-linux-gnu.cmake
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2020 Arm Limited. All rights reserved.
+# Copyright (c) 2020-2021 Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -19,6 +19,7 @@
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
-set (CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_SYSTEM_PROCESSOR "aarch64")
add_compile_options(-Wall -Wextra)
diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt
index 705a30a..5aa47bb 100644
--- a/kernel/CMakeLists.txt
+++ b/kernel/CMakeLists.txt
@@ -34,7 +34,7 @@ file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c" "*.h")
# Build the kernel module
add_custom_target(kernel ALL
- COMMAND ${CMAKE_MAKE_PROGRAM} -C ${KDIR} M=${CMAKE_CURRENT_SOURCE_DIR} CONFIG_ETHOSU=m CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 modules
+ COMMAND ${CMAKE_MAKE_PROGRAM} -C ${KDIR} M=${CMAKE_CURRENT_SOURCE_DIR} CONFIG_ETHOSU=m CROSS_COMPILE=${CROSS_COMPILE} ARCH=${ARCH} modules
BYPRODUCTS ethosu.ko
DEPENDS ${SOURCES} Kbuild Kconfig
COMMENT "Building ethosu.ko"
diff --git a/mailbox/CMakeLists.txt b/mailbox/CMakeLists.txt
index ac91374..1728b4e 100644
--- a/mailbox/CMakeLists.txt
+++ b/mailbox/CMakeLists.txt
@@ -40,7 +40,7 @@ list(TRANSFORM OBJ PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/)
add_custom_target(mailbox-module ALL
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
+ CROSS_COMPILE=${CROSS_COMPILE} ARCH=${ARCH} modules
BYPRODUCTS
${CMAKE_CURRENT_SOURCE_DIR}/arm_mhu.ko
${CMAKE_CURRENT_SOURCE_DIR}/arm_mhu.o
@@ -57,3 +57,4 @@ add_custom_target(mailbox-module ALL
COMMENT "Building arm_mhu.ko arm_mhu_v2.ko"
VERBATIM)
+install(FILES arm_mhu.ko arm_mhu_v2.ko DESTINATION "modules") \ No newline at end of file
diff --git a/remoteproc/CMakeLists.txt b/remoteproc/CMakeLists.txt
index fa3491a..58c9796 100644
--- a/remoteproc/CMakeLists.txt
+++ b/remoteproc/CMakeLists.txt
@@ -43,7 +43,7 @@ add_custom_target(ethosu-remoteproc-module ALL
COMMAND ${CMAKE_MAKE_PROGRAM} -C ${KDIR}
EXTRA_CFLAGS=-I${KDIR}/../../../drivers/remoteproc M=${CMAKE_CURRENT_SOURCE_DIR}
${MODULES}
- CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 modules
+ CROSS_COMPILE=${CROSS_COMPILE} ARCH=${ARCH} modules
BYPRODUCTS
${CMAKE_CURRENT_SOURCE_DIR}/ethosu_remoteproc.ko
${CMAKE_CURRENT_SOURCE_DIR}/ethosu_remoteproc.mod.o
@@ -54,3 +54,4 @@ add_custom_target(ethosu-remoteproc-module ALL
COMMENT "Building remoteproc modules"
VERBATIM)
+install(FILES ethosu_remoteproc.ko DESTINATION "modules") \ No newline at end of file