Prototype alternative deployment structure
Prototypes an alternative deployment directory structure for the
block-storage service to improve support for different build
configurations for different platforms. The new structure
reflects the three layers for app, infra and env to improve
reuse across multiple build configurations. The infra
(infrastructure) layer significantly improves flexibility
to realize app platform service dependencies in different
ways.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I0f91fd4b6f333eb3cb6a3a5e4206815bc3532fac
diff --git a/components/common/fdt/component.cmake b/components/common/fdt/component.cmake
index 77656e9..2c32e18 100644
--- a/components/common/fdt/component.cmake
+++ b/components/common/fdt/component.cmake
@@ -12,4 +12,4 @@
"${CMAKE_CURRENT_LIST_DIR}/fdt_helpers.c"
)
-include(../../../external/libfdt/libfdt.cmake)
+include(${TS_ROOT}/external/libfdt/libfdt.cmake)
diff --git a/deployments/block-storage/block-storage.cmake b/deployments/block-storage/block-storage.cmake
index d751a57..22760f5 100644
--- a/deployments/block-storage/block-storage.cmake
+++ b/deployments/block-storage/block-storage.cmake
@@ -3,36 +3,21 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
+# Common components used for any deployment of the block-storage service
+# provider.
#-------------------------------------------------------------------------------
add_components(TARGET "block-storage"
BASE_DIR ${TS_ROOT}
COMPONENTS
- "components/common/fdt"
"components/common/tlv"
"components/common/uuid"
"components/common/endian"
- "components/common/trace"
- "components/common/utils"
- "components/config/ramstore"
- "components/config/loader/sp"
- "components/messaging/ffa/libsp"
- "components/rpc/common/interface"
- "components/rpc/ffarpc/endpoint"
"components/service/common/include"
"components/service/common/provider"
"components/service/block_storage/block_store"
- "components/service/block_storage/block_store/device"
- "components/service/block_storage/block_store/device/ram"
- "components/service/block_storage/block_store/partitioned"
"components/service/block_storage/provider"
"components/service/block_storage/provider/serializer/packed-c"
- "components/service/block_storage/config/ref"
- "components/service/block_storage/factory/ref_ram"
-)
-
-target_sources(block-storage PRIVATE
- ${CMAKE_CURRENT_LIST_DIR}/common/block_storage_sp.c
)
#################################################################
diff --git a/deployments/block-storage/opteesp/CMakeLists.txt b/deployments/block-storage/config/default-opteesp/CMakeLists.txt
similarity index 79%
rename from deployments/block-storage/opteesp/CMakeLists.txt
rename to deployments/block-storage/config/default-opteesp/CMakeLists.txt
index fa84397..e565233 100644
--- a/deployments/block-storage/opteesp/CMakeLists.txt
+++ b/deployments/block-storage/config/default-opteesp/CMakeLists.txt
@@ -6,9 +6,7 @@
#-------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
-# Set default platform.
-set(TS_PLATFORM "arm/fvp/fvp_base_revc-2xaemv8a" CACHE STRING "Target platform location.")
-include(../../deployment.cmake REQUIRED)
+include(../../../deployment.cmake REQUIRED)
#-------------------------------------------------------------------------------
# The CMakeLists.txt for building the block_storage deployment for opteesp
@@ -29,9 +27,14 @@
SP_NAME "block-storage"
)
+target_include_directories(block-storage PRIVATE
+ ${CMAKE_CURRENT_LIST_DIR}
+)
+
#-------------------------------------------------------------------------------
-# Components that are specific to deployment in the opteesp environment.
-#
+# Deployment specific components. This deployment uses an infrastructure that
+# that provides ram-backed block stoarged, configured with storage partitions
+# that conform to the 'ref' scheme used for test.
#-------------------------------------------------------------------------------
add_components(TARGET "block-storage"
BASE_DIR ${TS_ROOT}
@@ -39,24 +42,17 @@
"environments/opteesp"
)
-include(../block-storage.cmake REQUIRED)
+include(../../env/commonsp/block_storage_sp.cmake REQUIRED)
+include(../../block-storage.cmake REQUIRED)
+include(../../infra/ref-ram.cmake REQUIRED)
#-------------------------------------------------------------------------------
-# Set target platform to provide drivers needed by the deployment
-#
+# Deployment specific build options
#-------------------------------------------------------------------------------
-add_platform(TARGET "block-storage")
-
-#################################################################
-
target_compile_definitions(block-storage PRIVATE
ARM64=1
)
-target_include_directories(block-storage PRIVATE
- ${TS_ROOT}/deployments/block-storage/opteesp
-)
-
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(block-storage PRIVATE
-std=c99
@@ -66,7 +62,9 @@
compiler_generate_stripped_elf(TARGET block-storage NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
-######################################## install
+#-------------------------------------------------------------------------------
+# Deployment specific install options
+#-------------------------------------------------------------------------------
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
endif()
diff --git a/deployments/block-storage/opteesp/default_block-storage.dts.in b/deployments/block-storage/config/default-opteesp/default_block-storage.dts.in
similarity index 100%
rename from deployments/block-storage/opteesp/default_block-storage.dts.in
rename to deployments/block-storage/config/default-opteesp/default_block-storage.dts.in
diff --git a/deployments/block-storage/opteesp/optee_sp_user_defines.h b/deployments/block-storage/config/default-opteesp/optee_sp_user_defines.h
similarity index 100%
rename from deployments/block-storage/opteesp/optee_sp_user_defines.h
rename to deployments/block-storage/config/default-opteesp/optee_sp_user_defines.h
diff --git a/deployments/block-storage/sp/CMakeLists.txt b/deployments/block-storage/config/default-sp/CMakeLists.txt
similarity index 81%
rename from deployments/block-storage/sp/CMakeLists.txt
rename to deployments/block-storage/config/default-sp/CMakeLists.txt
index ff598a8..626cb0c 100644
--- a/deployments/block-storage/sp/CMakeLists.txt
+++ b/deployments/block-storage/config/default-sp/CMakeLists.txt
@@ -6,9 +6,7 @@
#-------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
-# Set default platform.
-set(TS_PLATFORM "arm/fvp/fvp_base_revc-2xaemv8a" CACHE STRING "Target platform location.")
-include(../../deployment.cmake REQUIRED)
+include(../../../deployment.cmake REQUIRED)
#-------------------------------------------------------------------------------
# The CMakeLists.txt for building the block-storage deployment for generic sp
@@ -31,8 +29,9 @@
set(TRACE_PREFIX "BLOCK" CACHE STRING "Trace prefix")
#-------------------------------------------------------------------------------
-# Components that are specific to deployment in the opteesp environment.
-#
+# Deployment specific components. This deployment uses an infrastructure that
+# that provides ram-backed block stoarged, configured with storage partitions
+# that conform to the 'ref' scheme used for test.
#-------------------------------------------------------------------------------
add_components(TARGET "block-storage"
BASE_DIR ${TS_ROOT}
@@ -40,16 +39,13 @@
environments/sp
)
-include(../block-storage.cmake REQUIRED)
+include(../../env/commonsp/block_storage_sp.cmake REQUIRED)
+include(../../block-storage.cmake REQUIRED)
+include(../../infra/ref-ram.cmake REQUIRED)
#-------------------------------------------------------------------------------
-# Set target platform to provide drivers needed by the deployment
-#
+# Deployment specific build options
#-------------------------------------------------------------------------------
-add_platform(TARGET "block-storage")
-
-#################################################################
-
target_compile_definitions(block-storage PRIVATE
ARM64=1
)
@@ -67,7 +63,9 @@
include(${TS_ROOT}/tools/cmake/common/ExportMemoryRegionsToManifest.cmake REQUIRED)
export_memory_regions_to_manifest(TARGET block-storage NAME "${SP_UUID_CANON}_memory_regions.dtsi" RES EXPORT_MEMORY_REGIONS_DTSI)
-######################################## install
+#-------------------------------------------------------------------------------
+# Deployment specific install options
+#-------------------------------------------------------------------------------
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
endif()
diff --git a/deployments/block-storage/sp/default_block-storage.dts.in b/deployments/block-storage/config/default-sp/default_block-storage.dts.in
similarity index 100%
rename from deployments/block-storage/sp/default_block-storage.dts.in
rename to deployments/block-storage/config/default-sp/default_block-storage.dts.in
diff --git a/deployments/block-storage/common/block_storage_sp.c b/deployments/block-storage/env/commonsp/block_storage_sp.c
similarity index 100%
rename from deployments/block-storage/common/block_storage_sp.c
rename to deployments/block-storage/env/commonsp/block_storage_sp.c
diff --git a/deployments/block-storage/env/commonsp/block_storage_sp.cmake b/deployments/block-storage/env/commonsp/block_storage_sp.cmake
new file mode 100644
index 0000000..0dea2a8
--- /dev/null
+++ b/deployments/block-storage/env/commonsp/block_storage_sp.cmake
@@ -0,0 +1,29 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Includes components needed for deploying the block-storage service provider
+# within a secure partition.
+#-------------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------------
+# Common components for block-storage sp deployments
+#
+#-------------------------------------------------------------------------------
+add_components(TARGET "block-storage"
+ BASE_DIR ${TS_ROOT}
+ COMPONENTS
+ "components/common/fdt"
+ "components/common/trace"
+ "components/common/utils"
+ "components/config/ramstore"
+ "components/config/loader/sp"
+ "components/messaging/ffa/libsp"
+ "components/rpc/common/interface"
+ "components/rpc/ffarpc/endpoint"
+)
+
+target_sources(block-storage PRIVATE
+ ${CMAKE_CURRENT_LIST_DIR}/block_storage_sp.c
+)
diff --git a/deployments/block-storage/common/block_storage_sp.h b/deployments/block-storage/env/commonsp/block_storage_sp.h
similarity index 100%
rename from deployments/block-storage/common/block_storage_sp.h
rename to deployments/block-storage/env/commonsp/block_storage_sp.h
diff --git a/deployments/block-storage/infra/ref-ram.cmake b/deployments/block-storage/infra/ref-ram.cmake
new file mode 100644
index 0000000..2e1ca55
--- /dev/null
+++ b/deployments/block-storage/infra/ref-ram.cmake
@@ -0,0 +1,24 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Lists components that provide an infrastructure layer for the block-storage
+# service provider that uses a ram-backed block store, partitioned by default
+# using the 'ref' configuration. This infrastructure is intended for test
+# purposes.
+#-------------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------------
+# Infrastructure components
+#
+#-------------------------------------------------------------------------------
+add_components(TARGET "block-storage"
+ BASE_DIR ${TS_ROOT}
+ COMPONENTS
+ "components/service/block_storage/block_store/device"
+ "components/service/block_storage/block_store/device/ram"
+ "components/service/block_storage/block_store/partitioned"
+ "components/service/block_storage/config/ref"
+ "components/service/block_storage/factory/ref_ram"
+)
diff --git a/environments/opteesp/component.cmake b/environments/opteesp/component.cmake
index 72eef78..8cd3883 100644
--- a/environments/opteesp/component.cmake
+++ b/environments/opteesp/component.cmake
@@ -36,7 +36,7 @@
SP_HEAP_SIZE=${SP_HEAP_SIZE}
)
-include(../../../external/newlib/newlib.cmake)
+include(${TS_ROOT}/external/newlib/newlib.cmake)
target_link_libraries(${TGT} PRIVATE
stdlib::c
diff --git a/environments/sp/component.cmake b/environments/sp/component.cmake
index 87f813a..56db858 100644
--- a/environments/sp/component.cmake
+++ b/environments/sp/component.cmake
@@ -38,7 +38,7 @@
SP_HEAP_SIZE=${SP_HEAP_SIZE}
)
-include(../../../external/newlib/newlib.cmake)
+include(${TS_ROOT}/external/newlib/newlib.cmake)
target_link_libraries(${TGT} PRIVATE
stdlib::c