Progress: runable in real machines#13
Merged
Merged
Conversation
Mount imx-forge as projects/imx-forge-demo (non-recursive) as a reference integration scenario: validating CFBox as a BusyBox replacement in an i.MX6ULL (armhf) rootfs. CFBox's own CMake/CI does not depend on projects/; it stays a standalone demo.
askfirst gates exec behind a console keypress so boot logs are not drowned by an immediate login prompt. Strip the leading '-' from the inittab process (e.g. -/bin/sh), print a prompt, and wait for Enter; on EOF exit quietly so init respawns. Track askfirst entries like respawn so they re-prompt after the child exits. Covers the imx-forge rootfs inittab line console::askfirst:-/bin/sh.
Add the mount applet the imx-forge rootfs rcS script relies on: mount -a reads /etc/fstab, mount -t devpts devpts /dev/pts mounts a single fs. Comma-separated -o options map to VFS flags (ro/rw/nosuid/...) with leftovers passed as fs-specific data; fstab parsing is split into pure helpers exercised by tests. Also fix a latent build bug: a stale generated include/cfbox/applet_config.hpp (90c55a0) shadowed the cmake-generated copy, so editing applet_config.hpp.in never took effect and newly registered applets silently failed (cfbox reported unknown applet, tests were #if'd out). Delete the stale copy and gitignore it so the .in template is the single source.
Add the mdev applet the imx-forge rcS script runs after mounting devtmpfs: mdev -s walks /sys/class/* and /sys/block (plus partitions), reads each device's major:minor, and creates the matching /dev node with mknod. Hotplug mode (kernel-invoked uevent via environment) is intentionally not implemented since imx-forge only uses the coldplug scan.
Complete the shutdown/control path the imx-forge inittab needs: umount -a -r unmounts in reverse order with a read-only fallback, swapoff -a backs the shutdown entry, and reboot/poweroff drive ctrlaltdel and explicit restart via the reboot(2) syscall (sync first to never reboot with dirty filesystems). poweroff shares reboot.cpp. With mount/mdev/init-askfirst, cfbox can now drive the full imx-forge rootfs boot and shutdown cycle as PID 1.
End-to-end run on i.MX6ULL exposed three gaps invisible to local tests: sh ran its REPL with std::getline and no termios, so the serial console echoed raw backspace/arrow bytes (force the controlling tty into canonical mode via an RAII guard so the kernel handles line editing); cfbox init execs sh with only HOME/TERM, leaving PATH empty so which/PATH lookups failed (fall back to /bin:/sbin:/usr/bin:/usr/sbin and export it); ls -l printed blank owner/group placeholders (resolve via getpwuid/getgrgid, fall back to numeric id when NSS cannot, e.g. static link on a minimal rootfs).
The cooked-tty fix let the kernel handle line editing, but the i.MX6ULL serial console sends Ctrl-H (0x08) for backspace while the default VERASE is DEL (0x7f), so backspace was still echoed literally. Set VERASE to Ctrl-H to match.
- hero + 实测 section: cfbox as PID 1 on i.MX6ULL (askfirst/mount/mdev), with enter_shell/cat_cpuinfo screenshots and a demo GIF - badges: tests 379->399, applets 115->123, add armhf - size table now generated by scripts/gen_size_table.sh (measures cfbox, references others) - command list: add filesystem/init category (mount/mdev/umount/swapoff/reboot/poweroff) - gitignore demo source mp4
CI cross-compile (aarch64/armhf) and release-size builds enable _FORTIFY_SOURCE, which marks write() with warn_unused_result; the (void) cast on the askfirst prompt did not suppress -Werror=unused-result, so those jobs failed at init_spawn.cpp:42. Compare the return value instead.
CI gcc-13 (aarch64/release-size) failed on issues invisible to local gcc-16, which transitively includes <algorithm> via <vector>/<string>: swapoff.cpp:51 ignored the fgets return value (-Werror=unused-result, glibc fortify marks fgets warn_unused_result) — check it; and std::min/std::max were used without #include <algorithm> — add it to init_spawn.cpp, ar.cpp, more.cpp, inflate.hpp, deflate.hpp.
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.
No description provided.