Improve:Ipc config build.

This commit is contained in:
Fancy code 2024-05-24 13:54:35 +08:00
parent 023bf9bbea
commit 4834d682d4
5 changed files with 11 additions and 3 deletions

View File

@ -38,6 +38,7 @@ set(CURL_OPENSSL_LIB_SHARED_ENABLE "false")
# ------------ build IpcConfig ------------ #
set(IPC_CONFIG_FILE_PATH "./ipc_config")
set(USERDATA_MOUNT_PATH "/userdata")
# ------------ build IpcConfig end ------------ #
# ------------ build log ------------ #

View File

@ -2,5 +2,11 @@
if (DEFINED IPC_CONFIG_FILE_PATH)
add_definitions(-DIPC_CONFIG_FILE_PATH=\"${IPC_CONFIG_FILE_PATH}\")
else()
message(FATAL_ERROR "You set define IPC_CONFIG_FILE_PATH in toolchan .cmake file to tell code where to save config file.")
message(FATAL_ERROR "You should set define IPC_CONFIG_FILE_PATH in toolchan.cmake file to tell code where to save config file.")
endif()
if (DEFINED USERDATA_MOUNT_PATH)
add_definitions(-DUSERDATA_MOUNT_PATH=\"${USERDATA_MOUNT_PATH}\")
else()
message(FATAL_ERROR "You should set define USERDATA_MOUNT_PATH in toolchan.cmake.")
endif()

View File

@ -895,7 +895,7 @@ bool IpcConfigImpl::CheckConfigPathMounted(void)
while (fgets(line, sizeof(line), fp) != nullptr) {
if (sscanf(line, "%*s %1023s %*s %*s %*d %*d\n", mount_point) == 1) {
// LogInfo("mount_point: %s\n", mount_point);
if (strcmp("/userdata", mount_point) == 0) {
if (strcmp(USERDATA_MOUNT_PATH, mount_point) == 0) {
fclose(fp);
return true; // mounted
}

View File

@ -1,4 +1,5 @@
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
include(${MIDDLEWARE_SOURCE_PATH}/IpcConfig/build/ipc_config.cmake)
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})

View File

@ -50,7 +50,7 @@ void IpcConfigTestTool::MockMountedFile(void)
fprintf(file, "tmpfs /tmp tmpfs rw,relatime,size=14464k,nr_inodes=3616 0 0\n");
fprintf(file, "tmpfs /run tmpfs rw,nosuid,nodev,relatime,size=14464k,nr_inodes=3616,mode=755 0 0\n");
fprintf(file, "sysfs /sys sysfs rw,relatime 0 0\n");
fprintf(file, "/dev/block/by-name/userdata /userdata jffs2 rw,relatime 0 0\n");
fprintf(file, "/dev/block/by-name" USERDATA_MOUNT_PATH " " USERDATA_MOUNT_PATH " jffs2 rw,relatime 0 0\n");
fprintf(
file,
"/dev/mmcblk1p1 /mnt/sdcard vfat "