JianyuWang0623 opened a new pull request, #19984:
URL: https://github.com/apache/nuttx/pull/19984
## Summary
Switch every defconfig whose init entry point was `nsh_main` on the three
locally verifiable boards — **sim (83), qemu-armv8a (20), qemu-armv7a (6)**,
109 defconfigs total — to nxinit (`init_main`), matching the esp32p4/esp32s3
boards' existing nxinit configs. With nxinit, `nsh` no longer *is* init; it
runs as a `console sh` service started by `init.rc`.
Split into three commits, one per board:
- `boards/sim: switch all nsh defconfigs to nxinit entrypoint`
- `boards/arm64/qemu-armv8a: switch all nsh defconfigs to nxinit entrypoint`
- `boards/arm/qemu-armv7a: switch all nsh defconfigs to nxinit entrypoint`
Per defconfig (regenerated with `make savedefconfig`):
- `CONFIG_INIT_ENTRYPOINT="init_main"`
- `CONFIG_INIT_STACKSIZE=8192` (nxinit init task running console-sh)
- `CONFIG_SYSTEM_NXINIT=y` plus its Kconfig deps: `CONFIG_EXPERIMENTAL`,
`CONFIG_LIBC_EXECFUNCS`, `CONFIG_SCHED_CHILD_STATUS`
(which depends on `CONFIG_SCHED_HAVE_PARENT`)
- `CONFIG_SYSTEM_NSH_STACKSIZE=8192` (nsh is now a spawned service and needs
its own stack instead of borrowing the init stack)
- `CONFIG_ETC_ROMFS=y` / `CONFIG_FS_ROMFS=y` to ship `init.rc` via ROMFS
Each board gains an `src/etc/init.d/init.rc` (registers a `console sh`
service guarded by `CONFIG_SYSTEM_NSH`; `on init` starts it), shipped through
ROMFS in both the Make build (`RCSRCS`) and CMake (`nuttx_add_romfs()`), both
gated on `CONFIG_ETC_ROMFS && CONFIG_SYSTEM_NXINIT` so non-nxinit configs are
unaffected. Omitting this ROMFS plumbing causes a link-time
`undefined reference to romfs_img`.
Five sim configs (`dynconns`, `module`, `module32`, `sotest`, `sotest32`)
had `CONFIG_BINFMT_DISABLE=y`, which blocks `CONFIG_LIBC_EXECFUNCS` and thus
`CONFIG_SYSTEM_NXINIT`. Since nxinit spawns services via `exec()`, binfmt is
re-enabled in those five; they still build cleanly.
## Impact
- Only affects the `sim`, `qemu-armv7a`, and `qemu-armv8a` boards' defconfigs
plus each board's `src/{Makefile,CMakeLists.txt}` and new `init.rc`. No
common code, no other boards, no NSH behavior change: `nsh` still owns the
interactive console, now as an nxinit service rather than as init itself.
- The new ROMFS wiring is conditional on `CONFIG_ETC_ROMFS &&
CONFIG_SYSTEM_NXINIT`;
existing non-nxinit builds of these boards are byte-for-byte unchanged.
- `CONFIG_SYSTEM_NXINIT` currently `depends on EXPERIMENTAL`.
## Testing
Verified against `apache/master` (before = `nsh_main`) vs this branch
(after = `init_main`), building each config and, where a config reaches an
interactive `nsh>` prompt, capturing `ps`. Toolchains: host gcc (sim),
`aarch64-none-elf` + `qemu-system-aarch64` (armv8a), `arm-none-eabi` +
`qemu-system-arm` (armv7a); SMP configs booted with `-smp 4`.
Runtime `ps` (before/after) — init task changes from `nsh_main` to
`init_main`, and `nsh` (`sh`) is spawned as its child service:
```
sim:nsh (host)
BEFORE nsh> ps
4 4 0 100 FIFO Task Running ... nsh_main
AFTER nsh> ps
4 4 0 100 FIFO Task Waiting Semaphore ... init_main
5 5 4 100 FIFO Task Running ... sh
qemu-armv8a:nsh (qemu-system-aarch64)
BEFORE 3 3 0 100 RR Task Running ... nsh_main
AFTER 3 3 0 100 RR Task Waiting Semaphore ... init_main
4 4 3 100 RR Task Running ... sh
qemu-armv8a:nsh_smp (-smp 4)
AFTER 4 4 0 -- 100 RR Task Waiting Semaphore ... init_main
5 5 4 0 100 RR Task Running ... sh
qemu-armv7a:nsh (qemu-system-arm)
BEFORE 3 3 0 100 RR Task Running ... nsh_main
AFTER 3 3 0 100 RR Task Waiting Semaphore ... init_main
4 4 3 100 RR Task Running ... sh
qemu-armv7a:smp (-smp 4)
AFTER 6 6 0 -- 100 RR Task Waiting Semaphore ... init_main
7 7 6 1 100 RR Task Running ... sh
```
`ps` before/after confirmed for the 55 configs that reach an interactive nsh
prompt (sim: 41, qemu: 14). Configs that don't drop to an nsh prompt
(app-entrypoint like nx/foc/can, remoteproc rpproxy/rpserver pairs, graphics,
gdbstub waiting for a debugger) were build-verified instead; those are not
`ps`-observable by design.
Build note: 18 configs (sim: adb, alsa, bastest, duktape, login, lua, minmea,
mnemofs, nand, nimble, posix_spawn, romfs, rust, smartfs, windows;
qemu-armv8a: nsh_fiq, nsh_gicv2; qemu-armv7a: full) fail to build in my local
environment due to **missing external dependencies** (clang, lua headers,
third-party libs). These fail identically on unmodified `apache/master`, i.e.
they are pre-existing environment limitations unrelated to this change and
build fine in upstream CI.
--
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]