This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 8f3cbb59a150fdc3ea3f41423594d3adf3cfc348
Author: raiden00pl <[email protected]>
AuthorDate: Tue Aug 4 18:38:51 2026 +0200

    boards/x86_64/qemu-intel64: generate ROMFS image in CMake kernel builds
    
    The CMake build compiled no ROMFS source, so kernel-mode
    configurations (knsh_romfs) failed to link with undefined references
    to romfs_img. Generate the ROMFS image from the applications in
    <build>/bin with genromfs/xxd and compile it into the board library;
    other configurations keep the empty stub.
    
    Signed-off-by: raiden00pl <[email protected]>
    Assisted-by: Claude Code
---
 boards/x86_64/qemu/qemu-intel64/src/CMakeLists.txt | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/boards/x86_64/qemu/qemu-intel64/src/CMakeLists.txt 
b/boards/x86_64/qemu/qemu-intel64/src/CMakeLists.txt
index 3ab2d5cd52a..16e2d421b3f 100644
--- a/boards/x86_64/qemu/qemu-intel64/src/CMakeLists.txt
+++ b/boards/x86_64/qemu/qemu-intel64/src/CMakeLists.txt
@@ -26,6 +26,30 @@ if(CONFIG_BOARDCTL_RESET)
   list(APPEND SRCS qemu_reset.c)
 endif()
 
+if(CONFIG_BUILD_KERNEL)
+  # Pack the standalone application binaries into the ROMFS image registered by
+  # qemu_boardinit.c. The application targets are not known yet when this
+  # directory is configured, so the dependency is resolved at generation time
+  # from the nuttx target property. The nuttx_add_romfs helper cannot be used
+  # here: its library is added to apps_post, which the application targets
+  # depend on (cycle).
+  add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/romfs_boot.c
+    COMMAND genromfs -f romfs.img -d ${CMAKE_BINARY_DIR}/bin -V NuttXBootVol
+    COMMAND xxd -i romfs.img romfs_boot.c
+    DEPENDS $<TARGET_PROPERTY:nuttx,NUTTX_LOADABLE_APPS>
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+  # the board target is defined in a parent directory: anchor the generated
+  # source with a local target so the build rule is emitted
+  add_custom_target(board_romfs
+                    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/romfs_boot.c)
+  add_dependencies(board board_romfs)
+  list(APPEND SRCS ${CMAKE_CURRENT_BINARY_DIR}/romfs_boot.c)
+elseif(CONFIG_BOARD_LATE_INITIALIZE)
+  # empty ROMFS placeholder, see Makefile
+  list(APPEND SRCS romfs_stub.c)
+endif()
+
 target_sources(board PRIVATE ${SRCS})
 
 set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/qemu.ld")

Reply via email to