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 69b362c3ab1840cdb01f1a207d70a829ea82dd45
Author: hujun5 <[email protected]>
AuthorDate: Thu May 7 16:56:55 2026 +0800

    boards/arm64/imx9: add rcS auto-mount for /data
    
    Enable the ETC_ROMFS / NSH rcS mechanism on the imx95-a55-evk nsh_smp
    config and ship a minimal rcS that mounts the user-data FAT partition
    on /data at boot, so users no longer need to type
    'mount -t fatfs /dev/mmcsd0p2 /data' manually after every reset.
    
    Changes:
    
      * defconfig: add CONFIG_ETC_ROMFS=y. This is the single master switch
        that gates both build-side and run-side behaviour:
          - build side: vela's CMake nuttx_add_romfs.cmake::process_all_
            directory_romfs() returns early when CONFIG_ETC_ROMFS is unset,
            i.e. any add_board_rcsrcs() registrations are silently dropped
          - run side: nuttx/sched/init/nx_bringup.c::nx_romfsetc() is guarded
            by the same CONFIG; without it, even a baked-in romfs_etc.c is
            never mounted on /etc, and nsh_sysinitscript/nsh_initscript
            would have nothing to open
        Implicit Kconfig deps (FS_ROMFS=y, !DISABLE_MOUNTPOINT,
        !NSH_DISABLESCRIPT) were already satisfied by this defconfig.
    
      * src/CMakeLists.txt: register src/etc/init.d/{rcS,rc.sysinit} via
        add_board_rcsrcs() under if(CONFIG_ETC_ROMFS), matching the vela
        CMake build convention (board's rcS files live in the source tree
        as real scripts and are packed into romfs_etc.c at configure time
        via genromfs + xxd, rather than being pre-generated byte arrays
        like the upstream Make build expects).
    
      * src/etc/init.d/rc.sysinit: empty sysinit hook (placeholder).
    
      * src/etc/init.d/rcS: single mount line guarded by CONFIG_MMCSD
        (the rcS is C-preprocessed before being packed, so #ifdef works).
    
    Signed-off-by: hujun5 <[email protected]>
---
 .../imx9/imx95-a55-evk/configs/nsh_smp/defconfig   |  2 ++
 boards/arm64/imx9/imx95-a55-evk/src/CMakeLists.txt |  5 ++++
 boards/arm64/imx9/imx95-a55-evk/src/Makefile       |  4 ++++
 .../imx9/imx95-a55-evk/src/etc/init.d/rc.sysinit   | 23 ++++++++++++++++++
 boards/arm64/imx9/imx95-a55-evk/src/etc/init.d/rcS | 27 ++++++++++++++++++++++
 5 files changed, 61 insertions(+)

diff --git a/boards/arm64/imx9/imx95-a55-evk/configs/nsh_smp/defconfig 
b/boards/arm64/imx9/imx95-a55-evk/configs/nsh_smp/defconfig
index c5c4a3b5d12..eb8fecdfa6e 100644
--- a/boards/arm64/imx9/imx95-a55-evk/configs/nsh_smp/defconfig
+++ b/boards/arm64/imx9/imx95-a55-evk/configs/nsh_smp/defconfig
@@ -29,9 +29,11 @@ CONFIG_DEBUG_FEATURES=y
 CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DEFAULT_TASK_STACKSIZE=8192
+CONFIG_ETC_ROMFS=y
 CONFIG_EXAMPLES_HELLO=y
 CONFIG_EXPERIMENTAL=y
 CONFIG_FRAME_POINTER=y
+CONFIG_FS_FAT=y
 CONFIG_FS_LARGEFILE=y
 CONFIG_FS_PROCFS=y
 CONFIG_FS_ROMFS=y
diff --git a/boards/arm64/imx9/imx95-a55-evk/src/CMakeLists.txt 
b/boards/arm64/imx9/imx95-a55-evk/src/CMakeLists.txt
index 5c6fb4f6077..2d2fcfdc43c 100644
--- a/boards/arm64/imx9/imx95-a55-evk/src/CMakeLists.txt
+++ b/boards/arm64/imx9/imx95-a55-evk/src/CMakeLists.txt
@@ -34,4 +34,9 @@ if(CONFIG_IMX9_USBHOST)
   list(APPEND SRCS imx9_usbhost.c)
 endif()
 
+if(CONFIG_ETC_ROMFS)
+  add_board_rcsrcs(${CMAKE_CURRENT_SOURCE_DIR}/etc/init.d/rcS
+                   ${CMAKE_CURRENT_SOURCE_DIR}/etc/init.d/rc.sysinit)
+endif()
+
 target_sources(board PRIVATE ${SRCS})
diff --git a/boards/arm64/imx9/imx95-a55-evk/src/Makefile 
b/boards/arm64/imx9/imx95-a55-evk/src/Makefile
index 7542a781735..56d09f6fa8a 100644
--- a/boards/arm64/imx9/imx95-a55-evk/src/Makefile
+++ b/boards/arm64/imx9/imx95-a55-evk/src/Makefile
@@ -24,6 +24,10 @@ include $(TOPDIR)/Make.defs
 
 CSRCS = imx9_boardinit.c imx9_bringup.c
 
+ifeq ($(CONFIG_ETC_ROMFS),y)
+RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS
+endif
+
 ifeq ($(CONFIG_BOARDCTL_RESET),y)
 CSRCS += imx9_reset.c
 endif
diff --git a/boards/arm64/imx9/imx95-a55-evk/src/etc/init.d/rc.sysinit 
b/boards/arm64/imx9/imx95-a55-evk/src/etc/init.d/rc.sysinit
new file mode 100644
index 00000000000..bced6a56c12
--- /dev/null
+++ b/boards/arm64/imx9/imx95-a55-evk/src/etc/init.d/rc.sysinit
@@ -0,0 +1,23 @@
+/****************************************************************************
+ * boards/arm64/imx9/imx95-a55-evk/src/etc/init.d/rc.sysinit
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#include <nuttx/config.h>
diff --git a/boards/arm64/imx9/imx95-a55-evk/src/etc/init.d/rcS 
b/boards/arm64/imx9/imx95-a55-evk/src/etc/init.d/rcS
new file mode 100644
index 00000000000..1268f295fbc
--- /dev/null
+++ b/boards/arm64/imx9/imx95-a55-evk/src/etc/init.d/rcS
@@ -0,0 +1,27 @@
+/****************************************************************************
+ * boards/arm64/imx9/imx95-a55-evk/src/etc/init.d/rcS
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifdef CONFIG_MMCSD
+mount -t fatfs /dev/mmcsd0p2 /data
+#endif

Reply via email to