Storage & filesystems
One VFS, three very different backends.
The kernel keeps filesystem policy thin: a mount table and an
fs_ops vtable. FAT provides persistent read/write storage,
the command-pack ramfs is a read-only system image, and
/share is a writable RAM filesystem for network uploads;
an installed disk adds a persistent FAT data volume at
/data.
VFS layer
vfs.c mounts every detected FAT device under
/, keeps the two memory filesystems available throughout
the boot scan, and dispatches file operations through
struct fs_ops. The shell, the file service and the
WebDAV server never call fat_* directly.
vfs_resolve() drops . components, collapses
and trims slashes, and resolves .. against the mount.
The shell's working directory is per-process and inherited across
commands, so relative paths keep working after cd.
FAT
fat.c supports FAT12, FAT16 and FAT32 on
any registered block device. It reads the BPB, validates the media
byte and mounts partitions as separate entries such as
ide0p1, sata0p2 or usb0p1.
USB mass-storage devices are registered by
usbmsc.c and mount exactly like an
internal disk; the install command is separate and
clones raw image sectors without parsing FAT.
- Read/write. Read, write, delete, mkdir and rmdir are implemented; FAT32 allocation uses an FSInfo-seeded free-cluster hint.
- 8.3 names. The on-disk name is the canonical one. The shell and
filesdisplay the space-padded form; a long name cannot be created. - Directory cache. The last FAT directory's first 64 entries are cached in
vfs.c, so WebDAV's index sequence is one walk instead of N. Any write invalidates the cache. - Serialization. A file operation runs in a non-preemptible section because the FAT driver has static state and the floppy needs IRQ 6;
vfs_scan_busy/format_busymake it sleep first while a mount scan or a format owns the disks. A format releases the BKL for its raw-sector loop, and only disk-backed mounts wait for it, so/ramfsand/sharestay usable.
fatdetect.c and fatformat.c
back the format command. A disk can be formatted in
binary units (format ide0 100mb, 1gb) or
whole-disk; the Chromebook eMMC is format mmc0.
FAT32 limits. The FSInfo free-count is not updated, and a completely full FAT32 directory is not grown: new cluster allocation for directories is not implemented.
ramfs & the command pack
The system root is a compressed command pack, not a disk image. Every
ring-3 command is a static ELF linked at 0x40000000,
packed as bin/<name>, gzipped and wrapped in a
one-sector NBROOT1 header. At boot the path loads the
pack into RAM and ramfs.c inflates it into a
private page-allocated copy mounted read-only at /ramfs.
_end.
The high-memory legacy loader caps the compressed pack at 1 MB;
the 8 MB rootfs partition and ramfs cap remain the larger limits.
| Container | Format | Purpose |
|---|---|---|
cmds.pack | NBPAK1 | Raw command archive: bin/<name> entries. |
cmds_pack_gz.bin | gzip | Compressed pack; libdeflate-gzip -12 when available. |
rootfs.bin | NBROOT1 + gzip | Floppy append (header + pack). |
cmds.img | NBROOT1 padded to 8 MB | USB rootfs partition image. |
rootfs-full.bin | NBROOT1 + full gzip | Network persistent-install payload. |
/share | RAM entries | Writable upload target; not part of the pack. |
/data | FAT32/16, label NEBOSDATA | Partition 4 on the installed disk; persistent user files. |
The pack build is part of the normal Makefile. Add a
ucmd_<name>.c to UCMDS and the pack,
the mount and the PATH listing pick it up automatically. Runtime
replacement uses make cmds-dev or
make net-cmds and validates the pack before swapping it.
/data
The installer creates a fourth partition after the 8 MB ESP and
formats it as FAT with the label NEBOSDATA. It fills
the rest of the disk and is mounted at /data; the VFS
recognises the label in the FAT boot sector, not the device name, so
the path is stable on mmc0, sata0 or
ide0.
- Persistent. A reinstall or
install <target> selfreplaces the OS partitions (P1 kernel, P2 rootfs pack, P3 ESP) and keeps P4.net-installwrites only P1/P2. - First install is destructive. Creating P4 formats the rest of the target disk; an existing
NEBOSDATAvolume is detected and left untouched. - 8.3 names. The FAT driver creates and reads short names only; long names need VFAT LFN write support.
- WiFi credentials. A successful WiFi connect stores the SSID/passphrase in
WIFI.CFG; the boot-timewifi autoconnecthelper reads it. The file is plaintext and 8.3, like the rest of the volume. - Fixed start. P4 starts at LBA 34816. A BIOS-only install leaves the space between P2 and P4 unpartitioned, and a later disk clone does not resize P4.
- No fsck. Like the other FAT mounts, the volume has no journal, repair tool or permissions; it is writable by every process.
File service ABI
Ring-3 commands use SYS_READ_FILE,
SYS_WRITE_FILE, SYS_LIST_DIR,
SYS_LIST_MOUNTS, SYS_UNLINK,
SYS_MKDIR, SYS_RMDIR,
SYS_FS_STAT and SYS_GETCWD.
sys_fs.c validates the path, resolves it
against the caller's cwd, calls the VFS and maps backend errors to
the stable SYS_E* values.
The file service reads whole files, not streams. The shell loads an
ELF through vfs_load_file and spawns it; FAT ELFs are
loaded through kmalloc under sys_fs_enter/exit,
since the floppy needs IRQ 6.
Directory entries carry a 64-byte display name plus raw_83,
so FAT's space-padded names and the string-named memory filesystems
share one ABI.
WebDAV
websrv is a ring-3 HTTP/1.1 + WebDAV server
built on the kernel TCP listener. It serves the VFS:
/ lists mounts, /ramfs is read-only, FAT
mounts accept only names that round-trip to 8.3, and
/share and /data are the writable
targets (RAM and persistent respectively).
- Concurrency. One active connection plus a small backlog (three backlog/closing slots in the current TCP server). Parallel clients queue with a zero window until the active request finishes.
- Bodies. Whole-file buffering, 4 MB normally and 1 MB when the heap cannot provide the larger buffer. A larger PUT gets 413.
- Methods. GET, PUT, DELETE, MKCOL, PROPFIND and MOVE to the extent described; directory
MOVEis 501 andPROPPATCHis answered 200 without persisting. - No auth. This is a trusted-LAN service;
/shareis writable by anyone who can reach it.
The WebDAV server still takes the raw NIC lease, so it is mutually
exclusive with packet-level commands and with TCP client connections
(curl and the browser workers). Starting
websrv while another raw owner exists fails; TCP clients
fail to connect while it owns the receiver.
Capacity chart
Limits
- Whole-file service. Commands read a complete file into memory; there is no stream API for general files.
- FAT names. No long filename creation or lookup. WebDAV refuses names that cannot be represented exactly in 8.3.
- ramfs is read-only. Writes return
SYS_EROFS; use/sharefor volatile data and/datafor persistent files. - Pack volatile at runtime. Runtime pack replacement is RAM only; a cold boot uses the flashed rootfs.
- Directory listing cache. Only the first 64 entries of the last FAT directory are cached; a very large directory still costs a walk.
Source map
vfs.c,vfs.h— mounts and dispatchfat.c,fat.h— FAT12/16/32ramfs.c,ramfs.h— pack inflateshare.c,share.h— /sharesys_fs.c— ring-3 file servicemkpack.c,mkrootfs.c,rootfs.hinflate.c— DEFLATE/gzipucmd_websrv.c— HTTP/WebDAVfatdetect.c,fatformat.c— formatusbmsc.c,usbmsc.h— USB mass-storage block devicesinstall.c,install.h— clone, self-update and net-install writerrootfs.h— installed image geometry and NBROOT1 header