Files
bare-operating-system/packages/bare-os-seeder/kernel/lib/init/STRUCTURE.md
T
Raven Scott 72e0c9c881 feat(booter): ctx 1.54.0, process table v9, and Holepunch/POSIX proc parity
- Bump BARE_OS_CTX_API_VERSION to 1.54.0 and POSIX profile to 1.0.19
- Process table schema 9: nice/accountingSource, logical maps/threads /proc builders, renice
- disk.os: replication_operator_sketch v8, HyperDHT address sketch, pkg index surfaces
- Protomux operator sketch v4, security_posture v7, corestore snapshot UX hint, pear_stage_pointer v2
- Swarm: BARE_OS_SWARM_ATTEMPT_BURST_PER_SEC; HDMS: host booter warn logging; shell wait exit codes
- getconf/sysconf: additional _SC_* via bareOsGetconfSysconf; socketMsgSurface v6 (iovec/SUSv4 refs)
- Identity: vault rotation audit includes pathcap trusted key count
- CI/docs: holepunch drift report env, kernel STRUCTURE note, verify-bundle-throws comment, matrices and examples
2026-04-05 23:14:08 -04:00

24 lines
2.0 KiB
Markdown

# Stock kernel internal layout (`/boot/init.js`)
The shipped kernel is a **single** Hyperdrive file evaluated with `AsyncFunction` (see `packages/bare-os-booter/lib/kernel-runner.js`). Sources are concatenated by [`scripts/bundle-kernel-init.mjs`](../../../scripts/bundle-kernel-init.mjs) in this order:
1. **`kernel/lib/boot/*.js`** (sorted) — preamble (`BARE_OS_BOOT_TXN_STATE`, multisig shape, `invokeCtxBootHooks`).
2. **`kernel/lib/init/fragments/*.js`** (sorted) — large cohesive regions:
- **`20-init-boot-policy.js`** — semver helpers, skip merge, `kernel.d` env guards, **`applyBootPolicyFile`**.
- **`30-init-kernel-extensions.js`** — **`runKernelExtDropins`**, topological ordering, signer pins, multisig gate.
3. **`kernel/lib/init/init-main.js`** — boot trace/journals, RC runners, selftest, **`start(ctx)`**, REPL.
Staged paths: **`/lib/init/init-main.js`**, **`/lib/init/fragments/*`**, and bundled **`/boot/init.js`**.
| Concern | Responsibility | Primary source |
| --- | --- | --- |
| Boot policy & env gates | `applyBootPolicyFile`, skip sets, ABI checks | `fragments/20-init-boot-policy.js` |
| RC runners | `runRcLines`, `kernel.d`, `rc.d` | `init-main.js` |
| Extensions | `runKernelExtDropins`, topological ordering | `fragments/30-init-kernel-extensions.js` |
| Selftest | `kernel.d` / `selftest.d` harness | `init-main.js` |
| Interactive loop | readline / REPL after boot stages | `init-main.js` |
After editing any fragment or `init-main.js`, run `node scripts/bundle-kernel-init.mjs` and sync the seeder tree (`rsync -a --delete kernel/ packages/bare-os-seeder/kernel/`). CI: `verify-init-bundle-recipe.mjs`, `verify-kernel-seeder-parity.mjs`, `verify-runtime-no-incomplete-markers.mjs`.
**Boot footprint:** keep heavy optional paths (for example deep selftest or auxiliary REPL wiring) behind **boot policy** / env gates inside existing fragments rather than adding new concatenation slots unless `verify-init-bundle-recipe.mjs` is updated—this preserves a single `/boot/init.js` artifact while allowing cold-boot skipping of gated sections.