morpheus_core

Module iso

Source
Expand description

ISO Storage Management

Manages large ISO files that exceed the FAT32 4GB file size limit by splitting them across multiple “chunk” partitions. Each chunk is stored as a single file on a dedicated FAT32 partition.

§Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        GPT Disk Layout                          │
├────────┬────────┬────────┬────────┬────────┬────────┬──────────┤
│  ESP   │ Chunk  │ Chunk  │ Chunk  │ Chunk  │ Chunk  │   Free   │
│ (EFI)  │   0    │   1    │   2    │   3    │   4    │  Space   │
│ ~512MB │ ~4GB   │ ~4GB   │ ~4GB   │ ~4GB   │ <4GB   │          │
└────────┴────────┴────────┴────────┴────────┴────────┴──────────┘

§Manifest Format

Each ISO set has a manifest file stored on the ESP at /.iso/<name>.manifest:

MORPHEUS_ISO_MANIFEST_V1
name: ubuntu-24.04-desktop-amd64.iso
size: 6234567890
chunks: 3
sha256: <hash>
chunk_0: <partition_uuid> 4294967296
chunk_1: <partition_uuid> 4294967296
chunk_2: <partition_uuid> 1939600298

§Usage

// Writing an ISO (during download)
let mut writer = ChunkWriter::new(block_io, &manifest)?;
writer.write_chunk_data(data_slice)?;
writer.finalize()?;

// Reading an ISO (during boot)
let reader = ChunkReader::new(block_io, &manifest)?;
let data = reader.read_range(offset, length)?;

§Constraints

  • Maximum chunk size: 4GB - 1 byte (FAT32 limit)
  • Maximum chunks per ISO: 16 (fixed array)
  • Chunk partition type: Linux filesystem GUID (for now)
  • Each chunk partition is formatted as FAT32 with single file

Modules§

Structs§

Enums§

Constants§

Traits§

  • Trait for block I/O operations (matches gpt_disk_io::BlockIo pattern)

Functions§

  • Calculate number of chunks needed for a given ISO size
  • Calculate total disk space needed for an ISO (with FAT32 overhead)