Expand description
Build bootable ext4 rootfs images for sandboxes.
Two builders live here, both backed by the pure-Rust oci2rootfs /
arcbox-ext4 stack (no external binary, no mount, no root required for
the ext4 write itself):
RootfsBuilder::convert_layer_to_rootfs— convert a staged OCI image layout (or a Docker overlay2 layer directory) to ext4, then inject/sbin/vm-agentthrough a loop mount. Cached ext4 images are reused to avoid redundant conversions.RootfsBuilder::ensure_default_rootfs— build the default busybox + vm-agent image used when a create supplies no rootfs. Rebuilt when the source binaries are newer than the cached image.
The rootfs convention the boot protocol relies on — the agent binary at
/sbin/vm-agent, /etc/resolv.conf
symlinked into the /run tmpfs — is enforced only by the guest failing to
boot, so it is implemented once, here, with the agent binary source and
the output location supplied by the composer through RootfsPaths.
Converted images retain their own /sbin/init; select the agent with
init=/sbin/vm-agent. The default busybox image also links /sbin/init.
Structs§
- Rootfs
Builder - Builds sandbox rootfs images; see the module docs.
- Rootfs
Paths - Where the rootfs builder finds its inputs and keeps its outputs.
- Rootfs
Spec
Enums§
Constants§
- ROOTFS_
CAPACITY_ GRANULARITY - One ext4 block group with the formatter’s 4 KiB block size. Capacities must contain whole groups because the formatter rounds up.
- VM_
AGENT_ PATH - Agent path in every built image. Use this path in the kernel’s
init=argument.
Functions§
- has_
ext4_ magic - Check if a file has a valid ext4 superblock magic (0x53EF at offset 0x438).