Skip to content
Snippets Groups Projects
Commit 5036a09e authored by David Sidrane's avatar David Sidrane
Browse files

Add support from cromfs generation

parent f2208171
No related branches found
No related tags found
No related merge requests found
......@@ -189,17 +189,53 @@ add_custom_command(OUTPUT romfs.img romfs.txt
COMMENT "ROMFS: generating image"
)
# create nsh_romfsimg.c
find_program(XXD xxd)
if(NOT XXD)
message(FATAL_ERROR "xxd not found")
if(CONFIG_FS_CROMFS)
#TODO:build gencromfs tool from nuttx and path to it.
find_program(GENCROMFS gencromfs)
if(NOT GENCROMFS)
message(FATAL_ERROR "gencromfs not found")
endif()
# create nsh_romfsimg.c
add_custom_command(OUTPUT nsh_romfsimg.c
COMMAND ${CMAKE_COMMAND} -E remove -f nsh_romfsimg.c
COMMAND ${GENCROMFS} ${romfs_gen_root_dir} nsh_romfsimg.c
DEPENDS
${romfs_gen_root_dir}/init.d/rcS
${romfs_gen_root_dir}/init.d/rc.autostart
romfs_extras.stamp
romfs_pruned.stamp
COMMENT "ROMFS: generating image"
)
else()
find_program(GENROMFS genromfs)
if(NOT GENROMFS)
message(FATAL_ERROR "genromfs not found")
endif()
# create romfs.img
add_custom_command(OUTPUT romfs.img romfs.txt
COMMAND ${CMAKE_COMMAND} -E remove -f romfs.img romfs.txt
COMMAND ${GENROMFS} -f romfs.img -d ${romfs_gen_root_dir} -V "NSHInitVol" -v > romfs.txt 2>&1
DEPENDS
${romfs_gen_root_dir}/init.d/rcS
${romfs_gen_root_dir}/init.d/rc.autostart
romfs_extras.stamp
COMMENT "ROMFS: generating image"
)
# create nsh_romfsimg.c
find_program(XXD xxd)
if(NOT XXD)
message(FATAL_ERROR "xxd not found")
endif()
add_custom_command(OUTPUT nsh_romfsimg.c
COMMAND ${CMAKE_COMMAND} -E remove -f nsh_romfsimg.c
COMMAND ${XXD} -i romfs.img nsh_romfsimg.c
COMMAND sed 's/unsigned/const unsigned/g' nsh_romfsimg.c > nsh_romfsimg.c.tmp && ${CMAKE_COMMAND} -E rename nsh_romfsimg.c.tmp nsh_romfsimg.c
DEPENDS romfs.img
)
endif()
add_custom_command(OUTPUT nsh_romfsimg.c
COMMAND ${CMAKE_COMMAND} -E remove -f nsh_romfsimg.c
COMMAND ${XXD} -i romfs.img nsh_romfsimg.c
COMMAND sed 's/unsigned/const unsigned/g' nsh_romfsimg.c > nsh_romfsimg.c.tmp && ${CMAKE_COMMAND} -E rename nsh_romfsimg.c.tmp nsh_romfsimg.c
DEPENDS romfs.img
)
add_library(romfs STATIC nsh_romfsimg.c)
add_dependencies(romfs prebuild_targets)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment