Skip to main content

Module rootfs

Module rootfs 

Source
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-agent through 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 (and /sbin/init pointing at it), /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.

Structs§

RootfsBuilder
Builds sandbox rootfs images; see the module docs.
RootfsPaths
Where the rootfs builder finds its inputs and keeps its outputs.

Functions§

has_ext4_magic
Check if a file has a valid ext4 superblock magic (0x53EF at offset 0x438).