Skip to content

Latest commit

 

History

History
41 lines (37 loc) · 2.67 KB

README.md

File metadata and controls

41 lines (37 loc) · 2.67 KB

Kernel build

A platform is described in one file, platforms/<platform>.toml: its architecture, kernel image, DTB directory, upstream lock, patch series and config. build reads it, fetches the pinned revision, applies the ordered patch layers and config, and compiles one kernel, its modules and every DTB of the platform. A device name resolves to its platform through devices/<device>/device.toml [kernel] and additionally copies its DTB to DIRECTORY/<device>.dtb. Git and Podman are required. series.py --platform NAME prints the checked descriptor of a platform or device.

orchard build runs it; build with orchard build --device j71b (platform apple-16k plus the j71b DTB) or orchard build --platform apple-16k, not with kernel/build directly. It holds the shared tree's lock and switches the tree between patch series for every checkout (see AGENTS.md).

The source and compiler output live in one incremental tree per platform and upstream pin, shared by every hardware checkout and worktree: ${ORCHARD_CACHE_DIR:-${XDG_CACHE_HOME:-~/.cache}/orchard}/kernel-work/<platform>-<pin>/ (--work-dir chooses another). Every build continues that tree: a changed patch series resets the files the old series touched and applies the new one, so only affected files recompile. Hand edits in the tree are refused rather than lost. A second build of the same tree waits for the first. The cache key of a built kernel is what determines it: the source tree, the config, the descriptor's arch, image and DTB directory, the toolchain image and KERNEL_PRODUCER in src/orchard/build.py, not the text of these scripts; raise that version when a change alters what they produce. Compiled objects also go into a compiler cache (ccache) next to the trees, .../orchard/ccache/kernel/, so a tree that returns to a patch set built before, in any worktree, compiles it from the cache; it keeps itself under 2 GB. ccache stands in for clang-19 on the recipe's PATH, so the recorded compiler commands are the same with and without it; ORCHARD_CCACHE=0 builds without it and rebuilds nothing by itself. make runs one job per CPU of the build environment (the Podman machine's CPUs); ORCHARD_KERNEL_JOBS=N chooses another number. --output must name a new directory; it receives the image the descriptor names (Image.gz for arm64), <device>.dtb, dtbs/, kernel.release and lib/modules/.

The kernel has no device-specific NVMe fences. Protecting Apple's data is the installer's job: the recovery keeps every NVMe partition and every namespace but the main one read-only (runtime/recovery/storage-fence), and the install script makes writable only what its plan creates, while writing.