| Crates.io | isobemak |
| lib.rs | isobemak |
| version | 0.2.3 |
| created_at | 2025-09-14 17:27:23.718111+00 |
| updated_at | 2025-10-07 09:39:48.72083+00 |
| description | Create bootable ISO images with FAT32 and UEFI (El Torito) support in Rust. |
| homepage | |
| repository | https://github.com/p14c31355/isobemak |
| max_upload_size | |
| id | 1838988 |
| size | 146,576 |
isobemak is a Rust crate for creating bootable ISO 9660 images with UEFI and BIOS support. It can generate standard ISO images or hybrid isohybrid images that can boot from both optical media and USB drives.
Add this to your Cargo.toml:
[dependencies]
isobemak = "0.2.2"
The primary function is build_iso, which takes a configured IsoImage and generates the ISO file.
use isobemak::{build_iso, IsoImage, IsoImageFile, BootInfo, UefiBootInfo};
use std::path::PathBuf;
let isolinux_bin_path = PathBuf::from("path/to/isolinux.bin");
let kernel_path = PathBuf::from("path/to/kernel");
let bootx64_efi_path = PathBuf::from("path/to/BOOTX64.EFI");
let iso_output_path = PathBuf::from("bootable.iso");
let iso_image = IsoImage {
files: vec![
IsoImageFile {
source: kernel_path.clone(),
destination: "kernel".to_string(),
},
],
boot_info: BootInfo {
bios_boot: None,
uefi_boot: Some(UefiBootInfo {
boot_image: bootx64_efi_path.clone(),
kernel_image: kernel_path.clone(),
destination_in_iso: "EFI/BOOT/BOOTX64.EFI".to_string(),
}),
},
};
// Create a standard UEFI-bootable ISO
let (iso_path, _temp_fat, _iso_file, _fat_size) = build_iso(&iso_output_path, &iso_image, false)?;
use isobemak::{build_iso, IsoImage, IsoImageFile, BootInfo, BiosBootInfo, UefiBootInfo};
use std::path::PathBuf;
let isolinux_bin_path = PathBuf::from("path/to/isolinux.bin");
let kernel_path = PathBuf::from("path/to/kernel");
let bootx64_efi_path = PathBuf::from("path/to/BOOTX64.EFI");
let iso_output_path = PathBuf::from("hybrid.iso");
let iso_image = IsoImage {
files: vec![
IsoImageFile {
source: kernel_path.clone(),
destination: "kernel".to_string(),
},
],
boot_info: BootInfo {
bios_boot: Some(BiosBootInfo {
boot_catalog: PathBuf::from("BOOT.CAT"),
boot_image: isolinux_bin_path.clone(),
destination_in_iso: "isolinux/isolinux.bin".to_string(),
}),
uefi_boot: Some(UefiBootInfo {
boot_image: bootx64_efi_path.clone(),
kernel_image: kernel_path.clone(),
destination_in_iso: "EFI/BOOT/BOOTX64.EFI".to_string(),
}),
},
};
// Create a hybrid isohybrid ISO that can boot from both CD/DVD and USB
let (iso_path, _temp_fat, _iso_file, _fat_size) = build_iso(&iso_output_path, &iso_image, true)?;
For hybrid images, the process additionally includes:
build_iso(iso_path: &Path, image: &IsoImage, is_isohybrid: bool) - Main ISO creation functionIsoImage - Top-level configuration containing files and boot informationIsoImageFile - Specifies source file and destination path in ISOBootInfo - Contains optional BIOS and UEFI boot configurationsBiosBootInfo - BIOS/El Torito boot settingsUefiBootInfo - UEFI boot settings including ESP creationFor more control, you can use the IsoBuilder:
use isobemak::{IsoBuilder, BootInfo, BiosBootInfo, UefiBootInfo};
use std::fs::File;
use std::path::{Path, PathBuf};
let mut builder = IsoBuilder::new();
builder.set_isohybrid(true);
builder.add_file("kernel", PathBuf::from("my_kernel"))?;
builder.add_file("initrd.img", PathBuf::from("my_initrd"))?;
let boot_info = BootInfo {
bios_boot: Some(BiosBootInfo {
boot_catalog: PathBuf::from("BOOT.CAT"),
boot_image: PathBuf::from("isolinux.bin"),
destination_in_iso: "isolinux/isolinux.bin".to_string(),
}),
uefi_boot: Some(UefiBootInfo {
boot_image: PathBuf::from("BOOTX64.EFI"),
kernel_image: PathBuf::from("kernel"),
destination_in_iso: "EFI/BOOT/BOOTX64.EFI".to_string(),
}),
};
builder.set_boot_info(boot_info);
let mut iso_file = File::create("output.iso")?;
builder.build(&mut iso_file, Path::new("output.iso"), None, None)?;
src/lib.rs - Main library exports and definitionssrc/iso/ - ISO 9660 filesystem implementation
builder.rs - Core ISO building logiciso_writer.rs - File writing and descriptor creationfs_node.rs - Filesystem node representationsvolume_descriptor.rs - Volume descriptor structuresgpt/ - GUID Partition Table support for hybrid imagessrc/fat.rs - FAT32 ESP creation utilitiessrc/utils.rs - Utility functions and constantscrc32fast - CRC32 checksum calculationfatfs - FAT filesystem manipulationuuid - UUID generation for GPT partitionstempfile - Temporary file handlingregex - Text processing utilitiesLicensed under both MIT and Apache 2.0 licenses.
Contributions are welcome! Please see the contributing guide at docs/CONTRIBUTING.md.