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 b5dccf4fe3c19c03b3e7a362f790e15696468c09
Author: raiden00pl <[email protected]>
AuthorDate: Tue Aug 4 18:38:51 2026 +0200

    cmake: fix installed application binaries to match Application.mk
    
    Match the Application.mk install rule: keep the application attribute
    symbols (nx_stacksize etc.) through strip as NX_KEEP does, and mark
    the installed binaries executable, since ld -r output is not and
    filesystem images built from bin/ refuse to exec.
    
    Signed-off-by: raiden00pl <[email protected]>
    Assisted-by: Claude Code
---
 cmake/nuttx_add_application.cmake | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/cmake/nuttx_add_application.cmake 
b/cmake/nuttx_add_application.cmake
index 78c27c6e2a8..12fc54de8d7 100644
--- a/cmake/nuttx_add_application.cmake
+++ b/cmake/nuttx_add_application.cmake
@@ -199,7 +199,15 @@ function(nuttx_add_application)
           COMMAND
             ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin_debug/${ELF_NAME}
             ${CMAKE_BINARY_DIR}/bin/${ELF_NAME}
-          COMMAND ${CMAKE_STRIP} ${CMAKE_BINARY_DIR}/bin/${ELF_NAME}
+            # keep the application attribute symbols through strip so the 
binary
+            # loader can still read them, see NX_KEEP in Application.mk
+          COMMAND
+            ${CMAKE_STRIP} -K nx_stacksize -K nx_priority -K nx_uid -K nx_gid 
-K
+            nx_mode ${CMAKE_BINARY_DIR}/bin/${ELF_NAME}
+            # match the Application.mk install rule: ld -r output is not marked
+            # executable, but filesystem images built from bin/ must carry the
+            # execute permission
+          COMMAND chmod +x ${CMAKE_BINARY_DIR}/bin/${ELF_NAME}
           COMMENT "Building ELF:${ELF_NAME}"
           COMMAND_EXPAND_LISTS)
       else()

Reply via email to