|
@@ -22,7 +22,7 @@ this file **and** the matching page:
|
|
|
| `docs/boot.html` | BIOS/VESA, MBR, UEFI loader, kexec, boot info, image layout |
|
|
| `docs/boot.html` | BIOS/VESA, MBR, UEFI loader, kexec, boot info, image layout |
|
|
|
| `docs/memory.html` | Address map, E820/bitmap allocator, paging, MTRR, user arenas |
|
|
| `docs/memory.html` | Address map, E820/bitmap allocator, paging, MTRR, user arenas |
|
|
|
| `docs/cpu.html` | GDT/TSS, interrupts, ACPI/SMP, CFS-lite, BKL, idle/power |
|
|
| `docs/cpu.html` | GDT/TSS, interrupts, ACPI/SMP, CFS-lite, BKL, idle/power |
|
|
|
-| `docs/drivers.html` | PCI, FDC/PATA/AHCI, USB core + UHCI/OHCI/EHCI/xHCI, HID, sensors |
|
|
|
|
|
|
|
+| `docs/drivers.html` | PCI, FDC/PATA/AHCI, USB core + UHCI/OHCI/EHCI/xHCI, HID, mass storage, sensors |
|
|
|
| `docs/filesystems.html` | VFS/`fs_ops`, FAT, ramfs pack, `/share`, WebDAV |
|
|
| `docs/filesystems.html` | VFS/`fs_ops`, FAT, ramfs pack, `/share`, WebDAV |
|
|
|
| `docs/graphics.html` | VBE/shadow, damage, blit, WM, canvas ABI, ngui, images |
|
|
| `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/network.html` | netdev, ARP/ICMP/UDP/DHCP/DNS, TCP, TLS, netconsole/netkexec |
|
|
@@ -65,6 +65,7 @@ make run-ahci # like `make run` + an ICH9 AHCI controller and a 512 MB SATA di
|
|
|
make uefi # build BOOTX64.EFI and the dual-boot usb-efi.img
|
|
make uefi # build BOOTX64.EFI and the dual-boot usb-efi.img
|
|
|
make run-uefi # boot usb-efi.img under OVMF (x86-64 UEFI; serial log in /tmp/opencode)
|
|
make run-uefi # boot usb-efi.img under OVMF (x86-64 UEFI; serial log in /tmp/opencode)
|
|
|
make test-uefi # headless OVMF boot test (greps the serial log for the boot line)
|
|
make test-uefi # headless OVMF boot test (greps the serial log for the boot line)
|
|
|
|
|
+make test-install # USB-storage installer test: clone + BIOS/UEFI target boot
|
|
|
make rootfs # build cmds.img (the 8 MB rootfs partition image)
|
|
make rootfs # build cmds.img (the 8 MB rootfs partition image)
|
|
|
make nowm # diagnostic kernel with no WM; the boot console stays visible
|
|
make nowm # diagnostic kernel with no WM; the boot console stays visible
|
|
|
make dev # serial kernel + rootfs reload (KXE2)
|
|
make dev # serial kernel + rootfs reload (KXE2)
|
|
@@ -107,7 +108,9 @@ make clean
|
|
|
CHS-only USB BIOS can read. The boot sector's `pack_lba` field points the
|
|
CHS-only USB BIOS can read. The boot sector's `pack_lba` field points the
|
|
|
VESA stage at partition 2. `usb-efi.img` (17 MB) adds an 8 MB FAT16 ESP
|
|
VESA stage at partition 2. `usb-efi.img` (17 MB) adds an 8 MB FAT16 ESP
|
|
|
as partition 3 (type `0xEF`, LBA 18432); `BOOTX64.EFI` embeds the kernel +
|
|
as partition 3 (type `0xEF`, LBA 18432); `BOOTX64.EFI` embeds the kernel +
|
|
|
- gz pack.
|
|
|
|
|
|
|
+ gz pack. The `install` command clones this used image (MBR through the
|
|
|
|
|
+ last partition) from a visible block device, so a cloned target keeps both
|
|
|
|
|
+ boot paths.
|
|
|
`make flash` writes the dual image; `make flash FLASH_IMG=usb.img` writes
|
|
`make flash` writes the dual image; `make flash FLASH_IMG=usb.img` writes
|
|
|
the legacy-only image. One BPB byte is cleared in the dual image (disk
|
|
the legacy-only image. One BPB byte is cleared in the dual image (disk
|
|
|
offset `0x7E16`, FATSize16): without that, UEFI firmware scans partition 1,
|
|
offset `0x7E16`, FATSize16): without that, UEFI firmware scans partition 1,
|
|
@@ -439,7 +442,7 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
see the panic section below.
|
|
see the panic section below.
|
|
|
- **Filesystem**: `fat.c` (FAT12/16/32 read/write, device-parameterized),
|
|
- **Filesystem**: `fat.c` (FAT12/16/32 read/write, device-parameterized),
|
|
|
`vfs.c` (mounts every FAT device under `/`), `fatdetect.c`/`fatformat.c`,
|
|
`vfs.c` (mounts every FAT device under `/`), `fatdetect.c`/`fatformat.c`,
|
|
|
- `blkdev.c` (floppy + IDE + SATA + eMMC registry), `ata.c` (ATA PIO, either the
|
|
|
|
|
|
|
+ `blkdev.c` (floppy + IDE + SATA + eMMC + USB registry), `ata.c` (ATA PIO, either the
|
|
|
legacy ports or the PCI IDE interface's native BARs — `ata_init_ports()`;
|
|
legacy ports or the PCI IDE interface's native BARs — `ata_init_ports()`;
|
|
|
multi-sector PIO waits for DRQ before every sector, since drives drop it
|
|
multi-sector PIO waits for DRQ before every sector, since drives drop it
|
|
|
between sectors, polls the command-block status rather than the alt-status
|
|
between sectors, polls the command-block status rather than the alt-status
|
|
@@ -465,6 +468,16 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
64 entries of the last FAT directory (`fat_cache` in `vfs.c`), so the
|
|
64 entries of the last FAT directory (`fat_cache` in `vfs.c`), so the
|
|
|
WebDAV server's index 0..N-1 sequence is one directory walk instead of N;
|
|
WebDAV server's index 0..N-1 sequence is one directory walk instead of N;
|
|
|
any write/mkdir/rmdir/unlink invalidates it.
|
|
any write/mkdir/rmdir/unlink invalidates it.
|
|
|
|
|
+- **Installer**: `install.c` — the privileged `install <target> [source]`
|
|
|
|
|
+ command clones the live NebOS image. It detects a source by the MBR plus
|
|
|
|
|
+ the LBA-63 boot-sector signature (`NEBOS` OEM string, `kernel_lba` 64,
|
|
|
|
|
+ `pack_lba` 1088), computes the used length from the highest partition end,
|
|
|
|
|
+ copies sectors 1..end in chunks, writes the source MBR **last**, flushes and
|
|
|
|
|
+ verifies by checksum before remounting the target. The source can be
|
|
|
|
|
+ `usb0` (USB mass storage), IDE, SATA or eMMC; the target is any non-floppy
|
|
|
|
|
+ block device with enough sectors. It reuses `format_busy`; the copy holds
|
|
|
|
|
+ the BKL so a USB source cannot be re-enumerated mid-install. It installs
|
|
|
|
|
+ the flashed image, not runtime `cmds-dev` pack updates.
|
|
|
- **`/share`**: `share.c/h` — writable, page-backed in-memory filesystem for
|
|
- **`/share`**: `share.c/h` — writable, page-backed in-memory filesystem for
|
|
|
network uploads (the netbooted board may have no writable disk). Entries
|
|
network uploads (the netbooted board may have no writable disk). Entries
|
|
|
are full relative paths (like the pack ramfs) plus explicit directory
|
|
are full relative paths (like the pack ramfs) plus explicit directory
|
|
@@ -591,6 +604,9 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
asynchronous schedule, up to 4 instances) and `xhci.c` (MMIO xHCI, USB2
|
|
asynchronous schedule, up to 4 instances) and `xhci.c` (MMIO xHCI, USB2
|
|
|
root ports; halt/HCH reset sequence and BIOS/OS handoff) implement it.
|
|
root ports; halt/HCH reset sequence and BIOS/OS handoff) implement it.
|
|
|
`lsusb.c` — the `lsusb` command (lists every controller and its tree).
|
|
`lsusb.c` — the `lsusb` command (lists every controller and its tree).
|
|
|
|
|
+ `usbmsc.c/h` — USB mass-storage class driver (BOT/SCSI) exposed as
|
|
|
|
|
+ `usb0..`; its device probe is registered next to ASIX and `blk_scan()`
|
|
|
|
|
+ registers the devices in the block registry.
|
|
|
The devices work on every controller type and
|
|
The devices work on every controller type and
|
|
|
can be plugged in at any time (root-port connect-change watcher); `lsusb`
|
|
can be plugged in at any time (root-port connect-change watcher); `lsusb`
|
|
|
re-enumerates the bus, after which `usbhid` re-inits itself via a scan
|
|
re-enumerates the bus, after which `usbhid` re-inits itself via a scan
|
|
@@ -940,7 +956,7 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
|
|
|
|
|
`cd [path]`, `ls [path]`, `cat <path>`, `save <path> <text>`, `rm <path>`,
|
|
`cd [path]`, `ls [path]`, `cat <path>`, `save <path> <text>`, `rm <path>`,
|
|
|
`mkdir <path>`, `rmdir <path>`, `hello`, `reboot`, `poweroff`,
|
|
`mkdir <path>`, `rmdir <path>`, `hello`, `reboot`, `poweroff`,
|
|
|
-`display`, `cpuinfo`, `mouseinfo`, `gfxbench`, `lsusb`, `touchpad`, `lspci [id]`, `peek <addr> [len]`, `poke <addr> <val>`, `storage`, `meminfo`, `top`, `sched`, `format <device> [size]` (binary units, e.g. `format ide0 100mb` or `1gb`; no size formats the whole disk),
|
|
|
|
|
|
|
+`display`, `cpuinfo`, `mouseinfo`, `gfxbench`, `lsusb`, `touchpad`, `lspci [id]`, `peek <addr> [len]`, `poke <addr> <val>`, `storage`, `meminfo`, `top`, `sched`, `format <device> [size]` (binary units, e.g. `format ide0 100mb` or `1gb`; no size formats the whole disk), `install <target> [source]` (clone the live image; auto-detects the source, preferring `usb0`),
|
|
|
`ps`, `renice <pid> <weight>`, `kill <pid>`, `idle [auto|hlt|c1e|c3|c6]`, `power`, `powerinfo`, `cpufreq [auto|min|max|off|<pstate>]`, `spin [ms]`, `help`, `clear`, `serial test`, `kexec`, `dbg`, `view <file>` (image viewer; PNG, baseline/progressive JPEG, animated GIF, BMP, TGA, PNM, ICO, PAM), and `browser [url|file]` (disk app launcher).
|
|
`ps`, `renice <pid> <weight>`, `kill <pid>`, `idle [auto|hlt|c1e|c3|c6]`, `power`, `powerinfo`, `cpufreq [auto|min|max|off|<pstate>]`, `spin [ms]`, `help`, `clear`, `serial test`, `kexec`, `dbg`, `view <file>` (image viewer; PNG, baseline/progressive JPEG, animated GIF, BMP, TGA, PNM, ICO, PAM), and `browser [url|file]` (disk app launcher).
|
|
|
|
|
|
|
|
Network: `netinfo`, `netrecv`, `netsend`, `netip [a.b.c.d]`, `dhcp` (re-run the
|
|
Network: `netinfo`, `netrecv`, `netsend`, `netip [a.b.c.d]`, `dhcp` (re-run the
|
|
@@ -1210,6 +1226,20 @@ so addresses do not collide.
|
|
|
Devices plugged in after boot bind through `asix.c`, which calls
|
|
Devices plugged in after boot bind through `asix.c`, which calls
|
|
|
`netdev_hotplug()` so the dongle becomes the active NIC when the boot
|
|
`netdev_hotplug()` so the dongle becomes the active NIC when the boot
|
|
|
probe found none.
|
|
probe found none.
|
|
|
|
|
+- **Mass storage** (`usbmsc.c/h`): the device probe claims a class 8 /
|
|
|
|
|
+ subclass 6 / protocol 0x50 (SCSI transparent, bulk-only) interface, parses
|
|
|
|
|
+ its bulk IN/OUT endpoints, sets the configuration and identifies the disk
|
|
|
|
|
+ with SCSI INQUIRY + READ CAPACITY. Commands use BOT CBW/CSW with LUN 0,
|
|
|
|
|
+ 512-byte blocks and at most 62 sectors per data stage; READ(10), WRITE(10),
|
|
|
|
|
+ SYNCHRONIZE CACHE, a BOT reset and endpoint-halt clear are implemented.
|
|
|
|
|
+ `blk_scan()` registers present devices as `usb0..` (`BLK_USB`), so
|
|
|
|
|
+ `storage`, the VFS mount path, `format` and `install` can use them. Bulk
|
|
|
|
|
+ transfers exist only on EHCI and xHCI; a storage device on a UHCI/OHCI
|
|
|
|
|
+ companion is left unclaimed. The xHCI bulk-IN path arms one transfer per
|
|
|
|
|
+ call and does not auto re-arm, so a consumer can alternate CBW, data and
|
|
|
|
|
+ CSW buffers. The installer reads the live image from `usb0`; USB3
|
|
|
|
|
+ SuperSpeed ports (not driven by `xhci.c`) and UAS/4Kn sticks are not
|
|
|
|
|
+ usable.
|
|
|
- **Devices** (`usbhid.c`): every HID (class 3) interface with an
|
|
- **Devices** (`usbhid.c`): every HID (class 3) interface with an
|
|
|
interrupt-IN endpoint gets its own interrupt slot (USB_HCD_INT_SLOTS = 6).
|
|
interrupt-IN endpoint gets its own interrupt slot (USB_HCD_INT_SLOTS = 6).
|
|
|
Boot interfaces (subclass 1, protocol 2/1) are used as-is in boot
|
|
Boot interfaces (subclass 1, protocol 2/1) are used as-is in boot
|
|
@@ -1414,7 +1444,7 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
7. `display` (needs a GPU snapshot) and `lsusb` (a 45-byte wrapper around
|
|
7. `display` (needs a GPU snapshot) and `lsusb` (a 45-byte wrapper around
|
|
|
the USB tree printer) are the last non-privileged commands still living in
|
|
the USB tree printer) are the last non-privileged commands still living in
|
|
|
the kernel, plus the privileged ones (`peek`, `poke`, `dbg`, `serial`,
|
|
the kernel, plus the privileged ones (`peek`, `poke`, `dbg`, `serial`,
|
|
|
- `kexec`, `reboot`, `poweroff`, `format`, `ps`/`kill`).
|
|
|
|
|
|
|
+ `kexec`, `reboot`, `poweroff`, `format`, `install`, `ps`/`kill`).
|
|
|
8. The rootfs pack is inflated into one contiguous page-allocated run at
|
|
8. The rootfs pack is inflated into one contiguous page-allocated run at
|
|
|
boot, capped by `RAMFS_MAX_DECOMPRESSED` (8 MB); a larger pack fails to
|
|
boot, capped by `RAMFS_MAX_DECOMPRESSED` (8 MB); a larger pack fails to
|
|
|
load (the USB rootfs partition is 8 MB, so this only bites if the cap is
|
|
load (the USB rootfs partition is 8 MB, so this only bites if the cap is
|
|
@@ -1435,7 +1465,9 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
11. The BKL serializes all kernel execution: a long FAT/disk operation, a
|
|
11. The BKL serializes all kernel execution: a long FAT/disk operation, a
|
|
|
non-network driver wait or a big shadow-buffer operation can stall syscalls
|
|
non-network driver wait or a big shadow-buffer operation can stall syscalls
|
|
|
on the other CPUs for its duration. `bkl_pause()`/`bkl_resume()` is used
|
|
on the other CPUs for its duration. `bkl_pause()`/`bkl_resume()` is used
|
|
|
- for serial/network waits, not yet for disk I/O.
|
|
|
|
|
|
|
+ for serial/network waits and the format raw-sector loop; the installer
|
|
|
|
|
+ holds the BKL for the copy so a USB source cannot be re-enumerated
|
|
|
|
|
+ mid-install.
|
|
|
12. Kernel threads (kworker, kexec/payload, kernel commands) are pinned to
|
|
12. Kernel threads (kworker, kexec/payload, kernel commands) are pinned to
|
|
|
the BSP. Only ring-3 processes use the APs, so a single CPU-bound kernel
|
|
the BSP. Only ring-3 processes use the APs, so a single CPU-bound kernel
|
|
|
driver still limits throughput.
|
|
driver still limits throughput.
|
|
@@ -1645,3 +1677,14 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
cache flush uses CMD6 FLUSH_CACHE when EXT_CSD CACHE_SIZE is non-zero.
|
|
cache flush uses CMD6 FLUSH_CACHE when EXT_CSD CACHE_SIZE is non-zero.
|
|
|
The eMMC contains the stock ChromeOS image, so `format mmc0` is
|
|
The eMMC contains the stock ChromeOS image, so `format mmc0` is
|
|
|
destructive; the board boots from USB.
|
|
destructive; the board boots from USB.
|
|
|
|
|
+
|
|
|
|
|
+32. Installer limits: `install` clones the live image's used sectors (~17 MB
|
|
|
|
|
+ for `usb-efi.img`, ~8.5 MB for `usb.img`), so the rest of the target stays
|
|
|
|
|
+ unpartitioned and runtime `cmds-dev` pack updates are not part of the
|
|
|
|
|
+ clone. The source must be visible as a `blkdev`: USB mass storage is
|
|
|
|
|
+ BOT/SCSI on EHCI/xHCI USB2 bulk only (no UHCI/OHCI bulk path, no USB3
|
|
|
|
|
+ SuperSpeed ports, no UAS or 4Kn), so a USB3-only port or an unsupported
|
|
|
|
|
+ stick leaves no source. The copy holds the BKL and can freeze the UI for
|
|
|
|
|
+ its duration; a failed copy leaves an incomplete target. IDE, SATA and
|
|
|
|
|
+ eMMC sources work without USB, but a target smaller than the image is
|
|
|
|
|
+ refused.
|