toybox: new feature, boards configuration, documentation, other updates. - #19818
Open
acassis wants to merge 7 commits into
Open
toybox: new feature, boards configuration, documentation, other updates.#19818acassis wants to merge 7 commits into
acassis wants to merge 7 commits into
Conversation
|
padlen = sizeof(void *) - (addr % sizeof(void *)) never returns 0, even when addr is already pointer-aligned -- it returns a full alignment unit instead. Since callers size buflen for zero padding, the subsequent "buflen < padlen + reqdlen" check then always fails, so getgrgid()/ getgrnam() and their _r variants always return ERANGE. Found via `id` on sim:toybox, which resolves gid 0 to "root" through this path. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
wait4() is BSD/Linux-standard (used by toybox's "time" applet) but NuttX only had waitpid()+getrusage() separately. Add it to libs/libc/unistd/ built on top of those two existing primitives, so it needs no syscall plumbing of its own and works unmodified across flat/protected/kernel build separation. Prototype added to include/sys/wait.h. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
inode_nextname() already skipped a '.' segment mid-path (e.g. "./foo"), but only checked for a '/' right after it -- a path ending in a bare '.' (e.g. "/foo/.", or "." itself once AT_FDCWD resolution prepends $PWD) fell through and was looked up as a literal child named ".", which no real node is ever named, failing with ENOENT. This broke every "operate on the current directory" idiom relative paths rely on: bare `ls`, `stat .`, `cd .`, etc., all failed outright even though the equivalent absolute path worked fine. Found while testing the Toybox port's interactive REPL, but this is generic VFS path resolution, not Toybox-specific. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
CONFIG_SYSTEM_TOYBOX=y with CONFIG_INIT_ENTRYPOINT="toybox_main": Toybox as the system's shell instead of NSH. No NSH config is present -- Toybox has no dependency on it in either direction (see apps/system/toybox/Kconfig's SYSTEM_TOYBOX_BUILTIN_BRIDGE). Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
Same shape as boards/sim/sim/sim/configs/toybox: CONFIG_SYSTEM_TOYBOX=y with CONFIG_INIT_ENTRYPOINT="toybox_main", built on top of the existing stm32f4discovery:nsh defconfig's board/console setup. Needs several options nsh's defconfig doesn't, since Toybox's library code references more of NuttX's libc unconditionally than NSH does: CONFIG_ALLOW_MIT_COMPONENTS (gates CONFIG_LIBC_REGEX -- grep/sed/etc), CONFIG_ARCH_SETJMP_H (sigjmp_buf; the REPL's rebound trap uses sigsetjmp/siglongjmp), CONFIG_LIBC_EXECFUNCS, CONFIG_LIBC_LOCALE, CONFIG_LIBC_LOCALTIME, CONFIG_PIPES, CONFIG_PSEUDOFS_SOFTLINKS, CONFIG_FS_NOTIFY (tail -f), CONFIG_SCHED_HAVE_PARENT (waitpid()). Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
Basic usage/configuration reference for the toybox application, plus known limitations: ps lists no processes (it expects Linux's /proc/<pid>/stat, which NuttX's procfs doesn't provide), and grep -r is unreliable against procfs. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
tzset() is unconditionally defined in libs/libc/time/lib_localtime.c, but its prototype in <time.h> is gated behind CONFIG_LIBC_LOCALTIME -- without it, Toybox's own tzset() calls (lib/xwrap.c, toys/posix/date.c) compile as implicit declarations instead. The stm32f4discovery:toybox defconfig already carries this option (see its own commit message); sim:toybox's was simply missing it. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
|
msys2 build failed :-( |
Contributor
Author
It is the internal CI issue to download some artifacts |
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s): CI run: https://github.com/apache/nuttx/actions/runs/31637144938 |
Contributor
|
will restarting ci help in this case @acassis ? :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Toybox is the tool box used on Android by default. Adding it to NuttX allows to have more advanced features from Linux, even better support for shell scripts.
Depends-on: apache/nuttx-apps#3722
Impact
User could use a shell more similar to Linux and even use real shell scripts from Linux
Testing