JianyuWang0623 opened a new pull request, #19954:
URL: https://github.com/apache/nuttx/pull/19954
## Summary
The `lckfb-szpi-esp32s3` board's defconfigs already run `nxinit`
(`init_main`)
as system init instead of `nsh_main` (see 73ad366f45c). This extends the same
switch to the remaining 12 boards under `boards/xtensa/esp32s3` that still
used `nsh_main` (esp32s3-8048S043, esp32s3-box, esp32s3-devkit, esp32s3-eye,
esp32s3-korvo-2, esp32s3-lcd-ev, esp32s3-lhcbit, esp32s3-m5-cardputer,
esp32s3-meadow, esp32s3-touch-lcd7, esp32s3-ws-lcd128, esp32s3-xiao), for
consistency across all esp32s3 boards. 105 defconfigs changed, one commit per
board.
For each defconfig:
- `CONFIG_INIT_ENTRYPOINT` switched from `"nsh_main"` to `"init_main"`
- `CONFIG_INIT_STACKSIZE` raised to 8192. The default init stack overflows at
runtime once `init_main` takes over as system init, clobbering the global
inode/mount tree so the procfs mount disappears; `ls /` then crashes in
`read_pseudodir` and `ps` reports `/proc not mounted` (this was diagnosed
on lckfb-szpi-esp32s3 hardware, see 95a292de9ab).
- `CONFIG_SYSTEM_NXINIT=y` added, plus its direct Kconfig dependencies
(`CONFIG_EXPERIMENTAL`, `CONFIG_LIBC_EXECFUNCS`,
`CONFIG_SCHED_CHILD_STATUS`
which in turn selects `CONFIG_SCHED_HAVE_PARENT`)
- `CONFIG_SYSTEM_NSH_STACKSIZE=8192` added: the nsh console service launched
by init.rc also needs a larger stack, otherwise it crashes in `getumask`
while running `ps` because its stack is too small to reach the procfs read
path.
- `CONFIG_ETC_ROMFS`/`CONFIG_FS_ROMFS` added where missing, needed to ship
`init.rc` via the board's ROMFS
`nsh` keeps running, just as a console service started by init.rc
(`boards/xtensa/esp32s3/common/src/etc/init.d/init.rc`) instead of the
top-level init.
## Impact
Affects only defconfigs under `boards/xtensa/esp32s3` (12 boards, 105
defconfigs). No change to shared arch/board source, no ABI/API changes.
Slightly higher init/nsh stack usage (8192 bytes each) on these boards only.
## Testing
Build Host: Linux x86_64, xtensa-esp32s3-elf-gcc 12.2.0 (ESP-IDF toolchain)
Target: esp32s3 (12 boards, 105 defconfigs)
102 of 105 changed defconfigs build cleanly with `make`. 3 pre-existing
failures confirmed unrelated to this change (reproduced identically on
unmodified code before this patch):
- `esp32s3-devkit:qemu_openeth` — link step fails with `MERGEBIN error:
Missing argument for binary files directory` (missing `ESPTOOL_BINDIR`),
a local build-invocation issue.
- `esp32s3-devkit:stack` — linker segfaults (`make[1]: *** [Makefile:183:
nuttx] Segmentation fault`), a local toolchain issue on this host.
- `esp32s3-devkit:ulp` — `context` step fails (`check_rv_toolchain`) due to
a missing local RISC-V ULP cross-toolchain.
`tools/checkpatch.sh -g apache/master..HEAD` passes on the full diff.
No hardware was attached for any of these 12 boards in this session. Runtime
behavior of the nxinit/init.rc mechanism was instead verified on
lckfb-szpi-esp32s3 hardware (which already uses the identical mechanism),
since init_main taking over as system init and starting nsh as a console
service is a chip/OS-level behavior, not board-specific. On that hardware,
the `nsh` defconfig was temporarily reverted to `nsh_main` to capture a
"before" baseline, then restored to `init_main` for "after", each flashed and
probed over UART:
### Before (nsh_main as top-level init)
```
nsh> ps
TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK
STACK COMMAND
0 0 0 0 FIFO Kthread - Ready
0000000000000000 0003040 Idle_Task
2 2 0 100 RR Task - Running
0000000000000000 0003000 nsh_main
```
### After (init_main as top-level init, nsh as a console service it spawns)
```
nsh> ps
TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK
STACK COMMAND
0 0 0 0 FIFO Kthread - Ready
0000000000000000 0003040 Idle_Task
2 2 0 100 RR Task - Waiting Semaphore
0000000000000000 0008120 init_main
3 3 2 100 RR Task - Running
0000000000000000 0008144 sh
```
`init_main` (PID 2) is the parent of the nsh console service `sh` (PID 3),
confirming nxinit is in control of the boot sequence. Additional checks after
the switch:
```
nsh> ls /
/:
dev/
etc/
proc/
nsh> uname -a
NuttX 13.0.1-RC0 73ad366f45c-dirty Aug 24 2026 23:24:09 xtensa
lckfb-szpi-esp32s3
nsh> free
total used free maxused maxfree nused nfree name
389240 21960 367280 22328 367200 60 2 Umem
```
`/proc` stays mounted (`ls /` succeeds, no crash in `read_pseudodir`), and
`free`/`uname` respond normally, confirming the procfs/stack overflow issue
that motivated raising `CONFIG_INIT_STACKSIZE` does not recur with the new
value.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]