2.4 KiB
2.4 KiB
How the Build Process Works
build.sh iterates through stage directories in alphanumeric order and processes each one.
Stage Processing
For each stage directory:
- Skip the stage entirely if a
SKIPfile is present. - Run
prerun.sh— typically copies the rootfs from the previous stage. - Iterate through each numbered subdirectory (e.g.
00-configure-apt,01-sys-tweaks) in order. - Within each subdirectory, process these files if present:
| File | Description |
|---|---|
00-run.sh |
Shell script run on the host (must be executable) |
00-run-chroot.sh |
Shell script run inside the chroot (must be executable) |
00-debconf |
Passed to debconf-set-selections |
00-packages |
Packages installed via apt-get install |
00-packages-nr |
Same, but with --no-install-recommends |
00-packages-<arch> |
Arch-specific packages (e.g. 00-packages-amd64, 00-packages-arm-only) |
00-packages-nr-<arch> |
Arch-specific packages without recommends |
00-patches |
Directory of quilt patches applied to the rootfs |
00-patches-<arch> |
Arch-specific quilt patches |
- If the stage contains
EXPORT_IMAGE,EXPORT_ISO, orEXPORT_SQUASHFS(andSKIP_IMAGESis not present), add it to the export queue.
Export Pipeline
After all stages are processed, the build runs the export pipeline for each queued stage:
| Marker file | Export pipeline | Output |
|---|---|---|
EXPORT_IMAGE |
export-image/ |
.img disk image (RPi) |
EXPORT_ISO |
export-iso/ |
.iso live image (amd64) |
EXPORT_SQUASHFS |
export-squashfs/ |
.squashfs filesystem archive |
Multiple marker files can coexist in the same stage — all matching exports will run.
export-iso pipeline
prerun.sh— rsync rootfs into work dir01-set-sources— clean apt caches, run final upgrade02-network— configure resolv.conf03-finalise— rewrite fstab for live use, generate initramfs, build squashfs, build ISO withgrub-mkrescue
export-squashfs pipeline
prerun.sh— rsync rootfs into work dir00-finalise— create squashfs and deploy
Arch-Specific Logic
Scripts and package files support arch suffixes:
-arm-only— runs onarm64andarmhfonly-amd64— runs onamd64only-${ARCH}— can be any specific arch string
Scripts that handle arch themselves check ${ARCH} and exit early if not applicable.