| Crates.io | iso9660-rs |
| lib.rs | iso9660-rs |
| version | 1.0.2 |
| created_at | 2026-01-06 17:40:44.173325+00 |
| updated_at | 2026-01-06 18:07:47.780506+00 |
| description | A no_std ISO9660 filesystem implementation with El Torito boot support |
| homepage | |
| repository | https://github.com/Poprdi/morpheusx/tree/master/iso9660 |
| max_upload_size | |
| id | 2026383 |
| size | 131,461 |
A pure no_std ISO9660 filesystem implementation in Rust with El Torito bootable CD support.
no_std - Works in bare metal, UEFI bootloaders, and embedded environmentsgpt_disk_io for block device abstractionno_std contexts[dependencies]
iso9660-rs = "1.0.1"
For optional extensions:
[dependencies]
iso9660-rs = { version = "1.0.1", features = ["rock-ridge", "joliet"] }
use iso9660::{mount, find_file, read_file, find_boot_image};
// Mount ISO from block device
let volume = mount(&mut block_io, 0)?;
// Find and read a file
let file = find_file(&mut block_io, &volume, "/boot/vmlinuz")?;
let mut buffer = vec![0u8; file.size as usize];
read_file(&mut block_io, &file, &mut buffer)?;
// Extract bootable image via El Torito
let boot = find_boot_image(&mut block_io, &volume)?;
println!("Boot image at sector {}, {} bytes", boot.load_rba, boot.sector_count * 512);
| Function | Purpose |
|---|---|
mount(block_io, start_sector) → VolumeInfo |
Parse volume descriptors and mount ISO |
find_file(block_io, volume, path) → FileEntry |
Navigate directory tree to locate file by path |
read_file(block_io, file, buffer) → usize |
Read file contents into provided buffer |
read_file_vec(block_io, file) → Vec<u8> |
Read entire file into heap-allocated vector |
find_boot_image(block_io, volume) → BootImage |
Extract El Torito bootable image entry |
| Type | Purpose |
|---|---|
FileReader<B> |
Buffered file reader with seek(), read(), position(), is_eof() |
DirectoryIterator<B> |
Manual directory traversal for sequential listing |
VolumeInfo |
Volume descriptor details (publisher, volume name, creation date) |
FileEntry |
File metadata (name, size, location, flags, datetime) |
FileFlags |
File attribute flags (is_directory, is_file, is_hidden, etc.) |
BootImage |
Boot catalog entry (load_rba, sector_count, platform, media_type) |
BootMediaType |
Boot media type enum (NoEmulation, Floppy, HardDisk, CDROM) |
BootPlatform |
Boot platform ID enum (x86, EFI, PowerPC, Mac) |
Iso9660Error |
Comprehensive error types with error context |
Result<T> |
Standard result type alias |
use iso9660::{mount, find_file, read_file, FileReader};
// 1. Mount ISO
let volume = mount(&mut block_io, 0)?;
// 2. Find file by path
let file = find_file(&mut block_io, &volume, "/boot/vmlinuz")?;
// 3. Option A: Read entire file into vector
let data = iso9660::read_file_vec(&mut block_io, &file)?;
// Option B: Stream read with buffer
let mut buf = [0u8; 4096];
let bytes_read = read_file(&mut block_io, &file, &mut buf)?;
// Option C: Use FileReader for advanced control
let mut reader = FileReader::new(&file);
reader.seek(512)?; // Skip first sector
let pos = reader.position();
iso9660/
├── volume/ # Volume descriptor parsing (Primary, Supplementary, Boot)
├── directory/ # Directory record navigation and iteration
├── file/ # File reading from extents
├── boot/ # El Torito boot catalog parsing
├── extensions/ # Rock Ridge, Joliet (optional)
└── utils/ # Datetime, string conversion, checksums
Extract bootable images from live ISO files - essential for UEFI bootloaders booting Tails, Ubuntu, etc.:
use iso9660::find_boot_image;
// Find boot image
let boot = find_boot_image(&mut block_io, &volume)?;
// Access boot image metadata
println!("Boot platform: {:?}", boot.platform); // x86, EFI, PowerPC, Mac
println!("Media type: {:?}", boot.media_type); // NoEmulation, Floppy, HardDisk, CDROM
println!("Boot location: sector {}", boot.load_rba); // Sector number
println!("Boot size: {} bytes", boot.sector_count * 512); // Size in 512-byte sectors
Based on ECMA-119 (ISO 9660:1988) and El Torito (1995) specifications.
;1)rock-ridge)joliet)Rust 1.70 or later.
Licensed under either of:
at your option.
Contributions welcome! This crate aims to be a reliable foundation for low-level systems work. Please keep changes focused and include tests where possible.