]>
Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
userspace: major refactoring — dynamic linking, new commands, SysV init
Infrastructure:
- Rename user/init.c → user/fulltest.c, move to /sbin/fulltest
- Remove .elf extensions from all InitRD binaries
- Build ulibc as shared library (libc.so) with PIC objects
- Fix crt0.S to correctly parse argc/argv/envp from execve stack
- Fix ld.so: restore stack pointer before jumping to program entry
- Fix ld.so: add R_386_GLOB_DAT/R_386_COPY eager relocation processing
- Fix ld.so: move find_shlib_info() before relocation processing
- Create dyn_linker.ld for dynamically-linked PIE executables
- Add missing ulibc functions: waitpid, getdents, stat, fstat, chmod,
chown, link, symlink, readlink, sigaction
- Add dirent.h header, expand sys/stat.h with permission macros
- Update Makefile: dynamic linking build rules for all user commands
Rewritten commands (now use ulibc + dynamic linking via ld.so):
- cat: proper POSIX with stdin/- support, 4KB buffer
- echo: -n, -e, -E flags, escape sequence handling
- ls: -a, -l flags, getdents-based directory listing
- mkdir: -p flag for recursive parent creation
- rm: -r, -f, -d flags
New commands (all dynamically linked):
- File management: cp, mv, touch, ln (-s for symlinks)
- Text processing: head (-n), tail (-n), wc (-l/-w/-c),
sort (-r/-n), uniq (-c/-d), cut (-d/-f)
- Permissions: chmod (octal), chown (owner:group), chgrp
- System info: date, hostname, uptime
Shell improvements (/bin/sh):
- Variable assignment (VAR=value) and expansion ($VAR, ${VAR}, $?)
- Environment variables (export VAR=value)
- Line editing: left/right arrows, Ctrl+A/E/U, backspace
- Command history: up/down arrows, dedup
- Builtins: cd, pwd, export, unset, set, type, exit, echo
- PATH-based command resolution with colon-separated dirs
- Quote handling (single and double quotes)
- Semicolon command separation
- Append redirection (>>)
SysV init (/sbin/init):
- Parses /etc/inittab (id:runlevels:action:process format)
- Actions: sysinit, wait, once, respawn, ctrlaltdel, shutdown
- Runlevel support (0-6, S)
- Default behavior without inittab: run rcS then respawn /bin/sh
- Child reaping and respawn loop
Kernel changes:
- Default init path changed to /sbin/init (was /bin/init.elf)
- grub.cfg: add fulltest and shell entries with console=serial
- Update fulltest.c references: /bin/init.elf → /sbin/fulltest,
/bin/echo.elf → /bin/echo, /bin/pie_test.elf → /bin/pie_test
Tests: 89/89 smoke (9s), cppcheck clean
38 files changed: