mirror of
https://github.com/Leonmmcoset/cleonos.git
synced 2026-04-21 10:40:00 +00:00
2.5 KiB
2.5 KiB
CLeonOS Stage21
Stage Goal
- Add writable runtime filesystem capability without touching ELF execution path.
- Restrict write operations to
/tempto keep system area read-only. - Extend kernel shell with practical file/dir operations for daily debugging.
What Was Implemented
- New writable VFS APIs:
clks_fs_mkdir(const char *path)clks_fs_write_all(const char *path, const void *data, u64 size)clks_fs_append(const char *path, const void *data, u64 size)clks_fs_remove(const char *path)
- Write guard policy:
- Only
/tempsubtree is writable. /system,/shell,/driverremain read-only.- Non-empty directory delete is rejected.
- Only
- Runtime file payload management:
- Dynamically written file data uses kernel heap.
- Overwrite/append paths release previous heap-backed payload safely.
- Kernel shell command expansion:
pwdcd [dir]mkdir <dir>touch <file>write <file> <text>append <file> <text>rm <path>
- Shell path handling upgraded:
- relative path support
.and..handling- shell-maintained current working directory
Acceptance Criteria
- Boot completes and kernel shell is interactive.
helpoutput includes new file commands.- Writable flow under
/tempworks:- create dir
- create file
- write and append text
- read with
cat - remove file/empty dir
- Write operation outside
/tempfails with safe message. - No regression in scheduler/service/syscall/interrupt initialization logs.
Suggested Validation Script (Manual)
pwdcd /tempmkdir democd demotouch a.txtwrite a.txt helloappend a.txt _worldcat a.txt(expecthello_world)cd /write /system/x.txt bad(expect failure)rm /temp/demo/a.txtrm /temp/demo
Build Targets
make setupmake userappsmake isomake runmake debug
QEMU Command
qemu-system-x86_64 -M q35 -m 1024M -cdrom build/CLeonOS-x86_64.iso -serial stdio
Common Bugs and Debugging
mkdir/write/touchalways fails:- Confirm target path resolves under
/temp. - Use
pwdand absolute paths to verify current directory.
- Confirm target path resolves under
rmfails for directory:- Stage21 only allows removing empty directories.
catprints truncated data:- Current shell output keeps bounded preview buffer by design.
- Unexpected write behavior after repeated overwrite:
- Check heap stats and ensure no panic; Stage21 releases old heap payload before replacing.