|
|
@@ -13,8 +13,8 @@ Targets i586 (first-gen Pentium); runs under QEMU or on real hardware.
|
|
|
| `kernel/` | The kernel, its drivers and services, `kernel.ld`, `ap_tramp.*`, `kexec_tramp.S`, `irqret.inc`; host tests `ccmp_test.c`, `touchpad_gesture_test.c` |
|
|
|
| `common/` | Freestanding code linked into both kernel and userland: `inflate.c/h`, `font_8x16.c/h` |
|
|
|
| `include/` | ABI headers shared by boot, kernel, userland and host tools: `syscall.h`, `wm_abi.h`, `version.h`, `bootinfo.h`, `phys.h`, `rootfs.h`, `wifi_cfg.h`, `rtl8821a_tbl.h` |
|
|
|
-| `user/` | `ucmd_lib.h` (the ring-3 syscall wrappers) and `ucmd.ld` |
|
|
|
-| `user/apps/<name>/` | One ring-3 program per directory: entry file `ucmd_<name>.c` plus private modules (`browser/` holds `browser.c`, `browser_html.c`, `js_*.c`, `svg_raster.c`; `chat/` holds `chat_login.c`; `gallery/` holds the real `gallery.c` behind the `ucmd_gallery.c` launcher; `hello/` has its own `hello.ld`) |
|
|
|
+| `user/` | `ucmd_lib.h` (the ring-3 syscall wrappers), `service_proto.h` (the init/service protocol and unit table) and `ucmd.ld` |
|
|
|
+| `user/apps/<name>/` | One ring-3 program per directory: entry file `ucmd_<name>.c` plus private modules (`browser/` holds `browser.c`, `browser_html.c`, `js_*.c`, `svg_raster.c`; `chat/` holds `chat_login.c`; `gallery/` holds the real `gallery.c` behind the `ucmd_gallery.c` launcher; `init/` is the PID-1 service manager; `service/` holds the CLI/GUI client and its shared `service_defs.c`/`service_proto.c`; `hello/` has its own `hello.ld`) |
|
|
|
| `user/lib/<lib>/` | Ring-3 libraries: `libc`, `ngui`, `ufont`, `img`, `tls` (crypto incl. `wpa_crypto.c`), `uhttp`, `ujson`, `uwm` (`uwm_lib.c`), `wifi` (`wifi_store.c`, `wpa.c`); host tests live next to their library |
|
|
|
| `tools/` | Host tools (`mkpack.c`, `mkrootfs.c`, `mkrtwtbl.c`, `mkcursors.c`, `mkicons.c`, `jsstrip.c`, `mkwoff.py`, `kexec_send.c`, `netkexec_send.c`, `netmonitor.c`, `flash.sh`, `xcursor_trim.py`), the QMP test scripts and `cursor_test.c` |
|
|
|
| `assets/` | Imported assets: `assets/cursors/adwaita/` (the Adwaita 24 px Xcursor files) and `assets/icons/adwaita/` (the Adwaita symbolic SVGs used as UI icons), both LGPL-3 / CC-BY-SA-3.0, with README and licences |
|
|
|
@@ -57,7 +57,7 @@ this file **and** the matching page:
|
|
|
| `docs/filesystems.html` | VFS/`fs_ops`, FAT, ramfs pack, `/share`, WebDAV |
|
|
|
| `docs/graphics.html` | VBE/shadow, damage, blit, WM, canvas ABI, ngui, images |
|
|
|
| `docs/network.html` | netdev, ARP/ICMP/UDP/DHCP/DNS, TCP, TLS, netconsole/netkexec |
|
|
|
-| `docs/userland.html` | Ring-3 model, ELF spawn, syscalls, shell/PATH, pack, apps |
|
|
|
+| `docs/userland.html` | Ring-3 model, ELF spawn and parent/detach, syscalls, init/services, shell/PATH, pack, apps |
|
|
|
| `docs/development.html` | Toolchain, make targets, hot reload, tests, debugging |
|
|
|
|
|
|
Rules:
|
|
|
@@ -154,9 +154,11 @@ make clean
|
|
|
`cmds-lite.pack` (everything but `firmware/*`, the cursor bundle,
|
|
|
`install/kernel.bin` and `bin/browser.app`), because the ~1 MB WiFi
|
|
|
firmware and the ~500 KB gzip browser do not fit a 1.44 MB floppy; a
|
|
|
- floppy boot runs the browser from `BROWSER` on `root.img`. The kernel itself no longer
|
|
|
- carries the pack; the boot path loads it into RAM and `ramfs_init` takes a
|
|
|
- private copy (`bin/<name>` mounted at `/ramfs`).
|
|
|
+ floppy boot runs the browser from `BROWSER` on `root.img`. `bin/init` and
|
|
|
+ `bin/service` are in **both** packs; the current lite gzip pack is ~682 KB
|
|
|
+ and the floppy image still has ~390 KB of internal padding. The kernel
|
|
|
+ itself no longer carries the pack; the boot path loads it into RAM and
|
|
|
+ `ramfs_init` takes a private copy (`bin/<name>` mounted at `/ramfs`).
|
|
|
- The WiFi firmware `firmware/iwlwifi-7265D-29.ucode` (Chromebook) and
|
|
|
`firmware/iwlwifi-6000-4.ucode` (ThinkPad X201) are decompressed from the
|
|
|
host's linux-firmware (`WIFI_FW_7265D` / `WIFI_FW_6000` override the
|
|
|
@@ -238,8 +240,9 @@ and `make net-dev`/`kernel-net-dev` reload over the network. `bootlog save
|
|
|
3. `kernel.c` — `kernel_main` zeroes BSS then inits serial → memory/paging →
|
|
|
ACPI/MADT → I/O → power → idle → processes → timer (PIT; 1 kHz busy,
|
|
|
100 Hz idle + IDT) → SMP AP bring-up → PS/2 mouse (the I2C touchpad
|
|
|
- probe only on Airmont) → VGA shadow buffer → ramfs inflate → WM →
|
|
|
- publish `vfs_scan_busy` → `wm_server_boot_ready()` → wait (idle `hlt`,
|
|
|
+ probe only on Airmont) → VGA shadow buffer → ramfs inflate →
|
|
|
+ `wm_server_init()` → start `/ramfs/bin/init` as PID 1 → init spawns the
|
|
|
+ WM → publish `vfs_scan_busy` → `wm_server_boot_ready()` → wait (idle `hlt`,
|
|
|
1 s cap) until the first terminal has presented → USB bring-up and scan
|
|
|
(non-preemptible, as before the WM existed: reset/SOF timing) → NIC probe
|
|
|
→ kworker → the `bootscan` kernel thread (non-USB storage scan + FAT
|
|
|
@@ -253,7 +256,9 @@ and `make net-dev`/`kernel-net-dev` reload over the network. `bootlog save
|
|
|
first terminal presents (the bootscan window is not counted): the end
|
|
|
point of a boot-time measurement
|
|
|
(~0.5-0.6 s after the kernel starts on QEMU's USB image; the bootscan
|
|
|
- window is created first).
|
|
|
+ window is created first). The kernel never starts the WM: init is the
|
|
|
+ only creator, and `wm_server_attach` admits an init child named `wm`.
|
|
|
+ Without `/ramfs/bin/init` there is no WM; the boot console stays visible.
|
|
|
4. `mbr.S` — MBR (USB/HDD boot); loads the active partition's boot sector
|
|
|
(partition 1 at LBA 63).
|
|
|
5. **UEFI (`boot/efi/`)** — an x86-64 PE32+ `BOOTX64.EFI` loads from the ESP. It
|
|
|
@@ -294,7 +299,7 @@ a Pentium 1 (and a Pentium II board without ACPI) on the UP path.
|
|
|
| `0x60000` | No longer a rootfs staging area: the legacy stage copies each 16 KB chunk straight to `0x900000`. The kernel BSS/boot stack may use this range |
|
|
|
| `_end` | Kernel end (linker symbol; `kernel.ld` keeps `_end <= 0x90000` so the top of the low-memory gap and the EBDA stay untouched). BSS and the boot stack may extend past `0x60000` |
|
|
|
| (in-image) | Bootstrap/protected-mode stack: 8 KB `.stack` NOLOAD section, `__boot_stack_top`/`__boot_stack_bottom` (travels with the kernel) |
|
|
|
-| `0x900000`| Legacy boot-time rootfs pack written directly by `vesa_stage.S` (reserved by `mm_init` until `ramfs_init` takes its copy, then freed); `mm_init` places the frame bitmap in the first RAM after it (`0xB02000` with today's 2.1 MB pack, at most `0xD00000`); process stacks and kexec staging also start here |
|
|
|
+| `0x900000`| Legacy boot-time rootfs pack written directly by `vesa_stage.S` (reserved by `mm_init` until `ramfs_init` takes its copy, then freed); `mm_init` places the frame bitmap in the first RAM after it (`0xB08000` with today's ~2.13 MB pack, at most `0xD00000`; the `mm: bitmap ...` boot line reports the actual address); process stacks and kexec staging also start here |
|
|
|
| `0x100000`| VGA shadow buffer (`VGA_SHADOW_BASE`, `vga.h`) |
|
|
|
|
|
|
The legacy stage uses `0x3000..0x6FFF` as a 16 KB-chunk rootfs staging
|
|
|
@@ -349,12 +354,47 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
is the only global-tick source. APs do not start taking user work until
|
|
|
`smp_enable_sched()`, i.e. after device/FS setup. LAPIC IPIs (vector 0x31)
|
|
|
request a reschedule; they must be EOIed on the target LAPIC.
|
|
|
- `SYS_PROCINFO` exposes weight/state/CPU/ticks and the `kernel_thread` flag
|
|
|
- for the ring-3 `top` and `process` commands, and `sched`/`renice` plus
|
|
|
- `SYS_SCHEDINFO` expose the scheduler counters.
|
|
|
+ `SYS_PROCINFO` exposes pid/parent_pid, weight/state/CPU/ticks, pages and
|
|
|
+ the `kernel_thread` flag for the ring-3 `top` and `process` commands, and
|
|
|
+ `sched`/`renice` plus `SYS_SCHEDINFO` expose the scheduler counters.
|
|
|
Ring 0 is preemptible at tick boundaries unless `preempt_count` is set (FAT
|
|
|
and the shadow flush) or the BKL is held; voluntary blocks/yields go through
|
|
|
the `int 0x81` gate.
|
|
|
+ Every PCB carries `parent_pid` (0 = root). `process_exit()`,
|
|
|
+ `process_kill()` and the reaper kill the whole descendant subtree; a
|
|
|
+ child born while its parent dies is aborted. `SYS_SPAWN` has a flags word:
|
|
|
+ the default parents the child to the caller, `SYS_SPAWN_DETACH` attaches it
|
|
|
+ to the caller's parent (the terminal/WM session), or to 0 if that parent is
|
|
|
+ gone. `init` and kernel threads are roots; the WM and services are init's
|
|
|
+ children, the terminal/start-menu apps are the WM's, and terminal commands
|
|
|
+ are the terminal's. `SYS_SPAWN_KCMD` stays parented. The process monitor's
|
|
|
+ End task kills the subtree.
|
|
|
+- **Init and services**: `kernel/init.c/h` loads `/ramfs/bin/init` as PID 1
|
|
|
+ after `wm_server_init()` and before the WM. It records `init_pid` inside
|
|
|
+ `process_create_user_full()` before the process is runnable, refuses
|
|
|
+ `SYS_KILL(init)`, and the kworker restarts init if it dies. The ring-3
|
|
|
+ manager (`user/apps/init/ucmd_init.c`) is the only WM creator: it
|
|
|
+ `SYS_SPAWN`s `/ramfs/bin/wm`, monitors it, and respawns it after a crash.
|
|
|
+ It owns one private tty per running service, drains it to
|
|
|
+ `/share/svc-<name>.log` (32 KB), and writes `/share/svc-<name>.state`.
|
|
|
+ `/share/init.state` carries its pid/control tty/WM pid; `/share/init.log`
|
|
|
+ is its own log. `init` serves a small line protocol on a tty allocated
|
|
|
+ with `SYS_TTY_ALLOC`; the `service` CLI/GUI (`user/apps/service/`) sends
|
|
|
+ `NBI1 <seq> <op> <name> <resp_tty>` and reads the response tty. The
|
|
|
+ shared table/protocol lives in `user/service_proto.h`,
|
|
|
+ `user/apps/service/service_defs.c` and `service_proto.c`. Service starts,
|
|
|
+ stops, restarts and kills are init's state machine; a service that exits
|
|
|
+ unexpectedly is marked stopped (no v1 auto-restart), while the WM is
|
|
|
+ restart-on-death. On init restart it first kills every leftover ring-3
|
|
|
+ process (kernel threads stay), then starts the WM and the services whose
|
|
|
+ saved desired state is running. The control syscalls are
|
|
|
+ `SYS_TTY_ALLOC` (tty owned by the caller, no stdout rebind),
|
|
|
+ `SYS_TTY_WRITE` (non-blocking, no partial writes), `SYS_TTY_CLOSE` (owner)
|
|
|
+ and `SYS_IS_INIT`; `TTY_MAX` is 16. The first service is `websrv`
|
|
|
+ (`/ramfs/bin/websrv 8080`, autostart off: it owns the raw NIC receiver, so
|
|
|
+ stop it before browsing/`curl`/`net-dev`). `service logs init|websrv`,
|
|
|
+ `service logtail`, `service --gui` and `service status` are the user
|
|
|
+ tools; `bootscan` is a kernel thread/log viewer, not a service.
|
|
|
- **SMP / ACPI**: `acpi.c/h` (RSDP → RSDT/XSDT → MADT; CPU/LAPIC and IOAPIC
|
|
|
base lists; 4 MB table page mapping; the FADT PM1 control blocks, flags and
|
|
|
the DSDT (or SSDT) `\_S5` sleep types; malformed tables are ignored),
|
|
|
@@ -495,7 +535,13 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
`uwm_lib.c`). The kernel maps the shadow and each window's RGB565 front
|
|
|
canvas at `WM_CONTENT_VA_BASE`, routes input, owns the cursor, kexec
|
|
|
detection and the boot-console handoff. Every window is a canvas client;
|
|
|
- there is no in-kernel WM or terminal fallback. The WM paints the desktop,
|
|
|
+ there is no in-kernel WM or terminal fallback. Init is the only WM
|
|
|
+ creator (`SYS_SPAWN("/ramfs/bin/wm")`); the kernel never starts one.
|
|
|
+ `wm_server_attach` admits only a process named `wm` whose `parent_pid` is
|
|
|
+ the current init pid, cleans up a dead previous WM, maps the shadow and
|
|
|
+ disables the boot console. If init or `/ramfs/bin/wm` is absent the boot
|
|
|
+ console stays; there is no fallback. The WM watchdog still kills a wedged
|
|
|
+ WM (`wm_last_seen` > 15 s) and init respawns it. The WM paints the desktop,
|
|
|
spawns the `/ramfs/bin/bootscan` live-log window first and only then the
|
|
|
first terminal after `wm_server_boot_ready()`, so the terminal is the
|
|
|
newest window and keeps the keyboard focus on startup, and composites the
|
|
|
@@ -561,9 +607,9 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
first row is the dim `Applications` caption, `theme.panel_alt` hover rows
|
|
|
and a rounded Power tile. It lists every self-contained GUI app in the
|
|
|
pack -- Terminal, Files, Web, Gallery, Chat, Clock, Text editor, Colors,
|
|
|
- Mines, Cards, Disks, Tasks, Settings and Date & Time -- with a coloured
|
|
|
- letter tile and a hover highlight, shrinks its row height to fit short
|
|
|
- panels, and closes on an outside press. The last row, Power, opens a
|
|
|
+ Mines, Cards, Disks, Tasks, Services, Settings and Date & Time -- with a
|
|
|
+ coloured letter tile and a hover highlight, shrinks its row height to fit
|
|
|
+ short panels, and closes on an outside press. The last row, Power, opens a
|
|
|
submenu with Reboot and Power off; both spawn the privileged kernel
|
|
|
command through `SYS_SPAWN_KCMD` with no tty. The menu floats above every
|
|
|
window and is redrawn with the brightness OSD overlay. The bar notice and
|
|
|
@@ -608,8 +654,8 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
popover and then continues with the normal click handling; a second click
|
|
|
on the status cluster toggles it.
|
|
|
The start menu entries spawn the same pack binaries (`Chat` ->
|
|
|
- `/ramfs/bin/chat`, `Tasks` -> `/ramfs/bin/process`, `Disks` ->
|
|
|
- `/ramfs/bin/disks`, ...). When the full date/time would cross
|
|
|
+ `/ramfs/bin/chat`, `Tasks` -> `/ramfs/bin/process`, `Services` ->
|
|
|
+ `/ramfs/bin/service --gui`, `Disks` -> `/ramfs/bin/disks`, ...). When the full date/time would cross
|
|
|
`WM_BAR_LEFT_END`, the clock falls back to `MM-DD HH:MM` and is hidden if
|
|
|
even that does not fit.
|
|
|
`terminal.c` keeps the privileged kernel command
|
|
|
@@ -1572,9 +1618,18 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
ELF through the VFS and spawns it as a ring-3 process; `hello` is just
|
|
|
`bin/hello`. New command: create `user/apps/<name>/ucmd_<name>.c` and add
|
|
|
`<name>` to UCMDS — the pack, the mount and the PATH listing pick it up
|
|
|
- automatically (a command that links libraries also needs an `.elf` rule). `SYS_SPAWN` still
|
|
|
- loads ELFs from any VFS mount, so commands can also live on `/share` or a
|
|
|
- FAT disk (`path /share/bin`, or an absolute path). They talk to the kernel through
|
|
|
+ automatically (a command that links libraries also needs an `.elf` rule).
|
|
|
+ `init` and `service` are in both packs; `init` is PID 1 and refuses a
|
|
|
+ user-run start through `SYS_IS_INIT`.
|
|
|
+ `SYS_SPAWN` still loads ELFs from any VFS mount, so commands can also live
|
|
|
+ on `/share` or a FAT disk (`path /share/bin`, or an absolute path). Its
|
|
|
+ `struct sys_spawn` carries a flags word: default parented, or
|
|
|
+ `SYS_SPAWN_DETACH` to attach to the caller's parent (the session). There
|
|
|
+ is deliberately no old-ABI compatibility: the kernel, pack, `root.img`,
|
|
|
+ UEFI payload and host harness must be rebuilt together. The browser and
|
|
|
+ gallery launchers spawn the real app parented and wait for it, so a
|
|
|
+ terminal launch stays foreground and Ctrl-C/terminal close kills the app;
|
|
|
+ files/disks/chat and the WiFi helpers use detached spawns. They talk to the kernel through
|
|
|
`int 0x80` (`syscall.h`: putstr/ticks/sleep/exit, the whole-file service in
|
|
|
`sys_fs.c`, the state snapshots in `sys_info.c` and the network service in
|
|
|
`sys_net.c`) and inherit the terminal's screen, so their output lands in
|
|
|
@@ -1600,7 +1655,8 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
ELF ships in the pack as `bin/gallery.app`; `ucmd_gallery.c` is the tiny
|
|
|
`bin/gallery` launcher, which prefers `/share/GALLERY` (development upload
|
|
|
via `make gallery-dev`), then the pack copy, then the `GALLERY` disk
|
|
|
- fallback on `root.img`/FAT mounts.
|
|
|
+ fallback on `root.img`/FAT mounts. Like the browser launcher it spawns
|
|
|
+ the real app parented and waits for it.
|
|
|
- **Boot scan window**: `ucmd_bootscan.c` is the `bootscan` window, a live
|
|
|
tail of the `bootscan` kernel thread's own COM1 output. `boot_storage_main()`
|
|
|
calls `bootcon_scan_begin()`/`bootcon_scan_end()`; while active,
|
|
|
@@ -1625,12 +1681,15 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
histories of CPU busy (summed `SYS_SCHEDINFO` idle ticks over all CPUs),
|
|
|
physical memory in use (`SYS_MEMINFO`) and NIC throughput (the 32-bit frame
|
|
|
byte counters in `SYS_NET_INFO`). Three cards draw the graphs with ngui
|
|
|
- rectangles/lines; the process table below is sortable by PID, state, CPU,
|
|
|
- memory, time or name (click a header) and scrolls with PgUp/PgDn or the
|
|
|
- wheel.
|
|
|
- Selecting a row shows its details; `End task` asks for a second click, then
|
|
|
- calls `SYS_KILL`. Kernel threads and the monitor itself are protected
|
|
|
- (`sys_procinfo.kernel_thread`, `SYS_GETPID`). Esc closes the window.
|
|
|
+ rectangles/lines; the process table is a tree: children are indented under
|
|
|
+ their `parent_pid`, while each sibling group stays sortable by PID, state,
|
|
|
+ CPU, memory, time or name (click a header). PgUp/PgDn or the wheel
|
|
|
+ scrolls.
|
|
|
+ Selecting a row shows its pid/ppid and details; `End task` asks for a second
|
|
|
+ click, then
|
|
|
+ calls `SYS_KILL`, which also kills the process's descendants. Kernel
|
|
|
+ threads and the monitor itself are protected (`sys_procinfo.kernel_thread`,
|
|
|
+ `SYS_GETPID`); init is protected in the kernel. Esc closes the window.
|
|
|
- **Solitaire**: `ucmd_solitaire.c` — a Windows 95 style Klondike game on the
|
|
|
canvas service: green felt, a Game/Help menu (ngui buttons and menu items:
|
|
|
new game, draw one/three, blue or red deck), four foundations, seven tableau
|
|
|
@@ -1648,8 +1707,9 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
`ucmd_browser.c` is the tiny `bin/browser` launcher; it prefers
|
|
|
`/share/BROWSER` (`make browser-dev` uploads it via the board's `websrv`;
|
|
|
stop `websrv` before browsing HTTP, because it owns the NIC), then the pack
|
|
|
- copy, then `BROWSER` on `root.img`/IDE/SATA fat mounts. The launcher
|
|
|
- forwards its argument and cwd.
|
|
|
+ copy, then the disk fallback; it spawns the real app parented and waits for
|
|
|
+ it, so a terminal launch stays foreground and Ctrl-C/terminal close kills
|
|
|
+ the app. The launcher forwards its argument and cwd.
|
|
|
`uhttp.c/h` is the shared ring-3 HTTP client extracted from curl: URL
|
|
|
parsing/resolution (unsafe path bytes are percent-encoded; path
|
|
|
normalization stops at `?`/`#`), redirects, chunked decoding, timeouts
|
|
|
@@ -2393,7 +2453,7 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
`mkdir <path>`, `rmdir <path>`, `hello`, `acpidump` (writes the mapped
|
|
|
DSDT to `/share/DSDT.BIN`), `reboot`, `poweroff`,
|
|
|
`display`, `cpuinfo`, `mouseinfo`, `gfxbench`, `lsusb`, `touchpad [rightclick off|tap|corner|both] [tapclick on|off] [scroll on|off|natural|traditional]`, `lspci [id]`, `peek <addr> [len]`, `poke <addr> <val>`, `storage`, `disks` (the ngui storage manager), `meminfo`, `top`, `process` (the ngui task manager), `bootscan` (the live boot storage-scan window), `sched`, `format [-y] <device> [size]` (binary units, e.g. `format ide0 100mb` or `1gb`; no size formats the whole disk; `-y` skips the prompt), `install [-y] <target> [source|self]` (clone the live image, or write the running image; auto-detects the source, preferring `usb0`; `auto` targets the only non-USB NebOS disk),
|
|
|
-`ps`, `renice <pid> <weight>`, `kill <pid>`, `idle [auto|hlt|c1e|c3|c6]`, `power`, `powerinfo`, `cpufreq [auto|min|max|off|<pstate>]`, `spin [ms]`, `membench` (ring-3 speed check: TSC, ALU, heap/BSS memcpy, syscall rates), `backlight [0-100|up|down]` (also `probe`), `keytest` (raw scancode tap), `help`, `clear`, `serial test`, `kexec`, `dbg`, `view <file>` (image viewer; PNG, baseline/progressive JPEG, animated GIF, BMP, TGA, PNM, ICO, PAM), `browser [url|file]` (disk app launcher), and `chat [config-path]` (Cloudron Chat client).
|
|
|
+`ps`, `renice <pid> <weight>`, `kill <pid>`, `idle [auto|hlt|c1e|c3|c6]`, `power`, `powerinfo`, `cpufreq [auto|min|max|off|<pstate>]`, `spin [ms]`, `membench` (ring-3 speed check: TSC, ALU, heap/BSS memcpy, syscall rates), `backlight [0-100|up|down]` (also `probe`), `keytest` (raw scancode tap), `help`, `clear`, `serial test`, `kexec`, `dbg`, `service [list|status <name>|start|stop|restart|kill <name>|logs <name>|logtail <name>|--gui]` (init's client; `websrv` is the first service and holds the raw NIC receiver while running), `view <file>` (image viewer; PNG, baseline/progressive JPEG, animated GIF, BMP, TGA, PNM, ICO, PAM), `browser [url|file]` (disk app launcher; waits for the app so a terminal launch is foreground), and `chat [config-path]` (Cloudron Chat client).
|
|
|
|
|
|
Network: `netinfo`, `netrecv`, `netsend`, `netip [a.b.c.d]`, `dhcp` (re-run the
|
|
|
DHCP client), `netdev [name]` (kernel command: show the active NIC driver or
|
|
|
@@ -2956,6 +3016,15 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
grown (new cluster allocation for directories is not implemented).
|
|
|
- **Keep the memory map in sync** — hardcoded addresses appear in `.S`, `.c`, and
|
|
|
linker scripts; changing one without the others breaks boot/loading.
|
|
|
+- **Parent death is the default** — `parent_pid` is part of every PCB; exit,
|
|
|
+ kill and the reaper kill descendants. Spawn sites that must outlive their
|
|
|
+ launcher use `SYS_SPAWN_DETACH` (attach to the caller's parent/session).
|
|
|
+ Do not make a daemon a root process just because it is long-lived: put it
|
|
|
+ under init or detach it to the session. Kernel threads are roots.
|
|
|
+- **No syscall ABI compatibility for now** — `struct sys_spawn` grew a flags
|
|
|
+ word and `TTY_MAX`/the tty API changed. Rebuild the kernel, command pack,
|
|
|
+ `root.img`, UEFI payload and host harness together; an old rootfs or an
|
|
|
+ old command on `/share`/FAT is not expected to work.
|
|
|
- **Ring-3 data segments** — when an IRET returns to ring 3, the CPU nulls
|
|
|
DS/ES/FS/GS whose DPL is below CPL 3. Every stub that loads 0x10 to run
|
|
|
kernel code must therefore restore the user data selector (0x23) before
|
|
|
@@ -3007,9 +3076,9 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
with `--gc-sections`; the current full pack with the UI fonts, both
|
|
|
WiFi firmwares (7265D 1,036,312 bytes, ~442 KiB gzip; 6000 454,608 bytes,
|
|
|
~204 KiB gzip), the RTL8821A firmware and tables (31,898 + 11,668
|
|
|
- bytes) and `install/kernel.bin` is ~2.0 MiB gzip (~2 MB under the
|
|
|
- cap), inflating to ~4.35 MB, which adds about
|
|
|
- half a second to the boot; the floppy lite pack is ~641 KiB gzip and
|
|
|
+ bytes) and `install/kernel.bin` is ~2.13 MiB gzip (~2 MB under the
|
|
|
+ cap), inflating to ~4.4 MB, which adds about
|
|
|
+ half a second to the boot; the floppy lite pack is ~682 KiB gzip and
|
|
|
deliberately omits the firmware, `install/kernel.bin` and the browser
|
|
|
(`BROWSER` on `root.img` is the floppy copy). `libdeflate-gzip -12` is still preferred. Over
|
|
|
115200 serial a raw `cmds-dev` pack (4.3 MiB) now takes about four
|
|
|
@@ -3083,8 +3152,9 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
8×16 boot-console font, the IOAPIC/AMD-thermal additions and the safe
|
|
|
AMD MTRR path, the 32x32 cursor save buffer and the mount-policy table)
|
|
|
~0x8bf20 once the frame bitmap moved out of BSS; with the ioremap
|
|
|
- window, the EHCI handoff fix and the boot-scan log ring it is ~0x8df80,
|
|
|
- ~8 KB below the `0x90000` wall, and the
|
|
|
+ window, the EHCI handoff fix, the boot-scan log ring, the init bootstrap,
|
|
|
+ parent-pid tree kill, the tty control syscalls and `TTY_MAX` 16 it is
|
|
|
+ ~0x8f260, ~3.4 KB below the `0x90000` wall, and the
|
|
|
remaining limit
|
|
|
is kernel code/buffers only.
|
|
|
|
|
|
@@ -3532,8 +3602,8 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
for every spinner frame; both paths were written from the Linux
|
|
|
drivers and only Cirrus and the software cursor are tested in QEMU.
|
|
|
The cursor shape follows the WM poll, so it can lag the pointer by
|
|
|
- one WM loop. The 4 KB save buffer and the cursor code (~8 KB in all) are included in
|
|
|
- `_end` ~0x8df80, ~8 KB below the `0x90000` wall.
|
|
|
+ one WM loop. The 4 KB save buffer and the cursor code are included in
|
|
|
+ `_end` (see item 21).
|
|
|
|
|
|
40. Wallpaper limits: one screen-aspect image pre-scaled to at most
|
|
|
1440x810 (cropped to cover, no crop/position choice), no slideshow and
|
|
|
@@ -3544,3 +3614,29 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
`/share/wallpaper` otherwise. The WM keeps a 2.4 MB static copy plus a
|
|
|
256 KB RGB565->BGRA table (16/24 bpp convert per pixel), all inside the
|
|
|
4 MB user image window, and has no image decoder of its own.
|
|
|
+
|
|
|
+41. Init/service limits: the service table is static (`service_defs.c`), with
|
|
|
+ no enable/disable persistence, dependencies, targets, one-shot services,
|
|
|
+ timers or failed-service auto-restart (the WM is the only always-restart
|
|
|
+ unit). `stop` and `kill` both terminate the process: there are no
|
|
|
+ signals or graceful shutdown hooks; `kill` is the forced variant and
|
|
|
+ init drains/closes the log tty when it observes the exit.
|
|
|
+ Logs and state are RAM-only `/share` files (32 KB per service), so they
|
|
|
+ vanish across reboot/kexec. An init crash intentionally resets the
|
|
|
+ whole ring-3 tree (WM, terminals, apps and detached helpers); kernel
|
|
|
+ threads survive. Detached spawns outlive their launcher but not init.
|
|
|
+ The control protocol is a trusted single-user tty channel with no
|
|
|
+ authentication. `TTY_MAX` is 16, so a browser with four helpers plus
|
|
|
+ several services can exhaust tty slots. `websrv` holds the raw NIC
|
|
|
+ receiver while running: stop it before browser `curl`/`net-dev`, and a
|
|
|
+ second network owner fails with "network busy". `disks` format/install
|
|
|
+ kernel commands are parented: closing the Disks window aborts them, and
|
|
|
+ a mid-write install can leave P1/P2 intermediate (the MBR is written
|
|
|
+ last). There is no old `SYS_SPAWN` ABI compatibility: kernel, pack,
|
|
|
+ `root.img`, UEFI payload and host harness must be rebuilt together, and
|
|
|
+ `make kernel-dev` with an old rootfs is unsupported (the new kernel also
|
|
|
+ needs `/ramfs/bin/init` for a WM). `bootscan` is not a service; it is a
|
|
|
+ kernel thread plus the log viewer. The display server remains in the
|
|
|
+ kernel (window/canvas bookkeeping, input routing and shadow); a full
|
|
|
+ userland display service would need a generic framebuffer/shared-memory
|
|
|
+ and input API and is not part of this change.
|