Skip to content

Commit

Permalink
fix uncompressed web files in image
Browse files Browse the repository at this point in the history
  • Loading branch information
mjleehh committed Dec 16, 2024
1 parent 03b21ae commit 58697c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 16 additions & 5 deletions tools/cmake/storages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function(tbd_file_system_file_list)
"${web_app_dir}/*.ico"
)
foreach(file_path IN LISTS web_app_files)
list(APPEND file_mapping "www/${file_path}" "www/${file_path}")
list(APPEND file_mapping "www/${file_path}" "www/${file_path}" yes)
endforeach()
endif()

Expand All @@ -26,8 +26,8 @@ function(tbd_file_system_file_list)
"${plugin_dir}/*.jsn"
)
foreach(file_path IN LISTS plugin_files)
list(APPEND file_mapping "data/${file_path}" "data/${file_path}")
list(APPEND file_mapping "data/${file_path}" "dbup/${file_path}")
list(APPEND file_mapping "data/${file_path}" "data/${file_path}" no)
list(APPEND file_mapping "data/${file_path}" "dbup/${file_path}" no)
endforeach()
endif()

Expand All @@ -43,10 +43,21 @@ function(tbd_file_system_create_image)
tbd_file_system_file_list(${ARGN} VAR file_mapping)

while(file_mapping)
list(POP_FRONT file_mapping src dest)
list(POP_FRONT file_mapping src dest compressed)
set(src "${TBD_FILE_SYSTEM_RESOURCES}/${src}")
set(dest "${CMAKE_BINARY_DIR}/spiffs_image/${dest}")
configure_file("${src}" "${dest}" COPYONLY)

cmake_path(GET dest PARENT_PATH directory)
file(MAKE_DIRECTORY "${directory}")

if(compressed)
execute_process(COMMAND bash -c "gzip -9 -c '${src}' > '${dest}'.gz" ERROR_VARIABLE err)
if(err GREATER 0)
tbd_loge("failed to compress file ${src}")
endif()
else()
configure_file("${src}" "${dest}" COPYONLY)
endif()
endwhile()
littlefs_create_partition_image(storage ${CMAKE_BINARY_DIR}/spiffs_image FLASH_IN_PROJECT)
endfunction()
Expand Down
2 changes: 1 addition & 1 deletion tools/resources/src/tbe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ run_emulator() {
-drive file="${bin_dir}/qemu_efuse.bin,if=none,format=raw,id=efuse" \
-global driver=nvram.esp32s3.efuse,property=drive,value=efuse \
-global driver=timer.esp32c3.timg,property=wdt_disable,value=true \
-nic user,model=open_eth \
-nic user,model=open_eth,id=lo0,hostfwd=tcp:127.0.0.1:2024-:80 \
-nographic \
-serial mon:stdio \
${qemu_extra_args[@]} \
Expand Down

0 comments on commit 58697c4

Please sign in to comment.