diff --git a/tools/cmake/storages.cmake b/tools/cmake/storages.cmake index 0b0b6310..e0fcaf60 100644 --- a/tools/cmake/storages.cmake +++ b/tools/cmake/storages.cmake @@ -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() @@ -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() @@ -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() diff --git a/tools/resources/src/tbe.sh b/tools/resources/src/tbe.sh index de671da1..24adafac 100755 --- a/tools/resources/src/tbe.sh +++ b/tools/resources/src/tbe.sh @@ -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[@]} \