[u-boot-mgr]: Initial u-boot mgr hardening intf
Initial u-boot mgr to harden interface and usage. This
exposes method in D-Bus which other daemon can use to update
U-Boot environment variables, instead of directly using
fw_printenv or fw_setenv tools.
Tested:
Verified able to query the ReadAll, Read and Write
method exposed in this interface.
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
Change-Id: I21772c8f30b7c68f5c9a2da3d44217ea2f533014
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..5e29b6f
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,51 @@
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
+project(phosphor-u-boot-env-mgr CXX)
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti")
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
+find_package(Boost REQUIRED)
+include_directories(${Boost_INCLUDE_DIRS})
+add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
+add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
+add_definitions(-DBOOST_ALL_NO_LIB)
+add_definitions(-DBOOST_NO_RTTI)
+add_definitions(-DBOOST_NO_TYPEID)
+add_definitions(-DBOOST_ASIO_DISABLE_THREADS)
+
+set(SRC_FILES src/mainapp.cpp src/u-boot-env-mgr.cpp)
+
+# import sdbusplus
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED)
+include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS})
+link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS})
+find_program(SDBUSPLUSPLUS sdbus++)
+
+# phosphor-dbus-interfaces
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(DBUSINTERFACE phosphor-dbus-interfaces REQUIRED)
+include_directories(${DBUSINTERFACE_INCLUDE_DIRS})
+link_directories(${DBUSINTERFACE_LIBRARY_DIRS})
+
+# import phosphor-logging
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(LOGGING phosphor-logging REQUIRED)
+include_directories(${LOGGING_INCLUDE_DIRS})
+link_directories(${LOGGING_LIBRARY_DIRS})
+
+add_executable(${PROJECT_NAME} ${SRC_FILES})
+target_link_libraries(${PROJECT_NAME} ${SDBUSPLUSPLUS_LIBRARIES})
+target_link_libraries(${PROJECT_NAME} ${DBUSINTERFACE_LIBRARIES})
+target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
+target_link_libraries(${PROJECT_NAME} phosphor_logging)
+
+set(SERVICE_FILES
+ ${PROJECT_SOURCE_DIR}/xyz.openbmc_project.U_Boot.Environment.Manager.service
+ )
+
+install(TARGETS ${PROJECT_NAME} DESTINATION bin)
+install(FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/)
+