Image Generation Overview
The image generation process transforms packages into usable outputs:Configuration
JSON files define partitions, packages, and settings
Composition
Install packages into a filesystem
Formatting
Convert to VHD, VHDX, ISO, or other formats
Complete Image Build Flow
Configuration Files
Image generation is entirely driven by configuration files that define:- Image format - VHD, VHDX, ISO, container, etc.
- Disk layout - Partition sizes, filesystems, mount points
- Boot configuration - Bootloader, kernel parameters, UEFI/BIOS
- Package composition - Which packages to install
- Customization - Users, services, files, scripts
For complete configuration file format documentation, see Image Configuration.
Default Image Configurations
The toolkit includes several pre-built configurations in./imageconfigs/:
- core-efi.json (default)
- core-legacy.json
- Custom Configs
Gen-2 Hyper-V compatible
- Creates
core.vhdximage - UEFI boot support
- Basic system with essential packages
- Default for most builds
Stage 1: Configuration Validation
Theimageconfigvalidator tool validates configuration files before any build work begins.
What Gets Validated
Structural Validation
Structural Validation
- Valid JSON syntax
- Required fields present
- Field types correct
- No unknown fields
Disk Layout Validation
Disk Layout Validation
- Partition sizes are valid
- Partitions fit within disk size
- Filesystem types are supported
- Mount points are valid
Package Validation
Package Validation
- Package names are valid
- No conflicting packages
- Required packages present (kernel, bootloader, etc.)
Bootloader Validation
Bootloader Validation
- Boot configuration is valid
- Kernel parameters are reasonable
- UEFI/BIOS settings consistent with partitioning
Stage 2: Package Resolution
Theimagepkgfetcher tool gathers all packages needed for the image.
Package Sources
Similar tographpkgfetcher, this tool searches multiple sources:
Dependency Resolution
For each package listed in the config:- Find the package in available sources
- Determine all runtime dependencies recursively
- Download missing packages from remote repos
- Cache all packages locally for image composition
Stage 3: Image Composition (Imager)
Theimager tool creates the actual filesystem and installs packages using a chroot environment.
Image Composition Process
Create Disk Structure
- Allocate raw disk image or directory
- Create partition table (GPT or MBR)
- Format partitions with specified filesystems
- Set up mount points
Initialize Filesystem
- Create basic directory structure (
/etc,/usr,/var, etc.) - Set up device nodes (
/dev) - Configure initial system files
Install Packages
- Mount disk as loopback device (for raw images)
- Use RPM to install packages into filesystem
- Resolve dependencies and install in correct order
- Run post-installation scripts
Configure System
- Set up users and groups
- Configure networking
- Enable/disable services
- Install custom files
- Run custom scripts
Install Bootloader
- Install GRUB or other bootloader
- Generate boot configuration
- Set up kernel and initramfs
- Configure boot parameters
Raw Image vs Directory
The imager can produce two types of output:- Raw Disk Image (*.raw)
- Directory Tree
Full disk image with partitions
- Contains partition table
- Bootloader installed in MBR/ESP
- Mounted as loopback device during composition
- Converted to final format by roast tool
The imager uses the chroot worker environment to properly handle RPM installations and post-install scripts, ensuring packages are configured correctly for the target system.
Stage 4: Format Conversion (Roast)
Theroast tool converts raw disk images into final output formats.
Supported Output Formats
VHD
Virtual Hard Disk
- Hyper-V Gen-1 VMs
- Azure (older)
- Fixed or dynamic allocation
VHDX
Virtual Hard Disk v2
- Hyper-V Gen-2 VMs
- Azure (current)
- Better performance and features
QCOW2
QEMU Copy-On-Write
- KVM/QEMU virtual machines
- OpenStack
- Efficient storage
RAW
Raw Disk Image
- Universal format
- No overhead
- Large file size
Conversion Process
- Preserves partition layout and data
- Converts bootloader as needed
- Optimizes for target format
- Validates output integrity
ISO Installer Builds
ISO builds are different from standard images—they create bootable installers that can deploy images to target computers.ISO Components
- Initrd/Initramfs
- Installation Payload
- Boot Configuration
RAM-based root filesystem
- Boots from memory
- Contains installer application
- Includes necessary drivers and tools
- Two versions available:
- GUI: Calamares-based graphical installer
- Terminal: Text-based installer
Building ISOs
The ISO build process:Build Initrd
- Uses a static configuration included with toolkit
- Recursive Make call to build initrd image
- Includes
liveinstallertool - Contains minimal package set for installation
Prepare Payload
- Build or gather target image packages
- Include configuration files
- Compress installation data
Initrd Config Tracking
Initrd Config Tracking
Building the initrd requires a recursive Make call with a different
CONFIG_FILE. Since many build system components depend on CONFIG_FILE, rebuilding the initrd invalidates cached state and triggers a brief rebuild.This is expected behavior and ensures the initrd is built correctly for the target configuration.Live Installer
Theliveinstaller tool runs inside the ISO’s initrd and is responsible for:
- Detecting target disks
- Partitioning and formatting disks
- Installing packages to target
- Configuring bootloader
- Applying customizations
- Running post-install scripts
Distroless Images
Azure Linux supports distroless container images without an RPM database.RPM Manifest File
Distroless images include/var/lib/rpmmanifest/container-manifest-2 containing the output of:
The manifest file provides package metadata for security scanning while keeping the image minimal by excluding the full RPM database.
Output Locations
Built images are placed in:Next Steps
Build Logs
Learn how to interpret and troubleshoot build errors
Package Building
Return to the package building process